diff mbox

OMAP3: mailbox initialization for all omap versions

Message ID 20100401.142629.226796472.Hiroshi.DOYU@nokia.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Hiroshi DOYU April 1, 2010, 11:26 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 048faa0..94fa938 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -17,6 +17,10 @@  obj-$(CONFIG_ARCH_OMAP4) += $(omap-3-4-common) prcm.o clock.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
+obj-$(CONFIG_ARCH_OMAP24xx)		+= devices24xx.o
+obj-$(CONFIG_ARCH_OMAP34xx)		+= devices34xx.o
+obj-$(CONFIG_ARCH_OMAP44xx)		+= devices44xx.o
+
 # SMP support ONLY available for OMAP4
 obj-$(CONFIG_SMP)			+= omap-smp.o omap-headsmp.o
 obj-$(CONFIG_LOCAL_TIMERS)		+= timer-mpu.o
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index a622b6e..359f0ce 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -169,79 +169,6 @@  static inline void omap_init_camera(void)
 }
 #endif
 
-#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-
-#define MBOX_REG_SIZE   0x120
-
-#ifdef CONFIG_ARCH_OMAP2
-static struct resource omap_mbox_resources[] = {
-	{
-		.start		= OMAP24XX_MAILBOX_BASE,
-		.end		= OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
-		.flags		= IORESOURCE_MEM,
-	},
-	{
-		.start		= INT_24XX_MAIL_U0_MPU,
-		.flags		= IORESOURCE_IRQ,
-	},
-	{
-		.start		= INT_24XX_MAIL_U3_MPU,
-		.flags		= IORESOURCE_IRQ,
-	},
-};
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static struct resource omap_mbox_resources[] = {
-	{
-		.start		= OMAP34XX_MAILBOX_BASE,
-		.end		= OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
-		.flags		= IORESOURCE_MEM,
-	},
-	{
-		.start		= INT_24XX_MAIL_U0_MPU,
-		.flags		= IORESOURCE_IRQ,
-	},
-};
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-
-#define OMAP4_MBOX_REG_SIZE	0x130
-static struct resource omap_mbox_resources[] = {
-	{
-		.start          = OMAP44XX_MAILBOX_BASE,
-		.end            = OMAP44XX_MAILBOX_BASE +
-					OMAP4_MBOX_REG_SIZE - 1,
-		.flags          = IORESOURCE_MEM,
-	},
-	{
-		.start          = INT_44XX_MAIL_U0_MPU,
-		.flags          = IORESOURCE_IRQ,
-	},
-};
-#endif
-
-static struct platform_device mbox_device = {
-	.name		= "omap2-mailbox",
-	.id		= -1,
-};
-
-static inline void omap_init_mbox(void)
-{
-	if (cpu_is_omap2420() || cpu_is_omap3430() || cpu_is_omap44xx()) {
-		mbox_device.num_resources = ARRAY_SIZE(omap_mbox_resources);
-		mbox_device.resource = omap_mbox_resources;
-	} else {
-		pr_err("%s: platform not supported\n", __func__);
-		return;
-	}
-	platform_device_register(&mbox_device);
-}
-#else
-static inline void omap_init_mbox(void) { }
-#endif /* CONFIG_OMAP_MBOX_FWK */
-
 #if defined(CONFIG_OMAP_SDTI)
 
 #if defined(CONFIG_ARCH_OMAP2)
@@ -865,7 +792,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/devices24xx.c b/arch/arm/mach-omap2/devices24xx.c
new file mode 100644
index 0000000..22baa8b
--- /dev/null
+++ b/arch/arm/mach-omap2/devices24xx.c
@@ -0,0 +1,63 @@ 
+/*
+ * omap24xx architecture specific deivce initialization
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <plat/irqs.h>
+
+#include <mach/hardware.h>
+
+#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+
+#define MBOX_REG_SIZE   0x120
+
+static struct resource omap_mbox_resources[] = {
+	{
+		.start		= OMAP24XX_MAILBOX_BASE,
+		.end		= OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= INT_24XX_MAIL_U0_MPU,
+		.flags		= IORESOURCE_IRQ,
+	},
+	{
+		.start		= INT_24XX_MAIL_U3_MPU,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mbox_device = {
+	.name		= "omap2-mailbox",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(omap_mbox_resources),
+	.resource	= omap_mbox_resources,
+};
+
+static inline void omap_mbox_init(void)
+{
+	platform_device_register(&omap_mbox_device);
+}
+#else
+static inline void omap_mbox_init(void) { }
+#endif	/* CONFIG_OMAP_MBOX_FWK */
+
+static int __init omap24xx_init_devices(void)
+{
+	if (!cpu_is_omap24xx())
+		return;
+
+	omap_mbox_init();
+
+	return 0;
+}
+arch_initcall(omap24xx_init_devices);
diff --git a/arch/arm/mach-omap2/devices34xx.c b/arch/arm/mach-omap2/devices34xx.c
new file mode 100644
index 0000000..0de1208
--- /dev/null
+++ b/arch/arm/mach-omap2/devices34xx.c
@@ -0,0 +1,59 @@ 
+/*
+ * omap34xx architecture specific deivce initialization
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <plat/irqs.h>
+
+#include <mach/hardware.h>
+
+#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+
+#define MBOX_REG_SIZE   0x120
+
+static struct resource omap_mbox_resources[] = {
+	{
+		.start		= OMAP34XX_MAILBOX_BASE,
+		.end		= OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= INT_24XX_MAIL_U0_MPU,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mbox_device = {
+	.name		= "omap2-mailbox",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(omap_mbox_resources),
+	.resource	= omap_mbox_resources,
+};
+
+static inline void omap_mbox_init(void)
+{
+	platform_device_register(&omap_mbox_device);
+}
+#else
+static inline void omap_mbox_init(void) { }
+#endif	/* CONFIG_OMAP_MBOX_FWK */
+
+static int __init omap34xx_init_devices(void)
+{
+	if (!cpu_is_omap34xx())
+		return 0;
+
+	omap_mbox_init();
+
+	return 0;
+}
+arch_initcall(omap34xx_init_devices);
diff --git a/arch/arm/mach-omap2/devices44xx.c b/arch/arm/mach-omap2/devices44xx.c
new file mode 100644
index 0000000..ad98033
--- /dev/null
+++ b/arch/arm/mach-omap2/devices44xx.c
@@ -0,0 +1,60 @@ 
+/*
+ * omap44xx architecture specific deivce initialization
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <plat/irqs.h>
+
+#include <mach/hardware.h>
+
+#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+
+#define OMAP4_MBOX_REG_SIZE	0x130
+
+static struct resource omap_mbox_resources[] = {
+	{
+		.start          = OMAP44XX_MAILBOX_BASE,
+		.end            = OMAP44XX_MAILBOX_BASE +
+					OMAP4_MBOX_REG_SIZE - 1,
+		.flags          = IORESOURCE_MEM,
+	},
+	{
+		.start          = INT_44XX_MAIL_U0_MPU,
+		.flags          = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mbox_device = {
+	.name		= "omap2-mailbox",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(omap_mbox_resources),
+	.resource	= omap_mbox_resources,
+};
+
+static inline void omap_mbox_init(void)
+{
+	platform_device_register(&omap_mbox_device);
+}
+#else
+static inline void omap_mbox_init(void) { }
+#endif	/* CONFIG_OMAP_MBOX_FWK */
+
+static int __init omap44xx_init_devices(void)
+{
+	if (!cpu_is_omap44xx())
+		return;
+
+	omap_mbox_init();
+
+	return 0;
+}
+arch_initcall(omap44xx_init_devices);