public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: santosh.shilimkar@ti•com (Santosh Shilimkar)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 01/15] ARM: OMAP2+: mailbox: Add an API for flushing the FIFO
Date: Sat, 3 Nov 2012 21:33:47 +0530	[thread overview]
Message-ID: <50954063.5010901@ti.com> (raw)
In-Reply-To: <1351859566-24818-2-git-send-email-vaibhav.bedia@ti.com>

On Friday 02 November 2012 06:02 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 by 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>
> ---
>   arch/arm/mach-omap2/mailbox.c             |   42 ++++++++++++++++++++---------
>   arch/arm/plat-omap/include/plat/mailbox.h |    3 ++
>   arch/arm/plat-omap/mailbox.c              |   35 ++++++++++++++++++++++++
>   3 files changed, 67 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> index 0d97456..f38b4fa 100644
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
> @@ -123,6 +123,20 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
>   	return mbox_read_reg(fifo->fifo_stat);
>   }
>
> +static int omap2_mbox_fifo_needs_flush(struct omap_mbox *mbox)
> +{
> +	struct omap_mbox2_fifo *fifo =
> +		&((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
type casting is generally avoided in linux code.
> +	return mbox_read_reg(fifo->msg_stat);
> +}
> +
> +static mbox_msg_t omap2_mbox_fifo_readback(struct omap_mbox *mbox)
> +{
> +	struct omap_mbox2_fifo *fifo =
> +		&((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
> +	return (mbox_msg_t) mbox_read_reg(fifo->msg);
same here.
> +}
> +
>   /* Mailbox IRQ handle functions */
>   static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
>   		omap_mbox_type_t irq)
> @@ -205,19 +219,21 @@ static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
>   }
>
>   static struct omap_mbox_ops omap2_mbox_ops = {
> -	.type		= OMAP_MBOX_TYPE2,
> -	.startup	= omap2_mbox_startup,
> -	.shutdown	= omap2_mbox_shutdown,
> -	.fifo_read	= omap2_mbox_fifo_read,
> -	.fifo_write	= omap2_mbox_fifo_write,
> -	.fifo_empty	= omap2_mbox_fifo_empty,
> -	.fifo_full	= omap2_mbox_fifo_full,
> -	.enable_irq	= omap2_mbox_enable_irq,
> -	.disable_irq	= omap2_mbox_disable_irq,
> -	.ack_irq	= omap2_mbox_ack_irq,
> -	.is_irq		= omap2_mbox_is_irq,
> -	.save_ctx	= omap2_mbox_save_ctx,
> -	.restore_ctx	= omap2_mbox_restore_ctx,
> +	.type			= OMAP_MBOX_TYPE2,
> +	.startup		= omap2_mbox_startup,
> +	.shutdown		= omap2_mbox_shutdown,
> +	.fifo_read		= omap2_mbox_fifo_read,
> +	.fifo_write		= omap2_mbox_fifo_write,
> +	.fifo_empty		= omap2_mbox_fifo_empty,
> +	.fifo_full		= omap2_mbox_fifo_full,
> +	.fifo_needs_flush	= omap2_mbox_fifo_needs_flush,
> +	.fifo_readback		= omap2_mbox_fifo_readback,
> +	.enable_irq		= omap2_mbox_enable_irq,
> +	.disable_irq		= omap2_mbox_disable_irq,
> +	.ack_irq		= omap2_mbox_ack_irq,
> +	.is_irq			= omap2_mbox_is_irq,
> +	.save_ctx		= omap2_mbox_save_ctx,
> +	.restore_ctx		= omap2_mbox_restore_ctx,
You should do the indentation fix in another patch.

>   };
>
>   /*
> diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
> index cc3921e..e136529 100644
> --- a/arch/arm/plat-omap/include/plat/mailbox.h
> +++ b/arch/arm/plat-omap/include/plat/mailbox.h
> @@ -29,6 +29,8 @@ struct omap_mbox_ops {
>   	void		(*fifo_write)(struct omap_mbox *mbox, mbox_msg_t msg);
>   	int		(*fifo_empty)(struct omap_mbox *mbox);
>   	int		(*fifo_full)(struct omap_mbox *mbox);
> +	int		(*fifo_needs_flush)(struct omap_mbox *mbox);
> +	mbox_msg_t	(*fifo_readback)(struct omap_mbox *mbox);
Do you think passing the msg structure as an argument and letting the
function populate it will be better instead of returning the msg
structure ? No strong opinion since from read_foo() point of view
what you have done might be right thing. In either case, please
get rid of typecasting.

Regards
Santosh

  parent reply	other threads:[~2012-11-03 16:03 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02 12:32 [RFC 00/15] Add basic suspend-resume support for AM33XX Vaibhav Bedia
2012-11-02 12:32 ` [PATCH 01/15] ARM: OMAP2+: mailbox: Add an API for flushing the FIFO Vaibhav Bedia
2012-11-02 19:00   ` Tony Lindgren
2012-11-03  8:24     ` Bedia, Vaibhav
2012-11-03 16:03   ` Santosh Shilimkar [this message]
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05 14:59       ` Santosh Shilimkar
2012-11-02 12:32 ` [PATCH 02/15] ARM: OMAP2+: mailbox: Add support for AM33XX Vaibhav Bedia
2012-11-03  0:14   ` Russ Dill
2012-11-03  8:39     ` Bedia, Vaibhav
2012-11-03 13:48     ` Bedia, Vaibhav
2012-11-03 16:10   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05 15:00       ` Santosh Shilimkar
2012-11-02 12:32 ` [PATCH 03/15] ARM: OMAP: mailbox: Convert to device_initcall Vaibhav Bedia
2012-11-03 16:12   ` Santosh Shilimkar
2012-11-02 12:32 ` [PATCH 04/15] ARM: OMAP2+: hwmod: Update the reset API for AM33XX Vaibhav Bedia
2012-11-05  6:58   ` Vaibhav Hiremath
2012-11-05 17:57     ` Bedia, Vaibhav
2012-11-06  6:06       ` Hiremath, Vaibhav
2012-11-06  7:19         ` Bedia, Vaibhav
2012-11-02 12:32 ` [PATCH 05/15] ARM: OMAP2+: AM33XX: Update WKUP_M3 hwmod entry for reset status Vaibhav Bedia
2012-11-03 16:15   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05  6:59   ` Vaibhav Hiremath
2012-11-02 12:32 ` [PATCH 06/15] ARM: OMAP2+: hwmod: Enable OCMCRAM registration in AM33XX Vaibhav Bedia
2012-11-03 16:16   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05  7:23   ` Vaibhav Hiremath
2012-11-05 17:57     ` Bedia, Vaibhav
2012-11-06  6:07       ` Hiremath, Vaibhav
2012-11-02 12:32 ` [PATCH 07/15] ARM: OMAP2+: hwmod: Update the hwmod data for TPTCs " Vaibhav Bedia
2012-11-05  7:19   ` Vaibhav Hiremath
2012-11-02 12:32 ` [PATCH 08/15] ARM: OMAP2+: hwmod: Fix the omap_hwmod_addr_space for CPGMAC0 Vaibhav Bedia
2012-11-03 16:18   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05  9:10     ` Bedia, Vaibhav
2012-11-06  9:29       ` Vaibhav Hiremath
2012-11-06 10:09         ` Bedia, Vaibhav
2012-11-06 13:08           ` Hiremath, Vaibhav
2012-11-06 13:46             ` Bedia, Vaibhav
2012-11-06 13:50               ` Benoit Cousson
2012-11-06 13:56                 ` Bedia, Vaibhav
2012-11-02 12:32 ` [PATCH 09/15] ARM: OMAP: AM33XX: Remove unnecessary include and use __ASSEMBLER__ macros Vaibhav Bedia
2012-11-03 16:29   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-02 12:32 ` [PATCH 10/15] ARM: OMAP2+: control: Add some AM33XX Control module registers Vaibhav Bedia
2012-11-02 12:32 ` [PATCH 11/15] ARM: OMAP: timer: Interchange clksrc and clkevt for AM33XX Vaibhav Bedia
2012-11-03 11:43   ` Kevin Hilman
2012-11-03 12:47     ` Bedia, Vaibhav
2012-11-03 13:04       ` Kevin Hilman
2012-11-03 13:48         ` Bedia, Vaibhav
2012-11-05 18:03           ` Kevin Hilman
2012-11-05 21:59             ` Santosh Shilimkar
2012-11-06 14:38               ` Bedia, Vaibhav
2012-11-08 13:15               ` Bedia, Vaibhav
2012-11-06 14:33             ` Bedia, Vaibhav
2012-11-03 16:22   ` Kevin Hilman
2012-11-05  4:40     ` Bedia, Vaibhav
2012-11-03 16:31   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-08 20:41   ` Jon Hunter
2012-11-12 22:54     ` Tony Lindgren
2012-11-02 12:32 ` [PATCH 12/15] ARM: OMAP: timer: Add suspend-resume callbacks for clockevent device Vaibhav Bedia
2012-11-03 12:15   ` Kevin Hilman
2012-11-03 13:17     ` Bedia, Vaibhav
2012-11-03 13:41       ` Kevin Hilman
2012-11-03 14:03         ` Bedia, Vaibhav
2012-11-05 21:20       ` Jon Hunter
2012-11-06  9:38         ` Bedia, Vaibhav
2012-11-06 16:02           ` Jon Hunter
2012-11-03 15:52   ` Santosh Shilimkar
2012-11-04 15:25     ` Bedia, Vaibhav
2012-11-05 14:55       ` Santosh Shilimkar
2012-11-05 21:04   ` Jon Hunter
2012-11-06  7:32     ` Bedia, Vaibhav
2012-11-06 16:00       ` Jon Hunter
2012-11-02 12:32 ` [PATCH 13/15] ARM: DTS: AM33XX: Add nodes for OCMCRAM and Mailbox Vaibhav Bedia
2012-11-03 12:16   ` Kevin Hilman
2012-11-03 13:17     ` Bedia, Vaibhav
2012-11-03 15:54   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05 14:53       ` Santosh Shilimkar
2012-11-05 17:57         ` Bedia, Vaibhav
2012-11-05 19:29           ` Kevin Hilman
2012-11-05 21:19             ` Santosh Shilimkar
2012-11-05 21:45               ` Santosh Shilimkar
2012-11-06  5:08                 ` Bedia, Vaibhav
2012-11-05 14:58       ` Santosh Shilimkar
2012-11-02 12:32 ` [PATCH 14/15] ARM: OMAP2+: omap2plus_defconfig: Enable Mailbox Vaibhav Bedia
2012-11-03 12:20   ` Kevin Hilman
2012-11-03 13:17     ` Bedia, Vaibhav
2012-11-03 13:43       ` Kevin Hilman
2012-11-02 12:32 ` [PATCH 15/15] ARM: OMAP2+: AM33XX: Basic suspend resume support Vaibhav Bedia
2012-11-02 13:11   ` Bedia, Vaibhav
2012-11-03 16:57   ` Santosh Shilimkar
2012-11-04 15:26     ` Bedia, Vaibhav
2012-11-05 17:40   ` Kevin Hilman
2012-11-05 21:52     ` Santosh Shilimkar
2012-11-06 12:29       ` Bedia, Vaibhav
2012-11-06 12:38         ` Santosh Shilimkar
2012-11-06 13:00           ` Bedia, Vaibhav
2012-11-06 10:40     ` Bedia, Vaibhav
2012-11-07  1:06       ` Kevin Hilman
2012-11-07 13:25         ` Bedia, Vaibhav
2012-11-07 17:15           ` Kevin Hilman
2012-11-08 13:05             ` Bedia, Vaibhav
2012-11-02 22:16 ` [RFC 00/15] Add basic suspend-resume support for AM33XX Daniel Mack
2012-11-03  8:39   ` 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=50954063.5010901@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