* [PATCH v2t2 00/17] omap: mailbox:
@ 2010-05-21 21:44 Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 01/17] omap: mailbox: trivial whitespace cleanups Felipe Contreras
` (18 more replies)
0 siblings, 19 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
From: Felipe Contreras <felipe.contreras@nokia.com>
Hi,
The main purpose of this patch series is to be able to compile mailbox
mach platform data as built-in.
[no changes since the last v2, just rebased on top of the latest
git://gitorious.org/~doyu/lk/mainline.git for-tony-mailbox]
Currently, the code is split into three places:
1) mach-omapX/devices.c: for platform_device_register() the resources
2) mach-omapX/mailbox.c: do platform_driver_register(), fetch the resources,
and register logical mailboxes with omap_mbox_register()
3) plat-omap/mailbox.c: implement omap_mbox_register() to add the mbox
to an internal linked list (static struct omap_mbox *mboxes)
So, obviously 1) is always built-in, but 2) can't be because of the
dependency of omap_mbox_register(), which is in 3) and cannot be taken
out.
Users of mailbox will load 3) due to omap_mbox_get(), but not 2),
therefore, no mailboxes will be registered.
Hiroshi DOYU claims that udev would handle the loading of 2), but that
doesn't help machines without udev.
The easiest way to solve this problem for everybody is to always built-in
2), which this patch attempts.
This approach brings a number of reorganizing options:
a) mach-omapX/mailbox.c can do platform_device_register() directly,
removing the need to do so in mach-omapX/devices.c
b) since omap_mbox_register()/omap_mbox_unregister() are used only in
plat-omap/mailbox.c, there's no need to export them
Another option that I haven't explored yet:
c) plat-omap/mailbox.c can remove all the custom linked list code in
order to dynamically register and unregister mailboxes: the list
would be statically defined
In order to achieve this, the dependency on omap_mbox_register() should be
removed, and in order to do that, I'm adding a custom platform_data that
stores the mailboxes.
Also, if you are wondering if each mailbox should be a
platform_device... No; mailboxes are not a one-to-one mapping to
resources; that is, some resources belong to multiple mboxes. So it's
best to think of mailboxes as logic (fake) devices. That is why custom
platform_data is required in order to define them.
Finally, a bunch of cleaning up is done in the very first patches, specially for
OMAP1.
The initial RFC included comments from Felipe Balbi, and this proposal includes
comments from Tony Lindgren.
v2:
* Rebased on top of Hiroshi's v2.6.34-rc7.mailbox
* A bit more extra cleanups
Tested on OMAP3 (beagleboard), and compiled-tested for OMAP1.
Felipe Contreras (17):
omap: mailbox: trivial whitespace cleanups
omap: mailbox: trivial cleanups
omap: mailbox: reorganize structures
omap: mailbox: 2420 should be detected at run-time
omap: mailbox: use correct config for omap1
omap: mailbox: update omap1 probing
omap: mailbox: reorganize registering
omap: mailbox: only compile for configured archs
omap: mailbox: reorganize omap platform_device
omap: mailbox: move more stuff to omap_mbox_init()
omap: mailbox: trivial sync between omap1 and 2
omap: mailbox: split platform driver
omap: mailbox: always built-in platform data
omap: mailbox: reorganize headers
omap: mailbox: don't export unecessary symbols
omap: mailbox: mark some resources as __initdata
omap: mailbox: don't export register/unregister
arch/arm/mach-omap1/Makefile | 6 +-
arch/arm/mach-omap1/devices.c | 40 -----
arch/arm/mach-omap1/mailbox.c | 118 ++++++++------
arch/arm/mach-omap2/Makefile | 5 +-
arch/arm/mach-omap2/devices.c | 92 -----------
arch/arm/mach-omap2/mailbox.c | 254 ++++++++++++++++-------------
arch/arm/plat-omap/include/plat/mailbox.h | 10 +-
arch/arm/plat-omap/mailbox.c | 89 +++++++---
8 files changed, 290 insertions(+), 324 deletions(-)
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 01/17] omap: mailbox: trivial whitespace cleanups
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 02/17] omap: mailbox: trivial cleanups Felipe Contreras
` (17 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/plat-omap/mailbox.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 36b3aa2..7877bbb 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -142,14 +142,14 @@ static void mbox_rx_work(struct work_struct *work)
struct omap_mbox_queue *mq =
container_of(work, struct omap_mbox_queue, work);
mbox_msg_t msg;
- int len;
-
- while (kfifo_len(&mq->fifo) >= sizeof(msg)) {
- len = kfifo_out(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
- WARN_ON(len != sizeof(msg));
-
- if (mq->callback)
- mq->callback((void *)msg);
+ int len;
+
+ while (kfifo_len(&mq->fifo) >= sizeof(msg)) {
+ len = kfifo_out(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
+ WARN_ON(len != sizeof(msg));
+
+ if (mq->callback)
+ mq->callback((void *)msg);
}
}
@@ -165,12 +165,12 @@ static void __mbox_tx_interrupt(struct omap_mbox *mbox)
static void __mbox_rx_interrupt(struct omap_mbox *mbox)
{
- struct omap_mbox_queue *mq = mbox->rxq;
+ struct omap_mbox_queue *mq = mbox->rxq;
mbox_msg_t msg;
- int len;
+ int len;
while (!mbox_fifo_empty(mbox)) {
- if (unlikely(kfifo_avail(&mq->fifo) < sizeof(msg))) {
+ if (unlikely(kfifo_avail(&mq->fifo) < sizeof(msg))) {
omap_mbox_disable_irq(mbox, IRQ_RX);
rq_full = true;
goto nomem;
@@ -178,8 +178,8 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
msg = mbox_fifo_read(mbox);
- len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
- WARN_ON(len != sizeof(msg));
+ len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
+ WARN_ON(len != sizeof(msg));
if (mbox->ops->type == OMAP_MBOX_TYPE1)
break;
@@ -278,11 +278,11 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
return 0;
- fail_alloc_rxq:
+fail_alloc_rxq:
mbox_queue_free(mbox->txq);
- fail_alloc_txq:
+fail_alloc_txq:
free_irq(mbox->irq, mbox);
- fail_request_irq:
+fail_request_irq:
if (mbox->ops->shutdown)
mbox->ops->shutdown(mbox);
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 02/17] omap: mailbox: trivial cleanups
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 01/17] omap: mailbox: trivial whitespace cleanups Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 03/17] omap: mailbox: reorganize structures Felipe Contreras
` (16 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
And fix a few compilation warnings.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/devices.c | 6 ++----
arch/arm/mach-omap1/mailbox.c | 2 +-
arch/arm/mach-omap2/mailbox.c | 8 +++++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 379100c..462b59c 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -73,12 +73,10 @@ static inline void omap_init_rtc(void) {}
# define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
#endif
-#define OMAP1_MBOX_BASE OMAP16XX_MAILBOX_BASE
-
static struct resource mbox_resources[] = {
{
- .start = OMAP1_MBOX_BASE,
- .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
+ .start = OMAP16XX_MAILBOX_BASE,
+ .end = OMAP16XX_MAILBOX_BASE + OMAP1_MBOX_SIZE,
.flags = IORESOURCE_MEM,
},
{
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 4f5b3da..15bf2a2 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -83,7 +83,7 @@ static int omap1_mbox_fifo_full(struct omap_mbox *mbox)
struct omap_mbox1_fifo *fifo =
&((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
- return (mbox_read_reg(fifo->flag));
+ return mbox_read_reg(fifo->flag);
}
/* irq */
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 763272c..c9f3d39 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -300,8 +300,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 = {
@@ -357,7 +355,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 = {
@@ -443,6 +440,11 @@ 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);
return ret;
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 03/17] omap: mailbox: reorganize structures
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 01/17] omap: mailbox: trivial whitespace cleanups Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 02/17] omap: mailbox: trivial cleanups Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 04/17] omap: mailbox: 2420 should be detected at run-time Felipe Contreras
` (15 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
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 c9f3d39..7d42034 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -283,6 +283,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 = {
@@ -300,8 +301,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),
@@ -325,13 +358,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),
@@ -355,30 +381,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] 29+ messages in thread
* [PATCH v2t2 04/17] omap: mailbox: 2420 should be detected at run-time
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (2 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 03/17] omap: mailbox: reorganize structures Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 05/17] omap: mailbox: use correct config for omap1 Felipe Contreras
` (14 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 7d42034..7afc9aa 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -455,7 +455,8 @@ err_dsp:
static int __devexit omap2_mbox_remove(struct platform_device *pdev)
{
#if defined(CONFIG_ARCH_OMAP2420)
- omap_mbox_unregister(&mbox_iva_info);
+ if (cpu_is_omap2420())
+ omap_mbox_unregister(&mbox_iva_info);
#endif
if (cpu_is_omap44xx()) {
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 05/17] omap: mailbox: use correct config for omap1
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (3 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 04/17] omap: mailbox: 2420 should be detected at run-time Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 06/17] omap: mailbox: update omap1 probing Felipe Contreras
` (13 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
CONFIG_OMAP_DSP is not in mainline, CONFIG_OMAP_MBOX_FWK is.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/devices.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 462b59c..da796f2 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -63,7 +63,7 @@ static void omap_init_rtc(void)
static inline void omap_init_rtc(void) {}
#endif
-#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
+#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
#if defined(CONFIG_ARCH_OMAP15XX)
# define OMAP1_MBOX_SIZE 0x23
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 06/17] omap: mailbox: update omap1 probing
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (4 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 05/17] omap: mailbox: use correct config for omap1 Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 07/17] omap: mailbox: reorganize registering Felipe Contreras
` (12 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Based on omap2 code.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 15bf2a2..211b9fc 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -146,12 +146,7 @@ EXPORT_SYMBOL(mbox_dsp_info);
static int __devinit omap1_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
-
- if (pdev->num_resources != 2) {
- dev_err(&pdev->dev, "invalid number of resources: %d\n",
- pdev->num_resources);
- return -ENODEV;
- }
+ int ret;
/* MBOX base */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -161,27 +156,32 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
}
mbox_base = ioremap(res->start, resource_size(res));
- if (!mbox_base) {
- dev_err(&pdev->dev, "ioremap failed\n");
- return -ENODEV;
- }
+ if (!mbox_base)
+ return -ENOMEM;
/* DSP IRQ */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (unlikely(!res)) {
dev_err(&pdev->dev, "invalid irq resource\n");
- iounmap(mbox_base);
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_out;
}
mbox_dsp_info.irq = res->start;
- return omap_mbox_register(&pdev->dev, &mbox_dsp_info);
+ ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info);
+ if (ret)
+ goto err_out;
+ return 0;
+
+err_out:
+ iounmap(mbox_base);
+ return ret;
}
static int __devexit omap1_mbox_remove(struct platform_device *pdev)
{
omap_mbox_unregister(&mbox_dsp_info);
-
+ iounmap(mbox_base);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 07/17] omap: mailbox: reorganize registering
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (5 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 06/17] omap: mailbox: update omap1 probing Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 08/17] omap: mailbox: only compile for configured archs Felipe Contreras
` (11 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
This is a step forward to split the mbox registers.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 41 +++++++++--------
arch/arm/mach-omap2/mailbox.c | 102 +++++++++++++++++------------------------
2 files changed, 64 insertions(+), 79 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 211b9fc..d81b238 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -29,6 +29,8 @@
static void __iomem *mbox_base;
+static struct omap_mbox **list;
+
struct omap_mbox1_fifo {
unsigned long cmd;
unsigned long data;
@@ -143,44 +145,45 @@ struct omap_mbox mbox_dsp_info = {
};
EXPORT_SYMBOL(mbox_dsp_info);
+struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
+
static int __devinit omap1_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
int ret;
+ int i;
- /* MBOX base */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (unlikely(!res)) {
- dev_err(&pdev->dev, "invalid mem resource\n");
- return -ENODEV;
- }
+ res = pdev->resource;
- mbox_base = ioremap(res->start, resource_size(res));
+ mbox_base = ioremap(res[0].start, resource_size(&res[0]));
if (!mbox_base)
return -ENOMEM;
- /* DSP IRQ */
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (unlikely(!res)) {
- dev_err(&pdev->dev, "invalid irq resource\n");
- ret = -ENODEV;
- goto err_out;
- }
- mbox_dsp_info.irq = res->start;
+ list = omap1_mboxes;
- ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info);
- if (ret)
- goto err_out;
+ list[0]->irq = res[1].start;
+
+ for (i = 0; list[i]; i++) {
+ ret = omap_mbox_register(&pdev->dev, list[i]);
+ if (ret)
+ goto err_out;
+ }
return 0;
err_out:
+ while (i--)
+ omap_mbox_unregister(list[i]);
iounmap(mbox_base);
return ret;
}
static int __devexit omap1_mbox_remove(struct platform_device *pdev)
{
- omap_mbox_unregister(&mbox_dsp_info);
+ int i;
+
+ for (i = 0; list[i]; i++)
+ omap_mbox_unregister(list[i]);
+
iounmap(mbox_base);
return 0;
}
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 7afc9aa..5dda11c 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -56,6 +56,8 @@
static void __iomem *mbox_base;
+static struct omap_mbox **list;
+
struct omap_mbox2_fifo {
unsigned long msg;
unsigned long fifo_stat;
@@ -308,6 +310,8 @@ struct omap_mbox mbox_dsp_info = {
};
EXPORT_SYMBOL(mbox_dsp_info);
+struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL };
+
#if defined(CONFIG_ARCH_OMAP2420)
/* IVA */
@@ -332,6 +336,8 @@ static struct omap_mbox mbox_iva_info = {
.ops = &omap2_mbox_ops,
.priv = &omap2_mbox_iva_priv,
};
+
+struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL };
#endif
/* OMAP4 */
@@ -381,89 +387,65 @@ struct omap_mbox mbox_2_info = {
};
EXPORT_SYMBOL(mbox_2_info);
+struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
+
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
int ret;
+ int i;
- /* 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));
+ res = pdev->resource;
+
+ mbox_base = ioremap(res[0].start, resource_size(&res[0]));
if (!mbox_base)
return -ENOMEM;
- /* DSP or IVA2 IRQ */
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (cpu_is_omap3430()) {
+ list = omap3_mboxes;
- if (unlikely(!res)) {
- dev_err(&pdev->dev, "invalid irq resource\n");
- ret = -ENODEV;
- goto err_dsp;
+ list[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);
+#if defined(CONFIG_ARCH_OMAP2420)
+ else if (cpu_is_omap2420()) {
+ list = omap2_mboxes;
+
+ list[0]->irq = res[1].start;
+ list[1]->irq = res[2].start;
}
- if (ret)
- goto err_dsp;
+#endif
+ else if (cpu_is_omap44xx()) {
+ list = omap4_mboxes;
- 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;
- }
+ list[0]->irq = res[1].start;
+ list[1]->irq = res[1].start;
}
-#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
- 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;
- omap_mbox_unregister(&mbox_dsp_info);
- goto err_dsp;
- }
- mbox_iva_info.irq = res->start;
- ret = omap_mbox_register(&pdev->dev, &mbox_iva_info);
- if (ret) {
- omap_mbox_unregister(&mbox_dsp_info);
- goto err_dsp;
- }
+ else {
+ pr_err("%s: platform not supported\n", __func__);
+ return -ENODEV;
}
-#endif
- return 0;
-#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
-err_iva1:
- omap_mbox_unregister(&mbox_dsp_info);
-#endif
+ for (i = 0; list[i]; i++) {
+ ret = omap_mbox_register(&pdev->dev, list[i]);
+ if (ret)
+ goto err_out;
+ }
+ return 0;
-err_dsp:
+err_out:
+ while (i--)
+ omap_mbox_unregister(list[i]);
iounmap(mbox_base);
return ret;
}
static int __devexit omap2_mbox_remove(struct platform_device *pdev)
{
-#if defined(CONFIG_ARCH_OMAP2420)
- if (cpu_is_omap2420())
- omap_mbox_unregister(&mbox_iva_info);
-#endif
+ int i;
+
+ for (i = 0; list[i]; i++)
+ omap_mbox_unregister(list[i]);
- if (cpu_is_omap44xx()) {
- omap_mbox_unregister(&mbox_2_info);
- omap_mbox_unregister(&mbox_1_info);
- } else
- omap_mbox_unregister(&mbox_dsp_info);
iounmap(mbox_base);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 08/17] omap: mailbox: only compile for configured archs
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (6 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 07/17] omap: mailbox: reorganize registering Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 09/17] omap: mailbox: reorganize omap platform_device Felipe Contreras
` (10 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap2/mailbox.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 5dda11c..04b70ba 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -286,6 +286,7 @@ static struct omap_mbox_ops omap2_mbox_ops = {
/* FIXME: the following structs should be filled automatically by the user id */
+#if defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP2420)
/* DSP */
static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
.tx_fifo = {
@@ -309,11 +310,13 @@ struct omap_mbox mbox_dsp_info = {
.priv = &omap2_mbox_dsp_priv,
};
EXPORT_SYMBOL(mbox_dsp_info);
+#endif
+#if defined(CONFIG_ARCH_OMAP3430)
struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL };
+#endif
#if defined(CONFIG_ARCH_OMAP2420)
-
/* IVA */
static struct omap_mbox2_priv omap2_mbox_iva_priv = {
.tx_fifo = {
@@ -340,6 +343,7 @@ static struct omap_mbox mbox_iva_info = {
struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL };
#endif
+#if defined(CONFIG_ARCH_OMAP4)
/* OMAP4 */
static struct omap_mbox2_priv omap2_mbox_1_priv = {
.tx_fifo = {
@@ -388,6 +392,7 @@ struct omap_mbox mbox_2_info = {
EXPORT_SYMBOL(mbox_2_info);
struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
+#endif
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
@@ -401,11 +406,14 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
if (!mbox_base)
return -ENOMEM;
- if (cpu_is_omap3430()) {
+ if (false);
+#if defined(CONFIG_ARCH_OMAP3430)
+ else if (cpu_is_omap3430()) {
list = omap3_mboxes;
list[0]->irq = res[1].start;
}
+#endif
#if defined(CONFIG_ARCH_OMAP2420)
else if (cpu_is_omap2420()) {
list = omap2_mboxes;
@@ -414,12 +422,14 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
list[1]->irq = res[2].start;
}
#endif
+#if defined(CONFIG_ARCH_OMAP4)
else if (cpu_is_omap44xx()) {
list = omap4_mboxes;
list[0]->irq = res[1].start;
list[1]->irq = res[1].start;
}
+#endif
else {
pr_err("%s: platform not supported\n", __func__);
return -ENODEV;
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 09/17] omap: mailbox: reorganize omap platform_device
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (7 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 08/17] omap: mailbox: only compile for configured archs Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 10/17] omap: mailbox: move more stuff to omap_mbox_init() Felipe Contreras
` (9 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
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-omap1/devices.c | 38 ----------------
arch/arm/mach-omap1/mailbox.c | 56 ++++++++++++++++++++++++
arch/arm/mach-omap2/devices.c | 92 ---------------------------------------
arch/arm/mach-omap2/mailbox.c | 96 +++++++++++++++++++++++++++++++++++++++--
4 files changed, 148 insertions(+), 134 deletions(-)
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index da796f2..093dd13 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -63,43 +63,6 @@ static void omap_init_rtc(void)
static inline void omap_init_rtc(void) {}
#endif
-#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-
-#if defined(CONFIG_ARCH_OMAP15XX)
-# define OMAP1_MBOX_SIZE 0x23
-# define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1
-#elif defined(CONFIG_ARCH_OMAP16XX)
-# define OMAP1_MBOX_SIZE 0x2f
-# define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
-#endif
-
-static struct resource mbox_resources[] = {
- {
- .start = OMAP16XX_MAILBOX_BASE,
- .end = OMAP16XX_MAILBOX_BASE + OMAP1_MBOX_SIZE,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = INT_DSP_MAILBOX1,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device mbox_device = {
- .name = "omap1-mailbox",
- .id = -1,
- .num_resources = ARRAY_SIZE(mbox_resources),
- .resource = mbox_resources,
-};
-
-static inline void omap_init_mbox(void)
-{
- platform_device_register(&mbox_device);
-}
-#else
-static inline void omap_init_mbox(void) { }
-#endif
-
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
@@ -293,7 +256,6 @@ static int __init omap1_init_devices(void)
* in alphabetical order so they're easier to sort through.
*/
- omap_init_mbox();
omap_init_rtc();
omap_init_spi100k();
omap_init_sti();
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index d81b238..25f1f89 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -147,6 +147,20 @@ EXPORT_SYMBOL(mbox_dsp_info);
struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
+#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
+static struct resource omap1_mbox_resources[] = {
+ {
+ .start = OMAP16XX_MAILBOX_BASE,
+ .end = OMAP16XX_MAILBOX_BASE, /* to be updated */
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = 10,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+#endif
+
static int __devinit omap1_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
@@ -198,7 +212,49 @@ static struct platform_driver omap1_mbox_driver = {
static int __init omap1_mbox_init(void)
{
+ int err;
+ struct platform_device *pdev;
+ struct resource *res;
+ unsigned num;
+
+ if (false);
+#if defined(CONFIG_ARCH_OMAP15XX)
+ else if (cpu_is_omap15xx()) {
+ res = omap1_mbox_resources;
+ num = ARRAY_SIZE(omap1_mbox_resources);
+ res[1].end += 0x23;
+ }
+#endif
+#if defined(CONFIG_ARCH_OMAP16XX)
+ else if (cpu_is_omap16xx()) {
+ res = omap1_mbox_resources;
+ num = ARRAY_SIZE(omap1_mbox_resources);
+ res[1].end += 0x2f;
+ }
+#endif
+ else {
+ pr_err("%s: platform not supported\n", __func__);
+ return -ENODEV;
+ }
+
+ pdev = platform_device_alloc("omap1-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(&omap1_mbox_driver);
+
+err_out:
+ return err;
}
static void __exit omap1_mbox_exit(void)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2271b9b..eac0e0f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -136,97 +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 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 int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
-#else
-#define omap2_mbox_resources NULL
-#define omap2_mbox_resources_sz 0
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-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 int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
-#else
-#define omap3_mbox_resources NULL
-#define omap3_mbox_resources_sz 0
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-
-#define OMAP4_MBOX_REG_SIZE 0x130
-static struct resource omap4_mbox_resources[] = {
- {
- .start = OMAP44XX_MAILBOX_BASE,
- .end = OMAP44XX_MAILBOX_BASE +
- OMAP4_MBOX_REG_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = OMAP44XX_IRQ_MAIL_U0,
- .flags = IORESOURCE_IRQ,
- },
-};
-static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
-#else
-#define omap4_mbox_resources NULL
-#define omap4_mbox_resources_sz 0
-#endif
-
-static struct platform_device mbox_device = {
- .name = "omap2-mailbox",
- .id = -1,
-};
-
-static inline void omap_init_mbox(void)
-{
- if (cpu_is_omap24xx()) {
- mbox_device.resource = omap2_mbox_resources;
- mbox_device.num_resources = omap2_mbox_resources_sz;
- } else if (cpu_is_omap34xx()) {
- mbox_device.resource = omap3_mbox_resources;
- mbox_device.num_resources = omap3_mbox_resources_sz;
- } else if (cpu_is_omap44xx()) {
- mbox_device.resource = omap4_mbox_resources;
- mbox_device.num_resources = omap4_mbox_resources_sz;
- } 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)
@@ -795,7 +704,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 04b70ba..59e85fd 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -394,6 +394,52 @@ EXPORT_SYMBOL(mbox_2_info);
struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
#endif
+#ifdef CONFIG_ARCH_OMAP2420
+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,
+ },
+};
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3430
+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,
+ },
+};
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+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,
+ },
+};
+#endif
+
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
struct resource *res;
@@ -430,10 +476,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
list[1]->irq = res[1].start;
}
#endif
- else {
- pr_err("%s: platform not supported\n", __func__);
- return -ENODEV;
- }
for (i = 0; list[i]; i++) {
ret = omap_mbox_register(&pdev->dev, list[i]);
@@ -470,7 +512,53 @@ 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 (false);
+#if defined(CONFIG_ARCH_OMAP3430)
+ else if (cpu_is_omap3430()) {
+ res = omap3_mbox_resources;
+ num = ARRAY_SIZE(omap3_mbox_resources);
+ }
+#endif
+#if defined(CONFIG_ARCH_OMAP2420)
+ else if (cpu_is_omap2420()) {
+ res = omap2_mbox_resources;
+ num = ARRAY_SIZE(omap2_mbox_resources);
+ }
+#endif
+#if defined(CONFIG_ARCH_OMAP4)
+ else if (cpu_is_omap44xx()) {
+ res = omap4_mbox_resources;
+ num = ARRAY_SIZE(omap4_mbox_resources);
+ }
+#endif
+ 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] 29+ messages in thread
* [PATCH v2t2 10/17] omap: mailbox: move more stuff to omap_mbox_init()
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (8 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 09/17] omap: mailbox: reorganize omap platform_device Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 11/17] omap: mailbox: trivial sync between omap1 and 2 Felipe Contreras
` (8 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Will be needed to split the platform_driver.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 23 +++++++++++--------
arch/arm/mach-omap2/mailbox.c | 49 +++++++++++++++--------------------------
2 files changed, 31 insertions(+), 41 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 25f1f89..8c1b83f 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -169,14 +169,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
res = pdev->resource;
- mbox_base = ioremap(res[0].start, resource_size(&res[0]));
- if (!mbox_base)
- return -ENOMEM;
-
- list = omap1_mboxes;
-
- list[0]->irq = res[1].start;
-
for (i = 0; list[i]; i++) {
ret = omap_mbox_register(&pdev->dev, list[i]);
if (ret)
@@ -187,7 +179,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
err_out:
while (i--)
omap_mbox_unregister(list[i]);
- iounmap(mbox_base);
return ret;
}
@@ -198,7 +189,6 @@ static int __devexit omap1_mbox_remove(struct platform_device *pdev)
for (i = 0; list[i]; i++)
omap_mbox_unregister(list[i]);
- iounmap(mbox_base);
return 0;
}
@@ -222,14 +212,20 @@ static int __init omap1_mbox_init(void)
else if (cpu_is_omap15xx()) {
res = omap1_mbox_resources;
num = ARRAY_SIZE(omap1_mbox_resources);
+ list = omap1_mboxes;
+
res[1].end += 0x23;
+ list[0]->irq = res[1].start;
}
#endif
#if defined(CONFIG_ARCH_OMAP16XX)
else if (cpu_is_omap16xx()) {
res = omap1_mbox_resources;
num = ARRAY_SIZE(omap1_mbox_resources);
+ list = omap1_mboxes;
+
res[1].end += 0x2f;
+ list[0]->irq = res[1].start;
}
#endif
else {
@@ -251,6 +247,12 @@ static int __init omap1_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(&omap1_mbox_driver);
err_out:
@@ -260,6 +262,7 @@ err_out:
static void __exit omap1_mbox_exit(void)
{
platform_driver_unregister(&omap1_mbox_driver);
+ iounmap(mbox_base);
}
module_init(omap1_mbox_init);
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 59e85fd..4f3b84e 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -448,35 +448,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
res = pdev->resource;
- mbox_base = ioremap(res[0].start, resource_size(&res[0]));
- if (!mbox_base)
- return -ENOMEM;
-
- if (false);
-#if defined(CONFIG_ARCH_OMAP3430)
- else if (cpu_is_omap3430()) {
- list = omap3_mboxes;
-
- list[0]->irq = res[1].start;
- }
-#endif
-#if defined(CONFIG_ARCH_OMAP2420)
- else if (cpu_is_omap2420()) {
- list = omap2_mboxes;
-
- list[0]->irq = res[1].start;
- list[1]->irq = res[2].start;
- }
-#endif
-#if defined(CONFIG_ARCH_OMAP4)
- else if (cpu_is_omap44xx()) {
- list = omap4_mboxes;
-
- list[0]->irq = res[1].start;
- list[1]->irq = res[1].start;
- }
-#endif
-
for (i = 0; list[i]; i++) {
ret = omap_mbox_register(&pdev->dev, list[i]);
if (ret)
@@ -487,7 +458,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
err_out:
while (i--)
omap_mbox_unregister(list[i]);
- iounmap(mbox_base);
return ret;
}
@@ -498,7 +468,6 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
for (i = 0; list[i]; i++)
omap_mbox_unregister(list[i]);
- iounmap(mbox_base);
return 0;
}
@@ -522,18 +491,29 @@ static int __init omap2_mbox_init(void)
else if (cpu_is_omap3430()) {
res = omap3_mbox_resources;
num = ARRAY_SIZE(omap3_mbox_resources);
+ list = omap3_mboxes;
+
+ list[0]->irq = res[1].start;
}
#endif
#if defined(CONFIG_ARCH_OMAP2420)
else if (cpu_is_omap2420()) {
res = omap2_mbox_resources;
num = ARRAY_SIZE(omap2_mbox_resources);
+ list = omap2_mboxes;
+
+ list[0]->irq = res[1].start;
+ list[1]->irq = res[2].start;
}
#endif
#if defined(CONFIG_ARCH_OMAP4)
else if (cpu_is_omap44xx()) {
res = omap4_mbox_resources;
num = ARRAY_SIZE(omap4_mbox_resources);
+ list = omap4_mboxes;
+
+ list[0]->irq = res[1].start;
+ list[1]->irq = res[1].start;
}
#endif
else {
@@ -555,6 +535,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:
@@ -564,6 +550,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] 29+ messages in thread
* [PATCH v2t2 11/17] omap: mailbox: trivial sync between omap1 and 2
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (9 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 10/17] omap: mailbox: move more stuff to omap_mbox_init() Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 12/17] omap: mailbox: split platform driver Felipe Contreras
` (7 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 2 +-
arch/arm/mach-omap2/mailbox.c | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 8c1b83f..91780a0 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -1,5 +1,5 @@
/*
- * Mailbox reservation modules for DSP
+ * Mailbox reservation modules for OMAP1
*
* Copyright (C) 2006-2009 Nokia Corporation
* Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 4f3b84e..adbf5d7 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
@@ -475,7 +473,7 @@ static struct platform_driver omap2_mbox_driver = {
.probe = omap2_mbox_probe,
.remove = __devexit_p(omap2_mbox_remove),
.driver = {
- .name = DRV_NAME,
+ .name = "omap2-mailbox",
},
};
@@ -560,4 +558,4 @@ MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("omap mailbox: omap2/3/4 architecture specific functions");
MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>");
MODULE_AUTHOR("Paul Mundt");
-MODULE_ALIAS("platform:"DRV_NAME);
+MODULE_ALIAS("platform:omap2-mailbox");
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 12/17] omap: mailbox: split platform driver
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (10 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 11/17] omap: mailbox: trivial sync between omap1 and 2 Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 13/17] omap: mailbox: always built-in platform data Felipe Contreras
` (6 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
This will allow the current 'mailbox_mach' to be built-in.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 50 +++++------------------------
arch/arm/mach-omap2/mailbox.c | 50 +++++------------------------
arch/arm/plat-omap/include/plat/mailbox.h | 4 ++
arch/arm/plat-omap/mailbox.c | 46 +++++++++++++++++++++++++-
4 files changed, 64 insertions(+), 86 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 91780a0..f29ba8e 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -161,51 +161,13 @@ static struct resource omap1_mbox_resources[] = {
};
#endif
-static int __devinit omap1_mbox_probe(struct platform_device *pdev)
-{
- struct resource *res;
- int ret;
- int i;
-
- res = pdev->resource;
-
- for (i = 0; list[i]; i++) {
- ret = omap_mbox_register(&pdev->dev, list[i]);
- if (ret)
- goto err_out;
- }
- return 0;
-
-err_out:
- while (i--)
- omap_mbox_unregister(list[i]);
- return ret;
-}
-
-static int __devexit omap1_mbox_remove(struct platform_device *pdev)
-{
- int i;
-
- for (i = 0; list[i]; i++)
- omap_mbox_unregister(list[i]);
-
- return 0;
-}
-
-static struct platform_driver omap1_mbox_driver = {
- .probe = omap1_mbox_probe,
- .remove = __devexit_p(omap1_mbox_remove),
- .driver = {
- .name = "omap1-mailbox",
- },
-};
-
static int __init omap1_mbox_init(void)
{
int err;
struct platform_device *pdev;
struct resource *res;
unsigned num;
+ struct omap_mbox_platform_data pdata;
if (false);
#if defined(CONFIG_ARCH_OMAP15XX)
@@ -233,7 +195,7 @@ static int __init omap1_mbox_init(void)
return -ENODEV;
}
- pdev = platform_device_alloc("omap1-mailbox", -1);
+ pdev = platform_device_alloc("omap-mailbox", -1);
if (!pdev) {
err = -ENOMEM;
goto err_out;
@@ -243,6 +205,11 @@ static int __init omap1_mbox_init(void)
if (err)
goto err_out;
+ pdata.list = list;
+ err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+ if (err)
+ goto err_out;
+
err = platform_device_add(pdev);
if (err)
goto err_out;
@@ -253,7 +220,7 @@ static int __init omap1_mbox_init(void)
return -ENOMEM;
}
- return platform_driver_register(&omap1_mbox_driver);
+ return 0;
err_out:
return err;
@@ -261,7 +228,6 @@ err_out:
static void __exit omap1_mbox_exit(void)
{
- platform_driver_unregister(&omap1_mbox_driver);
iounmap(mbox_base);
}
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index adbf5d7..a54898a 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -438,51 +438,13 @@ static struct resource omap4_mbox_resources[] = {
};
#endif
-static int __devinit omap2_mbox_probe(struct platform_device *pdev)
-{
- struct resource *res;
- int ret;
- int i;
-
- res = pdev->resource;
-
- for (i = 0; list[i]; i++) {
- ret = omap_mbox_register(&pdev->dev, list[i]);
- if (ret)
- goto err_out;
- }
- return 0;
-
-err_out:
- while (i--)
- omap_mbox_unregister(list[i]);
- return ret;
-}
-
-static int __devexit omap2_mbox_remove(struct platform_device *pdev)
-{
- int i;
-
- for (i = 0; list[i]; i++)
- omap_mbox_unregister(list[i]);
-
- return 0;
-}
-
-static struct platform_driver omap2_mbox_driver = {
- .probe = omap2_mbox_probe,
- .remove = __devexit_p(omap2_mbox_remove),
- .driver = {
- .name = "omap2-mailbox",
- },
-};
-
static int __init omap2_mbox_init(void)
{
int err;
struct platform_device *pdev;
struct resource *res;
unsigned num;
+ struct omap_mbox_platform_data pdata;
if (false);
#if defined(CONFIG_ARCH_OMAP3430)
@@ -519,7 +481,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;
@@ -529,6 +491,11 @@ static int __init omap2_mbox_init(void)
if (err)
goto err_out;
+ pdata.list = list;
+ err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+ if (err)
+ goto err_out;
+
err = platform_device_add(pdev);
if (err)
goto err_out;
@@ -539,7 +506,7 @@ static int __init omap2_mbox_init(void)
return -ENOMEM;
}
- return platform_driver_register(&omap2_mbox_driver);
+ return 0;
err_out:
return err;
@@ -547,7 +514,6 @@ err_out:
static void __exit omap2_mbox_exit(void)
{
- platform_driver_unregister(&omap2_mbox_driver);
iounmap(mbox_base);
}
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
index 0c3c4a5..b68fdc3 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -67,6 +67,10 @@ struct omap_mbox {
void (*err_notify)(void);
};
+struct omap_mbox_platform_data {
+ struct omap_mbox **list;
+};
+
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 7877bbb..8fbf364 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -29,6 +29,7 @@
#include <linux/slab.h>
#include <linux/kfifo.h>
#include <linux/err.h>
+#include <linux/platform_device.h>
#include <plat/mailbox.h>
@@ -403,6 +404,47 @@ int omap_mbox_unregister(struct omap_mbox *mbox)
}
EXPORT_SYMBOL(omap_mbox_unregister);
+static int __devinit omap_mbox_probe(struct platform_device *pdev)
+{
+ struct omap_mbox_platform_data *pdata = pdev->dev.platform_data;
+ struct resource *res;
+ int ret;
+ int i;
+
+ res = pdev->resource;
+
+ for (i = 0; pdata->list[i]; i++) {
+ ret = omap_mbox_register(&pdev->dev, pdata->list[i]);
+ if (ret)
+ goto err_out;
+ }
+ return 0;
+
+err_out:
+ while (i--)
+ omap_mbox_unregister(pdata->list[i]);
+ return ret;
+}
+
+static int __devexit omap_mbox_remove(struct platform_device *pdev)
+{
+ struct omap_mbox_platform_data *pdata = pdev->dev.platform_data;
+ int i;
+
+ for (i = 0; pdata->list[i]; i++)
+ omap_mbox_unregister(pdata->list[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)
{
int err;
@@ -418,13 +460,13 @@ static int __init omap_mbox_init(void)
/* kfifo size sanity check: alignment and minimal size */
mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(mbox_msg_t));
mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size, sizeof(mbox_msg_t));
-
- return 0;
+ return platform_driver_register(&omap_mbox_driver);
}
subsys_initcall(omap_mbox_init);
static void __exit omap_mbox_exit(void)
{
+ platform_driver_unregister(&omap_mbox_driver);
destroy_workqueue(mboxd);
class_unregister(&omap_mbox_class);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 13/17] omap: mailbox: always built-in platform data
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (11 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 12/17] omap: mailbox: split platform driver Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 14/17] omap: mailbox: reorganize headers Felipe Contreras
` (5 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/Makefile | 6 +++---
arch/arm/mach-omap2/Makefile | 5 +++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index b6a537c..c1e1ae5 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -14,9 +14,9 @@ obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
# Power Management
obj-$(CONFIG_PM) += pm.o sleep.o
-# DSP
-obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
-mailbox_mach-objs := mailbox.o
+ifneq ($(CONFIG_OMAP_MBOX_FWK),)
+obj-y += mailbox.o
+endif
i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
obj-y += $(i2c-omap-m) $(i2c-omap-y)
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 4b9fc57..c9757fb 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -86,8 +86,9 @@ obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_3xxx_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] 29+ messages in thread
* [PATCH v2t2 14/17] omap: mailbox: reorganize headers
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (12 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 13/17] omap: mailbox: always built-in platform data Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 15/17] omap: mailbox: don't export unecessary symbols Felipe Contreras
` (4 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 3 ---
arch/arm/mach-omap2/mailbox.c | 1 -
arch/arm/plat-omap/include/plat/mailbox.h | 3 ++-
arch/arm/plat-omap/mailbox.c | 5 ++---
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index f29ba8e..f6376b9 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -9,13 +9,10 @@
* for more details.
*/
-#include <linux/kernel.h>
-#include <linux/resource.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <plat/mailbox.h>
-#include <mach/irqs.h>
#define MAILBOX_ARM2DSP1 0x00
#define MAILBOX_ARM2DSP1b 0x04
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index a54898a..c1a732e 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -10,7 +10,6 @@
* for more details.
*/
-#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/platform_device.h>
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
index b68fdc3..cbde52a 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -3,9 +3,10 @@
#ifndef MAILBOX_H
#define MAILBOX_H
-#include <linux/wait.h>
+#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
+#include <linux/device.h>
#include <linux/kfifo.h>
typedef u32 mbox_msg_t;
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 8fbf364..a784284 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -21,10 +21,9 @@
*
*/
-#include <linux/kernel.h>
-#include <linux/module.h>
#include <linux/interrupt.h>
-#include <linux/device.h>
+#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/kfifo.h>
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 15/17] omap: mailbox: don't export unecessary symbols
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (13 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 14/17] omap: mailbox: reorganize headers Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 16/17] omap: mailbox: mark some resources as __initdata Felipe Contreras
` (3 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 1 -
arch/arm/mach-omap2/mailbox.c | 3 ---
2 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index f6376b9..7e6aea3 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -140,7 +140,6 @@ struct omap_mbox mbox_dsp_info = {
.ops = &omap1_mbox_ops,
.priv = &omap1_mbox_dsp_priv,
};
-EXPORT_SYMBOL(mbox_dsp_info);
struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index c1a732e..f230edb 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -306,7 +306,6 @@ struct omap_mbox mbox_dsp_info = {
.ops = &omap2_mbox_ops,
.priv = &omap2_mbox_dsp_priv,
};
-EXPORT_SYMBOL(mbox_dsp_info);
#endif
#if defined(CONFIG_ARCH_OMAP3430)
@@ -363,7 +362,6 @@ struct omap_mbox mbox_1_info = {
.ops = &omap2_mbox_ops,
.priv = &omap2_mbox_1_priv,
};
-EXPORT_SYMBOL(mbox_1_info);
static struct omap_mbox2_priv omap2_mbox_2_priv = {
.tx_fifo = {
@@ -386,7 +384,6 @@ struct omap_mbox mbox_2_info = {
.ops = &omap2_mbox_ops,
.priv = &omap2_mbox_2_priv,
};
-EXPORT_SYMBOL(mbox_2_info);
struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 16/17] omap: mailbox: mark some resources as __initdata
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (14 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 15/17] omap: mailbox: don't export unecessary symbols Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 17/17] omap: mailbox: don't export register/unregister Felipe Contreras
` (2 subsequent siblings)
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/mach-omap1/mailbox.c | 2 +-
arch/arm/mach-omap2/mailbox.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 7e6aea3..aa661a1 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -144,7 +144,7 @@ struct omap_mbox mbox_dsp_info = {
struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
-static struct resource omap1_mbox_resources[] = {
+static struct resource __initdata omap1_mbox_resources[] = {
{
.start = OMAP16XX_MAILBOX_BASE,
.end = OMAP16XX_MAILBOX_BASE, /* to be updated */
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index f230edb..ddaf7f0 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -389,7 +389,7 @@ struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
#endif
#ifdef CONFIG_ARCH_OMAP2420
-static struct resource omap2_mbox_resources[] = {
+static struct resource __initdata omap2_mbox_resources[] = {
{
.start = OMAP24XX_MAILBOX_BASE,
.end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -407,7 +407,7 @@ static struct resource omap2_mbox_resources[] = {
#endif
#ifdef CONFIG_ARCH_OMAP3430
-static struct resource omap3_mbox_resources[] = {
+static struct resource __initdata omap3_mbox_resources[] = {
{
.start = OMAP34XX_MAILBOX_BASE,
.end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -421,7 +421,7 @@ static struct resource omap3_mbox_resources[] = {
#endif
#ifdef CONFIG_ARCH_OMAP4
-static struct resource omap4_mbox_resources[] = {
+static struct resource __initdata omap4_mbox_resources[] = {
{
.start = OMAP44XX_MAILBOX_BASE,
.end = OMAP44XX_MAILBOX_BASE + OMAP4_MBOX_REG_SIZE - 1,
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 17/17] omap: mailbox: don't export register/unregister
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (15 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 16/17] omap: mailbox: mark some resources as __initdata Felipe Contreras
@ 2010-05-21 21:44 ` Felipe Contreras
2010-05-21 21:57 ` [PATCH v2t2 00/17] omap: mailbox: Russell King - ARM Linux
2010-05-22 5:40 ` Hiroshi DOYU
18 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 21:44 UTC (permalink / raw)
To: linux-arm-kernel
No need for that now.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
arch/arm/plat-omap/include/plat/mailbox.h | 3 ---
arch/arm/plat-omap/mailbox.c | 6 ++----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
index cbde52a..e01be54 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -78,9 +78,6 @@ 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 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) {
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index a784284..69267a2 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -349,7 +349,7 @@ EXPORT_SYMBOL(omap_mbox_put);
static struct class omap_mbox_class = { .name = "mbox", };
-int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
+static int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
{
int ret = 0;
struct omap_mbox **tmp;
@@ -379,9 +379,8 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
err_find:
return ret;
}
-EXPORT_SYMBOL(omap_mbox_register);
-int omap_mbox_unregister(struct omap_mbox *mbox)
+static int omap_mbox_unregister(struct omap_mbox *mbox)
{
struct omap_mbox **tmp;
@@ -401,7 +400,6 @@ int omap_mbox_unregister(struct omap_mbox *mbox)
return -EINVAL;
}
-EXPORT_SYMBOL(omap_mbox_unregister);
static int __devinit omap_mbox_probe(struct platform_device *pdev)
{
--
1.7.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (16 preceding siblings ...)
2010-05-21 21:44 ` [PATCH v2t2 17/17] omap: mailbox: don't export register/unregister Felipe Contreras
@ 2010-05-21 21:57 ` Russell King - ARM Linux
2010-05-21 22:09 ` Felipe Contreras
2010-05-22 5:40 ` Hiroshi DOYU
18 siblings, 1 reply; 29+ messages in thread
From: Russell King - ARM Linux @ 2010-05-21 21:57 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, May 22, 2010 at 12:44:32AM +0300, Felipe Contreras wrote:
> [no changes since the last v2, just rebased on top of the latest
> git://gitorious.org/~doyu/lk/mainline.git for-tony-mailbox]
>
> Currently, the code is split into three places:
> 1) mach-omapX/devices.c: for platform_device_register() the resources
> 2) mach-omapX/mailbox.c: do platform_driver_register(), fetch the resources,
> and register logical mailboxes with omap_mbox_register()
> 3) plat-omap/mailbox.c: implement omap_mbox_register() to add the mbox
> to an internal linked list (static struct omap_mbox *mboxes)
>
> So, obviously 1) is always built-in, but 2) can't be because of the
> dependency of omap_mbox_register(), which is in 3) and cannot be taken
> out.
>
> Users of mailbox will load 3) due to omap_mbox_get(), but not 2),
> therefore, no mailboxes will be registered.
This doesn't make sense - why would 3 be loaded due to the dependency
which comes from 2, but not 2?
The only reason 3 would be loaded due to that dependency is if 2 were
being modprobed, which means it's going to be inserted after 3 anyway.
I don't see anything else in 3 which would trigger it to be loaded.
The "platform:omap2-mailbox" module alias of 2 should result in 2
being modprobed, causing 3 to be loaded to satisfy the dependency.
As already pointed out, this should happen as a result of udev or
(older) hotplug initialization.
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-21 21:57 ` [PATCH v2t2 00/17] omap: mailbox: Russell King - ARM Linux
@ 2010-05-21 22:09 ` Felipe Contreras
2010-05-21 22:15 ` Russell King - ARM Linux
0 siblings, 1 reply; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 22:09 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, May 22, 2010 at 12:57 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Sat, May 22, 2010 at 12:44:32AM +0300, Felipe Contreras wrote:
>> [no changes since the last v2, just rebased on top of the latest
>> git://gitorious.org/~doyu/lk/mainline.git for-tony-mailbox]
>>
>> Currently, the code is split into three places:
>> 1) mach-omapX/devices.c: for platform_device_register() the resources
>> 2) mach-omapX/mailbox.c: do platform_driver_register(), fetch the resources,
>> ? ?and register logical mailboxes with omap_mbox_register()
>> 3) plat-omap/mailbox.c: implement omap_mbox_register() to add the mbox
>> ? ?to an internal linked list (static struct omap_mbox *mboxes)
>>
>> So, obviously 1) is always built-in, but 2) can't be because of the
>> dependency of omap_mbox_register(), which is in 3) and cannot be taken
>> out.
>>
>> Users of mailbox will load 3) due to omap_mbox_get(), but not 2),
>> therefore, no mailboxes will be registered.
>
> This doesn't make sense - why would 3 be loaded due to the dependency
> which comes from 2, but not 2?
All the exported functions, including omap_mbox_get(), are in 3).
2) depends on 3) because 3) implements omap_mbox_register(). 3)
doesn't depend on 2).
> The only reason 3 would be loaded due to that dependency is if 2 were
> being modprobed, which means it's going to be inserted after 3 anyway.
>
> I don't see anything else in 3 which would trigger it to be loaded.
>
> The "platform:omap2-mailbox" module alias of 2 should result in 2
> being modprobed,
I see, at initialization?
> causing 3 to be loaded to satisfy the dependency.
> As already pointed out, this should happen as a result of udev or
> (older) hotplug initialization.
Well, in the minimal system I have in my beagleboard it doesn't
happen. I load bridgedriver, which loads mailbox, but fails
immediately because mailbox_mach is not there.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-21 22:09 ` Felipe Contreras
@ 2010-05-21 22:15 ` Russell King - ARM Linux
2010-05-21 23:34 ` Felipe Contreras
0 siblings, 1 reply; 29+ messages in thread
From: Russell King - ARM Linux @ 2010-05-21 22:15 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, May 22, 2010 at 01:09:12AM +0300, Felipe Contreras wrote:
> On Sat, May 22, 2010 at 12:57 AM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > The only reason 3 would be loaded due to that dependency is if 2 were
> > being modprobed, which means it's going to be inserted after 3 anyway.
> >
> > I don't see anything else in 3 which would trigger it to be loaded.
> >
> > The "platform:omap2-mailbox" module alias of 2 should result in 2
> > being modprobed,
>
> I see, at initialization?
That's the theory - and it should be that same mechanism which allows
things like already plugged in PCMCIA and the like cards to be properly
dealt with at boot time.
> > causing 3 to be loaded to satisfy the dependency.
> > As already pointed out, this should happen as a result of udev or
> > (older) hotplug initialization.
>
> Well, in the minimal system I have in my beagleboard it doesn't
> happen. I load bridgedriver, which loads mailbox, but fails
> immediately because mailbox_mach is not there.
I assume that having the MMC host driver built in, but the MMC block
driver as a module also doesn't work on your setup?
I don't see this as something that should be worked around in the
kernel by making things non-modular - I view the missing userspace
functionality causing the problem.
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-21 22:15 ` Russell King - ARM Linux
@ 2010-05-21 23:34 ` Felipe Contreras
2010-05-22 5:14 ` Hiroshi DOYU
0 siblings, 1 reply; 29+ messages in thread
From: Felipe Contreras @ 2010-05-21 23:34 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, May 22, 2010 at 1:15 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Sat, May 22, 2010 at 01:09:12AM +0300, Felipe Contreras wrote:
>> On Sat, May 22, 2010 at 12:57 AM, Russell King - ARM Linux
>> <linux@arm.linux.org.uk> wrote:
>> > The only reason 3 would be loaded due to that dependency is if 2 were
>> > being modprobed, which means it's going to be inserted after 3 anyway.
>> >
>> > I don't see anything else in 3 which would trigger it to be loaded.
>> >
>> > The "platform:omap2-mailbox" module alias of 2 should result in 2
>> > being modprobed,
>>
>> I see, at initialization?
>
> That's the theory - and it should be that same mechanism which allows
> things like already plugged in PCMCIA and the like cards to be properly
> dealt with at boot time.
>
>> > causing 3 to be loaded to satisfy the dependency.
>> > As already pointed out, this should happen as a result of udev or
>> > (older) hotplug initialization.
>>
>> Well, in the minimal system I have in my beagleboard it doesn't
>> happen. I load bridgedriver, which loads mailbox, but fails
>> immediately because mailbox_mach is not there.
>
> I assume that having the MMC host driver built in, but the MMC block
> driver as a module also doesn't work on your setup?
I wouldn't know because my file-system is on the MMC.
> I don't see this as something that should be worked around in the
> kernel by making things non-modular - I view the missing userspace
> functionality causing the problem.
First of all, most of the cleanups are independent of the built-in
option, although that was my motivation, the patches are good by
themselves: there's no need to export
omap_mbox_register()/_unregister() unnecessarily when the platform
data can be used, right?
Now, regarding the built-in mode; for the iommu case you said it
should be built-in:
http://article.gmane.org/gmane.linux.ports.arm.kernel/58555
Apparently it's not, so it's not clear to me how omap3-iommu would be
loaded since there's no "platform:" alias.
Moreover, Tony says that anything that registers platform devices
should be built-in, but omap3-iommu does register devices and is not
built-in. We could make it built-in as you suggested, but according to
you, things should be modular.
So, I have a bunch of questions:
1) should platform devices be built-in?
2) should platform modules like omap3-iommu and mailbox-mach have a
"platform:" alias?
3) should such modules follow a guideline like foo-mach, or $mach-foo?
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-21 23:34 ` Felipe Contreras
@ 2010-05-22 5:14 ` Hiroshi DOYU
2010-05-22 14:16 ` Felipe Contreras
2010-05-24 6:36 ` Hiroshi DOYU
0 siblings, 2 replies; 29+ messages in thread
From: Hiroshi DOYU @ 2010-05-22 5:14 UTC (permalink / raw)
To: linux-arm-kernel
From: ext Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH v2t2 00/17] omap: mailbox:
Date: Sat, 22 May 2010 01:34:52 +0200
> On Sat, May 22, 2010 at 1:15 AM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Sat, May 22, 2010 at 01:09:12AM +0300, Felipe Contreras wrote:
>>> On Sat, May 22, 2010 at 12:57 AM, Russell King - ARM Linux
>>> <linux@arm.linux.org.uk> wrote:
>>> > The only reason 3 would be loaded due to that dependency is if 2 were
>>> > being modprobed, which means it's going to be inserted after 3 anyway.
>>> >
>>> > I don't see anything else in 3 which would trigger it to be loaded.
>>> >
>>> > The "platform:omap2-mailbox" module alias of 2 should result in 2
>>> > being modprobed,
>>>
>>> I see, at initialization?
>>
>> That's the theory - and it should be that same mechanism which allows
>> things like already plugged in PCMCIA and the like cards to be properly
>> dealt with at boot time.
>>
>>> > causing 3 to be loaded to satisfy the dependency.
>>> > As already pointed out, this should happen as a result of udev or
>>> > (older) hotplug initialization.
>>>
>>> Well, in the minimal system I have in my beagleboard it doesn't
>>> happen. I load bridgedriver, which loads mailbox, but fails
>>> immediately because mailbox_mach is not there.
>>
>> I assume that having the MMC host driver built in, but the MMC block
>> driver as a module also doesn't work on your setup?
>
> I wouldn't know because my file-system is on the MMC.
I guess that your other platform drivers wouldn't work as dynamic module.
>> I don't see this as something that should be worked around in the
>> kernel by making things non-modular - I view the missing userspace
>> functionality causing the problem.
>
> First of all, most of the cleanups are independent of the built-in
> option, although that was my motivation, the patches are good by
Your cleanup patches are ok.
> themselves: there's no need to export
> omap_mbox_register()/_unregister() unnecessarily when the platform
> data can be used, right?
This is not the point.
> Now, regarding the built-in mode; for the iommu case you said it
> should be built-in:
> http://article.gmane.org/gmane.linux.ports.arm.kernel/58555
Right.
> Apparently it's not, so it's not clear to me how omap3-iommu would be
> loaded since there's no "platform:" alias.
This alias is only necessary for platform drivers.
> Moreover, Tony says that anything that registers platform devices
> should be built-in, but omap3-iommu does register devices and is not
> built-in.
It seems that this makes you confused. It should have been
build-in;). This is going to be integrated into omap hwmod framework
soon.
> We could make it built-in as you suggested, but according to
> you, things should be modular.
>
> So, I have a bunch of questions:
> 1) should platform devices be built-in?
Yes.
> 2) should platform modules like omap3-iommu and mailbox-mach have a
> "platform:" alias?
No.
> 3) should such modules follow a guideline like foo-mach, or $mach-foo?
No, this is not a guideline. Just to avoid the module name cofliction.
> From what I can see there's already a lot of code that adds platform
> data at registering time, which is built-in, but I guess you object
> because of the size of all the extra data and code that would come by
> making mach-omapX/mailbox.c as built-in. Am I right?
Yes.
> If that's the case I agree, although I have the feeling that the
> platform-specific data can be reduced a lot.
Then, eventually the code would result in the one which the current
"devices.ko" has at present.
The point is that, only 17 lines of patch does the same, more
simply. The conversion of your fake platform device doesn't make
much sense.
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
` (17 preceding siblings ...)
2010-05-21 21:57 ` [PATCH v2t2 00/17] omap: mailbox: Russell King - ARM Linux
@ 2010-05-22 5:40 ` Hiroshi DOYU
18 siblings, 0 replies; 29+ messages in thread
From: Hiroshi DOYU @ 2010-05-22 5:40 UTC (permalink / raw)
To: linux-arm-kernel
From: ext Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v2t2 00/17] omap: mailbox:
Date: Fri, 21 May 2010 23:44:32 +0200
> From: Felipe Contreras <felipe.contreras@nokia.com>
>
> Hi,
>
> The main purpose of this patch series is to be able to compile mailbox
> mach platform data as built-in.
>
> [no changes since the last v2, just rebased on top of the latest
> git://gitorious.org/~doyu/lk/mainline.git for-tony-mailbox]
>
> Currently, the code is split into three places:
> 1) mach-omapX/devices.c: for platform_device_register() the resources
> 2) mach-omapX/mailbox.c: do platform_driver_register(), fetch the resources,
> and register logical mailboxes with omap_mbox_register()
> 3) plat-omap/mailbox.c: implement omap_mbox_register() to add the mbox
> to an internal linked list (static struct omap_mbox *mboxes)
>
> So, obviously 1) is always built-in, but 2) can't be because of the
> dependency of omap_mbox_register(), which is in 3) and cannot be taken
> out.
>
> Users of mailbox will load 3) due to omap_mbox_get(), but not 2),
> therefore, no mailboxes will be registered.
How are the above user of mailbox loaded at present?
I think that "bridgedriver.ko" is the user of it and it is also
a platform driver. Someone would have to load it without udev, right?
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-22 5:14 ` Hiroshi DOYU
@ 2010-05-22 14:16 ` Felipe Contreras
2010-05-24 6:36 ` Hiroshi DOYU
1 sibling, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-22 14:16 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, May 22, 2010 at 8:14 AM, Hiroshi DOYU <Hiroshi.DOYU@nokia.com> wrote:
> From: ext Felipe Contreras <felipe.contreras@gmail.com>
>> Apparently it's not, so it's not clear to me how omap3-iommu would be
>> loaded since there's no "platform:" alias.
>
> This alias is only necessary for platform drivers.
So, omap3-iommu should be built-in (since it would not be loaded
automatically), so the "platform:" alias is not _required_, but can't
hurt anyway. Right?
>> Moreover, Tony says that anything that registers platform devices
>> should be built-in, but omap3-iommu does register devices and is not
>> built-in.
>
> It seems that this makes you confused. It should have been
> build-in;). This is going to be integrated into omap hwmod framework
> soon.
The hwmod framework will deal with the resources, not with the
platform device. Somebody, presumably the current omap3-iommu, would
have to call omap_device_build() with the right hwmod and platform
data.
>> We could make it built-in as you suggested, but according to
>> you, things should be modular.
>>
>> So, I have a bunch of questions:
>> 1) should platform devices be built-in?
>
> Yes.
>
>> 2) should platform modules like omap3-iommu and mailbox-mach have a
>> "platform:" alias?
>
> No.
They must have it when compiled as a module, but if not, it's not
_needed_, but does it hurt?
>> 3) should such modules follow a guideline like foo-mach, or $mach-foo?
>
> No, this is not a guideline. Just to avoid the module name cofliction.
I know there is no guideline, I'm asking if there _should_ be one. It
would be interesting to do lsmod | grep "^*-mach".
>> From what I can see there's already a lot of code that adds platform
>> data at registering time, which is built-in, but I guess you object
>> because of the size of all the extra data and code that would come by
>> making mach-omapX/mailbox.c as built-in. Am I right?
>
> Yes.
>
>> If that's the case I agree, although I have the feeling that the
>> platform-specific data can be reduced a lot.
>
> Then, eventually the code would result in the one which the current
> "devices.ko" has at present.
>
> The point is that, only 17 lines of patch does the same, more
> simply. The conversion of your fake platform device doesn't make
> much sense.
I'm not sure what you mean.
Anyway, I started playing with hwmod on top of my branch and I found
that there same cleanups are possible without the need to move
platform_device resources.
I will split the series in two: one for cleanups, and one for hwmod +
platform_device split (RFC). And hopefully the possibilities would be
clear.
Cheers.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-22 5:14 ` Hiroshi DOYU
2010-05-22 14:16 ` Felipe Contreras
@ 2010-05-24 6:36 ` Hiroshi DOYU
2010-05-24 8:58 ` Felipe Contreras
1 sibling, 1 reply; 29+ messages in thread
From: Hiroshi DOYU @ 2010-05-24 6:36 UTC (permalink / raw)
To: linux-arm-kernel
From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Subject: Re: [PATCH v2t2 00/17] omap: mailbox:
Date: Sat, 22 May 2010 08:14:15 +0300 (EEST)
> From: ext Felipe Contreras <felipe.contreras@gmail.com>
> Subject: Re: [PATCH v2t2 00/17] omap: mailbox:
> Date: Sat, 22 May 2010 01:34:52 +0200
>
>> On Sat, May 22, 2010 at 1:15 AM, Russell King - ARM Linux
>> <linux@arm.linux.org.uk> wrote:
>>> On Sat, May 22, 2010 at 01:09:12AM +0300, Felipe Contreras wrote:
>>>> On Sat, May 22, 2010 at 12:57 AM, Russell King - ARM Linux
>>>> <linux@arm.linux.org.uk> wrote:
>>>> > The only reason 3 would be loaded due to that dependency is if 2 were
>>>> > being modprobed, which means it's going to be inserted after 3 anyway.
>>>> >
>>>> > I don't see anything else in 3 which would trigger it to be loaded.
>>>> >
>>>> > The "platform:omap2-mailbox" module alias of 2 should result in 2
>>>> > being modprobed,
>>>>
>>>> I see, at initialization?
>>>
>>> That's the theory - and it should be that same mechanism which allows
>>> things like already plugged in PCMCIA and the like cards to be properly
>>> dealt with at boot time.
>>>
>>>> > causing 3 to be loaded to satisfy the dependency.
>>>> > As already pointed out, this should happen as a result of udev or
>>>> > (older) hotplug initialization.
>>>>
>>>> Well, in the minimal system I have in my beagleboard it doesn't
>>>> happen. I load bridgedriver, which loads mailbox, but fails
>>>> immediately because mailbox_mach is not there.
>>>
>>> I assume that having the MMC host driver built in, but the MMC block
>>> driver as a module also doesn't work on your setup?
>>
>> I wouldn't know because my file-system is on the MMC.
>
> I guess that your other platform drivers wouldn't work as dynamic module.
>
>>> I don't see this as something that should be worked around in the
>>> kernel by making things non-modular - I view the missing userspace
>>> functionality causing the problem.
>>
>> First of all, most of the cleanups are independent of the built-in
>> option, although that was my motivation, the patches are good by
>
> Your cleanup patches are ok.
>
>> themselves: there's no need to export
>> omap_mbox_register()/_unregister() unnecessarily when the platform
>> data can be used, right?
>
> This is not the point.
>
>> Now, regarding the built-in mode; for the iommu case you said it
>> should be built-in:
>> http://article.gmane.org/gmane.linux.ports.arm.kernel/58555
>
> Right.
>
>> Apparently it's not, so it's not clear to me how omap3-iommu would be
>> loaded since there's no "platform:" alias.
>
> This alias is only necessary for platform drivers.
>
>> Moreover, Tony says that anything that registers platform devices
>> should be built-in, but omap3-iommu does register devices and is not
>> built-in.
>
> It seems that this makes you confused. It should have been
> build-in;). This is going to be integrated into omap hwmod framework
> soon.
For built-in part, it could be something like:
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-24 6:36 ` Hiroshi DOYU
@ 2010-05-24 8:58 ` Felipe Contreras
2010-05-24 9:29 ` Hiroshi DOYU
0 siblings, 1 reply; 29+ messages in thread
From: Felipe Contreras @ 2010-05-24 8:58 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, May 24, 2010 at 9:36 AM, Hiroshi DOYU <Hiroshi.DOYU@nokia.com> wrote:
>>> Moreover, Tony says that anything that registers platform devices
>>> should be built-in, but omap3-iommu does register devices and is not
>>> built-in.
>>
>> It seems that this makes you confused. It should have been
>> build-in;). This is going to be integrated into omap hwmod framework
>> soon.
>
> For built-in part, it could be something like:
>
> From a09c2040e083f23a43232f97cb29b9aefc9c0d11 Mon Sep 17 00:00:00 2001
> From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> Date: Mon, 24 May 2010 09:35:11 +0300
> Subject: [PATCH 1/1] omap iommu: Make omap-iommu.o built-in
>
> This is a platform device registration.
>
> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> ---
> ?arch/arm/mach-omap2/Makefile | ? ?5 ++++-
> ?1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 7d2cf0f..4d754f6 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -89,7 +89,10 @@ obj-$(CONFIG_OMAP3_EMU) ? ? ? ? ? ? ? ? ? ? ?+= emu.o
> ?obj-$(CONFIG_OMAP_MBOX_FWK) ? ? ? ? ? ?+= mailbox_mach.o
> ?mailbox_mach-objs ? ? ? ? ? ? ? ? ? ? ?:= mailbox.o
>
> -obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o omap-iommu.o
> +obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o
> +
> +iommu-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? := omap-iommu.o
> +obj-y ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+= $(iommu-m) $(iommu-y)
>
> ?i2c-omap-$(CONFIG_I2C_OMAP) ? ? ? ? ? ?:= i2c.o
> ?obj-y ?+= $(i2c-omap-m) $(i2c-omap-y)
> --
I would prefer this:
-obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o omap-iommu.o
+obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o
+
+ifneq ($(CONFIG_OMAP_IOMMU),)
+obj-y += omap-iommu.o
+endif
Much clearer, and easier to understand.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-24 8:58 ` Felipe Contreras
@ 2010-05-24 9:29 ` Hiroshi DOYU
2010-05-24 11:03 ` Felipe Contreras
0 siblings, 1 reply; 29+ messages in thread
From: Hiroshi DOYU @ 2010-05-24 9:29 UTC (permalink / raw)
To: linux-arm-kernel
From: ext Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH v2t2 00/17] omap: mailbox:
Date: Mon, 24 May 2010 10:58:31 +0200
> On Mon, May 24, 2010 at 9:36 AM, Hiroshi DOYU <Hiroshi.DOYU@nokia.com> wrote:
>>>> Moreover, Tony says that anything that registers platform devices
>>>> should be built-in, but omap3-iommu does register devices and is not
>>>> built-in.
>>>
>>> It seems that this makes you confused. It should have been
>>> build-in;). This is going to be integrated into omap hwmod framework
>>> soon.
>>
>> For built-in part, it could be something like:
>>
>> From a09c2040e083f23a43232f97cb29b9aefc9c0d11 Mon Sep 17 00:00:00 2001
>> From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
>> Date: Mon, 24 May 2010 09:35:11 +0300
>> Subject: [PATCH 1/1] omap iommu: Make omap-iommu.o built-in
>>
>> This is a platform device registration.
>>
>> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
>> ---
>> ?arch/arm/mach-omap2/Makefile | ? ?5 ++++-
>> ?1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
>> index 7d2cf0f..4d754f6 100644
>> --- a/arch/arm/mach-omap2/Makefile
>> +++ b/arch/arm/mach-omap2/Makefile
>> @@ -89,7 +89,10 @@ obj-$(CONFIG_OMAP3_EMU) ? ? ? ? ? ? ? ? ? ? ?+= emu.o
>> ?obj-$(CONFIG_OMAP_MBOX_FWK) ? ? ? ? ? ?+= mailbox_mach.o
>> ?mailbox_mach-objs ? ? ? ? ? ? ? ? ? ? ?:= mailbox.o
>>
>> -obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o omap-iommu.o
>> +obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o
>> +
>> +iommu-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? := omap-iommu.o
>> +obj-y ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+= $(iommu-m) $(iommu-y)
>>
>> ?i2c-omap-$(CONFIG_I2C_OMAP) ? ? ? ? ? ?:= i2c.o
>> ?obj-y ?+= $(i2c-omap-m) $(i2c-omap-y)
>> --
>
> I would prefer this:
> -obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o omap-iommu.o
> +obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o
> +
> +ifneq ($(CONFIG_OMAP_IOMMU),)
> +obj-y += omap-iommu.o
> +endif
The above occupies 3 lines. I'd follow the current convention of this
Makefile. There are five more similar ones, "obj-y += $(*-m) $(*-y)".
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2t2 00/17] omap: mailbox:
2010-05-24 9:29 ` Hiroshi DOYU
@ 2010-05-24 11:03 ` Felipe Contreras
0 siblings, 0 replies; 29+ messages in thread
From: Felipe Contreras @ 2010-05-24 11:03 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, May 24, 2010 at 12:29 PM, Hiroshi DOYU <Hiroshi.DOYU@nokia.com> wrote:
> From: ext Felipe Contreras <felipe.contreras@gmail.com>
> Subject: Re: [PATCH v2t2 00/17] omap: mailbox:
> Date: Mon, 24 May 2010 10:58:31 +0200
>
>> On Mon, May 24, 2010 at 9:36 AM, Hiroshi DOYU <Hiroshi.DOYU@nokia.com> wrote:
>>>>> Moreover, Tony says that anything that registers platform devices
>>>>> should be built-in, but omap3-iommu does register devices and is not
>>>>> built-in.
>>>>
>>>> It seems that this makes you confused. It should have been
>>>> build-in;). This is going to be integrated into omap hwmod framework
>>>> soon.
>>>
>>> For built-in part, it could be something like:
>>>
>>> From a09c2040e083f23a43232f97cb29b9aefc9c0d11 Mon Sep 17 00:00:00 2001
>>> From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
>>> Date: Mon, 24 May 2010 09:35:11 +0300
>>> Subject: [PATCH 1/1] omap iommu: Make omap-iommu.o built-in
>>>
>>> This is a platform device registration.
>>>
>>> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
>>> ---
>>> ?arch/arm/mach-omap2/Makefile | ? ?5 ++++-
>>> ?1 files changed, 4 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
>>> index 7d2cf0f..4d754f6 100644
>>> --- a/arch/arm/mach-omap2/Makefile
>>> +++ b/arch/arm/mach-omap2/Makefile
>>> @@ -89,7 +89,10 @@ obj-$(CONFIG_OMAP3_EMU) ? ? ? ? ? ? ? ? ? ? ?+= emu.o
>>> ?obj-$(CONFIG_OMAP_MBOX_FWK) ? ? ? ? ? ?+= mailbox_mach.o
>>> ?mailbox_mach-objs ? ? ? ? ? ? ? ? ? ? ?:= mailbox.o
>>>
>>> -obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o omap-iommu.o
>>> +obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o
>>> +
>>> +iommu-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? := omap-iommu.o
>>> +obj-y ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+= $(iommu-m) $(iommu-y)
>>>
>>> ?i2c-omap-$(CONFIG_I2C_OMAP) ? ? ? ? ? ?:= i2c.o
>>> ?obj-y ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+= $(i2c-omap-m) $(i2c-omap-y)
>>> --
>>
>> I would prefer this:
>> -obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o omap-iommu.o
>> +obj-$(CONFIG_OMAP_IOMMU) ? ? ? ? ? ? ? := iommu2.o
>> +
>> +ifneq ($(CONFIG_OMAP_IOMMU),)
>> +obj-y ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+= omap-iommu.o
>> +endif
>
> The above occupies 3 lines. I'd follow the current convention of this
> Makefile. There are five more similar ones, "obj-y += $(*-m) $(*-y)".
Ok. I tried to grep the whole kernel to find a convention outside of
omap Makefiles but it seems nobody is doing similar things, except in
fs/Makefile for NFSD where they do follow this convention.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2010-05-24 11:03 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 21:44 [PATCH v2t2 00/17] omap: mailbox: Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 01/17] omap: mailbox: trivial whitespace cleanups Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 02/17] omap: mailbox: trivial cleanups Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 03/17] omap: mailbox: reorganize structures Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 04/17] omap: mailbox: 2420 should be detected at run-time Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 05/17] omap: mailbox: use correct config for omap1 Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 06/17] omap: mailbox: update omap1 probing Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 07/17] omap: mailbox: reorganize registering Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 08/17] omap: mailbox: only compile for configured archs Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 09/17] omap: mailbox: reorganize omap platform_device Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 10/17] omap: mailbox: move more stuff to omap_mbox_init() Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 11/17] omap: mailbox: trivial sync between omap1 and 2 Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 12/17] omap: mailbox: split platform driver Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 13/17] omap: mailbox: always built-in platform data Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 14/17] omap: mailbox: reorganize headers Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 15/17] omap: mailbox: don't export unecessary symbols Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 16/17] omap: mailbox: mark some resources as __initdata Felipe Contreras
2010-05-21 21:44 ` [PATCH v2t2 17/17] omap: mailbox: don't export register/unregister Felipe Contreras
2010-05-21 21:57 ` [PATCH v2t2 00/17] omap: mailbox: Russell King - ARM Linux
2010-05-21 22:09 ` Felipe Contreras
2010-05-21 22:15 ` Russell King - ARM Linux
2010-05-21 23:34 ` Felipe Contreras
2010-05-22 5:14 ` Hiroshi DOYU
2010-05-22 14:16 ` Felipe Contreras
2010-05-24 6:36 ` Hiroshi DOYU
2010-05-24 8:58 ` Felipe Contreras
2010-05-24 9:29 ` Hiroshi DOYU
2010-05-24 11:03 ` Felipe Contreras
2010-05-22 5:40 ` Hiroshi DOYU
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).