From 4f2a64e388a41fef14de997017d99aefd3298ab3 Mon Sep 17 00:00:00 2001 From: Toshihiro Kobayashi Date: Sat, 11 Nov 2006 02:10:36 +0200 Subject: [PATCH] ARM: OMAP: Fix for mailbox and dsp module (repost) Fix to build DSP Gateway as a module. After this fix, modules regarding mailbox will be built as follows. arch/arm/mach-omap[12]/mailbox.o -> mailbox_mach.ko arch/arm/plat-omap/mailbox.o ->mailbox.ko Signed-off-by: Toshihiro Kobayashi --- arch/arm/mach-omap1/Makefile | 3 ++- arch/arm/mach-omap1/devices.c | 2 +- arch/arm/mach-omap1/mailbox.c | 1 + arch/arm/mach-omap2/Makefile | 3 ++- arch/arm/mach-omap2/devices.c | 2 +- arch/arm/mach-omap2/mailbox.c | 3 ++- arch/arm/plat-omap/dsp/dsp_common.c | 1 + arch/arm/plat-omap/dsp/dsp_core.c | 6 +++++- arch/arm/plat-omap/dsp/dsp_mem.c | 12 +++++++++--- arch/arm/plat-omap/mailbox.c | 2 ++ 10 files changed, 26 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index 9cb1f705639..60528f91b73 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -11,7 +11,8 @@ obj-$(CONFIG_OMAP_MPU_TIMER) += time.o obj-$(CONFIG_PM) += pm.o sleep.o # DSP -obj-$(CONFIG_OMAP_DSP) += mailbox.o +obj-$(CONFIG_OMAP_DSP) += mailbox_mach.o +mailbox_mach-objs := mailbox.o led-y := leds.o diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index adae4f80d2f..497c8bb5e69 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c @@ -61,7 +61,7 @@ static void omap_init_rtc(void) static inline void omap_init_rtc(void) {} #endif -#if defined(CONFIG_OMAP_DSP) +#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) #if defined(CONFIG_ARCH_OMAP15XX) # define OMAP1_MBOX_SIZE 0x23 diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c index ed59f968825..877b8380cd4 100644 --- a/arch/arm/mach-omap1/mailbox.c +++ b/arch/arm/mach-omap1/mailbox.c @@ -141,6 +141,7 @@ struct omap_mbox mbox_dsp_info = { .ops = &omap1_mbox_ops, .priv = &omap1_mbox_dsp_priv, }; +EXPORT_SYMBOL(mbox_dsp_info); static int __init omap1_mbox_probe(struct platform_device *pdev) { diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 841dba83217..626d9b8af2d 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -12,7 +12,8 @@ obj-$(CONFIG_OMAP_MPU_TIMER) += timer-gp.o obj-$(CONFIG_PM) += pm.o pm-domain.o sleep.o # DSP -obj-$(CONFIG_OMAP_DSP) += mailbox.o +obj-$(CONFIG_OMAP_DSP) += mailbox_mach.o +mailbox_mach-objs := mailbox.o # Specific board support obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 484bb9ea74d..488f4a8e2ee 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -66,7 +66,7 @@ static void omap_init_i2c(void) {} #endif -#if defined(CONFIG_OMAP_DSP) +#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE) static struct resource mbox_resources[] = { diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 835e340988c..e541e95d8dc 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c @@ -209,11 +209,12 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .newmsg_bit = MAILBOX_IRQ_NEWMSG(1), }; -static struct omap_mbox mbox_dsp_info = { +struct omap_mbox mbox_dsp_info = { .name = "dsp", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_dsp_priv, }; +EXPORT_SYMBOL(mbox_dsp_info); /* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { diff --git a/arch/arm/plat-omap/dsp/dsp_common.c b/arch/arm/plat-omap/dsp/dsp_common.c index 087971ad8c0..44fa86aed81 100644 --- a/arch/arm/plat-omap/dsp/dsp_common.c +++ b/arch/arm/plat-omap/dsp/dsp_common.c @@ -587,6 +587,7 @@ EXPORT_SYMBOL(api_ck_handle); EXPORT_SYMBOL(dsp_fck_handle); EXPORT_SYMBOL(dsp_ick_handle); #endif +EXPORT_SYMBOL(omap_dsp); EXPORT_SYMBOL(dspmem_base); EXPORT_SYMBOL(dspmem_size); EXPORT_SYMBOL(daram_base); diff --git a/arch/arm/plat-omap/dsp/dsp_core.c b/arch/arm/plat-omap/dsp/dsp_core.c index ceeb5e5c97c..2da959b74cd 100644 --- a/arch/arm/plat-omap/dsp/dsp_core.c +++ b/arch/arm/plat-omap/dsp/dsp_core.c @@ -406,7 +406,7 @@ int dsp_mbox_config(void *p) static int __init dsp_mbox_init(void) { omap_dsp->mbox = omap_mbox_get("dsp"); - if (IS_ERR(omap_dsp->mbox)) { + if (omap_dsp->mbox == NULL) { printk(KERN_ERR "failed to get mailbox handler for DSP.\n"); return -ENODEV; } @@ -677,5 +677,9 @@ static void __exit omap_dsp_mod_exit(void) platform_driver_unregister(&dsp_driver); } +/* module dependency: need mailbox module that have mbox_dsp_info */ +extern struct omap_mbox mbox_dsp_info; +struct omap_mbox *mbox_dep = &mbox_dsp_info; + module_init(omap_dsp_mod_init); module_exit(omap_dsp_mod_exit); diff --git a/arch/arm/plat-omap/dsp/dsp_mem.c b/arch/arm/plat-omap/dsp/dsp_mem.c index b53cdc7e1ba..ebf3c6b171b 100644 --- a/arch/arm/plat-omap/dsp/dsp_mem.c +++ b/arch/arm/plat-omap/dsp/dsp_mem.c @@ -1647,6 +1647,8 @@ static int dsp_mmu_itack(void) DSP_MMU_IRQ_TLBMISS) #endif +static int is_mmu_init; + static void dsp_mmu_init(void) { struct tlb_lock tlb_lock; @@ -1682,13 +1684,17 @@ static void dsp_mmu_init(void) omap_dsp_release_mem(); clk_disable(dsp_ck_handle); #endif + + is_mmu_init = 1; } static void dsp_mmu_shutdown(void) { - exmap_flush(); - exmap_clear_preserved_entries(); - dsp_mmu_disable(); + if (is_mmu_init) { + exmap_flush(); + exmap_clear_preserved_entries(); + dsp_mmu_disable(); + } } #ifdef CONFIG_ARCH_OMAP1 diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index e7177cd62f3..1d3761fae0f 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c @@ -345,3 +345,5 @@ static void __exit omap_mbox_class_exit(void) subsys_initcall(omap_mbox_class_init); module_exit(omap_mbox_class_exit); + +MODULE_LICENSE("GPL"); -- 2.41.1