]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mailbox: OMAP: introduce mailbox framework
authorOmar Ramirez Luna <omar.luna@linaro.org>
Tue, 12 Mar 2013 22:55:29 +0000 (17:55 -0500)
committerSuman Anna <s-anna@ti.com>
Thu, 14 Mar 2013 18:04:30 +0000 (13:04 -0500)
Actually moving it from plat-omap, as this framework/driver code is
supposed to be under drivers/ folder. The framework should work with
the current supported OMAP processors (OMAP1+) that have mailbox and
can be used as a method of interprocessor communication.

The mailbox hardware (in OMAP) uses a queued mailbox-interrupt mechanism
that provides a communication channel between processors through a set of
registers and their associated interrupt signals by sending and receiving
messages.

As part of the migration from plat and mach code:
- Kconfig symbols have been renamed to build OMAP1 or OMAP2+ drivers.
- mailbox.h has been changed from plat to a dedicated drivers/ folder.

Module names have changed too, instead of mailbox_mach:
- OMAP1: mailbox-omap1.ko
- OMAP2+: mailbox-omap2.ko

Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[s-anna@ti.com: Kconfig fixes for build errors]
Signed-off-by: Suman Anna <s-anna@ti.com>
17 files changed:
arch/arm/configs/omap1_defconfig
arch/arm/mach-omap1/Makefile
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/devices.c
arch/arm/plat-omap/Kconfig
arch/arm/plat-omap/Makefile
drivers/mailbox/Kconfig
drivers/mailbox/Makefile
drivers/mailbox/mailbox-omap1.c [moved from arch/arm/mach-omap1/mailbox.c with 99% similarity]
drivers/mailbox/mailbox-omap2.c [moved from arch/arm/mach-omap2/mailbox.c with 98% similarity]
drivers/mailbox/mailbox.c [moved from arch/arm/plat-omap/mailbox.c with 97% similarity]
drivers/mailbox/mailbox_internal.h [new file with mode: 0644]
drivers/remoteproc/Kconfig
drivers/remoteproc/omap_remoteproc.c
drivers/staging/tidspbridge/Kconfig
drivers/staging/tidspbridge/include/dspbridge/host_os.h
include/linux/mailbox.h [moved from arch/arm/plat-omap/include/plat/mailbox.h with 90% similarity]

index 42eab9a2a0fd53ba4cb26eb36c1a7a7c29909587..2280d9df753e2dc402c34beb47b0891c31dd318c 100644 (file)
@@ -26,7 +26,8 @@ CONFIG_ARCH_OMAP=y
 CONFIG_ARCH_OMAP1=y
 CONFIG_OMAP_RESET_CLOCKS=y
 # CONFIG_OMAP_MUX is not set
-CONFIG_OMAP_MBOX_FWK=y
+CONFIG_MAILBOX=y
+CONFIG_OMAP1_MBOX=y
 CONFIG_OMAP_32K_TIMER=y
 CONFIG_OMAP_DM_TIMER=y
 CONFIG_ARCH_OMAP730=y
index 222d58c0ae76951efa9651e064182cf138ed0dbd..3889b6cd211e704b325573468246b28a45cf299d 100644 (file)
@@ -19,10 +19,6 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 # Power Management
 obj-$(CONFIG_PM) += pm.o sleep.o
 
-# DSP
-obj-$(CONFIG_OMAP_MBOX_FWK)    += mailbox_mach.o
-mailbox_mach-objs              := mailbox.o
-
 i2c-omap-$(CONFIG_I2C_OMAP)            := i2c.o
 obj-y                                  += $(i2c-omap-m) $(i2c-omap-y)
 
index b068b7fe99ef3239c98938de5cc0eab820bc371d..4098635b22cc1ef8482fe0d9f4d15252aff88655 100644 (file)
@@ -203,9 +203,6 @@ obj-$(CONFIG_ARCH_OMAP4)            += omap_hwmod_44xx_data.o
 obj-$(CONFIG_OMAP3_EMU)                        += emu.o
 obj-$(CONFIG_HW_PERF_EVENTS)           += pmu.o
 
