Merge branch 'devel-stable' into devel
[deliverable/linux.git] / arch / arm / mach-omap2 / devices.c
index 18ad93160abbc5fca7bf68ae3dba578c7f2f22b9..12154d10e53646a2abef4e70050792ab72a29b0c 100644 (file)
 #include <linux/clk.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
+#include <asm/pmu.h>
 
 #include <plat/control.h>
 #include <plat/tc.h>
@@ -141,7 +143,7 @@ static inline void omap_init_camera(void)
 #define MBOX_REG_SIZE   0x120
 
 #ifdef CONFIG_ARCH_OMAP2
-static struct resource omap_mbox_resources[] = {
+static struct resource omap2_mbox_resources[] = {
        {
                .start          = OMAP24XX_MAILBOX_BASE,
                .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -156,10 +158,14 @@ static struct resource omap_mbox_resources[] = {
                .flags          = IORESOURCE_IRQ,
        },
 };
+static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
+#else
+#define omap2_mbox_resources           NULL
+#define omap2_mbox_resources_sz                0
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-static struct resource omap_mbox_resources[] = {
+static struct resource omap3_mbox_resources[] = {
        {
                .start          = OMAP34XX_MAILBOX_BASE,
                .end            = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -170,12 +176,16 @@ static struct resource omap_mbox_resources[] = {
                .flags          = IORESOURCE_IRQ,
        },
 };
+static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
+#else
+#define omap3_mbox_resources           NULL
+#define omap3_mbox_resources_sz                0
 #endif
 
 #ifdef CONFIG_ARCH_OMAP4
 
 #define OMAP4_MBOX_REG_SIZE    0x130
-static struct resource omap_mbox_resources[] = {
+static struct resource omap4_mbox_resources[] = {
        {
                .start          = OMAP44XX_MAILBOX_BASE,
                .end            = OMAP44XX_MAILBOX_BASE +
@@ -183,10 +193,14 @@ static struct resource omap_mbox_resources[] = {
                .flags          = IORESOURCE_MEM,
        },
        {
-               .start          = INT_44XX_MAIL_U0_MPU,
+               .start          = OMAP44XX_IRQ_MAIL_U0,
                .flags          = IORESOURCE_IRQ,
        },
 };
+static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
+#else
+#define omap4_mbox_resources           NULL
+#define omap4_mbox_resources_sz                0
 #endif
 
 static struct platform_device mbox_device = {
@@ -196,9 +210,15 @@ static struct platform_device mbox_device = {
 
 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;
+       if (cpu_is_omap24xx()) {
+               mbox_device.resource = omap2_mbox_resources;
+               mbox_device.num_resources = omap2_mbox_resources_sz;
+       } else if (cpu_is_omap34xx()) {
+               mbox_device.resource = omap3_mbox_resources;
+               mbox_device.num_resources = omap3_mbox_resources_sz;
+       } else if (cpu_is_omap44xx()) {
+               mbox_device.resource = omap4_mbox_resources;
+               mbox_device.num_resources = omap4_mbox_resources_sz;
        } else {
                pr_err("%s: platform not supported\n", __func__);
                return;
@@ -435,6 +455,37 @@ static void omap_init_mcspi(void)
 static inline void omap_init_mcspi(void) {}
 #endif
 
+static struct resource omap2_pmu_resource = {
+       .start  = 3,
+       .end    = 3,
+       .flags  = IORESOURCE_IRQ,
+};
+
+static struct resource omap3_pmu_resource = {
+       .start  = INT_34XX_BENCH_MPU_EMUL,
+       .end    = INT_34XX_BENCH_MPU_EMUL,
+       .flags  = IORESOURCE_IRQ,
+};
+
+static struct platform_device omap_pmu_device = {
+       .name           = "arm-pmu",
+       .id             = ARM_PMU_DEVICE_CPU,
+       .num_resources  = 1,
+};
+
+static void omap_init_pmu(void)
+{
+       if (cpu_is_omap24xx())
+               omap_pmu_device.resource = &omap2_pmu_resource;
+       else if (cpu_is_omap34xx())
+               omap_pmu_device.resource = &omap3_pmu_resource;
+       else
+               return;
+
+       platform_device_register(&omap_pmu_device);
+}
+
+
 #ifdef CONFIG_OMAP_SHA1_MD5
 static struct resource sha1_md5_resources[] = {
        {
@@ -492,7 +543,12 @@ static struct platform_device dummy_pdev = {
  **/
 static void __init omap_hsmmc_reset(void)
 {
-       u32 i, nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
+       u32 i, nr_controllers;
+
+       if (cpu_is_omap242x())
+               return;
+
+       nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
                (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
 
        for (i = 0; i < nr_controllers; i++) {
@@ -697,13 +753,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                        if (!cpu_is_omap44xx())
                                return;
                        base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
-                       irq = INT_44XX_MMC4_IRQ;
+                       irq = OMAP44XX_IRQ_MMC4;
                        break;
                case 4:
                        if (!cpu_is_omap44xx())
                                return;
                        base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
-                       irq = INT_44XX_MMC5_IRQ;
+                       irq = OMAP44XX_IRQ_MMC5;
                        break;
                default:
                        continue;
@@ -715,7 +771,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                } else if (cpu_is_omap44xx()) {
                        if (i < 3) {
                                base += OMAP4_MMC_REG_OFFSET;
-                               irq += IRQ_GIC_START;
+                               irq += OMAP44XX_IRQ_GIC_START;
                        }
                        size = OMAP4_HSMMC_SIZE;
                        name = "mmci-omap-hs";
@@ -774,6 +830,7 @@ static int __init omap2_init_devices(void)
        omap_init_camera();
        omap_init_mbox();
        omap_init_mcspi();
+       omap_init_pmu();
        omap_hdq_init();
        omap_init_sti();
        omap_init_sha1_md5();
This page took 0.025605 seconds and 5 git commands to generate.