From: 黄涛 Date: Tue, 7 Feb 2012 08:01:27 +0000 (+0800) Subject: rk30: move nand device from board to devices.c X-Git-Tag: firefly_0821_release~9595^2~174 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e21b7af41ba3cb36291f33dfa35159d721d5c146;p=firefly-linux-kernel-4.4.55.git rk30: move nand device from board to devices.c --- diff --git a/arch/arm/mach-rk30/board-rk30-sdk.c b/arch/arm/mach-rk30/board-rk30-sdk.c index 494cc9bc848e..d31641290823 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk.c +++ b/arch/arm/mach-rk30/board-rk30-sdk.c @@ -34,48 +34,27 @@ #include #include -//#include "devices.h" #include -#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 diff --git a/arch/arm/mach-rk30/devices.c b/arch/arm/mach-rk30/devices.c index 69e7b09315d6..20c0b7294eb9 100644 --- a/arch/arm/mach-rk30/devices.c +++ b/arch/arm/mach-rk30/devices.c @@ -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);