]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/devices.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / devices.c
index ce03fa750775d25d4d715175218354e90a8d2567..dad4528d345166cc731e1ee4f408858846edb2b0 100644 (file)
 #include <mach/eac.h>
 #include <mach/mmc.h>
 
-#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
-#define OMAP2_MBOX_BASE                IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
+#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
 
-static struct resource mbox_resources[] = {
+static struct resource cam_resources[] = {
        {
-               .start          = OMAP2_MBOX_BASE,
-               .end            = OMAP2_MBOX_BASE + 0x11f,
+               .start          = OMAP24XX_CAMERA_BASE,
+               .end            = OMAP24XX_CAMERA_BASE + 0xfff,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = INT_24XX_CAM_IRQ,
+               .flags          = IORESOURCE_IRQ,
+       }
+};
+
+static struct platform_device omap_cam_device = {
+       .name           = "omap24xxcam",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(cam_resources),
+       .resource       = cam_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+       platform_device_register(&omap_cam_device);
+}
+
+#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
+
+static struct resource cam_resources[] = {
+       {
+               .start          = OMAP34XX_CAMERA_BASE,
+               .end            = OMAP34XX_CAMERA_BASE + 0x1B70,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = INT_34XX_CAM_IRQ,
+               .flags          = IORESOURCE_IRQ,
+       }
+};
+
+static struct platform_device omap_cam_device = {
+       .name           = "omap34xxcam",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(cam_resources),
+       .resource       = cam_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+       platform_device_register(&omap_cam_device);
+}
+#else
+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
+
+static struct resource omap2_mbox_resources[] = {
+       {
+               .start          = OMAP24XX_MAILBOX_BASE,
+               .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
                .flags          = IORESOURCE_MEM,
        },
        {
@@ -47,20 +105,39 @@ static struct resource mbox_resources[] = {
        },
 };
 
+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 struct platform_device mbox_device = {
-       .name           = "mailbox",
+       .name           = "omap2-mailbox",
        .id             = -1,
-       .num_resources  = ARRAY_SIZE(mbox_resources),
-       .resource       = mbox_resources,
 };
 
 static inline void omap_init_mbox(void)
 {
+       if (cpu_is_omap2420()) {
+               mbox_device.num_resources = ARRAY_SIZE(omap2_mbox_resources);
+               mbox_device.resource = omap2_mbox_resources;
+       } else if (cpu_is_omap3430()) {
+               mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
+               mbox_device.resource = omap3_mbox_resources;
+       } else {
+               return;
+       }
        platform_device_register(&mbox_device);
 }
 #else
 static inline void omap_init_mbox(void) { }
-#endif
+#endif /* CONFIG_OMAP_MBOX_FWK */
 
 #if defined(CONFIG_OMAP_STI)
 
@@ -227,10 +304,12 @@ static void omap_init_mcspi(void)
        platform_device_register(&omap2_mcspi1);
        platform_device_register(&omap2_mcspi2);
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
-       platform_device_register(&omap2_mcspi3);
+       if (cpu_is_omap2430() || cpu_is_omap343x())
+               platform_device_register(&omap2_mcspi3);
 #endif
 #ifdef CONFIG_ARCH_OMAP3
-       platform_device_register(&omap2_mcspi4);
+       if (cpu_is_omap343x())
+               platform_device_register(&omap2_mcspi4);
 #endif
 }
 
@@ -240,12 +319,12 @@ static inline void omap_init_mcspi(void) {}
 
 #ifdef CONFIG_SND_OMAP24XX_EAC
 
-#define OMAP2_EAC_BASE                 0x48090000
+#define OMAP2_EAC_BASE                 (L4_24XX_BASE + 0x90000)
 
 static struct resource omap2_eac_resources[] = {
        {
                .start          = OMAP2_EAC_BASE,
-               .end            = OMAP2_EAC_BASE + 0x109,
+               .end            = OMAP2_EAC_BASE + 0xfff,
                .flags          = IORESOURCE_MEM,
        },
 };
@@ -506,6 +585,7 @@ static int __init omap2_init_devices(void)
         * in alphabetical order so they're easier to sort through.
         */
        omap_hsmmc_reset();
+       omap_init_camera();
        omap_init_mbox();
        omap_init_mcspi();
        omap_hdq_init();