diff options
author | Juergen Beisert <jbe@pengutronix.de> | 2012-01-02 12:44:01 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-01-02 13:32:14 +0100 |
commit | 59994faae6162e0e29a0add7cd24023eac0c9580 (patch) | |
tree | e1ad4ae7e4b0f66dd3f6ac0c0e7d2b2ec59cf4a0 /arch/arm/boards/a9m2410 | |
parent | b8560b2b2f9a12baf42ca6cf426bd59342d4e0a3 (diff) | |
download | barebox-59994faae6162e0e29a0add7cd24023eac0c9580.tar.gz barebox-59994faae6162e0e29a0add7cd24023eac0c9580.tar.xz |
MACH SAMSUNG/S3C: Re-work the memory detection and handling
Keep common code in the MACH instead of re-inventing it in each platform.
Also use S3C* macros for all memory related register.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/a9m2410')
-rw-r--r-- | arch/arm/boards/a9m2410/a9m2410.c | 47 | ||||
-rw-r--r-- | arch/arm/boards/a9m2410/lowlevel_init.S | 4 |
2 files changed, 14 insertions, 37 deletions
diff --git a/arch/arm/boards/a9m2410/a9m2410.c b/arch/arm/boards/a9m2410/a9m2410.c index a66afb937a..daaa5c1c1a 100644 --- a/arch/arm/boards/a9m2410/a9m2410.c +++ b/arch/arm/boards/a9m2410/a9m2410.c @@ -34,6 +34,8 @@ #include <io.h> #include <mach/s3c-iomap.h> #include <mach/s3c24xx-nand.h> +#include <mach/s3c-generic.h> +#include <mach/s3c-busctl.h> // {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, static struct s3c24x0_nand_platform_data nand_info = { @@ -42,38 +44,13 @@ static struct s3c24x0_nand_platform_data nand_info = { static int a9m2410_mem_init(void) { - resource_size_t size = 0; - uint32_t reg; + resource_size_t size; /* - * detect the current memory size * Note: On this card the second SDRAM page is not used */ - reg = readl(BANKSIZE); - - switch (reg &= 0x7) { - case 0: - size = 32 * 1024 * 1024; - break; - case 1: - size = 64 * 1024 * 1024; - break; - case 2: - size = 128 * 1024 * 1024; - break; - case 4: - size = 2 * 1024 * 1024; - break; - case 5: - size = 4 * 1024 * 1024; - break; - case 6: - size = 8 * 1024 * 1024; - break; - case 7: - size = 16 * 1024 * 1024; - break; - } + s3c24xx_disable_second_sdram_bank(); + size = s3c24xx_get_memory_size(); /* ---------- configure the GPIOs ------------- */ writel(0x007FFFFF, GPACON); @@ -100,7 +77,7 @@ static int a9m2410_mem_init(void) */ writel(0x40140, MISCCR); - arm_add_mem_device("ram0", CS6_BASE, size); + arm_add_mem_device("ram0", S3C_SDRAM_BASE, size); return 0; } @@ -111,19 +88,19 @@ static int a9m2410_devices_init(void) uint32_t reg; /* ----------- configure the access to the outer space ---------- */ - reg = readl(BWSCON); + reg = readl(S3C_BWSCON); /* CS#1 to access the network controller */ reg &= ~0xf0; reg |= 0xe0; - writel(0x1350, BANKCON1); + writel(0x1350, S3C_BANKCON1); /* CS#2 to the dual 16550 UART */ reg &= ~0xf00; reg |= 0x400; - writel(0x0d50, BANKCON2); + writel(0x0d50, S3C_BANKCON2); - writel(reg, BWSCON); + writel(reg, S3C_BWSCON); /* release the reset signal to the network and UART device */ reg = readl(MISCCR); @@ -138,7 +115,7 @@ static int a9m2410_devices_init(void) * connected to CS line 1 and interrupt line * GPIO3, data width is 32 bit */ - add_generic_device("smc91c111", -1, NULL, CS1_BASE + 0x300, 16, + add_generic_device("smc91c111", -1, NULL, S3C_CS1_BASE + 0x300, 16, IORESOURCE_MEM, NULL); #ifdef CONFIG_NAND @@ -150,7 +127,7 @@ static int a9m2410_devices_init(void) dev_add_bb_dev("env_raw", "env0"); #endif - armlinux_set_bootparams((void*)CS6_BASE + 0x100); + armlinux_set_bootparams((void*)S3C_SDRAM_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_A9M2410); return 0; diff --git a/arch/arm/boards/a9m2410/lowlevel_init.S b/arch/arm/boards/a9m2410/lowlevel_init.S index 752c668195..a106d53a1d 100644 --- a/arch/arm/boards/a9m2410/lowlevel_init.S +++ b/arch/arm/boards/a9m2410/lowlevel_init.S @@ -15,9 +15,9 @@ board_init_lowlevel: bl s3c24x0_disable_wd /* skip everything here if we are already running from SDRAM */ - cmp pc, #S3C24X0_SDRAM_BASE + cmp pc, #S3C_SDRAM_BASE blo 1f - cmp pc, #S3C24X0_SDRAM_END + cmp pc, #S3C_SDRAM_END bhs 1f mov pc, r10 |