arm: omap mailbox: add omap3 support with some fixes
Subsystems (4)
cover arm: omap mailbox: add omap3 support with some fixes
The following patches add omap3 support and some cleanups.
This "omap mailbox" device driver has been used for the interprocessor communication between ARM and some co-processors(DSP) inside of omap SoC, which is a kind of interrupt driven FIFO.
---
Hiroshi DOYU (10):
omap mailbox: remove unnecessary header file inclusion omap mailbox: convert sequence bit checking to module paramter omap mailbox: move mailbox.h into mailbox.c
omap mailbox: add save_/restore_ctx() for PM
omap mailbox: fix empty struct device for omap2 omap mailbox: fix empty struct device for omap1 omap mailbox: fix empty struct device for omap_mbox omap mailbox: print hardware revision at startup omap mailbox: add initial omap3 support
omap mailbox: cleanup omap2 register definition with macro
arch/arm/mach-omap1/devices.c | 2 arch/arm/mach-omap1/mailbox.c | 31 ++-- arch/arm/mach-omap2/devices.c | 38 ++++- arch/arm/mach-omap2/mailbox.c | 195 +++++++++++++++++----------- arch/arm/plat-omap/Kconfig | 8 + arch/arm/plat-omap/include/mach/mailbox.h | 27 ++++ arch/arm/plat-omap/include/mach/omap34xx.h | 1 arch/arm/plat-omap/mailbox.c | 152 ++++++++++++++++------ arch/arm/plat-omap/mailbox.h | 100 -------------- 9 files changed, 311 insertions(+), 243 deletions(-) delete mode 100644 arch/arm/plat-omap/mailbox.h
Signature · 1 line
Hiroshi DOYU
PATCH 1/10 omap mailbox: cleanup omap2 register definition with macro
---
arch/arm/mach-omap2/mailbox.c | 77 +++++++++++++++-------------------------- 1 files changed, 29 insertions(+), 48 deletions(-)
arch/arm/mach-omap2/mailbox.c +29 -48
@@ -1,9 +1,9 @@/* -* Mailbox reservation modules for OMAP2 +* Mailbox reservation modules for OMAP2/3 * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2008 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> -* and Paul Mundt <[email protected]> +* and Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive
@@ -18,40 +18,19 @@#include <mach/mailbox.h> #include <mach/irqs.h> -#define MAILBOX_REVISION 0x00 -#define MAILBOX_SYSCONFIG 0x10 -#define MAILBOX_SYSSTATUS 0x14 -#define MAILBOX_MESSAGE_0 0x40 -#define MAILBOX_MESSAGE_1 0x44 -#define MAILBOX_MESSAGE_2 0x48 -#define MAILBOX_MESSAGE_3 0x4c -#define MAILBOX_MESSAGE_4 0x50 -#define MAILBOX_MESSAGE_5 0x54 -#define MAILBOX_FIFOSTATUS_0 0x80 -#define MAILBOX_FIFOSTATUS_1 0x84 -#define MAILBOX_FIFOSTATUS_2 0x88 -#define MAILBOX_FIFOSTATUS_3 0x8c -#define MAILBOX_FIFOSTATUS_4 0x90 -#define MAILBOX_FIFOSTATUS_5 0x94 -#define MAILBOX_MSGSTATUS_0 0xc0 -#define MAILBOX_MSGSTATUS_1 0xc4 -#define MAILBOX_MSGSTATUS_2 0xc8 -#define MAILBOX_MSGSTATUS_3 0xcc -#define MAILBOX_MSGSTATUS_4 0xd0 -#define MAILBOX_MSGSTATUS_5 0xd4 -#define MAILBOX_IRQSTATUS_0 0x100 -#define MAILBOX_IRQENABLE_0 0x104 -#define MAILBOX_IRQSTATUS_1 0x108 -#define MAILBOX_IRQENABLE_1 0x10c -#define MAILBOX_IRQSTATUS_2 0x110 -#define MAILBOX_IRQENABLE_2 0x114 -#define MAILBOX_IRQSTATUS_3 0x118 -#define MAILBOX_IRQENABLE_3 0x11c +#define MAILBOX_REVISION 0x000 +#define MAILBOX_SYSCONFIG 0x010 +#define MAILBOX_SYSSTATUS 0x014 +#define MAILBOX_MESSAGE (m) (0x040 + 4 * (m)) +#define MAILBOX_FIFOSTATUS (m) (0x080 + 4 * (m)) +#define MAILBOX_MSGSTATUS (m) (0x0c0 + 4 * (m)) +#define MAILBOX_IRQSTATUS (u) (0x100 + 8 * (u)) +#define MAILBOX_IRQENABLE (u) (0x108 + 8 * (u)) -static unsigned long mbox_base; +#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u))) +#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) -#define MAILBOX_IRQ_NOTFULL (n) (1 << (2 * (n) + 1)) -#define MAILBOX_IRQ_NEWMSG (n) (1 << (2 * (n))) +static unsigned long mbox_base;struct omap_mbox2_fifo {unsigned long msg;
@@ -209,15 +188,15 @@ static struct omap_mbox_ops omap2_mbox_ops = {/* DSP */ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .tx_fifo = { - .msg =MAILBOX_MESSAGE_0 , - .fifo_stat =MAILBOX_FIFOSTATUS_0 , + .msg =MAILBOX_MESSAGE (0 ), + .fifo_stat =MAILBOX_FIFOSTATUS (0 ), }, .rx_fifo = { - .msg =MAILBOX_MESSAGE_1 , - .msg_stat =MAILBOX_MSGSTATUS_1 , + .msg =MAILBOX_MESSAGE (1 ), + .msg_stat =MAILBOX_MSGSTATUS (1 ), }, - .irqenable =MAILBOX_IRQENABLE_0 , - .irqstatus =MAILBOX_IRQSTATUS_0 , + .irqenable =MAILBOX_IRQENABLE (0 ), + .irqstatus =MAILBOX_IRQSTATUS (0 ), .notfull_bit =MAILBOX_IRQ_NOTFULL (0 ), .newmsg_bit =MAILBOX_IRQ_NEWMSG (1 ), };
@@ -232,15 +211,15 @@ EXPORT_SYMBOL(mbox_dsp_info);/* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { - .msg =MAILBOX_MESSAGE_2 , - .fifo_stat =MAILBOX_FIFOSTATUS_2 , + .msg =MAILBOX_MESSAGE (2 ), + .fifo_stat =MAILBOX_FIFOSTATUS (2 ), }, .rx_fifo = { - .msg =MAILBOX_MESSAGE_3 , - .msg_stat =MAILBOX_MSGSTATUS_3 , + .msg =MAILBOX_MESSAGE (3 ), + .msg_stat =MAILBOX_MSGSTATUS (3 ), }, - .irqenable =MAILBOX_IRQENABLE_3 , - .irqstatus =MAILBOX_IRQSTATUS_3 , + .irqenable =MAILBOX_IRQENABLE (3 ), + .irqstatus =MAILBOX_IRQSTATUS (3 ), .notfull_bit =MAILBOX_IRQ_NOTFULL (2 ), .newmsg_bit =MAILBOX_IRQ_NEWMSG (3 ), };
@@ -320,4 +299,6 @@ static void __exit omap2_mbox_exit(void)module_init (omap2_mbox_init);module_exit (omap2_mbox_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("omap mailbox: omap2/3 architecture specific functions" ); +MODULE_AUTHOR ("Hiroshi DOYU <[email protected]>, Paul Mundt" );
Re: [PATCH 01/10] omap mailbox: cleanup omap2 register definition with macro
2009/1/16 Hiroshi DOYU <[email protected]>:
Quoted 42 lines
Signed-off-by Hiroshi DOYU <[email protected]>---
arch/arm/mach-omap2/mailbox.c | 77 +++++++++++++++-------------------------- 1 files changed, 29 insertions(+), 48 deletions(-)arch/arm/mach-omap2/mailbox.c +0
-27@@ -18,40 +18,19 @@#include <mach/mailbox.h> #include <mach/irqs.h> -#define MAILBOX_REVISION 0x00 -#define MAILBOX_SYSCONFIG 0x10 -#define MAILBOX_SYSSTATUS 0x14 -#define MAILBOX_MESSAGE_0 0x40 -#define MAILBOX_MESSAGE_1 0x44 -#define MAILBOX_MESSAGE_2 0x48 -#define MAILBOX_MESSAGE_3 0x4c -#define MAILBOX_MESSAGE_4 0x50 -#define MAILBOX_MESSAGE_5 0x54 -#define MAILBOX_FIFOSTATUS_0 0x80 -#define MAILBOX_FIFOSTATUS_1 0x84 -#define MAILBOX_FIFOSTATUS_2 0x88 -#define MAILBOX_FIFOSTATUS_3 0x8c -#define MAILBOX_FIFOSTATUS_4 0x90 -#define MAILBOX_FIFOSTATUS_5 0x94 -#define MAILBOX_MSGSTATUS_0 0xc0 -#define MAILBOX_MSGSTATUS_1 0xc4 -#define MAILBOX_MSGSTATUS_2 0xc8 -#define MAILBOX_MSGSTATUS_3 0xcc -#define MAILBOX_MSGSTATUS_4 0xd0 -#define MAILBOX_MSGSTATUS_5 0xd4 -#define MAILBOX_IRQSTATUS_0 0x100 -#define MAILBOX_IRQENABLE_0 0x104 -#define MAILBOX_IRQSTATUS_1 0x108 -#define MAILBOX_IRQENABLE_1 0x10c -#define MAILBOX_IRQSTATUS_2 0x110 -#define MAILBOX_IRQENABLE_2 0x114
arch/arm/mach-omap2/mailbox.c line 28
Quoted 10 lines
arch/arm/mach-omap2/mailbox.c +8
-2-#define MAILBOX_IRQSTATUS_3 0x118 -#define MAILBOX_IRQENABLE_3 0x11c +#define MAILBOX_REVISION 0x000 +#define MAILBOX_SYSCONFIG 0x010 +#define MAILBOX_SYSSTATUS 0x014 +#define MAILBOX_MESSAGE (m) (0x040 + 4 * (m)) +#define MAILBOX_FIFOSTATUS (m) (0x080 + 4 * (m)) +#define MAILBOX_MSGSTATUS (m) (0x0c0 + 4 * (m)) +#define MAILBOX_IRQSTATUS (u) (0x100 + 8 * (u)) +#define MAILBOX_IRQENABLE (u) (0x108 + 8 * (u))
^^^^^^^
shouldn't this be
#define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u))
Quoted 11 lines
arch/arm/mach-omap2/mailbox.c +3
-3-static unsigned long mbox_base; +#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u))) +#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) -#define MAILBOX_IRQ_NOTFULL (n) (1 << (2 * (n) + 1)) -#define MAILBOX_IRQ_NEWMSG (n) (1 << (2 * (n))) +static unsigned long mbox_base;struct omap_mbox2_fifo {unsigned long msg;
Re: [PATCH 01/10] omap mailbox: cleanup omap2 register definition with macro
From: "ext roel kluin" <[email protected]>
Subject: Re: [PATCH 01/10] omap mailbox: cleanup omap2 register definition with macro
Date: Fri, 16 Jan 2009 10:56:01 +0100
[...]
Quoted 10 lines
arch/arm/mach-omap2/mailbox.c line 28
Quoted 7 lines
arch/arm/mach-omap2/mailbox.c +7
-0+#define MAILBOX_SYSCONFIG 0x010 +#define MAILBOX_SYSSTATUS 0x014 +#define MAILBOX_MESSAGE (m) (0x040 + 4 * (m)) +#define MAILBOX_FIFOSTATUS (m) (0x080 + 4 * (m)) +#define MAILBOX_MSGSTATUS (m) (0x0c0 + 4 * (m)) +#define MAILBOX_IRQSTATUS (u) (0x100 + 8 * (u)) +#define MAILBOX_IRQENABLE (u) (0x108 + 8 * (u))^^^^^^^shouldn't this be
#defineMAILBOX_IRQENABLE(u)(0x104+ 8 * (u))
Right. I'll fix, thanks.
Re: [PATCH 01/10] omap mailbox: cleanup omap2 register definition with macro
Updated one attached.
From: "ext Hiroshi DOYU" <[email protected]>
Subject: Re: [PATCH 01/10] omap mailbox: cleanup omap2 register definition with macro
Date: Fri, 16 Jan 2009 14:15:24 +0200 (EET)
Quoted 16 lines
From: "ext roel kluin" <[email protected]>
Subject: Re: [PATCH 01/10] omap mailbox: cleanup omap2 register definition with macro
Date: Fri, 16 Jan 2009 10:56:01 +0100[...]
Quoted 10 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+#define MAILBOX_SYSCONFIG 0x010 +#define MAILBOX_SYSSTATUS 0x014 +#define MAILBOX_MESSAGE(m) (0x040 + 4 * (m)) +#define MAILBOX_FIFOSTATUS(m) (0x080 + 4 * (m)) +#define MAILBOX_MSGSTATUS(m) (0x0c0 + 4 * (m)) +#define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u)) +#define MAILBOX_IRQENABLE(u) (0x108 + 8 * (u))^^^^^^^shouldn't this be
#defineMAILBOX_IRQENABLE(u)(0x104+ 8 * (u))
Quoted 5 lines
Right. I'll fix, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
omap mailbox: cleanup omap2 register definition with macro
From: Hiroshi DOYU <[email protected]>
---
arch/arm/mach-omap2/mailbox.c | 77 +++++++++++++++-------------------------- 1 files changed, 29 insertions(+), 48 deletions(-)
arch/arm/mach-omap2/mailbox.c +29 -48
@@ -1,9 +1,9 @@/* -* Mailbox reservation modules for OMAP2 +* Mailbox reservation modules for OMAP2/3 * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2008 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> -* and Paul Mundt <[email protected]> +* and Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive
@@ -18,40 +18,19 @@#include <mach/mailbox.h> #include <mach/irqs.h> -#define MAILBOX_REVISION 0x00 -#define MAILBOX_SYSCONFIG 0x10 -#define MAILBOX_SYSSTATUS 0x14 -#define MAILBOX_MESSAGE_0 0x40 -#define MAILBOX_MESSAGE_1 0x44 -#define MAILBOX_MESSAGE_2 0x48 -#define MAILBOX_MESSAGE_3 0x4c -#define MAILBOX_MESSAGE_4 0x50 -#define MAILBOX_MESSAGE_5 0x54 -#define MAILBOX_FIFOSTATUS_0 0x80 -#define MAILBOX_FIFOSTATUS_1 0x84 -#define MAILBOX_FIFOSTATUS_2 0x88 -#define MAILBOX_FIFOSTATUS_3 0x8c -#define MAILBOX_FIFOSTATUS_4 0x90 -#define MAILBOX_FIFOSTATUS_5 0x94 -#define MAILBOX_MSGSTATUS_0 0xc0 -#define MAILBOX_MSGSTATUS_1 0xc4 -#define MAILBOX_MSGSTATUS_2 0xc8 -#define MAILBOX_MSGSTATUS_3 0xcc -#define MAILBOX_MSGSTATUS_4 0xd0 -#define MAILBOX_MSGSTATUS_5 0xd4 -#define MAILBOX_IRQSTATUS_0 0x100 -#define MAILBOX_IRQENABLE_0 0x104 -#define MAILBOX_IRQSTATUS_1 0x108 -#define MAILBOX_IRQENABLE_1 0x10c -#define MAILBOX_IRQSTATUS_2 0x110 -#define MAILBOX_IRQENABLE_2 0x114 -#define MAILBOX_IRQSTATUS_3 0x118 -#define MAILBOX_IRQENABLE_3 0x11c +#define MAILBOX_REVISION 0x000 +#define MAILBOX_SYSCONFIG 0x010 +#define MAILBOX_SYSSTATUS 0x014 +#define MAILBOX_MESSAGE (m) (0x040 + 4 * (m)) +#define MAILBOX_FIFOSTATUS (m) (0x080 + 4 * (m)) +#define MAILBOX_MSGSTATUS (m) (0x0c0 + 4 * (m)) +#define MAILBOX_IRQSTATUS (u) (0x100 + 8 * (u)) +#define MAILBOX_IRQENABLE (u) (0x104 + 8 * (u)) -static unsigned long mbox_base; +#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u))) +#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) -#define MAILBOX_IRQ_NOTFULL (n) (1 << (2 * (n) + 1)) -#define MAILBOX_IRQ_NEWMSG (n) (1 << (2 * (n))) +static unsigned long mbox_base;struct omap_mbox2_fifo {unsigned long msg;
@@ -209,15 +188,15 @@ static struct omap_mbox_ops omap2_mbox_ops = {/* DSP */ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .tx_fifo = { - .msg =MAILBOX_MESSAGE_0 , - .fifo_stat =MAILBOX_FIFOSTATUS_0 , + .msg =MAILBOX_MESSAGE (0 ), + .fifo_stat =MAILBOX_FIFOSTATUS (0 ), }, .rx_fifo = { - .msg =MAILBOX_MESSAGE_1 , - .msg_stat =MAILBOX_MSGSTATUS_1 , + .msg =MAILBOX_MESSAGE (1 ), + .msg_stat =MAILBOX_MSGSTATUS (1 ), }, - .irqenable =MAILBOX_IRQENABLE_0 , - .irqstatus =MAILBOX_IRQSTATUS_0 , + .irqenable =MAILBOX_IRQENABLE (0 ), + .irqstatus =MAILBOX_IRQSTATUS (0 ), .notfull_bit =MAILBOX_IRQ_NOTFULL (0 ), .newmsg_bit =MAILBOX_IRQ_NEWMSG (1 ), };
@@ -232,15 +211,15 @@ EXPORT_SYMBOL(mbox_dsp_info);/* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { - .msg =MAILBOX_MESSAGE_2 , - .fifo_stat =MAILBOX_FIFOSTATUS_2 , + .msg =MAILBOX_MESSAGE (2 ), + .fifo_stat =MAILBOX_FIFOSTATUS (2 ), }, .rx_fifo = { - .msg =MAILBOX_MESSAGE_3 , - .msg_stat =MAILBOX_MSGSTATUS_3 , + .msg =MAILBOX_MESSAGE (3 ), + .msg_stat =MAILBOX_MSGSTATUS (3 ), }, - .irqenable =MAILBOX_IRQENABLE_3 , - .irqstatus =MAILBOX_IRQSTATUS_3 , + .irqenable =MAILBOX_IRQENABLE (3 ), + .irqstatus =MAILBOX_IRQSTATUS (3 ), .notfull_bit =MAILBOX_IRQ_NOTFULL (2 ), .newmsg_bit =MAILBOX_IRQ_NEWMSG (3 ), };
@@ -320,4 +299,6 @@ static void __exit omap2_mbox_exit(void)module_init (omap2_mbox_init);module_exit (omap2_mbox_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("omap mailbox: omap2/3 architecture specific functions" ); +MODULE_AUTHOR ("Hiroshi DOYU <[email protected]>, Paul Mundt" );
PATCH 2/10 omap mailbox: add initial omap3 support
In reply to Hiroshi DOYU---
arch/arm/mach-omap2/devices.c | 36 ++++++++++++---- arch/arm/mach-omap2/mailbox.c | 65 +++++++++++++++++----------- arch/arm/plat-omap/Kconfig | 8 +++ arch/arm/plat-omap/include/mach/omap34xx.h | 1 4 files changed, 77 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/devices.c +28 -8
@@ -28,13 +28,14 @@#include <mach/eac.h> #include <mach/mmc.h> -#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) -#define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE) +#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) -static struct resource mbox_resources[] = { +#define MBOX_REG_SIZE 0x120 + +static struct resource omap2_mbox_resources[] = { { - .start = OMAP2_MBOX_BASE, - .end = OMAP2_MBOX_BASE + 0x11f, + .start = OMAP24XX_MAILBOX_BASE, + .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1, .flags = IORESOURCE_MEM, }, {
@@ -47,20 +48,39 @@ static struct resource mbox_resources[] = { }, }; +static struct resource omap3_mbox_resources[] = { + { + .start =OMAP34XX_MAILBOX_BASE , + .end =OMAP34XX_MAILBOX_BASE +MBOX_REG_SIZE -1 , + .flags =IORESOURCE_MEM , + }, + { + .start =INT_24XX_MAIL_U0_MPU , + .flags =IORESOURCE_IRQ , + }, +}; +static struct platform_device mbox_device = { .name ="mailbox" , .id =-1 , - .num_resources =ARRAY_SIZE (mbox_resources), - .resource = mbox_resources, };static inline void omap_init_mbox (void ) { +if (cpu_is_omap2420 ()) { + mbox_device.num_resources =ARRAY_SIZE (omap2_mbox_resources); + mbox_device.resource = omap2_mbox_resources; + }else if (cpu_is_omap3430 ()) { + mbox_device.num_resources =ARRAY_SIZE (omap3_mbox_resources); + mbox_device.resource = omap3_mbox_resources; + }else { +return ; + }platform_device_register (&mbox_device); }#else static inline void omap_init_mbox (void ) { } -#endif +#endif /* CONFIG_OMAP_MBOX_FWK */ #if defined(CONFIG_OMAP_STI )
arch/arm/mach-omap2/mailbox.c +40 -25
119 lines not on this page · raw message
arch/arm/plat-omap/Kconfig +8 -0
@@ -104,6 +104,14 @@ config OMAP_MCBSP Say Y here if you want support for the OMAP Multichannel Buffered Serial Port. +config OMAP_MBOX_FWK + tristate "Mailbox framework support" + depends on ARCH_OMAP + default n + help + Say Y here if you want to use OMAP Mailbox framework support for + DSP, IVA1.0 and IVA2 in OMAP1/2/3. + choice prompt "System timer" default OMAP_MPU_TIMER
arch/arm/plat-omap/include/mach/omap34xx.h +1 -0
@@ -61,6 +61,7 @@#define OMAP2_CM_BASE OMAP3430_CM_BASE#define OMAP2_PRM_BASE OMAP3430_PRM_BASE#define OMAP2_VA_IC_BASE IO_ADDRESS(OMAP34XX_IC_BASE) +#define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000)#endif
Re: [PATCH 02/10] omap mailbox: add initial omap3 support
Hi Hiroshi,
arch/arm/mach-omap2/devices.c static struct resource mbox_resources[] = { · line 76
Quoted 9 lines · Hiroshi DOYU
static inline void
omap_init_mbox(void)
{arch/arm/mach-omap2/devices.c +7
-0+if (cpu_is_omap2420 ()) { + mbox_device.num_resources =ARRAY_SIZE (omap2_mbox_resources); + mbox_device.resource = omap2_mbox_resources; + }else if (cpu_is_omap3430 ()) { + mbox_device.num_resources =ARRAY_SIZE (omap3_mbox_resources); + mbox_device.resource = omap3_mbox_resources; + }else {
how about a pr_info() or pr_err() here ?? Something like:pr_err("%s: platform not supported yet\n", __func__);
Quoted 44 lines
arch/arm/mach-omap2/devices.c +3
-1+ return; + }platform_device_register (&mbox_device); }#else static inline void omap_init_mbox (void ) { } -#endif +#endif /* CONFIG_OMAP_MBOX_FWK */ #if defined(CONFIG_OMAP_STI )arch/arm/mach-omap2/mailbox.c +5
-5@@ -30,7 +30,7 @@#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u)))#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) -static unsigned long mbox_base; +static void __iomem *mbox_base;struct omap_mbox2_fifo {unsigned long msg;@@ -52,14 +52,14 @@ static struct clk *mbox_ick_handle;static void omap2_mbox_enable_irq (struct omap_mbox *mbox,omap_mbox_type_t irq); -static inline unsigned int mbox_read_reg (unsigned int reg) +static inline unsigned int mbox_read_reg (size_t ofs) { -return __raw_readl (mbox_base + reg); +return __raw_readl (mbox_base + ofs); } -static inline void mbox_write_reg (unsigned int val,unsigned int reg) +static inline void mbox_write_reg (u32 val,size_t ofs) { -__raw_writel (val, mbox_base + reg); +__raw_writel (val, mbox_base + ofs); }/* Mailbox H/W preparations */
arch/arm/mach-omap2/mailbox.c struct omap_mbox mbox_dsp_info = { · line 211
Quoted 5 lines
arch/arm/mach-omap2/mailbox.c +1
-1@@ -208,7 +208,7 @@ struct omap_mbox mbox_dsp_info = { };EXPORT_SYMBOL (mbox_dsp_info); -/* IVA */ +#if defined(CONFIG_ARCH_OMAP2420 )/* IVA */
would be nice to have something like if (cpu_has_iva()) { ... } and move this check to a later location e.g. on probe(), but this wouldn't prevent this patch from going in now. Just a suggestion for later improvements.
Quoted 8 lines
arch/arm/mach-omap2/mailbox.c +1
-0static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { .msg =MAILBOX_MESSAGE (2 ),@@ -229,17 +229,12 @@ static struct omap_mbox mbox_iva_info = { .ops = &omap2_mbox_ops, .priv = &omap2_mbox_iva_priv, }; +#endif
[snip]
arch/arm/mach-omap2/mailbox.c static int __init omap2_mbox_probe(struct platform_device *pdev) · line 265
Quoted 12 lines
arch/arm/mach-omap2/mailbox.c +7
-5-/* IVA IRQ */ - res =platform_get_resource (pdev,IORESOURCE_IRQ ,1 ); -if (unlikely (!res)) { -dev_err (&pdev->dev,"invalid irq resource\n" ); -return -ENODEV ; +if (ret) + goto err_dsp; + +#if defined(CONFIG_ARCH_OMAP2420 )/* IVA */ +if (cpu_is_omap2420 ()) { +/* IVA IRQ */ + res =platform_get_resource (pdev,IORESOURCE_IRQ ,1 );
platform_get_irq(pdev, 0) would look more standard, I think.
Signature · 1 line
balbi
PATCH 3/10 omap mailbox: print hardware revision at startup
In reply to Hiroshi DOYU---
arch/arm/mach-omap2/mailbox.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mailbox.c +3 -0
@@ -74,6 +74,9 @@ static int omap2_mbox_startup(struct omap_mbox *mbox) }clk_enable (mbox_ick_handle); + l =mbox_read_reg (MAILBOX_REVISION ); +pr_info ("omap mailbox rev %d.%d\n" , (l &0xf0 ) >>4 , (l &0x0f )); +/* set smart-idle & autoidle */ l =mbox_read_reg (MAILBOX_SYSCONFIG ); l |=0x00000011 ;
PATCH 4/10 omap mailbox: fix empty struct device for omap_mbox
In reply to Hiroshi DOYUSince "mbox->dev" doesn't exist and isn't created either at registration, this patch will create "struct device", which belongs to "omap-mailbox" class and set this pointer for the member of "struct omap_mbox".
---
arch/arm/plat-omap/include/mach/mailbox.h | 4 +- arch/arm/plat-omap/mailbox.c | 63 ++++++++++++++--------------- 2 files changed, 33 insertions(+), 34 deletions(-)
arch/arm/plat-omap/include/mach/mailbox.h +2 -2
@@ -53,7 +53,7 @@ struct omap_mbox {mbox_msg_t seq_snd, seq_rcv; -struct device dev; +struct device *dev;struct omap_mbox *next;void *priv;
@@ -67,7 +67,7 @@ void omap_mbox_init_seq(struct omap_mbox *);struct omap_mbox *omap_mbox_get (const char *);void omap_mbox_put (struct omap_mbox *); -int omap_mbox_register (struct omap_mbox *); +int omap_mbox_register (struct device *parent,struct omap_mbox *);int omap_mbox_unregister (struct omap_mbox *);#endif /* MAILBOX_H */
arch/arm/plat-omap/mailbox.c +31 -32
132 lines not on this page · raw message
PATCH 5/10 omap mailbox: fix empty struct device for omap1
In reply to Hiroshi DOYU---
arch/arm/mach-omap1/devices.c | 2 +- arch/arm/mach-omap1/mailbox.c | 31 +++++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-)
arch/arm/mach-omap1/devices.c +1 -1
@@ -86,7 +86,7 @@ static struct resource mbox_resources[] = { };static struct platform_device mbox_device = { - .name ="mailbox" , + .name ="omap1-mailbox" , .id =-1 , .num_resources =ARRAY_SIZE (mbox_resources), .resource = mbox_resources,
arch/arm/mach-omap1/mailbox.c +17 -14
@@ -1,7 +1,7 @@/* * Mailbox reservation modules for DSP * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2008 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> * * This file is subject to the terms and conditions of the GNU General Public
@@ -17,6 +17,8 @@#include <mach/mailbox.h> #include <mach/irqs.h> +#define DRV_NAME "omap1-mailbox" +#define MAILBOX_ARM2DSP1 0x00#define MAILBOX_ARM2DSP1b 0x04#define MAILBOX_DSP2ARM1 0x08
@@ -27,7 +29,7 @@#define MAILBOX_DSP2ARM1_Flag 0x1c#define MAILBOX_DSP2ARM2_Flag 0x20 -unsigned long mbox_base; +static void __iomem *mbox_base;struct omap_mbox1_fifo {unsigned long cmd;
@@ -40,14 +42,14 @@ struct omap_mbox1_priv {struct omap_mbox1_fifo rx_fifo; }; -static inline int mbox_read_reg (unsigned int reg) +static inline int mbox_read_reg (size_t ofs) { -return __raw_readw (mbox_base + reg); +return __raw_readw (mbox_base + ofs); } -static inline void mbox_write_reg (unsigned int val,unsigned int reg) +static inline void mbox_write_reg (u32 val,size_t ofs) { -__raw_writew (val, mbox_base + reg); +__raw_writew (val, mbox_base + ofs); }/* msg */
@@ -143,7 +145,7 @@ struct omap_mbox mbox_dsp_info = { };EXPORT_SYMBOL (mbox_dsp_info); -static int __init omap1_mbox_probe (struct platform_device *pdev) +static int __devinit omap1_mbox_probe (struct platform_device *pdev) {struct resource *res;int ret =0 ;
@@ -170,12 +172,10 @@ static int __init omap1_mbox_probe(struct platform_device *pdev) } mbox_dsp_info.irq = res->start; - ret =omap_mbox_register (&mbox_dsp_info); - -return ret; +return omap_mbox_register (&pdev->dev, &mbox_dsp_info); } -static int omap1_mbox_remove (struct platform_device *pdev) +static int __devexit omap1_mbox_remove(struct platform_device *pdev) {omap_mbox_unregister (&mbox_dsp_info);
@@ -184,9 +184,9 @@ static int omap1_mbox_remove(struct platform_device *pdev)static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, - .remove = omap1_mbox_remove, + .remove =__devexit_p (omap1_mbox_remove), .driver = { - .name ="mailbox" , + .name =DRV_NAME , }, };
@@ -203,4 +203,7 @@ static void __exit omap1_mbox_exit(void)module_init (omap1_mbox_init);module_exit (omap1_mbox_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("omap mailbox: omap1 architecture specific functions" ); +MODULE_AUTHOR("Hiroshi DOYU" <[email protected]>); +MODULE_ALIAS ("platform:" DRV_NAME );
Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
arch/arm/mach-omap1/mailbox.c line 20
Quoted 5 lines · Hiroshi DOYU
arch/arm/mach-omap1/mailbox.c +1
-0@@ -17,6 +17,8 @@#include <mach/mailbox.h> #include <mach/irqs.h> +#define DRV_NAME "omap1-mailbox"
I don't see any need for this define - it just adds an additional level of indirection when trying to find out the name of the driver. It's only used in two places as is, so it's value is rather limited:
Quoted 21 lines
arch/arm/mach-omap1/mailbox.c +6
-3@@ -184,9 +184,9 @@ static int omap1_mbox_remove(struct platform_device *pdev)static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, - .remove = omap1_mbox_remove, + .remove =__devexit_p (omap1_mbox_remove), .driver = { - .name ="mailbox" , + .name =DRV_NAME , }, };@@ -203,4 +203,7 @@ static void __exit omap1_mbox_exit(void)module_init (omap1_mbox_init);module_exit (omap1_mbox_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("omap mailbox: omap1 architecture specific functions" ); +MODULE_AUTHOR("Hiroshi DOYU" <[email protected]>); +MODULE_ALIAS ("platform:" DRV_NAME );
Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
Hi Russell,
From: ext Russell King - ARM Linux <[email protected]>
Subject: Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
Date: Wed, 28 Jan 2009 15:49:55 +0100
Quoted 10 lines · Hiroshi DOYU
Review line 20
Quoted 5 lines
(quoted diff) +1
-0@@ -17,6 +17,8 @@ #include <mach/mailbox.h> #include <mach/irqs.h> +#define DRV_NAME "omap1-mailbox"I don't see any need for this define - it just adds an additional level of indirection when trying to find out the name of the driver. It's only used in two places as is, so it's value is rather limited:
I fixed this along with the patch 06/10 as well. A whole patchset is available as:
The following changes since commit 1de9e8e70f5acc441550ca75433563d91b269bbe:
Linus Torvalds (1):
Linux 2.6.29-rc2
are available in the git repository at:
http://git.gitorious.org/lk/mainline.git mailbox
Hiroshi DOYU (10):
omap mailbox: cleanup omap2 register definition with macro omap mailbox: add initial omap3 support
omap mailbox: print hardware revision at startup omap mailbox: fix empty struct device for omap_mbox omap mailbox: fix empty struct device for omap1 omap mailbox: fix empty struct device for omap2 omap mailbox: add save_/restore_ctx() for PM
omap mailbox: move mailbox.h into mailbox.c
omap mailbox: convert sequence bit checking to module paramter omap mailbox: remove unnecessary header file inclusion
arch/arm/mach-omap1/devices.c | 2 +- arch/arm/mach-omap1/mailbox.c | 33 +++-- arch/arm/mach-omap2/devices.c | 39 ++++-- arch/arm/mach-omap2/mailbox.c | 199 ++++++++++++++++------------ arch/arm/plat-omap/Kconfig | 8 + arch/arm/plat-omap/include/mach/mailbox.h | 27 ++++- arch/arm/plat-omap/include/mach/omap34xx.h | 1 + arch/arm/plat-omap/mailbox.c | 152 ++++++++++++++++------ arch/arm/plat-omap/mailbox.h | 100 -------------- 9 files changed, 313 insertions(+), 248 deletions(-) delete mode 100644 arch/arm/plat-omap/mailbox.h
Quoted 1 line
From
200f6c53d6d297690616d2b348b0ac01a969e795Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU <[email protected]>
Date: Sun, 18 Jan 2009 01:04:08 +0200
Subject: [PATCH 06/10] omap mailbox: fix empty struct device for omap2
--- arch/arm/mach-omap2/devices.c | 2 +- arch/arm/mach-omap2/mailbox.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/devices.c +1 -1
@@ -61,7 +61,7 @@ static struct resource omap3_mbox_resources[] = { };static struct platform_device mbox_device = { - .name ="mailbox" , + .name ="omap2-mailbox" , .id =-1 , };
arch/arm/mach-omap2/mailbox.c +10 -7
@@ -14,7 +14,9 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/platform_device.h> -#include <linux/io.h> + +#include <asm/io.h> +#include <mach/mailbox.h> #include <mach/irqs.h>
@@ -234,7 +236,7 @@ static struct omap_mbox mbox_iva_info = { };#endif -static int __init omap2_mbox_probe (struct platform_device *pdev) +static int __devinit omap2_mbox_probe (struct platform_device *pdev) {struct resource *res;int ret;
@@ -257,7 +259,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev) goto err_dsp; } - ret =omap_mbox_register (&mbox_dsp_info); + ret =omap_mbox_register (&pdev->dev, &mbox_dsp_info);if (ret) goto err_dsp;
@@ -271,7 +273,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev) goto err_iva1; } mbox_iva_info.irq = res->start; - ret =omap_mbox_register (&mbox_iva_info); + ret =omap_mbox_register (&pdev->dev, &mbox_iva_info);if (ret) goto err_iva1; }
@@ -285,7 +287,7 @@ err_dsp:return ret; } -static int omap2_mbox_remove (struct platform_device *pdev) +static int __devexit omap2_mbox_remove(struct platform_device *pdev) {#if defined(CONFIG_ARCH_OMAP2420 )omap_mbox_unregister (&mbox_iva_info);
@@ -297,9 +299,9 @@ static int omap2_mbox_remove(struct platform_device *pdev)static struct platform_driver omap2_mbox_driver = { .probe = omap2_mbox_probe, - .remove = omap2_mbox_remove, + .remove =__devexit_p (omap2_mbox_remove), .driver = { - .name ="mailbox" , + .name ="omap2-mailbox" , }, };
@@ -319,3 +321,4 @@ module_exit(omap2_mbox_exit);MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("omap mailbox: omap2/3 architecture specific functions" );MODULE_AUTHOR ("Hiroshi DOYU <[email protected]>, Paul Mundt" ); +MODULE_ALIAS ("platform:omap2-mailbox" );
Signature · 1 line
1.6.1.rc4
Quoted 1 line
From
6f215301eab1e20c83d4e55e0de5faec62b17ae7Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU <[email protected]>
Date: Sun, 18 Jan 2009 01:04:07 +0200
Subject: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
--- arch/arm/mach-omap1/devices.c | 2 +- arch/arm/mach-omap1/mailbox.c | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-)
arch/arm/mach-omap1/devices.c +1 -1
@@ -86,7 +86,7 @@ static struct resource mbox_resources[] = { };static struct platform_device mbox_device = { - .name ="mailbox" , + .name ="omap1-mailbox" , .id =-1 , .num_resources =ARRAY_SIZE (mbox_resources), .resource = mbox_resources,
arch/arm/mach-omap1/mailbox.c +18 -15
@@ -1,7 +1,7 @@/* * Mailbox reservation modules for DSP * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2009 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> * * This file is subject to the terms and conditions of the GNU General Public
@@ -13,7 +13,9 @@#include <linux/resource.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <linux/io.h> + +#include <asm/io.h> +#include <mach/mailbox.h> #include <mach/irqs.h>
@@ -27,7 +29,7 @@#define MAILBOX_DSP2ARM1_Flag 0x1c#define MAILBOX_DSP2ARM2_Flag 0x20 -unsigned long mbox_base; +static void __iomem *mbox_base;struct omap_mbox1_fifo {unsigned long cmd;
@@ -40,14 +42,14 @@ struct omap_mbox1_priv {struct omap_mbox1_fifo rx_fifo; }; -static inline int mbox_read_reg (unsigned int reg) +static inline int mbox_read_reg (size_t ofs) { -return __raw_readw (mbox_base + reg); +return __raw_readw (mbox_base + ofs); } -static inline void mbox_write_reg (unsigned int val,unsigned int reg) +static inline void mbox_write_reg (u32 val,size_t ofs) { -__raw_writew (val, mbox_base + reg); +__raw_writew (val, mbox_base + ofs); }/* msg */
@@ -143,7 +145,7 @@ struct omap_mbox mbox_dsp_info = { };EXPORT_SYMBOL (mbox_dsp_info); -static int __init omap1_mbox_probe (struct platform_device *pdev) +static int __devinit omap1_mbox_probe (struct platform_device *pdev) {struct resource *res;int ret =0 ;
@@ -170,12 +172,10 @@ static int __init omap1_mbox_probe(struct platform_device *pdev) } mbox_dsp_info.irq = res->start; - ret =omap_mbox_register (&mbox_dsp_info); - -return ret; +return omap_mbox_register (&pdev->dev, &mbox_dsp_info); } -static int omap1_mbox_remove (struct platform_device *pdev) +static int __devexit omap1_mbox_remove(struct platform_device *pdev) {omap_mbox_unregister (&mbox_dsp_info);
@@ -184,9 +184,9 @@ static int omap1_mbox_remove(struct platform_device *pdev)static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, - .remove = omap1_mbox_remove, + .remove =__devexit_p (omap1_mbox_remove), .driver = { - .name ="mailbox" , + .name ="omap1-mailbox" , }, };
@@ -203,4 +203,7 @@ static void __exit omap1_mbox_exit(void)module_init (omap1_mbox_init);module_exit (omap1_mbox_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("omap mailbox: omap1 architecture specific functions" ); +MODULE_AUTHOR("Hiroshi DOYU" <[email protected]>); +MODULE_ALIAS ("platform:omap1-mailbox" );
Signature · 1 line
1.6.1.rc4
Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
arch/arm/mach-omap2/mailbox.c line 19
Quoted 12 lines · Hiroshi DOYU
arch/arm/mach-omap2/mailbox.c +3
-1@@ -14,7 +14,9 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/platform_device.h> -#include <linux/io.h> + +#include <asm/io.h> +
NAK.
Quoted 14 lines
arch/arm/mach-omap1/mailbox.c +1
-1@@ -1,7 +1,7 @@/* * Mailbox reservation modules for DSP * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2009 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> * * This file is subject to the terms and conditions of the GNU General Public
arch/arm/mach-omap1/mailbox.c line 18
Quoted 7 lines
arch/arm/mach-omap1/mailbox.c +3
-1@@ -13,7 +13,9 @@#include <linux/resource.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <linux/io.h> + +#include <asm/io.h> +
NAK.
See fced80c735941fa518ac67c0b61bbe153fb8c050.
The above can not be explained by a mis-merge - they are not a mere reversion of the above change. They look like a purposeful change back to the wrong include file.
Can someone please work out why this has happened and what needs to be done to prevent it happening in the future.
Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
From: ext Russell King - ARM Linux <[email protected]>
Subject: Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
Date: Wed, 28 Jan 2009 18:50:43 +0100
Quoted 40 lines · Hiroshi DOYU
arch/arm/mach-omap2/mailbox.c line 19
Quoted 12 lines
arch/arm/mach-omap2/mailbox.c +3
-1@@ -14,7 +14,9 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/platform_device.h> -#include <linux/io.h> + +#include <asm/io.h> +NAK.
Quoted 14 lines
arch/arm/mach-omap1/mailbox.c +1
-1@@ -1,7 +1,7 @@/* * Mailbox reservation modules for DSP * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2009 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> * * This file is subject to the terms and conditions of the GNU General Public arch/arm/mach-omap1/mailbox.c line 18
Quoted 7 lines
arch/arm/mach-omap1/mailbox.c +3
-1@@ -13,7 +13,9 @@#include <linux/resource.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <linux/io.h> + +#include <asm/io.h> +NAK.
Quoted 5 lines
See
fced80c735941fa518ac67c0b61bbe153fb8c050.The above can not be explained by a mis-merge - they are not a mere reversion of the above change. They look like a purposeful change back to the wrong include file.
It seems that I misunderstood your comment in the following mail.
http://lkml.indiana.edu/hypermail/linux/kernel/0901.2/00610.html
Reverted both header file changes. Update attached patches.
Quoted 1 line
From
f0bd423fbd7401bbd491a0ebc6393eec230e6b14Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU <[email protected]>
Date: Wed, 28 Jan 2009 21:19:02 +0200
Subject: [PATCH 06/10] omap mailbox: fix empty struct device for omap2
--- arch/arm/mach-omap2/devices.c | 2 +- arch/arm/mach-omap2/mailbox.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/devices.c +1 -1
@@ -61,7 +61,7 @@ static struct resource omap3_mbox_resources[] = { };static struct platform_device mbox_device = { - .name ="mailbox" , + .name ="omap2-mailbox" , .id =-1 , };
arch/arm/mach-omap2/mailbox.c +7 -6
@@ -234,7 +234,7 @@ static struct omap_mbox mbox_iva_info = { };#endif -static int __init omap2_mbox_probe (struct platform_device *pdev) +static int __devinit omap2_mbox_probe (struct platform_device *pdev) {struct resource *res;int ret;
@@ -257,7 +257,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev) goto err_dsp; } - ret =omap_mbox_register (&mbox_dsp_info); + ret =omap_mbox_register (&pdev->dev, &mbox_dsp_info);if (ret) goto err_dsp;
@@ -271,7 +271,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev) goto err_iva1; } mbox_iva_info.irq = res->start; - ret =omap_mbox_register (&mbox_iva_info); + ret =omap_mbox_register (&pdev->dev, &mbox_iva_info);if (ret) goto err_iva1; }
@@ -285,7 +285,7 @@ err_dsp:return ret; } -static int omap2_mbox_remove (struct platform_device *pdev) +static int __devexit omap2_mbox_remove(struct platform_device *pdev) {#if defined(CONFIG_ARCH_OMAP2420 )omap_mbox_unregister (&mbox_iva_info);
@@ -297,9 +297,9 @@ static int omap2_mbox_remove(struct platform_device *pdev)static struct platform_driver omap2_mbox_driver = { .probe = omap2_mbox_probe, - .remove = omap2_mbox_remove, + .remove =__devexit_p (omap2_mbox_remove), .driver = { - .name ="mailbox" , + .name ="omap2-mailbox" , }, };
@@ -319,3 +319,4 @@ module_exit(omap2_mbox_exit);MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("omap mailbox: omap2/3 architecture specific functions" );MODULE_AUTHOR ("Hiroshi DOYU <[email protected]>, Paul Mundt" ); +MODULE_ALIAS ("platform:omap2-mailbox" );
Signature · 1 line
1.6.1.rc4
Quoted 1 line
From
f6efca787d09564c0cfd8ad1cb21d29213df8862Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU <[email protected]>
Date: Wed, 28 Jan 2009 21:18:07 +0200
Subject: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
--- arch/arm/mach-omap1/devices.c | 2 +- arch/arm/mach-omap1/mailbox.c | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-)
arch/arm/mach-omap1/devices.c +1 -1
@@ -86,7 +86,7 @@ static struct resource mbox_resources[] = { };static struct platform_device mbox_device = { - .name ="mailbox" , + .name ="omap1-mailbox" , .id =-1 , .num_resources =ARRAY_SIZE (mbox_resources), .resource = mbox_resources,
arch/arm/mach-omap1/mailbox.c +15 -14
@@ -1,7 +1,7 @@/* * Mailbox reservation modules for DSP * -* Copyright (C) 2006 Nokia Corporation +* Copyright (C) 2006-2009 Nokia Corporation * Written by: Hiroshi DOYU <[email protected]> * * This file is subject to the terms and conditions of the GNU General Public
@@ -27,7 +27,7 @@#define MAILBOX_DSP2ARM1_Flag 0x1c#define MAILBOX_DSP2ARM2_Flag 0x20 -unsigned long mbox_base; +static void __iomem *mbox_base;struct omap_mbox1_fifo {unsigned long cmd;
@@ -40,14 +40,14 @@ struct omap_mbox1_priv {struct omap_mbox1_fifo rx_fifo; }; -static inline int mbox_read_reg (unsigned int reg) +static inline int mbox_read_reg (size_t ofs) { -return __raw_readw (mbox_base + reg); +return __raw_readw (mbox_base + ofs); } -static inline void mbox_write_reg (unsigned int val,unsigned int reg) +static inline void mbox_write_reg (u32 val,size_t ofs) { -__raw_writew (val, mbox_base + reg); +__raw_writew (val, mbox_base + ofs); }/* msg */
@@ -143,7 +143,7 @@ struct omap_mbox mbox_dsp_info = { };EXPORT_SYMBOL (mbox_dsp_info); -static int __init omap1_mbox_probe (struct platform_device *pdev) +static int __devinit omap1_mbox_probe (struct platform_device *pdev) {struct resource *res;int ret =0 ;
@@ -170,12 +170,10 @@ static int __init omap1_mbox_probe(struct platform_device *pdev) } mbox_dsp_info.irq = res->start; - ret =omap_mbox_register (&mbox_dsp_info); - -return ret; +return omap_mbox_register (&pdev->dev, &mbox_dsp_info); } -static int omap1_mbox_remove (struct platform_device *pdev) +static int __devexit omap1_mbox_remove(struct platform_device *pdev) {omap_mbox_unregister (&mbox_dsp_info);
@@ -184,9 +182,9 @@ static int omap1_mbox_remove(struct platform_device *pdev)static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, - .remove = omap1_mbox_remove, + .remove =__devexit_p (omap1_mbox_remove), .driver = { - .name ="mailbox" , + .name ="omap1-mailbox" , }, };
@@ -203,4 +201,7 @@ static void __exit omap1_mbox_exit(void)module_init (omap1_mbox_init);module_exit (omap1_mbox_exit); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("omap mailbox: omap1 architecture specific functions" ); +MODULE_AUTHOR("Hiroshi DOYU" <[email protected]>); +MODULE_ALIAS ("platform:omap1-mailbox" );
Signature · 1 line
1.6.1.rc4
Re: [PATCH 05/10] omap mailbox: fix empty struct device for omap1
Quoted 3 lines · Hiroshi DOYU
It seems that I misunderstood your comment in the following mail.
http://lkml.indiana.edu/hypermail/linux/kernel/0901.2/00610.html
Ah, that comment was more about that specific include in that specific file - I couldn't see anything in there which required it.
The general rule is: if both asm/xxx.h and linux/xxx.h exists, then use the linux/xxx.h version. I stress _general_ rule - there are exceptions. For example, linux/irq.h and linux/memory.h. A clue would be if linux/xxx.h doesn't include asm/xxx.h, then the rule above probably doesn't apply.
Quoted 1 line
Reverted both header file changes. Update attached patches.
Much better, thanks. This I'm happy with.
PATCH 6/10 omap mailbox: fix empty struct device for omap2
In reply to Hiroshi DOYU---
arch/arm/mach-omap2/devices.c | 2 +- arch/arm/mach-omap2/mailbox.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/devices.c +1 -1
@@ -61,7 +61,7 @@ static struct resource omap3_mbox_resources[] = { };static struct platform_device mbox_device = { - .name ="mailbox" , + .name ="omap2-mailbox" , .id =-1 , };
arch/arm/mach-omap2/mailbox.c +9 -6
@@ -18,6 +18,8 @@#include <mach/mailbox.h> #include <mach/irqs.h> +#define DRV_NAME "omap2-mailbox" +#define MAILBOX_REVISION 0x000#define MAILBOX_SYSCONFIG 0x010#define MAILBOX_SYSSTATUS 0x014
@@ -234,7 +236,7 @@ static struct omap_mbox mbox_iva_info = { };#endif -static int __init omap2_mbox_probe (struct platform_device *pdev) +static int __devinit omap2_mbox_probe (struct platform_device *pdev) {struct resource *res;int ret;
@@ -258,7 +260,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev) } mbox_dsp_info.irq = res->start; - ret =omap_mbox_register (&mbox_dsp_info); + ret =omap_mbox_register (&pdev->dev, &mbox_dsp_info);if (ret) goto err_dsp;
@@ -272,7 +274,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev) goto err_iva1; } mbox_iva_info.irq = res->start; - ret =omap_mbox_register (&mbox_iva_info); + ret =omap_mbox_register (&pdev->dev, &mbox_iva_info);if (ret) goto err_iva1; }
@@ -286,7 +288,7 @@ err_dsp:return ret; } -static int omap2_mbox_remove (struct platform_device *pdev) +static int __devexit omap2_mbox_remove(struct platform_device *pdev) {#if defined(CONFIG_ARCH_OMAP2420 )omap_mbox_unregister (&mbox_iva_info);
@@ -298,9 +300,9 @@ static int omap2_mbox_remove(struct platform_device *pdev)static struct platform_driver omap2_mbox_driver = { .probe = omap2_mbox_probe, - .remove = omap2_mbox_remove, + .remove =__devexit_p (omap2_mbox_remove), .driver = { - .name ="mailbox" , + .name =DRV_NAME , }, };
@@ -320,3 +322,4 @@ module_exit(omap2_mbox_exit);MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("omap mailbox: omap2/3 architecture specific functions" );MODULE_AUTHOR ("Hiroshi DOYU <[email protected]>, Paul Mundt" ); +MODULE_ALIAS ("platform:" DRV_NAME );
PATCH 7/10 omap mailbox: add save_/restore_ctx() for PM
In reply to Hiroshi DOYUTo preserve the registers during off-mode
---
arch/arm/mach-omap2/mailbox.c | 35 +++++++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/mailbox.h | 23 +++++++++++++++++++ 2 files changed, 58 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mailbox.c +35 -0
@@ -32,6 +32,8 @@#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u)))#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) +#define MBOX_REG_SIZE 0x120 +static void __iomem *mbox_base;struct omap_mbox2_fifo {
@@ -47,6 +49,7 @@ struct omap_mbox2_priv {unsigned long irqstatus;u32 newmsg_bit;u32 notfull_bit; +char ctx[MBOX_REG_SIZE ]; };static struct clk *mbox_ick_handle;
@@ -167,6 +170,36 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,return (enable & status & bit); } +static void omap2_mbox_save_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_REG_SIZE ; i +=sizeof (u32)) { +u32 val; + + val =mbox_read_reg (i); + *(u32 *)(p->ctx + i) = val; + +dev_dbg (mbox->dev,"%s\t[%02d] %08x\n" , __func__, i, val); + } +} + +static void omap2_mbox_restore_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_REG_SIZE ; i +=sizeof (u32)) { +u32 val; + + val = *(u32 *)(p->ctx + i); +mbox_write_reg (val, i); + +dev_dbg (mbox->dev,"%s\t[%02d] %08x\n" , __func__, i, val); + } +} +static struct omap_mbox_ops omap2_mbox_ops = { .type =OMAP_MBOX_TYPE2 , .startup = omap2_mbox_startup,
@@ -179,6 +212,8 @@ static struct omap_mbox_ops omap2_mbox_ops = { .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, };/*
arch/arm/plat-omap/include/mach/mailbox.h +23 -0
@@ -33,6 +33,9 @@ struct omap_mbox_ops {void (*disable_irq)(struct omap_mbox *mbox,omap_mbox_irq_t irq);void (*ack_irq)(struct omap_mbox *mbox,omap_mbox_irq_t irq);int (*is_irq)(struct omap_mbox *mbox,omap_mbox_irq_t irq); +/* ctx */ +void (*save_ctx)(struct omap_mbox *mbox); +void (*restore_ctx)(struct omap_mbox *mbox); };struct omap_mbox_queue {
@@ -70,4 +73,24 @@ void omap_mbox_put(struct omap_mbox *);int omap_mbox_register (struct device *parent,struct omap_mbox *);int omap_mbox_unregister (struct omap_mbox *); +static inline void omap_mbox_save_ctx (struct omap_mbox *mbox) +{ +if (!mbox->ops->save_ctx) { +dev_err (mbox->dev,"%s:\tno save\n" , __func__); +return ; + } + + mbox->ops->save_ctx (mbox); +} + +static inline void omap_mbox_restore_ctx (struct omap_mbox *mbox) +{ +if (!mbox->ops->restore_ctx) { +dev_err (mbox->dev,"%s:\tno restore\n" , __func__); +return ; + } + + mbox->ops->restore_ctx (mbox); +} +#endif /* MAILBOX_H */
Re: [PATCH 07/10] omap mailbox: add save_/restore_ctx() for PM
Quoted 14 lines · Hiroshi DOYU
arch/arm/mach-omap2/mailbox.c +2
-0@@ -32,6 +32,8 @@#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u)))#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) +#define MBOX_REG_SIZE 0x120 +static void __iomem *mbox_base;struct omap_mbox2_fifo {
arch/arm/mach-omap2/mailbox.c struct omap_mbox2_priv { · line 52
Quoted 4 lines
arch/arm/mach-omap2/mailbox.c +1
-0@@ -47,6 +49,7 @@ struct omap_mbox2_priv {unsigned long irqstatus;u32 newmsg_bit;u32 notfull_bit; +char ctx[MBOX_REG_SIZE ];
u32 ctx[MOX_REG_SIZE / sizeof(u32)];
?
Quoted 7 lines
arch/arm/mach-omap2/mailbox.c +0
-0};static struct clk *mbox_ick_handle;@@ -167,6 +170,36 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,return (enable & status & bit); }
arch/arm/mach-omap2/mailbox.c static int omap2_mbox_is_irq(struct omap_mbox *mbox, · line 182
Quoted 10 lines
arch/arm/mach-omap2/mailbox.c +10
-0+static void omap2_mbox_save_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_REG_SIZE ; i +=sizeof (u32)) { +u32 val; + + val =mbox_read_reg (i); + *(u32 *)(p->ctx + i) = val;
p->ctx[i] = mbox_read_reg(i);
?
arch/arm/mach-omap2/mailbox.c static int omap2_mbox_is_irq(struct omap_mbox *mbox, · line 184
Quoted 2 lines
arch/arm/mach-omap2/mailbox.c +2
-0+ +dev_dbg (mbox->dev,"%s\t[%02d] %08x\n" , __func__, i, val);
tabs aren't nice in kernel messages.
dev_dbg(mbox->dev, "%s: [%02d] %08x\n", __func__, i, p->ctx[i]);
also, mixing decimal and octal as bare numbers can be rather confusing.
arch/arm/mach-omap2/mailbox.c static int omap2_mbox_is_irq(struct omap_mbox *mbox, · line 197
Quoted 13 lines
arch/arm/mach-omap2/mailbox.c +13
-0+ } +} + +static void omap2_mbox_restore_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_REG_SIZE ; i +=sizeof (u32)) { +u32 val; + + val = *(u32 *)(p->ctx + i); +mbox_write_reg (val, i);
mbox_write_reg(p->ctx[i], i);
arch/arm/mach-omap2/mailbox.c static int omap2_mbox_is_irq(struct omap_mbox *mbox, · line 199
Quoted 2 lines
arch/arm/mach-omap2/mailbox.c +2
-0+ +dev_dbg (mbox->dev,"%s\t[%02d] %08x\n" , __func__, i, val);
dev_dbg(mbox->dev, "%s: [%02d] %08x\n@, __func__, i, p->ctx[i]);
Re: [PATCH 07/10] omap mailbox: add save_/restore_ctx() for PM
Quoted 31 lines · Russell King - ARM Linux
Quoted 14 lines · Hiroshi DOYU
arch/arm/mach-omap2/mailbox.c +2
-0@@ -32,6 +32,8 @@#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u)))#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) +#define MBOX_REG_SIZE 0x120 +static void __iomem *mbox_base;struct omap_mbox2_fifo {arch/arm/mach-omap2/mailbox.c struct omap_mbox2_priv { · line 52
Quoted 4 lines
arch/arm/mach-omap2/mailbox.c +1
-0@@ -47,6 +49,7 @@ struct omap_mbox2_priv {unsigned long irqstatus;u32 newmsg_bit;u32 notfull_bit; +char ctx[MBOX_REG_SIZE ];u32 ctx[MOX_REG_SIZE / sizeof(u32)];?
Quoted 7 lines
arch/arm/mach-omap2/mailbox.c +0
-0};static struct clk *mbox_ick_handle;@@ -167,6 +170,36 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,return (enable & status & bit); }
Quoted 12 lines
arch/arm/mach-omap2/mailbox.c static int omap2_mbox_is_irq(struct omap_mbox *mbox, · line 182
Quoted 10 lines
arch/arm/mach-omap2/mailbox.c +10
-0+static void omap2_mbox_save_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_REG_SIZE ; i +=sizeof (u32)) { +u32 val; + + val =mbox_read_reg (i); + *(u32 *)(p->ctx + i) = val;p->ctx[i] = mbox_read_reg(i);
Hmm, don't forget 'i' is an offset not an index, so...
£define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32))
for (i = 0; i < MBOX_NR_REGS; i++) {
p->ctx[i] = mbox_read_reg(i * sizeof(u32));(you'll have to excuse the '£' there - my keyboard currently does not have a 'hash' key for some Fedora 9 post upgrade silly reason.)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/10] omap mailbox: add save_/restore_ctx() for PM
Hi Russell, Thank you for your review.
From: "ext Russell King - ARM Linux" <[email protected]>
Subject: Re: [PATCH 07/10] omap mailbox: add save_/restore_ctx() for PM
Date: Sat, 17 Jan 2009 17:20:37 +0000
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Hiroshi DOYU
Quoted 4 lines
arch/arm/mach-omap2/mailbox.c +0
-0
[...]
Quoted 6 lines
Hmm, don't forget 'i' is an offset not an index, so...
£define
MBOX_NR_REGS(MBOX_REG_SIZE/ sizeof(u32))for (i = 0; i < MBOX_NR_REGS; i++) { p->ctx[i] = mbox_read_reg(i * sizeof(u32));
The updated one is attached.
Quoted 2 lines
(you'll have to excuse the '£' there - my keyboard currently does not have a 'hash' key for some Fedora 9 post upgrade silly reason.)
No problem, just sorry for you inconvenience;)
Just for convenience, I provided a branch for the latest "mailbox" patchset as below:
The following changes since commit 1de9e8e70f5acc441550ca75433563d91b269bbe:
Linus Torvalds (1):
Linux 2.6.29-rc2
are available in the git repository at:
http://git.gitorious.org/lk/mainline.git mailbox
Hiroshi DOYU (10):
omap mailbox: cleanup omap2 register definition with macro omap mailbox: add initial omap3 support
omap mailbox: print hardware revision at startup omap mailbox: fix empty struct device for omap_mbox omap mailbox: fix empty struct device for omap1 omap mailbox: fix empty struct device for omap2 omap mailbox: add save_/restore_ctx() for PM
omap mailbox: move mailbox.h into mailbox.c
omap mailbox: convert sequence bit checking to module paramter omap mailbox: remove unnecessary header file inclusion
arch/arm/mach-omap1/devices.c | 2 +- arch/arm/mach-omap1/mailbox.c | 31 +++-- arch/arm/mach-omap2/devices.c | 39 ++++-- arch/arm/mach-omap2/mailbox.c | 197 ++++++++++++++++------------ arch/arm/plat-omap/Kconfig | 8 + arch/arm/plat-omap/include/mach/mailbox.h | 27 ++++- arch/arm/plat-omap/include/mach/omap34xx.h | 1 + arch/arm/plat-omap/mailbox.c | 152 ++++++++++++++++------ arch/arm/plat-omap/mailbox.h | 100 -------------- 9 files changed, 311 insertions(+), 246 deletions(-) delete mode 100644 arch/arm/plat-omap/mailbox.h
omap mailbox: add save_/restore_ctx() for PM
From: Hiroshi DOYU <[email protected]>
To preserve the registers during off-mode
---
arch/arm/mach-omap2/mailbox.c | 32 +++++++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/mailbox.h | 23 +++++++++++++++++++++ 2 files changed, 55 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mailbox.c +32 -0
@@ -32,6 +32,9 @@#define MAILBOX_IRQ_NEWMSG (u) (1 << (2 * (u)))#define MAILBOX_IRQ_NOTFULL (u) (1 << (2 * (u) + 1)) +#define MBOX_REG_SIZE 0x120 +#define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32)) +static void __iomem *mbox_base;struct omap_mbox2_fifo {
@@ -47,6 +50,7 @@ struct omap_mbox2_priv {unsigned long irqstatus;u32 newmsg_bit;u32 notfull_bit; +u32 ctx[MBOX_NR_REGS ]; };static struct clk *mbox_ick_handle;
@@ -167,6 +171,32 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,return (enable & status & bit); } +static void omap2_mbox_save_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_NR_REGS ; i++) { + p->ctx[i] =mbox_read_reg (i *sizeof (u32)); + +dev_dbg (mbox->dev,"%s: [%02x] %08x\n" , __func__, + i, p->ctx[i]); + } +} + +static void omap2_mbox_restore_ctx (struct omap_mbox *mbox) +{ +int i; +struct omap_mbox2_priv *p = mbox->priv; + +for (i =0 ; i <MBOX_NR_REGS ; i++) { +mbox_write_reg (p->ctx[i], i *sizeof (u32)); + +dev_dbg (mbox->dev,"%s: [%02x] %08x\n" , __func__, + i, p->ctx[i]); + } +} +static struct omap_mbox_ops omap2_mbox_ops = { .type =OMAP_MBOX_TYPE2 , .startup = omap2_mbox_startup,
@@ -179,6 +209,8 @@ static struct omap_mbox_ops omap2_mbox_ops = { .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, };/*
arch/arm/plat-omap/include/mach/mailbox.h +23 -0
@@ -33,6 +33,9 @@ struct omap_mbox_ops {void (*disable_irq)(struct omap_mbox *mbox,omap_mbox_irq_t irq);void (*ack_irq)(struct omap_mbox *mbox,omap_mbox_irq_t irq);int (*is_irq)(struct omap_mbox *mbox,omap_mbox_irq_t irq); +/* ctx */ +void (*save_ctx)(struct omap_mbox *mbox); +void (*restore_ctx)(struct omap_mbox *mbox); };struct omap_mbox_queue {
@@ -70,4 +73,24 @@ void omap_mbox_put(struct omap_mbox *);int omap_mbox_register (struct device *parent,struct omap_mbox *);int omap_mbox_unregister (struct omap_mbox *); +static inline void omap_mbox_save_ctx (struct omap_mbox *mbox) +{ +if (!mbox->ops->save_ctx) { +dev_err (mbox->dev,"%s:\tno save\n" , __func__); +return ; + } + + mbox->ops->save_ctx (mbox); +} + +static inline void omap_mbox_restore_ctx (struct omap_mbox *mbox) +{ +if (!mbox->ops->restore_ctx) { +dev_err (mbox->dev,"%s:\tno restore\n" , __func__); +return ; + } + + mbox->ops->restore_ctx (mbox); +} +#endif /* MAILBOX_H */
Re: [PATCH 07/10] omap mailbox: add save_/restore_ctx() for PM
Quoted 15 lines · Hiroshi DOYU
Hi Russell, Thank you for your review.
From: "ext Russell King - ARM Linux" <[email protected]>
Subject: Re: [PATCH 07/10] omap mailbox: add save_/restore_ctx() for PM
Date: Sat, 17 Jan 2009 17:20:37 +0000Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Hiroshi DOYU
Quoted 4 lines
arch/arm/mach-omap2/mailbox.c +0
-0[...]
Quoted 8 lines
Quoted 6 lines
Hmm, don't forget 'i' is an offset not an index, so...
£define
MBOX_NR_REGS(MBOX_REG_SIZE/ sizeof(u32))for (i = 0; i < MBOX_NR_REGS; i++) { p->ctx[i] = mbox_read_reg(i * sizeof(u32));The updated one is attached.
... which looks much better, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/10 omap mailbox: move mailbox.h into mailbox.c
In reply to Hiroshi DOYUno need to keep mailbox.h separately.
---
arch/arm/plat-omap/mailbox.c | 86 ++++++++++++++++++++++++++++++++++++ arch/arm/plat-omap/mailbox.h | 100 ------------------------------------------ 2 files changed, 85 insertions(+), 101 deletions(-) delete mode 100644 arch/arm/plat-omap/mailbox.h
arch/arm/plat-omap/mailbox.c +85 -1
@@ -31,11 +31,95 @@#include <linux/delay.h> #include <linux/io.h> #include <mach/mailbox.h> -#include "mailbox.h" static struct omap_mbox *mboxes;static DEFINE_RWLOCK (mboxes_lock); +/* +* Mailbox sequence bit API +*/ +#if defined(CONFIG_ARCH_OMAP1 ) +# define MBOX_USE_SEQ_BIT +#elif defined(CONFIG_ARCH_OMAP2 ) +# define MBOX_USE_SEQ_BIT +#endif + +#ifdef MBOX_USE_SEQ_BIT +/* seq_rcv should be initialized with any value other than +* 0 and 1 << 31, to allow either value for the first +* message. */ +static inline void mbox_seq_init (struct omap_mbox *mbox) +{ +/* any value other than 0 and 1 << 31 */ + mbox->seq_rcv =0xffffffff ; +} + +static inline void mbox_seq_toggle (struct omap_mbox *mbox,mbox_msg_t * msg) +{ +/* add seq_snd to msg */ + *msg = (*msg &0x7fffffff ) | mbox->seq_snd; +/* flip seq_snd */ + mbox->seq_snd ^=1 <<31 ; +} + +static inline int mbox_seq_test (struct omap_mbox *mbox,mbox_msg_t msg) +{ +mbox_msg_t seq = msg & (1 <<31 ); +if (seq == mbox->seq_rcv) +return -1 ; + mbox->seq_rcv = seq; +return 0 ; +} +#else +static inline void mbox_seq_init (struct omap_mbox *mbox) +{ +} +static inline void mbox_seq_toggle (struct omap_mbox *mbox,mbox_msg_t * msg) +{ +} +static inline int mbox_seq_test (struct omap_mbox *mbox,mbox_msg_t msg) +{ +return 0 ; +} +#endif + +/* Mailbox FIFO handle functions */ +static inline mbox_msg_t mbox_fifo_read (struct omap_mbox *mbox) +{ +return mbox->ops->fifo_read (mbox); +} +static inline void mbox_fifo_write (struct omap_mbox *mbox,mbox_msg_t msg) +{ + mbox->ops->fifo_write (mbox, msg); +} +static inline int mbox_fifo_empty (struct omap_mbox *mbox) +{ +return mbox->ops->fifo_empty (mbox); +} +static inline int mbox_fifo_full (struct omap_mbox *mbox) +{ +return mbox->ops->fifo_full (mbox); +} + +/* Mailbox IRQ handle functions */ +static inline void enable_mbox_irq (struct omap_mbox *mbox,omap_mbox_irq_t irq) +{ + mbox->ops->enable_irq (mbox, irq); +} +static inline void disable_mbox_irq (struct omap_mbox *mbox,omap_mbox_irq_t irq) +{ + mbox->ops->disable_irq (mbox, irq); +} +static inline void ack_mbox_irq (struct omap_mbox *mbox,omap_mbox_irq_t irq) +{ +if (mbox->ops->ack_irq) + mbox->ops->ack_irq (mbox, irq); +} +static inline int is_mbox_irq (struct omap_mbox *mbox,omap_mbox_irq_t irq) +{ +return mbox->ops->is_irq (mbox, irq); +} +/* Mailbox Sequence Bit function */ void omap_mbox_init_seq (struct omap_mbox *mbox) {
arch/arm/plat-omap/mailbox.h deleted +0 -100
100 lines not on this page · raw message
PATCH 9/10 omap mailbox: convert sequence bit checking to module paramter
In reply to Hiroshi DOYU---
arch/arm/plat-omap/mailbox.c | 35 ++++++++++++++++------------------- 1 files changed, 16 insertions(+), 19 deletions(-)
arch/arm/plat-omap/mailbox.c +16 -19
@@ -32,30 +32,34 @@#include <linux/io.h> #include <mach/mailbox.h> +static int enable_seq_bit; +module_param (enable_seq_bit, bool,0 ); +MODULE_PARM_DESC (enable_seq_bit,"Enable sequence bit checking." ); +static struct omap_mbox *mboxes;static DEFINE_RWLOCK (mboxes_lock);/* * Mailbox sequence bit API */ -#if defined(CONFIG_ARCH_OMAP1 ) -# define MBOX_USE_SEQ_BIT -#elif defined(CONFIG_ARCH_OMAP2 ) -# define MBOX_USE_SEQ_BIT -#endif -#ifdef MBOX_USE_SEQ_BIT /* seq_rcv should be initialized with any value other than * 0 and 1 << 31, to allow either value for the first * message. */ static inline void mbox_seq_init (struct omap_mbox *mbox) { +if (!enable_seq_bit) +return ; +/* any value other than 0 and 1 << 31 */ mbox->seq_rcv =0xffffffff ; }static inline void mbox_seq_toggle (struct omap_mbox *mbox,mbox_msg_t * msg) { +if (!enable_seq_bit) +return ; +/* add seq_snd to msg */ *msg = (*msg &0x7fffffff ) | mbox->seq_snd;/* flip seq_snd */
@@ -64,24 +68,17 @@ static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)static inline int mbox_seq_test (struct omap_mbox *mbox,mbox_msg_t msg) { -mbox_msg_t seq = msg & (1 <<31 ); +mbox_msg_t seq; + +if (!enable_seq_bit) +return 0 ; + + seq = msg & (1 <<31 );if (seq == mbox->seq_rcv)return -1 ; mbox->seq_rcv = seq;return 0 ; } -#else -static inline void mbox_seq_init (struct omap_mbox *mbox) -{ -} -static inline void mbox_seq_toggle (struct omap_mbox *mbox,mbox_msg_t * msg) -{ -} -static inline int mbox_seq_test (struct omap_mbox *mbox,mbox_msg_t msg) -{ -return 0 ; -} -#endif /* Mailbox FIFO handle functions */ static inline mbox_msg_t mbox_fifo_read (struct omap_mbox *mbox)
PATCH 10/10 omap mailbox: remove unnecessary header file inclusion
In reply to Hiroshi DOYU---
arch/arm/plat-omap/mailbox.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/plat-omap/mailbox.c +1 -5
@@ -21,15 +21,11 @@* */ -#include <linux/init.h> #include <linux/module.h> -#include <linux/sched.h> #include <linux/interrupt.h> #include <linux/device.h> -#include <linux/blkdev.h> -#include <linux/err.h> #include <linux/delay.h> -#include <linux/io.h> +#include <mach/mailbox.h> static int enable_seq_bit;
Tony Lindgren
maintainerQuoted 5 lines · Hiroshi DOYU
The following patches add omap3 support and some cleanups.
This "omap mailbox" device driver has been used for the interprocessor communication between ARM and some co-processors(DSP) inside of omap SoC, which is a kind of interrupt driven FIFO.
Adding the mailbox series to the omap for-next branch. Ignoring the iommu series for now as it still needs some updates.
Tony
Quoted 34 lines
---
Hiroshi DOYU (10):
omap mailbox: remove unnecessary header file inclusion omap mailbox: convert sequence bit checking to module paramter omap mailbox: movemailbox.hintomailbox.c
omap mailbox: add save_/restore_ctx() for PM
omap mailbox: fix empty struct device for omap2 omap mailbox: fix empty struct device for omap1 omap mailbox: fix empty struct device foromap_mboxomap mailbox: print hardware revision at startup omap mailbox: add initial omap3 support
omap mailbox: cleanup omap2 register definition with macroarch/arm/mach-omap1/devices.c | 2 arch/arm/mach-omap1/mailbox.c | 31 ++-- arch/arm/mach-omap2/devices.c | 38 ++++- arch/arm/mach-omap2/mailbox.c | 195 +++++++++++++++++----------- arch/arm/plat-omap/Kconfig | 8 + arch/arm/plat-omap/include/mach/mailbox.h | 27 ++++ arch/arm/plat-omap/include/mach/omap34xx.h | 1 arch/arm/plat-omap/mailbox.c | 152 ++++++++++++++++------ arch/arm/plat-omap/mailbox.h | 100 -------------- 9 files changed, 311 insertions(+), 243 deletions(-) delete mode 100644 arch/arm/plat-omap/mailbox.hSignature · 6 lines
Hiroshi DOYU -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html