-obj-$(CONFIG_OMAP_MBOX_FWK)            += mailbox_mach.o
-mailbox_mach-objs                      := mailbox.o
-
 iommu-$(CONFIG_OMAP_IOMMU)             := omap-iommu.o
 obj-y                                  += $(iommu-m) $(iommu-y)
 
index 039f6d717d4262e51f43852852db038faccc0de0..72ba57c69da54980604a5de3a6d2552aae9c1223 100644 (file)
@@ -328,7 +328,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
        return 0;
 }
 
-#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+#if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
 static inline void __init omap_init_mbox(void)
 {
        struct omap_hwmod *oh;
@@ -352,7 +352,7 @@ static inline void __init omap_init_mbox(void)
 }
 #else
 static inline void omap_init_mbox(void) { }
-#endif /* CONFIG_OMAP_MBOX_FWK */
+#endif /* CONFIG_OMAP2PLUS_MBOX */
 
 static inline void omap_init_sti(void) {}
 
index ce66eb9be481f118159c6c2305079795a933f1df..f82bae2171eb1c32ab206e4aff550334d641e468 100644 (file)
@@ -86,22 +86,6 @@ config OMAP_MUX_WARNINGS
          to change the pin multiplexing setup.  When there are no warnings
          printed, it's safe to deselect OMAP_MUX for your product.
 
-config OMAP_MBOX_FWK
-       tristate "Mailbox framework support"
-       depends on ARCH_OMAP && !ARCH_MULTIPLATFORM
-       help
-         Say Y here if you want to use OMAP Mailbox framework support for
-         DSP, IVA1.0 and IVA2 in OMAP1/2/3.
-
-config OMAP_MBOX_KFIFO_SIZE
-       int "Mailbox kfifo default buffer size (bytes)"
-       depends on OMAP_MBOX_FWK
-       default 256
-       help
-         Specify the default size of mailbox's kfifo buffers (bytes).
-         This can also be changed at runtime (via the mbox_kfifo_size
-         module parameter).
-
 config OMAP_IOMMU_IVA2
        bool
 
index 31199417b56a790a6e0633e5b9f823e659c335d1..0b01b68fd033072c818de997bd07536feb2ca64b 100644 (file)
@@ -17,6 +17,3 @@ obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
 i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
 obj-y += $(i2c-omap-m) $(i2c-omap-y)
 
-# OMAP mailbox framework
-obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
-
index 9545c9f03809bd88378135dc9c668b8214b1a891..22d6f8d1889ffaa6e917af5272a8b810743849b4 100644 (file)
@@ -16,4 +16,29 @@ config PL320_MBOX
          Management Engine, primarily for cpufreq. Say Y here if you want
          to use the PL320 IPCM support.
 
+config OMAP1_MBOX
+       tristate "OMAP1 Mailbox framework support"
+       depends on ARCH_OMAP1
+       help
+         Mailbox implementation for OMAP chips with hardware for
+         interprocessor communication involving DSP in OMAP1. Say Y here
+         if you want to use OMAP1 Mailbox framework support.
+
+config OMAP2PLUS_MBOX
+       tristate "OMAP2+ Mailbox framework support"
+       depends on ARCH_OMAP2PLUS
+       help
+         Mailbox implementation for OMAP family chips with hardware for
+         interprocessor communication involving DSP, IVA1.0 and IVA2 in
+         OMAP2/3; or IPU, IVA HD and DSP in OMAP4. Say Y here if you want
+         to use OMAP2+ Mailbox framework support.
+
+
+config OMAP_MBOX_KFIFO_SIZE
+       int "Mailbox kfifo default buffer size (bytes)"
+       default 256
+       help
+         Specify the default size of mailbox's kfifo buffers (bytes).
+         This can also be changed at runtime (via the mbox_kfifo_size
+         module parameter).
 endif
index 543ad6a795054b1015117f7bea877631b6d18463..9ee0fcba6c3d5bb19b0e3eb98f7ea70e83b1061d 100644 (file)
@@ -1 +1,5 @@
 obj-$(CONFIG_PL320_MBOX)       += pl320-ipc.o
