Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mailbox/omap: move the OMAP mailbox framework to drivers

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.

The OMAP mailbox framework/driver code is moved to be under
drivers/mailbox, in preparation for adapting to a common mailbox
driver framework. This allows the build for OMAP mailbox to be
enabled (it was disabled during the multi-platform support).

As part of the migration from plat and mach code:
- Kconfig symbols have been renamed to build OMAP1 or OMAP2+ drivers.
- mailbox.h under plat-omap/plat/include has been split into a public
and private header files. The public header has only the API related
functions and types.
- The module name mailbox.ko from plat-omap is changed to
omap-mailbox.ko
- The module name mailbox_mach.ko from mach-omapX is changed as
mailbox_omap1.ko for OMAP1
mailbox_omap2.ko for OMAP2+

Cc: Tony Lindgren <tony@atomide.com>
[gregkh@linuxfoundation.org: ack for staging part]
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Suman Anna <s-anna@ti.com>

+135 -92
+2 -1
arch/arm/configs/omap1_defconfig
··· 26 26 CONFIG_ARCH_OMAP1=y 27 27 CONFIG_OMAP_RESET_CLOCKS=y 28 28 # CONFIG_OMAP_MUX is not set 29 - CONFIG_OMAP_MBOX_FWK=y 29 + CONFIG_MAILBOX=y 30 + CONFIG_OMAP1_MBOX=y 30 31 CONFIG_OMAP_32K_TIMER=y 31 32 CONFIG_OMAP_DM_TIMER=y 32 33 CONFIG_ARCH_OMAP730=y
-4
arch/arm/mach-omap1/Makefile
··· 19 19 # Power Management 20 20 obj-$(CONFIG_PM) += pm.o sleep.o 21 21 22 - # DSP 23 - obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 24 - mailbox_mach-objs := mailbox.o 25 - 26 22 i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o 27 23 obj-y += $(i2c-omap-m) $(i2c-omap-y) 28 24
+2 -1
arch/arm/mach-omap1/mailbox.c drivers/mailbox/mailbox-omap1.c
··· 13 13 #include <linux/interrupt.h> 14 14 #include <linux/platform_device.h> 15 15 #include <linux/io.h> 16 - #include <plat/mailbox.h> 16 + 17 + #include "omap-mbox.h" 17 18 18 19 #define MAILBOX_ARM2DSP1 0x00 19 20 #define MAILBOX_ARM2DSP1b 0x04
-3
arch/arm/mach-omap2/Makefile
··· 203 203 obj-$(CONFIG_OMAP3_EMU) += emu.o 204 204 obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o 205 205 206 - obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 207 - mailbox_mach-objs := mailbox.o 208 - 209 206 iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o 210 207 obj-y += $(iommu-m) $(iommu-y) 211 208
+2 -2
arch/arm/mach-omap2/devices.c
··· 328 328 return 0; 329 329 } 330 330 331 - #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 331 + #if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE) 332 332 static inline void __init omap_init_mbox(void) 333 333 { 334 334 struct omap_hwmod *oh; ··· 352 352 } 353 353 #else 354 354 static inline void omap_init_mbox(void) { } 355 - #endif /* CONFIG_OMAP_MBOX_FWK */ 355 + #endif /* CONFIG_OMAP2PLUS_MBOX */ 356 356 357 357 static inline void omap_init_sti(void) {} 358 358
+4 -4
arch/arm/mach-omap2/mailbox.c drivers/mailbox/mailbox-omap2.c
··· 19 19 #include <linux/pm_runtime.h> 20 20 #include <linux/platform_data/mailbox-omap.h> 21 21 22 - #include <plat/mailbox.h> 22 + #include "omap-mbox.h" 23 23 24 24 #define MAILBOX_REVISION 0x000 25 25 #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m)) ··· 331 331 } 332 332 333 333 static struct platform_driver omap2_mbox_driver = { 334 - .probe = omap2_mbox_probe, 335 - .remove = omap2_mbox_remove, 336 - .driver = { 334 + .probe = omap2_mbox_probe, 335 + .remove = omap2_mbox_remove, 336 + .driver = { 337 337 .name = "omap-mailbox", 338 338 }, 339 339 };
-16
arch/arm/plat-omap/Kconfig
··· 86 86 to change the pin multiplexing setup. When there are no warnings 87 87 printed, it's safe to deselect OMAP_MUX for your product. 88 88 89 - config OMAP_MBOX_FWK 90 - tristate "Mailbox framework support" 91 - depends on ARCH_OMAP && !ARCH_MULTIPLATFORM 92 - help 93 - Say Y here if you want to use OMAP Mailbox framework support for 94 - DSP, IVA1.0 and IVA2 in OMAP1/2/3. 95 - 96 - config OMAP_MBOX_KFIFO_SIZE 97 - int "Mailbox kfifo default buffer size (bytes)" 98 - depends on OMAP_MBOX_FWK 99 - default 256 100 - help 101 - Specify the default size of mailbox's kfifo buffers (bytes). 102 - This can also be changed at runtime (via the mbox_kfifo_size 103 - module parameter). 104 - 105 89 config OMAP_IOMMU_IVA2 106 90 bool 107 91
-3
arch/arm/plat-omap/Makefile
··· 17 17 i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o 18 18 obj-y += $(i2c-omap-m) $(i2c-omap-y) 19 19 20 - # OMAP mailbox framework 21 - obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o 22 -
+15 -53
arch/arm/plat-omap/include/plat/mailbox.h drivers/mailbox/omap-mbox.h
··· 1 - /* mailbox.h */ 1 + /* 2 + * omap-mbox.h: OMAP mailbox internal definitions 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 2 8 3 - #ifndef MAILBOX_H 4 - #define MAILBOX_H 9 + #ifndef OMAP_MBOX_H 10 + #define OMAP_MBOX_H 5 11 12 + #include <linux/device.h> 13 + #include <linux/interrupt.h> 14 + #include <linux/kfifo.h> 6 15 #include <linux/spinlock.h> 7 16 #include <linux/workqueue.h> 8 - #include <linux/interrupt.h> 9 - #include <linux/device.h> 10 - #include <linux/kfifo.h> 11 - 12 - typedef u32 mbox_msg_t; 13 - struct omap_mbox; 14 - 15 - typedef int __bitwise omap_mbox_irq_t; 16 - #define IRQ_TX ((__force omap_mbox_irq_t) 1) 17 - #define IRQ_RX ((__force omap_mbox_irq_t) 2) 17 + #include <linux/omap-mailbox.h> 18 18 19 19 typedef int __bitwise omap_mbox_type_t; 20 20 #define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1) ··· 58 58 struct device *dev; 59 59 void *priv; 60 60 int use_count; 61 - struct blocking_notifier_head notifier; 61 + struct blocking_notifier_head notifier; 62 62 }; 63 - 64 - int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg); 65 - void omap_mbox_init_seq(struct omap_mbox *); 66 - 67 - struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb); 68 - void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb); 69 63 70 64 int omap_mbox_register(struct device *parent, struct omap_mbox **); 71 65 int omap_mbox_unregister(void); 72 66 73 - static inline void omap_mbox_save_ctx(struct omap_mbox *mbox) 74 - { 75 - if (!mbox->ops->save_ctx) { 76 - dev_err(mbox->dev, "%s:\tno save\n", __func__); 77 - return; 78 - } 79 - 80 - mbox->ops->save_ctx(mbox); 81 - } 82 - 83 - static inline void omap_mbox_restore_ctx(struct omap_mbox *mbox) 84 - { 85 - if (!mbox->ops->restore_ctx) { 86 - dev_err(mbox->dev, "%s:\tno restore\n", __func__); 87 - return; 88 - } 89 - 90 - mbox->ops->restore_ctx(mbox); 91 - } 92 - 93 - static inline void omap_mbox_enable_irq(struct omap_mbox *mbox, 94 - omap_mbox_irq_t irq) 95 - { 96 - mbox->ops->enable_irq(mbox, irq); 97 - } 98 - 99 - static inline void omap_mbox_disable_irq(struct omap_mbox *mbox, 100 - omap_mbox_irq_t irq) 101 - { 102 - mbox->ops->disable_irq(mbox, irq); 103 - } 104 - 105 - #endif /* MAILBOX_H */ 67 + #endif /* OMAP_MBOX_H */
+35 -1
arch/arm/plat-omap/mailbox.c drivers/mailbox/omap-mailbox.c
··· 31 31 #include <linux/notifier.h> 32 32 #include <linux/module.h> 33 33 34 - #include <plat/mailbox.h> 34 + #include "omap-mbox.h" 35 35 36 36 static struct omap_mbox **mboxes; 37 37 ··· 115 115 return ret; 116 116 } 117 117 EXPORT_SYMBOL(omap_mbox_msg_send); 118 + 119 + void omap_mbox_save_ctx(struct omap_mbox *mbox) 120 + { 121 + if (!mbox->ops->save_ctx) { 122 + dev_err(mbox->dev, "%s:\tno save\n", __func__); 123 + return; 124 + } 125 + 126 + mbox->ops->save_ctx(mbox); 127 + } 128 + EXPORT_SYMBOL(omap_mbox_save_ctx); 129 + 130 + void omap_mbox_restore_ctx(struct omap_mbox *mbox) 131 + { 132 + if (!mbox->ops->restore_ctx) { 133 + dev_err(mbox->dev, "%s:\tno restore\n", __func__); 134 + return; 135 + } 136 + 137 + mbox->ops->restore_ctx(mbox); 138 + } 139 + EXPORT_SYMBOL(omap_mbox_restore_ctx); 140 + 141 + void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) 142 + { 143 + mbox->ops->enable_irq(mbox, irq); 144 + } 145 + EXPORT_SYMBOL(omap_mbox_enable_irq); 146 + 147 + void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) 148 + { 149 + mbox->ops->disable_irq(mbox, irq); 150 + } 151 + EXPORT_SYMBOL(omap_mbox_disable_irq); 118 152 119 153 static void mbox_tx_tasklet(unsigned long tx_data) 120 154 {
+34
drivers/mailbox/Kconfig
··· 16 16 Management Engine, primarily for cpufreq. Say Y here if you want 17 17 to use the PL320 IPCM support. 18 18 19 + config OMAP_MBOX 20 + tristate 21 + help 22 + This option is selected by any OMAP architecture specific mailbox 23 + driver such as CONFIG_OMAP1_MBOX or CONFIG_OMAP2PLUS_MBOX. This 24 + enables the common OMAP mailbox framework code. 25 + 26 + config OMAP1_MBOX 27 + tristate "OMAP1 Mailbox framework support" 28 + depends on ARCH_OMAP1 29 + select OMAP_MBOX 30 + help 31 + Mailbox implementation for OMAP chips with hardware for 32 + interprocessor communication involving DSP in OMAP1. Say Y here 33 + if you want to use OMAP1 Mailbox framework support. 34 + 35 + config OMAP2PLUS_MBOX 36 + tristate "OMAP2+ Mailbox framework support" 37 + depends on ARCH_OMAP2PLUS 38 + select OMAP_MBOX 39 + help 40 + Mailbox implementation for OMAP family chips with hardware for 41 + interprocessor communication involving DSP, IVA1.0 and IVA2 in 42 + OMAP2/3; or IPU, IVA HD and DSP in OMAP4/5. Say Y here if you 43 + want to use OMAP2+ Mailbox framework support. 44 + 45 + config OMAP_MBOX_KFIFO_SIZE 46 + int "Mailbox kfifo default buffer size (bytes)" 47 + depends on OMAP2PLUS_MBOX || OMAP1_MBOX 48 + default 256 49 + help 50 + Specify the default size of mailbox's kfifo buffers (bytes). 51 + This can also be changed at runtime (via the mbox_kfifo_size 52 + module parameter). 19 53 endif
+6
drivers/mailbox/Makefile
··· 1 1 obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o 2 + 3 + obj-$(CONFIG_OMAP_MBOX) += omap-mailbox.o 4 + obj-$(CONFIG_OMAP1_MBOX) += mailbox_omap1.o 5 + mailbox_omap1-objs := mailbox-omap1.o 6 + obj-$(CONFIG_OMAP2PLUS_MBOX) += mailbox_omap2.o 7 + mailbox_omap2-objs := mailbox-omap2.o
+2 -1
drivers/remoteproc/Kconfig
··· 14 14 depends on HAS_DMA 15 15 depends on ARCH_OMAP4 || SOC_OMAP5 16 16 depends on OMAP_IOMMU 17 - depends on OMAP_MBOX_FWK 18 17 select REMOTEPROC 18 + select MAILBOX 19 + select OMAP2PLUS_MBOX 19 20 select RPMSG 20 21 help 21 22 Say y here to support OMAP's remote processors (dual M3
+1 -1
drivers/remoteproc/omap_remoteproc.c
··· 27 27 #include <linux/platform_device.h> 28 28 #include <linux/dma-mapping.h> 29 29 #include <linux/remoteproc.h> 30 + #include <linux/omap-mailbox.h> 30 31 31 - #include <plat/mailbox.h> 32 32 #include <linux/platform_data/remoteproc-omap.h> 33 33 34 34 #include "omap_remoteproc.h"
+2 -1
drivers/staging/tidspbridge/Kconfig
··· 5 5 menuconfig TIDSPBRIDGE 6 6 tristate "DSP Bridge driver" 7 7 depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM 8 - select OMAP_MBOX_FWK 8 + select MAILBOX 9 + select OMAP2PLUS_MBOX 9 10 help 10 11 DSP/BIOS Bridge is designed for platforms that contain a GPP and 11 12 one or more attached DSPs. The GPP is considered the master or
+1 -1
drivers/staging/tidspbridge/include/dspbridge/host_os.h
··· 41 41 #include <linux/ioport.h> 42 42 #include <linux/platform_device.h> 43 43 #include <linux/clk.h> 44 - #include <plat/mailbox.h> 44 + #include <linux/omap-mailbox.h> 45 45 #include <linux/pagemap.h> 46 46 #include <asm/cacheflush.h> 47 47 #include <linux/dma-mapping.h>
+29
include/linux/omap-mailbox.h
··· 1 + /* 2 + * omap-mailbox: interprocessor communication module for OMAP 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #ifndef OMAP_MAILBOX_H 10 + #define OMAP_MAILBOX_H 11 + 12 + typedef u32 mbox_msg_t; 13 + struct omap_mbox; 14 + 15 + typedef int __bitwise omap_mbox_irq_t; 16 + #define IRQ_TX ((__force omap_mbox_irq_t) 1) 17 + #define IRQ_RX ((__force omap_mbox_irq_t) 2) 18 + 19 + int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg); 20 + 21 + struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb); 22 + void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb); 23 + 24 + void omap_mbox_save_ctx(struct omap_mbox *mbox); 25 + void omap_mbox_restore_ctx(struct omap_mbox *mbox); 26 + void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq); 27 + void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq); 28 + 29 + #endif /* OMAP_MAILBOX_H */