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/edb93xx | |
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/edb93xx')
-rw-r--r-- | arch/arm/boards/edb93xx/edb93xx.c | 91 |
1 files changed, 18 insertions, 73 deletions
diff --git a/arch/arm/boards/edb93xx/edb93xx.c b/arch/arm/boards/edb93xx/edb93xx.c index 85fd2c0fe8..49a01d6507 100644 --- a/arch/arm/boards/edb93xx/edb93xx.c +++ b/arch/arm/boards/edb93xx/edb93xx.c @@ -45,64 +45,6 @@ static struct device_d cfi_dev = { .size = EDB93XX_CFI_FLASH_SIZE, }; -static struct memory_platform_data ram_dev_pdata0 = { - .name = "ram0", - .flags = IORESOURCE_MEM_WRITEABLE, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK0_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK0_SIZE, - .platform_data = &ram_dev_pdata0, -}; - -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2) -static struct memory_platform_data ram_dev_pdata1 = { - .name = "ram1", - .flags = IORESOURCE_MEM_WRITEABLE, -}; - -static struct device_d sdram1_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK1_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK1_SIZE, - .platform_data = &ram_dev_pdata1, -}; -#endif - -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3) -static struct memory_platform_data ram_dev_pdata2 = { - .name = "ram2", - .flags = IORESOURCE_MEM_WRITEABLE, -}; - -static struct device_d sdram2_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK2_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK2_SIZE, - .platform_data = &ram_dev_pdata2, -}; -#endif - -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4) -static struct memory_platform_data ram_dev_pdata3 = { - .name = "ram3", - .flags = IORESOURCE_MEM_WRITEABLE, -}; - -static struct device_d sdram3_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK3_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK3_SIZE, - .platform_data = &ram_dev_pdata3, -}; -#endif - static struct device_d eth_dev = { .id = -1, .name = "ep93xx_eth", @@ -110,6 +52,8 @@ static struct device_d eth_dev = { static int ep93xx_devices_init(void) { + struct device_d *sdram_dev; + register_device(&cfi_dev); /* @@ -121,26 +65,27 @@ static int ep93xx_devices_init(void) protect_file("/dev/env0", 1); - register_device(&sdram0_dev); -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2) - register_device(&sdram1_dev); -#endif -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3) - register_device(&sdram2_dev); -#endif -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4) - register_device(&sdram3_dev); -#endif - - armlinux_add_dram(&sdram0_dev); + sdram_dev = add_mem_device("ram0", CONFIG_EP93XX_SDRAM_BANK0_BASE, + CONFIG_EP93XX_SDRAM_BANK0_SIZE, + IORESOURCE_MEM_WRITEABLE); + armlinux_add_dram(sdram_dev); #if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2) - armlinux_add_dram(&sdram1_dev); + sdram_dev = add_mem_device("ram1", CONFIG_EP93XX_SDRAM_BANK1_BASE, + CONFIG_EP93XX_SDRAM_BANK1_SIZE, + IORESOURCE_MEM_WRITEABLE); + armlinux_add_dram(sdram_dev); #endif #if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3) - armlinux_add_dram(&sdram2_dev); + sdram_dev = add_mem_device("ram2", CONFIG_EP93XX_SDRAM_BANK2_BASE, + CONFIG_EP93XX_SDRAM_BANK2_SIZE, + IORESOURCE_MEM_WRITEABLE); + armlinux_add_dram(sdram_dev); #endif #if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4) - armlinux_add_dram(&sdram3_dev); + sdram_dev = add_mem_device("ram3", CONFIG_EP93XX_SDRAM_BANK3_BASE, + CONFIG_EP93XX_SDRAM_BANK2_SIZE, + IORESOURCE_MEM_WRITEABLE); + armlinux_add_dram(sdram_dev); #endif register_device(ð_dev); |