]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] pxa: move device registration into CPU-specific file
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Tue, 15 May 2007 09:39:49 +0000 (10:39 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 Jul 2007 13:28:21 +0000 (14:28 +0100)
This allows individual CPU support to determine which platform
devices should be registered.  Also fix a copy-n-paste bug in
the I2C power platform device entry.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/generic.h
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa27x.c

index 147b7c40d9f9fe2411cc76c572cee2f5227a8023..a496e498ef57bffb9236afeab4d28ac29807b17f 100644 (file)
@@ -242,7 +242,7 @@ static struct resource pxamci_resources[] = {
 
 static u64 pxamci_dmamask = 0xffffffffUL;
 
-static struct platform_device pxamci_device = {
+struct platform_device pxamci_device = {
        .name           = "pxa2xx-mci",
        .id             = -1,
        .dev            = {
@@ -281,7 +281,7 @@ static struct resource pxa2xx_udc_resources[] = {
 
 static u64 udc_dma_mask = ~(u32)0;
 
-static struct platform_device udc_device = {
+struct platform_device pxaudc_device = {
        .name           = "pxa2xx-udc",
        .id             = -1,
        .resource       = pxa2xx_udc_resources,
@@ -307,7 +307,7 @@ static struct resource pxafb_resources[] = {
 
 static u64 fb_dma_mask = ~(u64)0;
 
-static struct platform_device pxafb_device = {
+struct platform_device pxafb_device = {
        .name           = "pxa2xx-fb",
        .id             = -1,
        .dev            = {
@@ -328,24 +328,24 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
        pxafb_device.dev.parent = parent_dev;
 }
 
-static struct platform_device ffuart_device = {
+struct platform_device ffuart_device = {
        .name           = "pxa2xx-uart",
        .id             = 0,
 };
-static struct platform_device btuart_device = {
+struct platform_device btuart_device = {
        .name           = "pxa2xx-uart",
        .id             = 1,
 };
-static struct platform_device stuart_device = {
+struct platform_device stuart_device = {
        .name           = "pxa2xx-uart",
        .id             = 2,
 };
-static struct platform_device hwuart_device = {
+struct platform_device hwuart_device = {
        .name           = "pxa2xx-uart",
        .id             = 3,
 };
 
-static struct resource i2c_resources[] = {
+static struct resource pxai2c_resources[] = {
        {
                .start  = 0x40301680,
                .end    = 0x403016a3,
@@ -357,40 +357,19 @@ static struct resource i2c_resources[] = {
        },
 };
 
-static struct platform_device i2c_device = {
+struct platform_device pxai2c_device = {
        .name           = "pxa2xx-i2c",
        .id             = 0,
-       .resource       = i2c_resources,
-       .num_resources  = ARRAY_SIZE(i2c_resources),
+       .resource       = pxai2c_resources,
+       .num_resources  = ARRAY_SIZE(pxai2c_resources),
 };
 
-#ifdef CONFIG_PXA27x
-static struct resource i2c_power_resources[] = {
-       {
-               .start  = 0x40f00180,
-               .end    = 0x40f001a3,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = IRQ_PWRI2C,
-               .end    = IRQ_PWRI2C,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device i2c_power_device = {
-       .name           = "pxa2xx-i2c",
-       .id             = 1,
-       .resource       = i2c_power_resources,
-       .num_resources  = ARRAY_SIZE(i2c_resources),
-};
-#endif
-
 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
 {
-       i2c_device.dev.platform_data = info;
+       pxai2c_device.dev.platform_data = info;
 }
 
-static struct resource i2s_resources[] = {
+static struct resource pxai2s_resources[] = {
        {
                .start  = 0x40400000,
                .end    = 0x40400083,
@@ -402,16 +381,16 @@ static struct resource i2s_resources[] = {
        },
 };
 
-static struct platform_device i2s_device = {
+struct platform_device pxai2s_device = {
        .name           = "pxa2xx-i2s",
        .id             = -1,
-       .resource       = i2s_resources,
-       .num_resources  = ARRAY_SIZE(i2s_resources),
+       .resource       = pxai2s_resources,
+       .num_resources  = ARRAY_SIZE(pxai2s_resources),
 };
 
 static u64 pxaficp_dmamask = ~(u32)0;
 
-static struct platform_device pxaficp_device = {
+struct platform_device pxaficp_device = {
        .name           = "pxa2xx-ir",
        .id             = -1,
        .dev            = {
@@ -425,40 +404,7 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
        pxaficp_device.dev.platform_data = info;
 }
 
-static struct platform_device pxartc_device = {
+struct platform_device pxartc_device = {
        .name           = "sa1100-rtc",
        .id             = -1,
 };
-
-static struct platform_device *devices[] __initdata = {
-       &pxamci_device,
-       &udc_device,
-       &pxafb_device,
-       &ffuart_device,
-       &btuart_device,
-       &stuart_device,
-       &pxaficp_device,
-       &i2c_device,
-#ifdef CONFIG_PXA27x
-       &i2c_power_device,
-#endif
-       &i2s_device,
-       &pxartc_device,
-};
-
-static int __init pxa_init(void)
-{
-       int ret;
-
-       ret = platform_add_devices(devices, ARRAY_SIZE(devices));
-       if (ret)
-               return ret;
-
-       /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
-       if (cpu_is_pxa25x())
-               ret = platform_device_register(&hwuart_device);
-
-       return ret;
-}
-
-subsys_initcall(pxa_init);
index 91ab2ad8b34b78020da69be0bc71c5597c529ab4..b9b96ec4b9bc814d416f889bba41e994552fd693 100644 (file)
@@ -26,3 +26,14 @@ extern unsigned int get_clk_frequency_khz(int info);
        mi->bank[__nr].size = (__size), \
        mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
 
+extern struct platform_device pxamci_device;
+extern struct platform_device pxaudc_device;
+extern struct platform_device pxafb_device;
+extern struct platform_device ffuart_device;
+extern struct platform_device btuart_device;
+extern struct platform_device stuart_device;
+extern struct platform_device hwuart_device;
+extern struct platform_device pxai2c_device;
+extern struct platform_device pxai2s_device;
+extern struct platform_device pxaficp_device;
+extern struct platform_device pxartc_device;
index 13437582342d3dfaf21ebe4e7780e1ec81f9a34a..72b949bdf6589dc9e8a7b4dd9167ae41f973942b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/platform_device.h>
 #include <linux/pm.h>
 
 #include <asm/hardware.h>
@@ -136,6 +137,19 @@ void __init pxa25x_init_irq(void)
        pxa_init_irq_gpio(85);
 }
 
+static struct platform_device *pxa25x_devices[] __initdata = {
+       &pxamci_device,
+       &pxaudc_device,
+       &pxafb_device,
+       &ffuart_device,
+       &btuart_device,
+       &stuart_device,
+       &pxai2c_device,
+       &pxai2s_device,
+       &pxaficp_device,
+       &pxartc_device,
+};
+
 static int __init pxa25x_init(void)
 {
        int ret = 0;
@@ -146,8 +160,14 @@ static int __init pxa25x_init(void)
 #ifdef CONFIG_PM
                pm_set_ops(&pxa25x_pm_ops);
 #endif
+               ret = platform_add_devices(pxa25x_devices,
+                                          ARRAY_SIZE(pxa25x_devices));
        }
-       return 0; 
+       /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
+       if (cpu_is_pxa25x())
+               ret = platform_device_register(&hwuart_device);
+
+       return ret;
 }
 
 subsys_initcall(pxa25x_init);
index 5b819e2c556394103784a6c158c6a9d8e07aed24..27fd2fa56eaf087337e09ec7154c161d511cc395 100644 (file)
@@ -184,7 +184,7 @@ static struct resource pxa27x_ohci_resources[] = {
        },
 };
 
-static struct platform_device ohci_device = {
+static struct platform_device pxaohci_device = {
        .name           = "pxa27x-ohci",
        .id             = -1,
        .dev            = {
@@ -197,11 +197,41 @@ static struct platform_device ohci_device = {
 
 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
 {
-       ohci_device.dev.platform_data = info;
+       pxaohci_device.dev.platform_data = info;
 }
 
+static struct resource i2c_power_resources[] = {
+       {
+               .start  = 0x40f00180,
+               .end    = 0x40f001a3,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_PWRI2C,
+               .end    = IRQ_PWRI2C,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device pxai2c_power_device = {
+       .name           = "pxa2xx-i2c",
+       .id             = 1,
+       .resource       = i2c_power_resources,
+       .num_resources  = ARRAY_SIZE(i2c_power_resources),
+};
+
 static struct platform_device *devices[] __initdata = {
-       &ohci_device,
+       &pxamci_device,
+       &pxaudc_device,
+       &pxafb_device,
+       &ffuart_device,
+       &btuart_device,
+       &stuart_device,
+       &pxai2c_device,
+       &pxai2c_power_device,
+       &pxai2s_device,
+       &pxaficp_device,
+       &pxartc_device,
+       &pxaohci_device,
 };
 
 void __init pxa27x_init_irq(void)