* [PATCH 1/3] omap mailbox: cleanup register definition with macro
@ 2008-11-22 0:28 Hiroshi DOYU
2008-11-22 0:28 ` [PATCH 2/3] omap mailbox: add initial omap3 support Hiroshi DOYU
2008-11-22 11:55 ` [PATCH 1/3] omap mailbox: cleanup register definition with macro Felipe Balbi
0 siblings, 2 replies; 6+ messages in thread
From: Hiroshi DOYU @ 2008-11-22 0:28 UTC (permalink / raw)
To: linux-omap; +Cc: Hiroshi DOYU
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
arch/arm/mach-omap2/mailbox.c | 77 +++++++++++++++-------------------------
1 files changed, 29 insertions(+), 48 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 22546d0..5ff2ed8 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -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 <Hiroshi.DOYU@nokia.com>
- * and Paul Mundt <paul.mundt@nokia.com>
+ * 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 <Hiroshi.DOYU@nokia.com>, Paul Mundt");
--
1.6.0.3.613.g9f8f13
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] omap mailbox: add initial omap3 support
2008-11-22 0:28 [PATCH 1/3] omap mailbox: cleanup register definition with macro Hiroshi DOYU
@ 2008-11-22 0:28 ` Hiroshi DOYU
2008-11-22 0:28 ` [PATCH 3/3] omap mailbox: print hardware revision Hiroshi DOYU
2008-11-22 11:57 ` [PATCH 2/3] omap mailbox: add initial omap3 support Felipe Balbi
2008-11-22 11:55 ` [PATCH 1/3] omap mailbox: cleanup register definition with macro Felipe Balbi
1 sibling, 2 replies; 6+ messages in thread
From: Hiroshi DOYU @ 2008-11-22 0:28 UTC (permalink / raw)
To: linux-omap; +Cc: Hiroshi DOYU
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
arch/arm/mach-omap2/devices.c | 24 +++++++++++---
arch/arm/mach-omap2/mailbox.c | 46 ++++++++++++++++++----------
arch/arm/plat-omap/Kconfig | 2 +-
arch/arm/plat-omap/include/mach/irqs.h | 1 +
arch/arm/plat-omap/include/mach/omap34xx.h | 2 +-
5 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 241e418..d385f0f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -84,13 +84,15 @@ static inline void omap_init_camera(void)
}
#endif
-#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)
+
+#define MBOX_REG_SIZE 0x120
static struct resource mbox_resources[] = {
+#if defined(CONFIG_ARCH_OMAP2420)
{
- .start = OMAP2_MBOX_BASE,
- .end = OMAP2_MBOX_BASE + 0x11f,
+ .start = OMAP24XX_MAILBOX_BASE,
+ .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
.flags = IORESOURCE_MEM,
},
{
@@ -101,6 +103,18 @@ static struct resource mbox_resources[] = {
.start = INT_24XX_MAIL_U3_MPU,
.flags = IORESOURCE_IRQ,
},
+/* FIXME: if multiple architecture support is necessary */
+#elif defined(CONFIG_ARCH_OMAP3)
+ {
+ .start = OMAP34XX_MAILBOX_BASE,
+ .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_34XX_MAIL_U0_MPU,
+ .flags = IORESOURCE_IRQ,
+ },
+#endif
};
static struct platform_device mbox_device = {
@@ -116,7 +130,7 @@ static inline void omap_init_mbox(void)
}
#else
static inline void omap_init_mbox(void) { }
-#endif
+#endif /* CONFIG_OMAP_MBOX_FWK */
#if defined(CONFIG_OMAP_STI)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 5ff2ed8..ce39aa1 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -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((void __iomem *)(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, (void __iomem *)(mbox_base + reg));
+ __raw_writel(val, mbox_base + ofs);
}
/* Mailbox H/W preparations */
@@ -208,7 +208,7 @@ struct omap_mbox mbox_dsp_info = {
};
EXPORT_SYMBOL(mbox_dsp_info);
-/* IVA */
+#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
static struct omap_mbox2_priv omap2_mbox_iva_priv = {
.tx_fifo = {
.msg = MAILBOX_MESSAGE(2),
@@ -229,52 +229,66 @@ static struct omap_mbox mbox_iva_info = {
.ops = &omap2_mbox_ops,
.priv = &omap2_mbox_iva_priv,
};
+#endif
static int __init omap2_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
int ret = 0;
- if (pdev->num_resources != 3) {
- dev_err(&pdev->dev, "invalid number of resources: %d\n",
- pdev->num_resources);
- return -ENODEV;
- }
-
/* MBOX base */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(!res)) {
dev_err(&pdev->dev, "invalid mem resource\n");
return -ENODEV;
}
- mbox_base = res->start;
+ mbox_base = ioremap(res->start, res->end - res->start);
+ if (!mbox_base)
+ return -ENOMEM;
- /* DSP IRQ */
+ /* DSP or IVA2 IRQ */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (unlikely(!res)) {
dev_err(&pdev->dev, "invalid irq resource\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_dsp;
}
mbox_dsp_info.irq = res->start;
ret = omap_mbox_register(&mbox_dsp_info);
+ if (!ret)
+ goto err_dsp;
+#if defined(CONFIG_ARCH_OMAP2420)
/* IVA IRQ */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
if (unlikely(!res)) {
dev_err(&pdev->dev, "invalid irq resource\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_iva1;
}
mbox_iva_info.irq = res->start;
ret = omap_mbox_register(&mbox_iva_info);
+ if (!ret) {
+ omap_mbox_unregister(&mbox_dsp_info);
+ goto err_dsp;
+ }
+#endif
+ return ret;
+err_dsp:
+ iounmap(mbox_base);
return ret;
}
static int omap2_mbox_remove(struct platform_device *pdev)
{
+#if defined(CONFIG_ARCH_OMAP2420)
+ omap_mbox_unregister(&mbox_iva_info);
+#endif
omap_mbox_unregister(&mbox_dsp_info);
+ iounmap(mbox_base);
return 0;
}
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 960c13f..2465aea 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -180,7 +180,7 @@ config OMAP_MBOX_FWK
default n
help
Say Y here if you want to use OMAP Mailbox framework support for
- DSP and IVA1.0 in OMAP1/2.
+ DSP, IVA1.0 and IVA2 in OMAP1/2/3.
choice
prompt "System timer"
diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h
index d12c39f..74f58c6 100644
--- a/arch/arm/plat-omap/include/mach/irqs.h
+++ b/arch/arm/plat-omap/include/mach/irqs.h
@@ -315,6 +315,7 @@
#define INT_34XX_MCBSP3_IRQ 22
#define INT_34XX_MCBSP4_IRQ 23
#define INT_34XX_CAM_IRQ 24
+#define INT_34XX_MAIL_U0_MPU 26
#define INT_34XX_MCBSP5_IRQ 27
#define INT_34XX_GPIO_BANK1 29
#define INT_34XX_GPIO_BANK2 30
diff --git a/arch/arm/plat-omap/include/mach/omap34xx.h b/arch/arm/plat-omap/include/mach/omap34xx.h
index 0a137c1..afd0f6c 100644
--- a/arch/arm/plat-omap/include/mach/omap34xx.h
+++ b/arch/arm/plat-omap/include/mach/omap34xx.h
@@ -63,8 +63,8 @@
#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)
#define OMAP34XX_CAMERA_BASE (L4_34XX_BASE + 0xBC000)
-
#endif
#define OMAP34XX_DSP_BASE 0x58000000
--
1.6.0.3.613.g9f8f13
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] omap mailbox: print hardware revision
2008-11-22 0:28 ` [PATCH 2/3] omap mailbox: add initial omap3 support Hiroshi DOYU
@ 2008-11-22 0:28 ` Hiroshi DOYU
2008-11-22 11:57 ` [PATCH 2/3] omap mailbox: add initial omap3 support Felipe Balbi
1 sibling, 0 replies; 6+ messages in thread
From: Hiroshi DOYU @ 2008-11-22 0:28 UTC (permalink / raw)
To: linux-omap; +Cc: Hiroshi DOYU
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
arch/arm/mach-omap2/mailbox.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index ce39aa1..3daa406 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -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 %x\n", l);
+
/* set smart-idle & autoidle */
l = mbox_read_reg(MAILBOX_SYSCONFIG);
l |= 0x00000011;
--
1.6.0.3.613.g9f8f13
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] omap mailbox: cleanup register definition with macro
2008-11-22 0:28 [PATCH 1/3] omap mailbox: cleanup register definition with macro Hiroshi DOYU
2008-11-22 0:28 ` [PATCH 2/3] omap mailbox: add initial omap3 support Hiroshi DOYU
@ 2008-11-22 11:55 ` Felipe Balbi
1 sibling, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2008-11-22 11:55 UTC (permalink / raw)
To: Hiroshi DOYU; +Cc: linux-omap
On Sat, Nov 22, 2008 at 02:28:35AM +0200, Hiroshi DOYU wrote:
> +static unsigned long mbox_base;
shouldn't this be __void iomem *mbox_base ?
Then you would need a patch like this (not even compile tested):
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 22546d0..7aa68e5 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -48,7 +48,7 @@
#define MAILBOX_IRQSTATUS_3 0x118
#define MAILBOX_IRQENABLE_3 0x11c
-static unsigned long mbox_base;
+static void __iomem *mbox_base;
#define MAILBOX_IRQ_NOTFULL(n) (1 << (2 * (n) + 1))
#define MAILBOX_IRQ_NEWMSG(n) (1 << (2 * (n)))
@@ -75,12 +75,12 @@ static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
static inline unsigned int mbox_read_reg(unsigned int reg)
{
- return __raw_readl((void __iomem *)(mbox_base + reg));
+ return __raw_readl(mbox_base + reg);
}
static inline void mbox_write_reg(unsigned int val, unsigned int reg)
{
- __raw_writel(val, (void __iomem *)(mbox_base + reg));
+ __raw_writel(val, (mbox_base + reg));
}
/* Mailbox H/W preparations */
@@ -268,7 +268,7 @@ static int __init omap2_mbox_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "invalid mem resource\n");
return -ENODEV;
}
- mbox_base = res->start;
+ mbox_base = ioremap(res->start, res->end - res->start);
/* DSP IRQ */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
--
balbi
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] omap mailbox: add initial omap3 support
2008-11-22 0:28 ` [PATCH 2/3] omap mailbox: add initial omap3 support Hiroshi DOYU
2008-11-22 0:28 ` [PATCH 3/3] omap mailbox: print hardware revision Hiroshi DOYU
@ 2008-11-22 11:57 ` Felipe Balbi
2008-11-22 21:09 ` Hiroshi DOYU
1 sibling, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2008-11-22 11:57 UTC (permalink / raw)
To: Hiroshi DOYU; +Cc: linux-omap
On Sat, Nov 22, 2008 at 02:28:36AM +0200, Hiroshi DOYU wrote:
> @@ -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;
ohh. you did :-) forget my previous comment
--
balbi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] omap mailbox: add initial omap3 support
2008-11-22 11:57 ` [PATCH 2/3] omap mailbox: add initial omap3 support Felipe Balbi
@ 2008-11-22 21:09 ` Hiroshi DOYU
0 siblings, 0 replies; 6+ messages in thread
From: Hiroshi DOYU @ 2008-11-22 21:09 UTC (permalink / raw)
To: me; +Cc: linux-omap
Hi Felipe,
From: "ext Felipe Balbi" <me@felipebalbi.com>
Subject: Re: [PATCH 2/3] omap mailbox: add initial omap3 support
Date: Sat, 22 Nov 2008 13:57:47 +0200
> On Sat, Nov 22, 2008 at 02:28:36AM +0200, Hiroshi DOYU wrote:
> > @@ -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;
>
> ohh. you did :-) forget my previous comment
OK. Anyway, thank you for your review of these patches;)
Hiroshi DOYU
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-11-22 21:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-22 0:28 [PATCH 1/3] omap mailbox: cleanup register definition with macro Hiroshi DOYU
2008-11-22 0:28 ` [PATCH 2/3] omap mailbox: add initial omap3 support Hiroshi DOYU
2008-11-22 0:28 ` [PATCH 3/3] omap mailbox: print hardware revision Hiroshi DOYU
2008-11-22 11:57 ` [PATCH 2/3] omap mailbox: add initial omap3 support Felipe Balbi
2008-11-22 21:09 ` Hiroshi DOYU
2008-11-22 11:55 ` [PATCH 1/3] omap mailbox: cleanup register definition with macro Felipe Balbi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.