summaryrefslogtreecommitdiffstats
path: root/arch/nios2/boards
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-07-19 09:58:32 +0200
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-07-18 20:32:45 +0800
commitf928efa818adfe56a08350569a9b0f3c2fb791d2 (patch)
tree4fc754655afbd235d466a5c9d7a63ce89faed24b /arch/nios2/boards
parent88618eb5f12c27be7bb4400eb13768e4c2822ae7 (diff)
downloadbarebox-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/nios2/boards')
-rw-r--r--arch/nios2/boards/generic/generic.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/arch/nios2/boards/generic/generic.c b/arch/nios2/boards/generic/generic.c
index 5d6df8edba..37adfaa3b6 100644
--- a/arch/nios2/boards/generic/generic.c
+++ b/arch/nios2/boards/generic/generic.c
@@ -21,19 +21,6 @@ static struct device_d mac_dev = {
.platform_data = &phy_address,
};
-static struct memory_platform_data ram_pdata = {
- .name = "ram0",
- .flags = IORESOURCE_MEM_WRITEABLE,
-};
-
-static struct device_d ram_dev = {
- .id = -1,
- .name = "mem",
- .map_base = NIOS_SOPC_MEMORY_BASE,
- .size = NIOS_SOPC_MEMORY_SIZE,
- .platform_data = &ram_pdata,
-};
-
static struct device_d altera_serial_device = {
.id = -1,
.name = "altera_serial",
@@ -51,7 +38,8 @@ static struct device_d epcs_flash_device = {
static int generic_devices_init(void)
{
register_device(&cfi_dev);
- register_device(&ram_dev);
+ add_mem_device("ram0", NIOS_SOPC_MEMORY_BASE, NIOS_SOPC_MEMORY_SIZE,
+ IORESOURCE_MEM_WRITEABLE);
register_device(&mac_dev);
/*register_device(&epcs_flash_device);*/