+
+obj-$(CONFIG_MAILBOX)          += mailbox.o
+obj-$(CONFIG_OMAP1_MBOX)       += mailbox-omap1.o
+obj-$(CONFIG_OMAP2PLUS_MBOX)   += mailbox-omap2.o
similarity index 99%
rename from arch/arm/mach-omap1/mailbox.c
rename to drivers/mailbox/mailbox-omap1.c
index efc8f207f6fcd7845065b569f835764ff47e9ba5..dbf40e26dd811a326762998c0b4cd6f322d468bf 100644 (file)
@@ -13,7 +13,8 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <plat/mailbox.h>
+
+#include "mailbox_internal.h"
 
 #define MAILBOX_ARM2DSP1               0x00
 #define MAILBOX_ARM2DSP1b              0x04
similarity index 98%
rename from arch/arm/mach-omap2/mailbox.c
rename to drivers/mailbox/mailbox-omap2.c
index 8f5bcd8ed397cce3f0492c08934e065d24f67bbb..3fe8d7c09107699f4de6a52f2dbc9ce56d48542a 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/platform_data/mailbox-omap.h>
 
-#include <plat/mailbox.h>
+#include "mailbox_internal.h"
 
 #define MAILBOX_REVISION               0x000
 #define MAILBOX_MESSAGE(m)             (0x040 + 4 * (m))
@@ -63,7 +63,7 @@ struct omap_mbox2_priv {
 };
 
 static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
-                                 omap_mbox_type_t irq);
+               omap_mbox_type_t irq);
 
 static inline unsigned int mbox_read_reg(size_t ofs)
 {
@@ -185,7 +185,7 @@ static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
                p->ctx[i] = mbox_read_reg(i * sizeof(u32));
 
                dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__,
-                       i, p->ctx[i]);
+                               i, p->ctx[i]);
        }
 }
 
@@ -203,7 +203,7 @@ static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
                mbox_write_reg(p->ctx[i], i * sizeof(u32));
 
                dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__,
-                       i, p->ctx[i]);
+                               i, p->ctx[i]);
        }
 }
 
@@ -325,9 +325,9 @@ static int omap2_mbox_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap2_mbox_driver = {
-       .probe = omap2_mbox_probe,
-       .remove = omap2_mbox_remove,
-       .driver = {
+       .probe  = omap2_mbox_probe,
+       .remove = omap2_mbox_remove,
+       .driver = {
                .name = "omap-mailbox",
        },
 };
similarity index 97%
rename from arch/arm/plat-omap/mailbox.c
rename to drivers/mailbox/mailbox.c
index 42377ef9ea3d3fb4c5231622b21e4bc6714294ce..6c738aa00b5355bab3819b837da035caddb83292 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/notifier.h>
 #include <linux/module.h>
 
-#include <plat/mailbox.h>
+#include "mailbox_internal.h"
 
 static struct omap_mbox **mboxes;
 
@@ -130,7 +130,7 @@ static void mbox_tx_tasklet(unsigned long tx_data)
                }
 
                ret = kfifo_out(&mq->fifo, (unsigned char *)&msg,
-                                                               sizeof(msg));
+                               sizeof(msg));
                WARN_ON(ret != sizeof(msg));
 
                mbox_fifo_write(mbox, msg);
@@ -143,7 +143,7 @@ static void mbox_tx_tasklet(unsigned long tx_data)
 static void mbox_rx_work(struct work_struct *work)
 {
        struct omap_mbox_queue *mq =
-                       container_of(work, struct omap_mbox_queue, work);
+               container_of(work, struct omap_mbox_queue, work);
        mbox_msg_t msg;
        int len;
 
@@ -152,7 +152,7 @@ static void mbox_rx_work(struct work_struct *work)
                WARN_ON(len != sizeof(msg));
 
                blocking_notifier_call_chain(&mq->mbox->notifier, len,
-                                                               (void *)msg);
+                               (void *)msg);
                spin_lock_irq(&mq->lock);
                if (mq->full) {
                        mq->full = false;
@@ -214,8 +214,8 @@ static irqreturn_t mbox_interrupt(int irq, void *p)
 }
 
 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
