rk30: move nand device from board to devices.c

This commit is contained in:
黄涛
2012-02-07 16:01:27 +08:00
parent 32001abe7c
commit e21b7af41b
2 changed files with 25 additions and 26 deletions

View File

@@ -34,48 +34,27 @@
#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

View 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);