summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/a9m2440
diff options
context:
space:
mode:
authorJuergen Beisert <jbe@pengutronix.de>2012-01-02 12:44:01 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-01-02 13:32:14 +0100
commit59994faae6162e0e29a0add7cd24023eac0c9580 (patch)
treee1ad4ae7e4b0f66dd3f6ac0c0e7d2b2ec59cf4a0 /arch/arm/boards/a9m2440
parentb8560b2b2f9a12baf42ca6cf426bd59342d4e0a3 (diff)
downloadbarebox-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/a9m2440')
-rw-r--r--arch/arm/boards/a9m2440/a9m2410dev.c9
-rw-r--r--arch/arm/boards/a9m2440/a9m2440.c37
-rw-r--r--arch/arm/boards/a9m2440/lowlevel_init.S6
3 files changed, 24 insertions, 28 deletions
diff --git a/arch/arm/boards/a9m2440/a9m2410dev.c b/arch/arm/boards/a9m2440/a9m2410dev.c
index aa5da880b2..1da69eb814 100644
--- a/arch/arm/boards/a9m2440/a9m2410dev.c
+++ b/arch/arm/boards/a9m2440/a9m2410dev.c
@@ -29,6 +29,7 @@
#include <init.h>
#include <io.h>
#include <mach/s3c-iomap.h>
+#include <mach/s3c-busctl.h>
/**
* Initialize the CPU to be able to work with the a9m2410dev evaluation board
@@ -72,19 +73,19 @@ int a9m2410dev_devices_init(void)
writel((readl(MISCCR) & ~0xFFFF) | 0x0140, MISCCR);
/* ----------- 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);
diff --git a/arch/arm/boards/a9m2440/a9m2440.c b/arch/arm/boards/a9m2440/a9m2440.c
index 077d726aab..56ae9149ca 100644
--- a/arch/arm/boards/a9m2440/a9m2440.c
+++ b/arch/arm/boards/a9m2440/a9m2440.c
@@ -35,6 +35,7 @@
#include <mach/s3c-iomap.h>
#include <mach/s3c24xx-nand.h>
#include <mach/s3c-generic.h>
+#include <mach/s3c-busctl.h>
#include "baseboards.h"
@@ -66,12 +67,6 @@ static int a9m2440_check_for_ram(uint32_t addr)
return rc;
}
-static void a9m2440_disable_second_sdram_bank(void)
-{
- writel(readl(BANKCON7) & ~(0x3 << 15),BANKCON7);
- writel(readl(MISCCR) | (1 << 18), MISCCR); /* disable clock */
-}
-
static int a9m2440_mem_init(void)
{
/*
@@ -80,30 +75,30 @@ static int a9m2440_mem_init(void)
* So we must check here, if the second bank is populated to get the
* correct RAM size.
*/
- switch (readl(BANKSIZE) & 0x7) {
+ switch (readl(S3C_BANKSIZE) & 0x7) {
case 0:
- if (a9m2440_check_for_ram(S3C24X0_SDRAM_BASE + 32 * 1024 * 1024))
- a9m2440_disable_second_sdram_bank();
+ if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 32 * 1024 * 1024))
+ s3c24xx_disable_second_sdram_bank();
break;
case 1:
- if (a9m2440_check_for_ram(S3C24X0_SDRAM_BASE + 64 * 1024 * 1024))
- a9m2440_disable_second_sdram_bank();
+ if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 64 * 1024 * 1024))
+ s3c24xx_disable_second_sdram_bank();
break;
case 2:
- if (a9m2440_check_for_ram(S3C24X0_SDRAM_BASE + 128 * 1024 * 1024))
- a9m2440_disable_second_sdram_bank();
+ if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 128 * 1024 * 1024))
+ s3c24xx_disable_second_sdram_bank();
break;
case 4:
case 5:
case 6: /* not supported on this machine */
break;
default:
- if (a9m2440_check_for_ram(S3C24X0_SDRAM_BASE + 16 * 1024 * 1024))
- a9m2440_disable_second_sdram_bank();
+ if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 16 * 1024 * 1024))
+ s3c24xx_disable_second_sdram_bank();
break;
}
- arm_add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size());
+ arm_add_mem_device("ram0", S3C_SDRAM_BASE, s3c24xx_get_memory_size());
return 0;
}
@@ -114,14 +109,14 @@ static int a9m2440_devices_init(void)
uint32_t reg;
/* ----------- configure the access to the outer space ---------- */
- reg = readl(BWSCON);
+ reg = readl(S3C_BWSCON);
/* CS#5 to access the network controller */
reg &= ~0x00f00000;
reg |= 0x00d00000; /* 16 bit */
- writel(0x1f4c, BANKCON5);
+ writel(0x1f4c, S3C_BANKCON5);
- writel(reg, BWSCON);
+ writel(reg, S3C_BWSCON);
#ifdef CONFIG_MACH_A9M2410DEV
a9m2410dev_devices_init();
@@ -140,7 +135,7 @@ static int a9m2440_devices_init(void)
* Connected to CS line 5 + A24 and interrupt line EINT9,
* data width is 16 bit
*/
- add_generic_device("cs8900", -1, NULL, CS5_BASE + (1 << 24) + 0x300, 16,
+ add_generic_device("cs8900", -1, NULL, S3C_CS5_BASE + (1 << 24) + 0x300, 16,
IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
@@ -151,7 +146,7 @@ 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_set_bootparams((void*)CS6_BASE + 0x100);
+ armlinux_set_bootparams((void*)S3C_SDRAM_BASE + 0x100);
armlinux_set_architecture(MACH_TYPE_A9M2440);
return 0;
diff --git a/arch/arm/boards/a9m2440/lowlevel_init.S b/arch/arm/boards/a9m2440/lowlevel_init.S
index bfdd7f0630..57ebe3fbfc 100644
--- a/arch/arm/boards/a9m2440/lowlevel_init.S
+++ b/arch/arm/boards/a9m2440/lowlevel_init.S
@@ -37,7 +37,7 @@ sdram_init:
ldr r4, [r1]
and r4, r4, #0x3
- ldr r1, =S3C24X0_MEMCTL_BASE
+ ldr r1, =S3C_MEMCTL_BASE
/* configure both SDRAM areas with 32 bit data bus width */
ldr r0, =((0x2 << 24) + (0x2 << 28))
str r0, [r1], #0x1c /* post add register offset for bank6 */
@@ -218,9 +218,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