diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-07-19 09:58:32 +0200 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-07-18 20:32:45 +0800 |
commit | f928efa818adfe56a08350569a9b0f3c2fb791d2 (patch) | |
tree | 4fc754655afbd235d466a5c9d7a63ce89faed24b /arch/arm/boards/a9m2440 | |
parent | 88618eb5f12c27be7bb4400eb13768e4c2822ae7 (diff) | |
download | barebox-f928efa818adfe56a08350569a9b0f3c2fb791d2.tar.gz barebox-f928efa818adfe56a08350569a9b0f3c2fb791d2.tar.xz |
add a add_mem_device function
Add a helper function for boards to register their memory
devices. This makes the board code smaller and also helps
getting rid of map_base and struct memory_platform_data.
And switch all of the memory to it
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm/boards/a9m2440')
-rw-r--r-- | arch/arm/boards/a9m2440/a9m2440.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/arch/arm/boards/a9m2440/a9m2440.c b/arch/arm/boards/a9m2440/a9m2440.c index 55e9e8e953..7ea7f1ca18 100644 --- a/arch/arm/boards/a9m2440/a9m2440.c +++ b/arch/arm/boards/a9m2440/a9m2440.c @@ -38,18 +38,6 @@ #include "baseboards.h" -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = IORESOURCE_MEM_WRITEABLE, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = CS6_BASE, - .platform_data = &ram_pdata, -}; - static struct s3c24x0_nand_platform_data nand_info = { .nand_timing = CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1) }; @@ -106,6 +94,7 @@ static void a9m2440_disable_second_sdram_bank(void) static int a9m2440_devices_init(void) { uint32_t reg; + struct device_d *sdram_dev; /* * The special SDRAM setup code for this machine will always enable @@ -136,8 +125,6 @@ static int a9m2440_devices_init(void) break; } - sdram_dev.size = s3c24x0_get_memory_size(); - /* ----------- configure the access to the outer space ---------- */ reg = readl(BWSCON); @@ -159,7 +146,8 @@ static int a9m2440_devices_init(void) /* ----------- the devices the boot loader should work with -------- */ register_device(&nand_dev); - register_device(&sdram_dev); + sdram_dev = add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size(), + IORESOURCE_MEM_WRITEABLE); register_device(&network_dev); #ifdef CONFIG_NAND @@ -170,8 +158,8 @@ static int a9m2440_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); #endif - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void *)sdram_dev.map_base + 0x100); + armlinux_add_dram(sdram_dev); + armlinux_set_bootparams(dev_get_mem_region(sdram_dev, 0) + 0x100); armlinux_set_architecture(MACH_TYPE_A9M2440); return 0; |