-                                       void (*work) (struct work_struct *),
-                                       void (*tasklet)(unsigned long))
+               void (*work) (struct work_struct *),
+               void (*tasklet)(unsigned long))
 {
        struct omap_mbox_queue *mq;
 
@@ -262,10 +262,10 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
 
        if (!mbox->use_count++) {
                ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED,
-                                                       mbox->name, mbox);
+                               mbox->name, mbox);
                if (unlikely(ret)) {
                        pr_err("failed to register mailbox interrupt:%d\n",
-                                                                       ret);
+                                       ret);
                        goto fail_request_irq;
                }
                mq = mbox_queue_alloc(mbox, NULL, mbox_tx_tasklet);
@@ -417,7 +417,7 @@ 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));
+                       sizeof(mbox_msg_t));
 
        return 0;
 }
diff --git a/drivers/mailbox/mailbox_internal.h b/drivers/mailbox/mailbox_internal.h
new file mode 100644 (file)
index 0000000..b39badb
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * mailbox: interprocessor communication module
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef MAILBOX_INTERNAL_H
+#define MAILBOX_INTERNAL_H
+
+#include <linux/mailbox.h>
+
+#endif /* MAILBOX_INTERNAL_H */
index cc1f7bf53fd07c1c1788d0183b19e4ce41de8c1b..2465c71ae70517536bd98789fa5591e63d4f9a71 100644 (file)
@@ -12,8 +12,9 @@ config OMAP_REMOTEPROC
        depends on HAS_DMA
        depends on ARCH_OMAP4
        depends on OMAP_IOMMU
-       depends on OMAP_MBOX_FWK
        select REMOTEPROC
+       select MAILBOX
+       select OMAP2PLUS_MBOX
        select RPMSG
        help
          Say y here to support OMAP's remote processors (dual M3
index 0e396c155b3ba60d0d202af60f9aa34f84afd5bf..49a04d5ba13ab4cbb9c6a1ebd761e4b2932778b2 100644 (file)
@@ -27,8 +27,8 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/remoteproc.h>
+#include <linux/mailbox.h>
 
-#include <plat/mailbox.h>
 #include <linux/platform_data/remoteproc-omap.h>
 
 #include "omap_remoteproc.h"
index 60848f198b4844229acd41073043c18cf1dbde8a..165b918b8171b6380c4d8653d576a0bc085ecb99 100644 (file)
@@ -5,7 +5,8 @@
 menuconfig TIDSPBRIDGE
        tristate "DSP Bridge driver"
        depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM
-       select OMAP_MBOX_FWK
+       select MAILBOX
+       select OMAP2PLUS_MBOX
        help
          DSP/BIOS Bridge is designed for platforms that contain a GPP and
          one or more attached DSPs.  The GPP is considered the master or
index 7f3a1db316199ac4618d3e57a6162b27ed305282..27f6bd6114bcfa65622f7ef866e6a30b2725aa50 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
-#include <plat/mailbox.h>
+#include <linux/mailbox.h>
 #include <linux/pagemap.h>
 #include <asm/cacheflush.h>
 #include <linux/dma-mapping.h>
similarity index 90%
rename from arch/arm/plat-omap/include/plat/mailbox.h
rename to include/linux/mailbox.h
index e98f7e234686207ae0b738e50ab10e5856edae26..5722b93145c75cc74158b8d8f1256760408f8b92 100644 (file)
@@ -1,4 +1,10 @@
-/* mailbox.h */
+/*
+ * mailbox: interprocessor communication module
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
 
 #ifndef MAILBOX_H
 #define MAILBOX_H
@@ -58,7 +64,7 @@ struct omap_mbox {
        struct device           *dev;
        void                    *priv;
        int                     use_count;
-       struct blocking_notifier_head   notifier;
+       struct blocking_notifier_head   notifier;
 };
 
 int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);