rk30: move nand device from board to devices.c
author黄涛 <huangtao@rock-chips.com>
Tue, 7 Feb 2012 08:01:27 +0000 (16:01 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 7 Feb 2012 08:01:27 +0000 (16:01 +0800)
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/devices.c

index 494cc9bc848e8f85c973c6e0d4587863a9c7ce22..d31641290823f76e530c1d3df7840bf13ab35e8d 100755 (executable)
 
 #include <mach/board.h>
 #include <mach/hardware.h>
-//#include "devices.h"
 #include <mach/io.h>
 
-#if defined(CONFIG_MTD_NAND_RK29XX)  
-
-static struct resource rk30xxnand_resources[] = {
-       {
-               .start  = RK30_NANDC_PHYS,
-               .end    = RK30_NANDC_PHYS+RK30_NANDC_SIZE -1,
-               .flags  = IORESOURCE_MEM,
-       }
-};
-
-struct platform_device rk30xx_device_nand = {
-       .name   = "rk30xxnand", 
-       .id             =  -1, 
-       .resource       = rk30xxnand_resources,
-       .num_resources= ARRAY_SIZE(rk30xxnand_resources),
-};
-#endif
-
 static struct platform_device *devices[] __initdata = {
-#ifdef CONFIG_MTD_NAND_RK29XX
-       &rk30xx_device_nand,
-#endif
 };
+
 static void __init machine_rk30_board_init(void)
 {
-    platform_add_devices(devices, ARRAY_SIZE(devices));
+       platform_add_devices(devices, ARRAY_SIZE(devices));
 }
 
-
 static void __init rk30_reserve(void)
 {
-    board_mem_reserved();
+       board_mem_reserved();
 }
+
 MACHINE_START(RK30, "RK30board")
        .boot_params    = PLAT_PHYS_OFFSET + 0x800,
        .fixup          = rk30_fixup,
        .map_io         = rk30_map_io,
        .init_irq       = rk30_init_irq,
        .timer          = &rk30_timer,
-    .reserve    = &rk30_reserve,
+       .reserve        = &rk30_reserve,
        .init_machine   = machine_rk30_board_init,
 MACHINE_END
index 69e7b09315d69d8cd4e4968b5c6715eee40c9309..20c0b7294eb9ba4d63e5bb5aaeea46b2a3e94236 100644 (file)
@@ -126,9 +126,29 @@ static void __init rk30_init_uart(void)
 #endif
 }
 
+#ifdef CONFIG_MTD_NAND_RK29XX
+static struct resource resources_nand[] = {
+       {
+               .start  = RK30_NANDC_PHYS,
+               .end    = RK30_NANDC_PHYS + RK30_NANDC_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device device_nand = {
+       .name           = "rk30xxnand",
+       .id             = -1,
+       .resource       = resources_nand,
+       .num_resources  = ARRAY_SIZE(resources_nand),
+};
+#endif
+
 static int __init rk30_init_devices(void)
 {
        rk30_init_uart();
+#ifdef CONFIG_MTD_NAND_RK29XX
+       platform_device_register(&device_nand);
+#endif
         return 0;
 }
 arch_initcall(rk30_init_devices);