summaryrefslogtreecommitdiffstats
path: root/common/startup.c
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 /common/startup.c
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 'common/startup.c')
-rw-r--r--common/startup.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/common/startup.c b/common/startup.c
index 2e28cb2264..bf67aef152 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -82,21 +82,11 @@ void early_init (void)
#ifdef CONFIG_DEFAULT_ENVIRONMENT
#include <generated/barebox_default_env.h>
-static struct memory_platform_data default_env_platform_data = {
- .name = "defaultenv",
-};
-
-static struct device_d default_env_dev = {
- .id = -1,
- .name = "mem",
- .platform_data = &default_env_platform_data,
-};
-
static int register_default_env(void)
{
- default_env_dev.map_base = (unsigned long)default_environment;
- default_env_dev.size = sizeof(default_environment);
- register_device(&default_env_dev);
+ add_mem_device("defaultenv", (unsigned long)default_environment,
+ sizeof(default_environment),
+ IORESOURCE_MEM_WRITEABLE);
return 0;
}