* [RFC/PATCH 1/8] omap: mailbox: trivial cleanups
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
@ 2010-05-02 23:59 ` Felipe Contreras
2010-05-02 23:59 ` [RFC/PATCH 2/8] omap: mailbox: reorganize structures Felipe Contreras
` (6 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-02 23:59 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
Also fix a few compilation warnings.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 7 +++----
arch/arm/plat-omap/mailbox.c | 2 --
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 281ab63..7263b9b 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -93,7 +93,7 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
mbox_ick_handle = clk_get(NULL, "mailboxes_ick");
if (IS_ERR(mbox_ick_handle)) {
- printk(KERN_ERR "Could not get mailboxes_ick: %d\n",
+ printk(KERN_ERR "Could not get mailboxes_ick: %ld\n",
PTR_ERR(mbox_ick_handle));
return PTR_ERR(mbox_ick_handle);
}
@@ -279,8 +279,6 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
.irqdisable = MAILBOX_IRQENABLE(0),
};
-
-
/* OMAP4 specific data structure. Use the cpu_is_omap4xxx()
to use this*/
static struct omap_mbox2_priv omap2_mbox_1_priv = {
@@ -336,7 +334,6 @@ struct omap_mbox mbox_2_info = {
};
EXPORT_SYMBOL(mbox_2_info);
-
#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
static struct omap_mbox2_priv omap2_mbox_iva_priv = {
.tx_fifo = {
@@ -419,8 +416,10 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
#endif
return 0;
+#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
err_iva1:
omap_mbox_unregister(&mbox_dsp_info);
+#endif
err_dsp:
iounmap(mbox_base);
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 8d86b0b..822c377 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -82,7 +82,6 @@ static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
return ret;
}
-
int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
{
@@ -108,7 +107,6 @@ static void mbox_tx_tasklet(unsigned long tx_data)
struct request_queue *q = mbox->txq->queue;
while (1) {
-
rq = blk_fetch_request(q);
if (!rq)
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RFC/PATCH 2/8] omap: mailbox: reorganize structures
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
2010-05-02 23:59 ` [RFC/PATCH 1/8] omap: mailbox: trivial cleanups Felipe Contreras
@ 2010-05-02 23:59 ` Felipe Contreras
2010-05-02 23:59 ` [RFC/PATCH 3/8] omap: mailbox: 2420 should be detected at run-time Felipe Contreras
` (5 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-02 23:59 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
OMAP4 ones messed up the organization.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 68 +++++++++++++++++++++--------------------
1 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 7263b9b..252e53b 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -262,6 +262,7 @@ static struct omap_mbox_ops omap2_mbox_ops = {
*/
/* FIXME: the following structs should be filled automatically by the user id */
+
/* DSP */
static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
.tx_fifo = {
@@ -279,8 +280,40 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
.irqdisable = MAILBOX_IRQENABLE(0),
};
-/* OMAP4 specific data structure. Use the cpu_is_omap4xxx()
-to use this*/
+struct omap_mbox mbox_dsp_info = {
+ .name = "dsp",
+ .ops = &omap2_mbox_ops,
+ .priv = &omap2_mbox_dsp_priv,
+};
+EXPORT_SYMBOL(mbox_dsp_info);
+
+#if defined(CONFIG_ARCH_OMAP2420)
+
+/* IVA */
+static struct omap_mbox2_priv omap2_mbox_iva_priv = {
+ .tx_fifo = {
+ .msg = MAILBOX_MESSAGE(2),
+ .fifo_stat = MAILBOX_FIFOSTATUS(2),
+ },
+ .rx_fifo = {
+ .msg = MAILBOX_MESSAGE(3),
+ .msg_stat = MAILBOX_MSGSTATUS(3),
+ },
+ .irqenable = MAILBOX_IRQENABLE(3),
+ .irqstatus = MAILBOX_IRQSTATUS(3),
+ .notfull_bit = MAILBOX_IRQ_NOTFULL(2),
+ .newmsg_bit = MAILBOX_IRQ_NEWMSG(3),
+ .irqdisable = MAILBOX_IRQENABLE(3),
+};
+
+static struct omap_mbox mbox_iva_info = {
+ .name = "iva",
+ .ops = &omap2_mbox_ops,
+ .priv = &omap2_mbox_iva_priv,
+};
+#endif
+
+/* OMAP4 */
static struct omap_mbox2_priv omap2_mbox_1_priv = {
.tx_fifo = {
.msg = MAILBOX_MESSAGE(0),
@@ -304,13 +337,6 @@ struct omap_mbox mbox_1_info = {
};
EXPORT_SYMBOL(mbox_1_info);
-struct omap_mbox mbox_dsp_info = {
- .name = "dsp",
- .ops = &omap2_mbox_ops,
- .priv = &omap2_mbox_dsp_priv,
-};
-EXPORT_SYMBOL(mbox_dsp_info);
-
static struct omap_mbox2_priv omap2_mbox_2_priv = {
.tx_fifo = {
.msg = MAILBOX_MESSAGE(3),
@@ -334,30 +360,6 @@ struct omap_mbox mbox_2_info = {
};
EXPORT_SYMBOL(mbox_2_info);
-#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
-static struct omap_mbox2_priv omap2_mbox_iva_priv = {
- .tx_fifo = {
- .msg = MAILBOX_MESSAGE(2),
- .fifo_stat = MAILBOX_FIFOSTATUS(2),
- },
- .rx_fifo = {
- .msg = MAILBOX_MESSAGE(3),
- .msg_stat = MAILBOX_MSGSTATUS(3),
- },
- .irqenable = MAILBOX_IRQENABLE(3),
- .irqstatus = MAILBOX_IRQSTATUS(3),
- .notfull_bit = MAILBOX_IRQ_NOTFULL(2),
- .newmsg_bit = MAILBOX_IRQ_NEWMSG(3),
- .irqdisable = MAILBOX_IRQENABLE(3),
-};
-
-static struct omap_mbox mbox_iva_info = {
- .name = "iva",
- .ops = &omap2_mbox_ops,
- .priv = &omap2_mbox_iva_priv,
-};
-#endif
-
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RFC/PATCH 3/8] omap: mailbox: 2420 should be detected at run-time
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
2010-05-02 23:59 ` [RFC/PATCH 1/8] omap: mailbox: trivial cleanups Felipe Contreras
2010-05-02 23:59 ` [RFC/PATCH 2/8] omap: mailbox: reorganize structures Felipe Contreras
@ 2010-05-02 23:59 ` Felipe Contreras
2010-05-02 23:59 ` [RFC/PATCH 4/8] omap: mailbox: reorganize omap2 registering Felipe Contreras
` (4 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-02 23:59 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 252e53b..a328664 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -287,8 +287,6 @@ struct omap_mbox mbox_dsp_info = {
};
EXPORT_SYMBOL(mbox_dsp_info);
-#if defined(CONFIG_ARCH_OMAP2420)
-
/* IVA */
static struct omap_mbox2_priv omap2_mbox_iva_priv = {
.tx_fifo = {
@@ -311,7 +309,6 @@ static struct omap_mbox mbox_iva_info = {
.ops = &omap2_mbox_ops,
.priv = &omap2_mbox_iva_priv,
};
-#endif
/* OMAP4 */
static struct omap_mbox2_priv omap2_mbox_1_priv = {
@@ -401,7 +398,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
goto err_dsp;
}
}
-#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
if (cpu_is_omap2420()) {
/* IVA IRQ */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
@@ -415,13 +411,10 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
if (ret)
goto err_iva1;
}
-#endif
return 0;
-#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
err_iva1:
omap_mbox_unregister(&mbox_dsp_info);
-#endif
err_dsp:
iounmap(mbox_base);
@@ -430,9 +423,8 @@ err_dsp:
static int __devexit omap2_mbox_remove(struct platform_device *pdev)
{
-#if defined(CONFIG_ARCH_OMAP2420)
- omap_mbox_unregister(&mbox_iva_info);
-#endif
+ if (cpu_is_omap2420())
+ omap_mbox_unregister(&mbox_iva_info);
if (cpu_is_omap44xx()) {
omap_mbox_unregister(&mbox_2_info);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RFC/PATCH 4/8] omap: mailbox: reorganize omap2 registering
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
` (2 preceding siblings ...)
2010-05-02 23:59 ` [RFC/PATCH 3/8] omap: mailbox: 2420 should be detected at run-time Felipe Contreras
@ 2010-05-02 23:59 ` Felipe Contreras
2010-05-03 0:02 ` [RFC/PATCH 5/8] omap: mailbox: reorganize omap2 platform_device Felipe Contreras
` (3 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-02 23:59 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
The omap_mbox_list structure will allow us to split the actual
registers.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 100 ++++++++++++++++++++---------------------
1 files changed, 49 insertions(+), 51 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index a328664..8603464 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -70,6 +70,13 @@ struct omap_mbox2_priv {
unsigned long irqdisable;
};
+struct omap_mbox_list {
+ unsigned num;
+ struct omap_mbox **mbox;
+};
+
+struct omap_mbox_list list;
+
static struct clk *mbox_ick_handle;
static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
@@ -287,6 +294,8 @@ struct omap_mbox mbox_dsp_info = {
};
EXPORT_SYMBOL(mbox_dsp_info);
+struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info };
+
/* IVA */
static struct omap_mbox2_priv omap2_mbox_iva_priv = {
.tx_fifo = {
@@ -310,6 +319,8 @@ static struct omap_mbox mbox_iva_info = {
.priv = &omap2_mbox_iva_priv,
};
+struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info };
+
/* OMAP4 */
static struct omap_mbox2_priv omap2_mbox_1_priv = {
.tx_fifo = {
@@ -357,80 +368,67 @@ struct omap_mbox mbox_2_info = {
};
EXPORT_SYMBOL(mbox_2_info);
+struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info };
+
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
int ret;
+ int i;
+
+ res = pdev->resource;
- /* 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 = ioremap(res->start, resource_size(res));
if (!mbox_base)
return -ENOMEM;
- /* DSP or IVA2 IRQ */
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (cpu_is_omap3430()) {
+ list.num = ARRAY_SIZE(omap3_mboxes);
+ list.mbox = omap3_mboxes;
- if (unlikely(!res)) {
- dev_err(&pdev->dev, "invalid irq resource\n");
- ret = -ENODEV;
- goto err_dsp;
+ list.mbox[0]->irq = res[1].start;
}
- if (cpu_is_omap44xx()) {
- mbox_1_info.irq = res->start;
- ret = omap_mbox_register(&pdev->dev, &mbox_1_info);
- } else {
- mbox_dsp_info.irq = res->start;
- ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info);
+ else if (cpu_is_omap2420()) {
+ list.num = ARRAY_SIZE(omap2_mboxes);
+ list.mbox = omap2_mboxes;
+
+ list.mbox[0]->irq = res[1].start;
+ list.mbox[1]->irq = res[2].start;
}
- if (ret)
- goto err_dsp;
-
- if (cpu_is_omap44xx()) {
- mbox_2_info.irq = res->start;
- ret = omap_mbox_register(&pdev->dev, &mbox_2_info);
- if (ret) {
- omap_mbox_unregister(&mbox_1_info);
- goto err_dsp;
- }
+ else if (cpu_is_omap44xx()) {
+ list.num = ARRAY_SIZE(omap4_mboxes);
+ list.mbox = omap4_mboxes;
+
+ list.mbox[0]->irq = res[1].start;
+ list.mbox[1]->irq = res[1].start;
}
- if (cpu_is_omap2420()) {
- /* IVA IRQ */
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
- if (unlikely(!res)) {
- dev_err(&pdev->dev, "invalid irq resource\n");
- ret = -ENODEV;
- goto err_iva1;
- }
- mbox_iva_info.irq = res->start;
- ret = omap_mbox_register(&pdev->dev, &mbox_iva_info);
+ else {
+ pr_err("%s: platform not supported\n", __func__);
+ return -ENODEV;
+ }
+
+ for (i = 0; i < list.num; i++) {
+ struct omap_mbox *mbox = list.mbox[i];
+ ret = omap_mbox_register(&pdev->dev, mbox);
if (ret)
- goto err_iva1;
+ goto err_out;
}
return 0;
-err_iva1:
- omap_mbox_unregister(&mbox_dsp_info);
-
-err_dsp:
+err_out:
+ while (i--)
+ omap_mbox_unregister(list.mbox[i]);
iounmap(mbox_base);
return ret;
}
static int __devexit omap2_mbox_remove(struct platform_device *pdev)
{
- if (cpu_is_omap2420())
- omap_mbox_unregister(&mbox_iva_info);
-
- if (cpu_is_omap44xx()) {
- omap_mbox_unregister(&mbox_2_info);
- omap_mbox_unregister(&mbox_1_info);
- } else
- omap_mbox_unregister(&mbox_dsp_info);
+ int i;
+
+ for (i = 0; i < list.num; i++)
+ omap_mbox_unregister(list.mbox[i]);
+
iounmap(mbox_base);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RFC/PATCH 5/8] omap: mailbox: reorganize omap2 platform_device
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
` (3 preceding siblings ...)
2010-05-02 23:59 ` [RFC/PATCH 4/8] omap: mailbox: reorganize omap2 registering Felipe Contreras
@ 2010-05-03 0:02 ` Felipe Contreras
2010-05-03 18:10 ` Tony Lindgren
2010-05-03 0:02 ` [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init Felipe Contreras
` (2 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 0:02 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
Makes more sense to register in the mach file, plus it will allow more
functionality later on.
Also, this probably enables multi-omap for real.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/devices.c | 74 ------------------------------------
arch/arm/mach-omap2/mailbox.c | 83 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 79 insertions(+), 78 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 18ad931..bc7ac38 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -136,79 +136,6 @@ static inline void omap_init_camera(void)
}
#endif
-#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-
-#define MBOX_REG_SIZE 0x120
-
-#ifdef CONFIG_ARCH_OMAP2
-static struct resource omap_mbox_resources[] = {
- {
- .start = OMAP24XX_MAILBOX_BASE,
- .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = INT_24XX_MAIL_U0_MPU,
- .flags = IORESOURCE_IRQ,
- },
- {
- .start = INT_24XX_MAIL_U3_MPU,
- .flags = IORESOURCE_IRQ,
- },
-};
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static struct resource omap_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,
- },
-};
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-
-#define OMAP4_MBOX_REG_SIZE 0x130
-static struct resource omap_mbox_resources[] = {
- {
- .start = OMAP44XX_MAILBOX_BASE,
- .end = OMAP44XX_MAILBOX_BASE +
- OMAP4_MBOX_REG_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = INT_44XX_MAIL_U0_MPU,
- .flags = IORESOURCE_IRQ,
- },
-};
-#endif
-
-static struct platform_device mbox_device = {
- .name = "omap2-mailbox",
- .id = -1,
-};
-
-static inline void omap_init_mbox(void)
-{
- if (cpu_is_omap2420() || cpu_is_omap3430() || cpu_is_omap44xx()) {
- mbox_device.num_resources = ARRAY_SIZE(omap_mbox_resources);
- mbox_device.resource = omap_mbox_resources;
- } else {
- pr_err("%s: platform not supported\n", __func__);
- return;
- }
- platform_device_register(&mbox_device);
-}
-#else
-static inline void omap_init_mbox(void) { }
-#endif /* CONFIG_OMAP_MBOX_FWK */
-
#if defined(CONFIG_OMAP_STI)
#if defined(CONFIG_ARCH_OMAP2)
@@ -772,7 +699,6 @@ static int __init omap2_init_devices(void)
*/
omap_hsmmc_reset();
omap_init_camera();
- omap_init_mbox();
omap_init_mcspi();
omap_hdq_init();
omap_init_sti();
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 8603464..e9a803c 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -370,6 +370,46 @@ EXPORT_SYMBOL(mbox_2_info);
struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info };
+static struct resource omap2_mbox_resources[] = {
+ {
+ .start = OMAP24XX_MAILBOX_BASE,
+ .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_24XX_MAIL_U0_MPU,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = INT_24XX_MAIL_U3_MPU,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+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 resource omap4_mbox_resources[] = {
+ {
+ .start = OMAP44XX_MAILBOX_BASE,
+ .end = OMAP44XX_MAILBOX_BASE + OMAP4_MBOX_REG_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_44XX_MAIL_U0_MPU,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
@@ -402,10 +442,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
list.mbox[0]->irq = res[1].start;
list.mbox[1]->irq = res[1].start;
}
- else {
- pr_err("%s: platform not supported\n", __func__);
- return -ENODEV;
- }
for (i = 0; i < list.num; i++) {
struct omap_mbox *mbox = list.mbox[i];
@@ -443,7 +479,46 @@ static struct platform_driver omap2_mbox_driver = {
static int __init omap2_mbox_init(void)
{
+ int err;
+ struct platform_device *pdev;
+ struct resource *res;
+ unsigned num;
+
+ if (cpu_is_omap3430()) {
+ res = omap3_mbox_resources;
+ num = ARRAY_SIZE(omap3_mbox_resources);
+ }
+ else if (cpu_is_omap2420()) {
+ res = omap2_mbox_resources;
+ num = ARRAY_SIZE(omap2_mbox_resources);
+ }
+ else if (cpu_is_omap44xx()) {
+ res = omap4_mbox_resources;
+ num = ARRAY_SIZE(omap4_mbox_resources);
+ }
+ else {
+ pr_err("%s: platform not supported\n", __func__);
+ return -ENODEV;
+ }
+
+ pdev = platform_device_alloc("omap2-mailbox", -1);
+ if (!pdev) {
+ err = -ENOMEM;
+ goto err_out;
+ }
+
+ err = platform_device_add_resources(pdev, res, num);
+ if (err)
+ goto err_out;
+
+ err = platform_device_add(pdev);
+ if (err)
+ goto err_out;
+
return platform_driver_register(&omap2_mbox_driver);
+
+err_out:
+ return err;
}
static void __exit omap2_mbox_exit(void)
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [RFC/PATCH 5/8] omap: mailbox: reorganize omap2 platform_device
2010-05-03 0:02 ` [RFC/PATCH 5/8] omap: mailbox: reorganize omap2 platform_device Felipe Contreras
@ 2010-05-03 18:10 ` Tony Lindgren
2010-05-03 18:14 ` Felipe Contreras
0 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2010-05-03 18:10 UTC (permalink / raw)
To: Felipe Contreras; +Cc: linux-omap, Hiroshi Doyu, Ohad Ben-Cohen
* Felipe Contreras <felipe.contreras@gmail.com> [100502 16:58]:
> Makes more sense to register in the mach file, plus it will allow more
> functionality later on.
>
> Also, this probably enables multi-omap for real.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
<snip>
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
You still probably want to optimize kernel size and memory
consumption for production kernels built for one omap:
#ifdef CONFIG_ARCH_OMAP2
> +static struct resource omap2_mbox_resources[] = {
> + {
> + .start = OMAP24XX_MAILBOX_BASE,
> + .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + {
> + .start = INT_24XX_MAIL_U0_MPU,
> + .flags = IORESOURCE_IRQ,
> + },
> + {
> + .start = INT_24XX_MAIL_U3_MPU,
> + .flags = IORESOURCE_IRQ,
> + },
> +};
#else
#define omap2_mbox_resources NULL
#endif
And then do the same for omap3 and omap4.
BTW, looks like this could all be also set __initdata?
> @@ -443,7 +479,46 @@ static struct platform_driver omap2_mbox_driver = {
>
> static int __init omap2_mbox_init(void)
> {
> + int err;
> + struct platform_device *pdev;
> + struct resource *res;
> + unsigned num;
> +
> + if (cpu_is_omap3430()) {
> + res = omap3_mbox_resources;
> + num = ARRAY_SIZE(omap3_mbox_resources);
> + }
> + else if (cpu_is_omap2420()) {
> + res = omap2_mbox_resources;
> + num = ARRAY_SIZE(omap2_mbox_resources);
> + }
> + else if (cpu_is_omap44xx()) {
> + res = omap4_mbox_resources;
> + num = ARRAY_SIZE(omap4_mbox_resources);
> + }
> + else {
> + pr_err("%s: platform not supported\n", __func__);
> + return -ENODEV;
> + }
Note that these tests will fail when building for one omap only
unless you have the #else statement for eacch omapX_mbox_resources[].
Regards,
Tony
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC/PATCH 5/8] omap: mailbox: reorganize omap2 platform_device
2010-05-03 18:10 ` Tony Lindgren
@ 2010-05-03 18:14 ` Felipe Contreras
0 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 18:14 UTC (permalink / raw)
To: Tony Lindgren; +Cc: linux-omap, Hiroshi Doyu, Ohad Ben-Cohen
On Mon, May 3, 2010 at 9:10 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Felipe Contreras <felipe.contreras@gmail.com> [100502 16:58]:
>> Makes more sense to register in the mach file, plus it will allow more
>> functionality later on.
>>
>> Also, this probably enables multi-omap for real.
>>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>
> <snip>
>
>> --- a/arch/arm/mach-omap2/mailbox.c
>> +++ b/arch/arm/mach-omap2/mailbox.c
>
> You still probably want to optimize kernel size and memory
> consumption for production kernels built for one omap:
>
> #ifdef CONFIG_ARCH_OMAP2
True.
>> +static struct resource omap2_mbox_resources[] = {
>> + {
>> + .start = OMAP24XX_MAILBOX_BASE,
>> + .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
>> + .flags = IORESOURCE_MEM,
>> + },
>> + {
>> + .start = INT_24XX_MAIL_U0_MPU,
>> + .flags = IORESOURCE_IRQ,
>> + },
>> + {
>> + .start = INT_24XX_MAIL_U3_MPU,
>> + .flags = IORESOURCE_IRQ,
>> + },
>> +};
>
> #else
> #define omap2_mbox_resources NULL
> #endif
>
> And then do the same for omap3 and omap4.
>
> BTW, looks like this could all be also set __initdata?
Yeah, I think so.
>> @@ -443,7 +479,46 @@ static struct platform_driver omap2_mbox_driver = {
>>
>> static int __init omap2_mbox_init(void)
>> {
>> + int err;
>> + struct platform_device *pdev;
>> + struct resource *res;
>> + unsigned num;
>> +
>> + if (cpu_is_omap3430()) {
>> + res = omap3_mbox_resources;
>> + num = ARRAY_SIZE(omap3_mbox_resources);
>> + }
>> + else if (cpu_is_omap2420()) {
>> + res = omap2_mbox_resources;
>> + num = ARRAY_SIZE(omap2_mbox_resources);
>> + }
>> + else if (cpu_is_omap44xx()) {
>> + res = omap4_mbox_resources;
>> + num = ARRAY_SIZE(omap4_mbox_resources);
>> + }
>> + else {
>> + pr_err("%s: platform not supported\n", __func__);
>> + return -ENODEV;
>> + }
>
> Note that these tests will fail when building for one omap only
> unless you have the #else statement for eacch omapX_mbox_resources[].
Indeed. I'll fix that although the current code is already wrong.
Cheers.
--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
` (4 preceding siblings ...)
2010-05-03 0:02 ` [RFC/PATCH 5/8] omap: mailbox: reorganize omap2 platform_device Felipe Contreras
@ 2010-05-03 0:02 ` Felipe Contreras
2010-05-03 13:42 ` Kanigeri, Hari
2010-05-03 0:02 ` [RFC/PATCH 7/8] omap: mailbox: split platform_driver Felipe Contreras
2010-05-03 0:02 ` [RFC/PATCH 8/8] omap: mailbox: always built-in omap2 platform data Felipe Contreras
7 siblings, 1 reply; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 0:02 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
Will be needed to split the platform_driver.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 49 ++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index e9a803c..474c1e7 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -418,31 +418,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
res = pdev->resource;
- mbox_base = ioremap(res->start, resource_size(res));
- if (!mbox_base)
- return -ENOMEM;
-
- if (cpu_is_omap3430()) {
- list.num = ARRAY_SIZE(omap3_mboxes);
- list.mbox = omap3_mboxes;
-
- list.mbox[0]->irq = res[1].start;
- }
- else if (cpu_is_omap2420()) {
- list.num = ARRAY_SIZE(omap2_mboxes);
- list.mbox = omap2_mboxes;
-
- list.mbox[0]->irq = res[1].start;
- list.mbox[1]->irq = res[2].start;
- }
- else if (cpu_is_omap44xx()) {
- list.num = ARRAY_SIZE(omap4_mboxes);
- list.mbox = omap4_mboxes;
-
- list.mbox[0]->irq = res[1].start;
- list.mbox[1]->irq = res[1].start;
- }
-
for (i = 0; i < list.num; i++) {
struct omap_mbox *mbox = list.mbox[i];
ret = omap_mbox_register(&pdev->dev, mbox);
@@ -454,7 +429,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
err_out:
while (i--)
omap_mbox_unregister(list.mbox[i]);
- iounmap(mbox_base);
return ret;
}
@@ -465,7 +439,6 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
for (i = 0; i < list.num; i++)
omap_mbox_unregister(list.mbox[i]);
- iounmap(mbox_base);
return 0;
}
@@ -483,18 +456,33 @@ static int __init omap2_mbox_init(void)
struct platform_device *pdev;
struct resource *res;
unsigned num;
+ struct omap_mbox_list list;
if (cpu_is_omap3430()) {
res = omap3_mbox_resources;
num = ARRAY_SIZE(omap3_mbox_resources);
+ list.num = ARRAY_SIZE(omap3_mboxes);
+ list.mbox = omap3_mboxes;
+
+ list.mbox[0]->irq = res[1].start;
}
else if (cpu_is_omap2420()) {
res = omap2_mbox_resources;
num = ARRAY_SIZE(omap2_mbox_resources);
+ list.num = ARRAY_SIZE(omap2_mboxes);
+ list.mbox = omap2_mboxes;
+
+ list.mbox[0]->irq = res[1].start;
+ list.mbox[1]->irq = res[2].start;
}
else if (cpu_is_omap44xx()) {
res = omap4_mbox_resources;
num = ARRAY_SIZE(omap4_mbox_resources);
+ list.num = ARRAY_SIZE(omap4_mboxes);
+ list.mbox = omap4_mboxes;
+
+ list.mbox[0]->irq = res[1].start;
+ list.mbox[1]->irq = res[1].start;
}
else {
pr_err("%s: platform not supported\n", __func__);
@@ -515,6 +503,12 @@ static int __init omap2_mbox_init(void)
if (err)
goto err_out;
+ mbox_base = ioremap(res[0].start, resource_size(&res[0]));
+ if (!mbox_base) {
+ platform_device_put(pdev);
+ return -ENOMEM;
+ }
+
return platform_driver_register(&omap2_mbox_driver);
err_out:
@@ -524,6 +518,7 @@ err_out:
static void __exit omap2_mbox_exit(void)
{
platform_driver_unregister(&omap2_mbox_driver);
+ iounmap(mbox_base);
}
module_init(omap2_mbox_init);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* RE: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-03 0:02 ` [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init Felipe Contreras
@ 2010-05-03 13:42 ` Kanigeri, Hari
2010-05-03 15:08 ` Felipe Contreras
0 siblings, 1 reply; 17+ messages in thread
From: Kanigeri, Hari @ 2010-05-03 13:42 UTC (permalink / raw)
To: Felipe Contreras, linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen
Felipe,
Small suggestion...if we are re-organizing can we make it look similar to how iommu is structured? This way we can maintain consistency.
Thank you,
Best regards,
Hari
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Felipe Contreras
> Sent: Sunday, May 02, 2010 7:03 PM
> To: linux-omap
> Cc: Tony Lindgren; Hiroshi Doyu; Ohad Ben-Cohen; Felipe Contreras
> Subject: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
>
> Will be needed to split the platform_driver.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
> arch/arm/mach-omap2/mailbox.c | 49 ++++++++++++++++++------------------
> ----
> 1 files changed, 22 insertions(+), 27 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> index e9a803c..474c1e7 100644
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
> @@ -418,31 +418,6 @@ static int __devinit omap2_mbox_probe(struct
> platform_device *pdev)
>
> res = pdev->resource;
>
> - mbox_base = ioremap(res->start, resource_size(res));
> - if (!mbox_base)
> - return -ENOMEM;
> -
> - if (cpu_is_omap3430()) {
> - list.num = ARRAY_SIZE(omap3_mboxes);
> - list.mbox = omap3_mboxes;
> -
> - list.mbox[0]->irq = res[1].start;
> - }
> - else if (cpu_is_omap2420()) {
> - list.num = ARRAY_SIZE(omap2_mboxes);
> - list.mbox = omap2_mboxes;
> -
> - list.mbox[0]->irq = res[1].start;
> - list.mbox[1]->irq = res[2].start;
> - }
> - else if (cpu_is_omap44xx()) {
> - list.num = ARRAY_SIZE(omap4_mboxes);
> - list.mbox = omap4_mboxes;
> -
> - list.mbox[0]->irq = res[1].start;
> - list.mbox[1]->irq = res[1].start;
> - }
> -
> for (i = 0; i < list.num; i++) {
> struct omap_mbox *mbox = list.mbox[i];
> ret = omap_mbox_register(&pdev->dev, mbox);
> @@ -454,7 +429,6 @@ static int __devinit omap2_mbox_probe(struct
> platform_device *pdev)
> err_out:
> while (i--)
> omap_mbox_unregister(list.mbox[i]);
> - iounmap(mbox_base);
> return ret;
> }
>
> @@ -465,7 +439,6 @@ static int __devexit omap2_mbox_remove(struct
> platform_device *pdev)
> for (i = 0; i < list.num; i++)
> omap_mbox_unregister(list.mbox[i]);
>
> - iounmap(mbox_base);
> return 0;
> }
>
> @@ -483,18 +456,33 @@ static int __init omap2_mbox_init(void)
> struct platform_device *pdev;
> struct resource *res;
> unsigned num;
> + struct omap_mbox_list list;
>
> if (cpu_is_omap3430()) {
> res = omap3_mbox_resources;
> num = ARRAY_SIZE(omap3_mbox_resources);
> + list.num = ARRAY_SIZE(omap3_mboxes);
> + list.mbox = omap3_mboxes;
> +
> + list.mbox[0]->irq = res[1].start;
> }
> else if (cpu_is_omap2420()) {
> res = omap2_mbox_resources;
> num = ARRAY_SIZE(omap2_mbox_resources);
> + list.num = ARRAY_SIZE(omap2_mboxes);
> + list.mbox = omap2_mboxes;
> +
> + list.mbox[0]->irq = res[1].start;
> + list.mbox[1]->irq = res[2].start;
> }
> else if (cpu_is_omap44xx()) {
> res = omap4_mbox_resources;
> num = ARRAY_SIZE(omap4_mbox_resources);
> + list.num = ARRAY_SIZE(omap4_mboxes);
> + list.mbox = omap4_mboxes;
> +
> + list.mbox[0]->irq = res[1].start;
> + list.mbox[1]->irq = res[1].start;
> }
> else {
> pr_err("%s: platform not supported\n", __func__);
> @@ -515,6 +503,12 @@ static int __init omap2_mbox_init(void)
> if (err)
> goto err_out;
>
> + mbox_base = ioremap(res[0].start, resource_size(&res[0]));
> + if (!mbox_base) {
> + platform_device_put(pdev);
> + return -ENOMEM;
> + }
> +
> return platform_driver_register(&omap2_mbox_driver);
>
> err_out:
> @@ -524,6 +518,7 @@ err_out:
> static void __exit omap2_mbox_exit(void)
> {
> platform_driver_unregister(&omap2_mbox_driver);
> + iounmap(mbox_base);
> }
>
> module_init(omap2_mbox_init);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-03 13:42 ` Kanigeri, Hari
@ 2010-05-03 15:08 ` Felipe Contreras
2010-05-03 18:50 ` Kanigeri, Hari
0 siblings, 1 reply; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 15:08 UTC (permalink / raw)
To: Kanigeri, Hari; +Cc: linux-omap, Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen
On Mon, May 3, 2010 at 4:42 PM, Kanigeri, Hari <h-kanigeri2@ti.com> wrote:
> Small suggestion...if we are re-organizing can we make it look similar to how iommu is structured? This way we can maintain consistency.
I thought I did. What exactly do you have in mind?
Also, I noticed that since you made omap3-iommu not omap3-specific,
perhaps it makes sense to remove the omap prefix and just name it
'iommu'.
Cheers.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-03 15:08 ` Felipe Contreras
@ 2010-05-03 18:50 ` Kanigeri, Hari
2010-05-03 19:22 ` Felipe Contreras
2010-05-04 6:04 ` Hiroshi DOYU
0 siblings, 2 replies; 17+ messages in thread
From: Kanigeri, Hari @ 2010-05-03 18:50 UTC (permalink / raw)
To: Felipe Contreras; +Cc: linux-omap, Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen
Felipe,
> > Small suggestion...if we are re-organizing can we make it look similar
> to how iommu is structured? This way we can maintain consistency.
>
> I thought I did. What exactly do you have in mind?
1. What Tony mentioned in another email about using #ifdefs for the platforms. That will be bring close to what is in omap-iommu.c
2. Compare iommu_get with mailbox_get. iommu_get uses driver_find_device to get the iommu structure. I guess we can apply the same logic to get mailbox structure. This way we can get rid of omap_mbox_register, omap_mbox_unregister, and find_mboxes functions.
> Also, I noticed that since you made omap3-iommu not omap3-specific,
> perhaps it makes sense to remove the omap prefix and just name it
> 'iommu'.
>
-- You are right. It doesn't make sense to add omap prefix any more.
Thank you,
Best regards,
Hari
> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Monday, May 03, 2010 10:09 AM
> To: Kanigeri, Hari
> Cc: linux-omap; Tony Lindgren; Hiroshi Doyu; Ohad Ben-Cohen
> Subject: Re: [RFC/PATCH 6/8] omap: mailbox: more more stuff to
> omap2_mbox_init
>
> On Mon, May 3, 2010 at 4:42 PM, Kanigeri, Hari <h-kanigeri2@ti.com> wrote:
> > Small suggestion...if we are re-organizing can we make it look similar
> to how iommu is structured? This way we can maintain consistency.
>
> I thought I did. What exactly do you have in mind?
>
> Also, I noticed that since you made omap3-iommu not omap3-specific,
> perhaps it makes sense to remove the omap prefix and just name it
> 'iommu'.
>
> Cheers.
>
> --
> Felipe Contreras
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-03 18:50 ` Kanigeri, Hari
@ 2010-05-03 19:22 ` Felipe Contreras
2010-05-04 6:04 ` Hiroshi DOYU
1 sibling, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 19:22 UTC (permalink / raw)
To: Kanigeri, Hari; +Cc: linux-omap, Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen
On Mon, May 3, 2010 at 9:50 PM, Kanigeri, Hari <h-kanigeri2@ti.com> wrote:
>> > Small suggestion...if we are re-organizing can we make it look similar
>> to how iommu is structured? This way we can maintain consistency.
>>
>> I thought I did. What exactly do you have in mind?
>
> 1. What Tony mentioned in another email about using #ifdefs for the platforms. That will be bring close to what is in omap-iommu.c
>
> 2. Compare iommu_get with mailbox_get. iommu_get uses driver_find_device to get the iommu structure. I guess we can apply the same logic to get mailbox structure. This way we can get rid of omap_mbox_register, omap_mbox_unregister, and find_mboxes functions.
As I mentioned in another thread[1], we can't really do that because
the mailboxes are not really separate devices, but different irqs of
the same device. They all share the same resources (mem, and even
irqs), so effectively they are all one device.
[1] http://article.gmane.org/gmane.linux.ports.arm.omap/34921
--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-03 18:50 ` Kanigeri, Hari
2010-05-03 19:22 ` Felipe Contreras
@ 2010-05-04 6:04 ` Hiroshi DOYU
2010-05-04 8:42 ` Felipe Contreras
1 sibling, 1 reply; 17+ messages in thread
From: Hiroshi DOYU @ 2010-05-04 6:04 UTC (permalink / raw)
To: h-kanigeri2; +Cc: felipe.contreras, linux-omap, tony, ohad
From: "ext Kanigeri, Hari" <h-kanigeri2@ti.com>
Subject: RE: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
Date: Mon, 3 May 2010 20:50:39 +0200
> Felipe,
>
>> > Small suggestion...if we are re-organizing can we make it look similar
>> to how iommu is structured? This way we can maintain consistency.
>>
>> I thought I did. What exactly do you have in mind?
>
> 1. What Tony mentioned in another email about using #ifdefs for the platforms. That will be bring close to what is in omap-iommu.c
>
> 2. Compare iommu_get with mailbox_get. iommu_get uses
> driver_find_device to get the iommu structure. I guess we can apply
> the same logic to get mailbox structure. This way we can get rid of
> omap_mbox_register, omap_mbox_unregister, and find_mboxes functions.
Right. The same logic could be applied.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
2010-05-04 6:04 ` Hiroshi DOYU
@ 2010-05-04 8:42 ` Felipe Contreras
0 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-04 8:42 UTC (permalink / raw)
To: Hiroshi DOYU; +Cc: h-kanigeri2, linux-omap, tony, ohad
On Tue, May 4, 2010 at 9:04 AM, Hiroshi DOYU <Hiroshi.DOYU@nokia.com> wrote:
> From: "ext Kanigeri, Hari" <h-kanigeri2@ti.com>
> Subject: RE: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
> Date: Mon, 3 May 2010 20:50:39 +0200
>> 2. Compare iommu_get with mailbox_get. iommu_get uses
>> driver_find_device to get the iommu structure. I guess we can apply
>> the same logic to get mailbox structure. This way we can get rid of
>> omap_mbox_register, omap_mbox_unregister, and find_mboxes functions.
>
> Right. The same logic could be applied.
How? In omap2 there are two mailboxes, but the memory is the same. In
omap4 there are two mailboxes, but the memory region _and_ irqs are
the same.
Platform devices cannot share resources... so all the mailboxes are
part of a single platform device.
--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* [RFC/PATCH 7/8] omap: mailbox: split platform_driver
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
` (5 preceding siblings ...)
2010-05-03 0:02 ` [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init Felipe Contreras
@ 2010-05-03 0:02 ` Felipe Contreras
2010-05-03 0:02 ` [RFC/PATCH 8/8] omap: mailbox: always built-in omap2 platform data Felipe Contreras
7 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 0:02 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
Only OMAP2+ for now.
This would allow the current 'mailbox_mach' to be built-in.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 60 +++-------------------------
arch/arm/plat-omap/include/plat/mailbox.h | 5 ++
arch/arm/plat-omap/mailbox.c | 43 ++++++++++++++++++++-
3 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 474c1e7..5adac95 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,8 +18,6 @@
#include <plat/mailbox.h>
#include <mach/irqs.h>
-#define DRV_NAME "omap2-mailbox"
-
#define MAILBOX_REVISION 0x000
#define MAILBOX_SYSCONFIG 0x010
#define MAILBOX_SYSSTATUS 0x014
@@ -70,13 +68,6 @@ struct omap_mbox2_priv {
unsigned long irqdisable;
};
-struct omap_mbox_list {
- unsigned num;
- struct omap_mbox **mbox;
-};
-
-struct omap_mbox_list list;
-
static struct clk *mbox_ick_handle;
static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
@@ -410,46 +401,6 @@ static struct resource omap4_mbox_resources[] = {
},
};
-static int __devinit omap2_mbox_probe(struct platform_device *pdev)
-{
- struct resource *res;
- int ret;
- int i;
-
- res = pdev->resource;
-
- for (i = 0; i < list.num; i++) {
- struct omap_mbox *mbox = list.mbox[i];
- ret = omap_mbox_register(&pdev->dev, mbox);
- if (ret)
- goto err_out;
- }
- return 0;
-
-err_out:
- while (i--)
- omap_mbox_unregister(list.mbox[i]);
- return ret;
-}
-
-static int __devexit omap2_mbox_remove(struct platform_device *pdev)
-{
- int i;
-
- for (i = 0; i < list.num; i++)
- omap_mbox_unregister(list.mbox[i]);
-
- return 0;
-}
-
-static struct platform_driver omap2_mbox_driver = {
- .probe = omap2_mbox_probe,
- .remove = __devexit_p(omap2_mbox_remove),
- .driver = {
- .name = DRV_NAME,
- },
-};
-
static int __init omap2_mbox_init(void)
{
int err;
@@ -489,7 +440,7 @@ static int __init omap2_mbox_init(void)
return -ENODEV;
}
- pdev = platform_device_alloc("omap2-mailbox", -1);
+ pdev = platform_device_alloc("omap-mailbox", -1);
if (!pdev) {
err = -ENOMEM;
goto err_out;
@@ -499,6 +450,10 @@ static int __init omap2_mbox_init(void)
if (err)
goto err_out;
+ err = platform_device_add_data(pdev, &list, sizeof(list));
+ if (err)
+ goto err_out;
+
err = platform_device_add(pdev);
if (err)
goto err_out;
@@ -509,7 +464,7 @@ static int __init omap2_mbox_init(void)
return -ENOMEM;
}
- return platform_driver_register(&omap2_mbox_driver);
+ return 0;
err_out:
return err;
@@ -517,7 +472,6 @@ err_out:
static void __exit omap2_mbox_exit(void)
{
- platform_driver_unregister(&omap2_mbox_driver);
iounmap(mbox_base);
}
@@ -527,4 +481,4 @@ module_exit(omap2_mbox_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("omap mailbox: omap2/3/4 architecture specific functions");
MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, Paul Mundt");
-MODULE_ALIAS("platform:"DRV_NAME);
+MODULE_ALIAS("platform:omap2-mailbox");
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
index 729166b..f8ac2ca 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -67,6 +67,11 @@ struct omap_mbox {
void (*err_notify)(void);
};
+struct omap_mbox_list {
+ unsigned num;
+ struct omap_mbox **mbox;
+};
+
int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
void omap_mbox_init_seq(struct omap_mbox *);
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 822c377..22cdc79 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -25,6 +25,7 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/delay.h>
+#include <linux/platform_device.h>
#include <plat/mailbox.h>
@@ -408,14 +409,54 @@ int omap_mbox_unregister(struct omap_mbox *mbox)
}
EXPORT_SYMBOL(omap_mbox_unregister);
-static int __init omap_mbox_init(void)
+static int __devinit omap_mbox_probe(struct platform_device *pdev)
{
+ struct omap_mbox_list *list = pdev->dev.platform_data;
+ int ret;
+ int i;
+
+ for (i = 0; i < list->num; i++) {
+ struct omap_mbox *mbox = list->mbox[i];
+ ret = omap_mbox_register(&pdev->dev, mbox);
+ if (ret)
+ goto err_out;
+ }
return 0;
+
+err_out:
+ while (i--)
+ omap_mbox_unregister(list->mbox[i]);
+ return ret;
+}
+
+static int __devexit omap_mbox_remove(struct platform_device *pdev)
+{
+ struct omap_mbox_list *list = pdev->dev.platform_data;
+ int i;
+
+ for (i = 0; i < list->num; i++)
+ omap_mbox_unregister(list->mbox[i]);
+
+ return 0;
+}
+
+static struct platform_driver omap_mbox_driver = {
+ .probe = omap_mbox_probe,
+ .remove = __devexit_p(omap_mbox_remove),
+ .driver = {
+ .name = "omap-mailbox",
+ },
+};
+
+static int __init omap_mbox_init(void)
+{
+ return platform_driver_register(&omap_mbox_driver);
}
module_init(omap_mbox_init);
static void __exit omap_mbox_exit(void)
{
+ platform_driver_unregister(&omap_mbox_driver);
}
module_exit(omap_mbox_exit);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RFC/PATCH 8/8] omap: mailbox: always built-in omap2 platform data
2010-05-02 23:59 [RFC/PATCH 0/8] omap: mailbox: split platform_driver Felipe Contreras
` (6 preceding siblings ...)
2010-05-03 0:02 ` [RFC/PATCH 7/8] omap: mailbox: split platform_driver Felipe Contreras
@ 2010-05-03 0:02 ` Felipe Contreras
7 siblings, 0 replies; 17+ messages in thread
From: Felipe Contreras @ 2010-05-03 0:02 UTC (permalink / raw)
To: linux-omap; +Cc: Tony Lindgren, Hiroshi Doyu, Ohad Ben-Cohen, Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/Makefile | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 307f8b0..9fcd87b 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -56,8 +56,9 @@ obj-$(CONFIG_ARCH_OMAP4) += clock44xx.o clock44xx_data.o
# EMU peripherals
obj-$(CONFIG_OMAP3_EMU) += emu.o
-obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
-mailbox_mach-objs := mailbox.o
+ifneq ($(CONFIG_OMAP_MBOX_FWK),)
+obj-y += mailbox.o
+endif
iommu-y += iommu2.o
iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread