From: santosh.shilimkar@ti•com (Santosh Shilimkar)
To: linux-arm-kernel@lists•infradead.org
Subject: [RFC v2 02/18] mailbox: Add an API for flushing the FIFO
Date: Tue, 8 Jan 2013 19:26:51 +0530 [thread overview]
Message-ID: <50EC25A3.6070906@ti.com> (raw)
In-Reply-To: <1356959231-17335-3-git-send-email-vaibhav.bedia@ti.com>
On Monday 31 December 2012 06:36 PM, Vaibhav Bedia wrote:
> On AM33XX, the mailbox module between the MPU and the
> WKUP-M3 co-processor facilitates a one-way communication.
> MPU uses the assigned mailbox sub-module to issue the
> interrupt to the WKUP-M3 co-processor which then goes
> and reads the the IPC data from registers in the control
> module.
>
> WKUP-M3 is in the L4_WKUP and does not have any access to
> the mailbox module. Due to this limitation, the MPU is
> completely responsible for FIFO maintenance and interrupt
> generation. MPU needs to ensure that the FIFO does not
> overflow by reading back the assigned mailbox sub-module.
>
> This patch adds an API in the mailbox code which the MPU
> can use to empty the FIFO by issuing a readback command.
>
> Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti•com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti•com>
> ---
> Note: This patch which will be slightly reworked once the mailbox
> driver changes are finalized.
>
Can you expand a bit please ?
> drivers/mailbox/mailbox-omap2.c | 19 +++++++++++++++++++
> drivers/mailbox/mailbox.c | 36 ++++++++++++++++++++++++++++++++++++
> drivers/mailbox/mailbox.h | 3 +++
> include/linux/mailbox.h | 1 +
> 4 files changed, 59 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
> index 6d61159..c732be1 100644
> --- a/drivers/mailbox/mailbox-omap2.c
> +++ b/drivers/mailbox/mailbox-omap2.c
> @@ -125,6 +125,23 @@ static int omap2_mbox_fifo_full(struct mailbox *mbox)
> return mbox_read_reg(fifo->fifo_stat);
> }
>
> +static int omap2_mbox_fifo_needs_flush(struct mailbox *mbox)
> +{
> + struct omap_mbox2_priv *p = mbox->priv;
> + struct omap_mbox2_fifo *fifo = &p->tx_fifo;
> +
> + return mbox_read_reg(fifo->msg_stat);
> +}
> +
> +static void omap2_mbox_fifo_readback(struct mailbox *mbox,
> + struct mailbox_msg *msg)
> +{
> + struct omap_mbox2_priv *p = mbox->priv;
> + struct omap_mbox2_fifo *fifo = &p->tx_fifo;
> +
> + msg->header = mbox_read_reg(fifo->msg);
> +}
> +
> static int ompa2_mbox_poll_for_space(struct mailbox *mbox)
> {
> if (omap2_mbox_fifo_full(mbox))
> @@ -221,6 +238,8 @@ static struct mailbox_ops omap2_mbox_ops = {
> .read = omap2_mbox_fifo_read,
> .write = omap2_mbox_fifo_write,
> .empty = omap2_mbox_fifo_empty,
> + .fifo_needs_flush = omap2_mbox_fifo_needs_flush,
> + .fifo_readback = omap2_mbox_fifo_readback,
> .poll_for_space = ompa2_mbox_poll_for_space,
> .enable_irq = omap2_mbox_enable_irq,
> .disable_irq = omap2_mbox_disable_irq,
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index 2f50226..92c9f68 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -57,6 +57,15 @@ static inline int mbox_empty(struct mailbox *mbox)
> {
> return mbox->ops->empty(mbox);
> }
> +static inline int mbox_fifo_needs_flush(struct mailbox *mbox)
> +{
> + return mbox->ops->fifo_needs_flush(mbox);
> +}
> +static inline void mbox_fifo_readback(struct mailbox *mbox,
> + struct mailbox_msg *msg)
> +{
> + mbox->ops->fifo_readback(mbox, msg);
> +}
>
> /* Mailbox IRQ handle functions */
> static inline void ack_mbox_irq(struct mailbox *mbox, mailbox_irq_t irq)
> @@ -110,6 +119,33 @@ out:
> }
> EXPORT_SYMBOL(mailbox_msg_send);
>
> +/*
s/*/**
> + * Flush the Rx FIFO by reading back the messages
> + * Since the normal expectation is that the Rx will do the
> + * reading, add a debug message to indicate if we really flush
> + *
> + * Returns the no. of messages read back
> + */
Just look at the kernel doc style for above
Rest looks fine.
Regards
Santosh
next prev parent reply other threads:[~2013-01-08 13:56 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-31 13:06 [RFC v2 00/18] ARM: OMAP2+: AM33XX: Add suspend-resume support Vaibhav Bedia
2012-12-31 13:06 ` [RFC v2 01/18] mailbox: OMAP2+: Add support for AM33XX Vaibhav Bedia
2013-01-01 18:25 ` Tony Lindgren
2013-01-02 11:09 ` Bedia, Vaibhav
2013-01-08 13:53 ` Santosh Shilimkar
2013-01-09 5:16 ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 02/18] mailbox: Add an API for flushing the FIFO Vaibhav Bedia
2013-01-08 13:56 ` Santosh Shilimkar [this message]
2013-01-09 5:16 ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 03/18] memory: emif: Move EMIF related header file to include/linux/ Vaibhav Bedia
2013-01-08 14:04 ` Santosh Shilimkar
2013-01-09 5:31 ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 04/18] ARM: OMAP2+: AM33XX: CM: Get rid of unncessary header inclusions Vaibhav Bedia
2013-01-08 15:00 ` Santosh Shilimkar
2012-12-31 13:06 ` [RFC v2 05/18] ARM: OMAP2+: AM33XX: CM/PRM: Use __ASSEMBLER__ macros in header files Vaibhav Bedia
2013-01-08 15:01 ` Santosh Shilimkar
2013-01-09 5:31 ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 06/18] ARM: OMAP2+: AM33XX: hwmod: Register OCMC RAM hwmod Vaibhav Bedia
2013-01-08 15:04 ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 07/18] ARM: OMAP2+: AM33XX: hwmod: Update TPTC0 hwmod with the right flags Vaibhav Bedia
2013-01-08 15:05 ` Santosh Shilimkar
2013-01-09 6:02 ` Bedia, Vaibhav
2013-02-11 23:33 ` Kevin Hilman
2013-02-13 10:56 ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 08/18] ARM: OMAP2+: AM33XX: hwmod: Fixup cpgmac0 hwmod entry Vaibhav Bedia
2013-01-08 15:08 ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 09/18] ARM: OMAP2+: AM33XX: hwmod: Update the WKUP-M3 hwmod with reset status bit Vaibhav Bedia
2013-01-08 15:09 ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 10/18] ARM: OMAP2+: AM33XX: Update the hardreset API Vaibhav Bedia
2013-01-08 15:10 ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 11/18] ARM: DTS: AM33XX: Add nodes for OCMC RAM and WKUP-M3 Vaibhav Bedia
2013-01-08 15:12 ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 12/18] ARM: OMAP2+: timer: Add suspend-resume callbacks for clockevent device Vaibhav Bedia
2013-01-08 15:15 ` Santosh Shilimkar
2013-01-11 4:37 ` Bedia, Vaibhav
2013-01-17 18:45 ` Jon Hunter
2013-01-18 5:25 ` Santosh Shilimkar
2013-01-21 7:22 ` Bedia, Vaibhav
2013-01-30 17:46 ` Jon Hunter
2013-01-31 11:17 ` Bedia, Vaibhav
2013-01-17 18:40 ` Jon Hunter
2013-01-21 7:22 ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 13/18] ARM: OMAP2+: AM33XX: timer: Interchance clkevt and clksrc timers Vaibhav Bedia
2013-01-08 15:17 ` Santosh Shilimkar
2013-01-09 5:31 ` Bedia, Vaibhav
2013-01-17 19:09 ` Jon Hunter
2013-01-24 22:30 ` Jon Hunter
2013-01-30 17:48 ` Jon Hunter
2013-01-30 17:49 ` Jon Hunter
2013-01-31 11:29 ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 14/18] ARM: OMAP2+: AM33XX: control: Add some control module registers and APIs Vaibhav Bedia
2013-01-08 15:21 ` Santosh Shilimkar
2013-01-09 5:38 ` Bedia, Vaibhav
2013-01-09 7:31 ` Santosh Shilimkar
2013-01-09 9:37 ` Bedia, Vaibhav
2013-01-09 9:53 ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 15/18] ARM: OMAP2+: AM33XX: Add assembly code for PM operations Vaibhav Bedia
2012-12-31 13:07 ` [RFC v2 16/18] ARM: OMAP2+: AM33XX: Basic suspend resume support Vaibhav Bedia
2013-01-17 14:27 ` Peter Korsgaard
2013-01-21 10:37 ` Bedia, Vaibhav
2013-01-22 12:50 ` Peter Korsgaard
2013-02-12 1:27 ` Kevin Hilman
2013-02-13 13:43 ` Bedia, Vaibhav
2013-02-18 16:11 ` Kevin Hilman
2013-02-20 9:21 ` Bedia, Vaibhav
2013-02-20 14:30 ` Kevin Hilman
2013-04-03 11:52 ` Daniel Mack
2013-04-04 8:47 ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 17/18] ARM: OMAP2+: AM33XX: Select Mailbox when PM is enabled Vaibhav Bedia
2013-01-08 15:22 ` Santosh Shilimkar
2013-01-09 5:38 ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 18/18] ARM: OMAP2+: AM33XX: Hookup AM33XX PM code into OMAP builds Vaibhav Bedia
2013-01-08 15:31 ` [RFC v2 00/18] ARM: OMAP2+: AM33XX: Add suspend-resume support Santosh Shilimkar
2013-01-09 5:38 ` Bedia, Vaibhav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50EC25A3.6070906@ti.com \
--to=santosh.shilimkar@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox