From 1f45f393e19570be2ae8c1822858fa22c77e3a1a Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Fri, 27 Nov 2009 11:30:26 +0900 Subject: [PATCH] s5pc110: Set correct memory size Signed-off-by: Kyungmin Park --- board/samsung/universal/lowlevel_init.S | 23 +++++++++++++++++++++++ board/samsung/universal/mem_setup.S | 27 ++++----------------------- board/samsung/universal/universal.c | 3 ++- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/board/samsung/universal/lowlevel_init.S b/board/samsung/universal/lowlevel_init.S index d1a1955..6a31527 100644 --- a/board/samsung/universal/lowlevel_init.S +++ b/board/samsung/universal/lowlevel_init.S @@ -41,6 +41,7 @@ * r5 has zero always * r7 has S5PC100 GPIO base, 0xE0300000 * r8 has real GPIO base, 0xE0300000, 0xE0200000 at S5PC100, S5PC110 repectively + * r9 has Mobile DDR size, 1 means 1GiB, 2 means 2GiB and so on */ _TEXT_BASE: @@ -140,6 +141,28 @@ lowlevel_init: /* init system clock */ bl system_clock_init + /* r9 has 2Gib default */ + mov r9, #2 + /* FIXME 1Gib detection: Universal, J1B2, Limo Universal */ + /* Check Limo Real board + * LR (suspend) LU J1B2 + * 0x04 0x01 (0x01) 0x01 (0x01) 0x01 (0x01) + * 0x24 0x28 (0xA8) 0x28 (0x6A) 0x1C (0x1C) + * 0x44 0x00 (0xC7) 0x00 (0x47) 0x00 (0x47) + * 0x64 0x03 (0x1F) 0x07 (0x1F) 0x0f (0x0F) + * + * Check (0 << 3) at 0x64 at boot + * Check 0x47 at 0x44 at suspend + */ + ldrne r2, =0xE0200C00 + ldrne r1, [r2, #0x64] + mov r1, r1, lsr #2 + cmp r1, #1 + moveq r9, #1 + ldr r1, [r2, #0x44] + cmp r1, #0x47 + moveq r9, #1 + bl mem_ctrl_asm_init /* OneNAND Sync Read Support at S5PC110 only diff --git a/board/samsung/universal/mem_setup.S b/board/samsung/universal/mem_setup.S index d54df8c..b0f84a0 100644 --- a/board/samsung/universal/mem_setup.S +++ b/board/samsung/universal/mem_setup.S @@ -105,30 +105,11 @@ swap_memory: * [ 7:4 ] 2: 14 bits - Row * [ 3:0 ] 2: 4 banks */ + /* Default : 2GiB */ + ldr r4, =0x40f00322 @ 2Gib + cmp r9, #1 + ldreq r4, =0x40f80222 @ 1Gib - /* - * Check Limo Real board - * LR (suspend) LU J1B2 - * 0x04 0x01 (0x01) 0x01 (0x01) 0x01 (0x01) - * 0x24 0x28 (0xA8) 0x28 (0x6A) 0x1C (0x1C) - * 0x44 0x00 (0xC7) 0x00 (0x47) 0x00 (0x47) - * 0x64 0x03 (0x1F) 0x07 (0x1F) 0x0f (0x0F) - * - * Check (0 << 2) at 0x64 at boot - * Check (1 << 7) at 0x24 at suspend - */ - ldrne r4, =0x40f00322 @ 2Gib - - ldrne r2, =0xE0200C00 - ldrne r1, [r2, #0x64] - mov r1, r1, lsr #2 - cmp r1, #0 - beq 2f - ldr r1, [r2, #0x24] - mov r1, r1, lsr #7 - cmp r1, #1 - ldrne r4, =0x40f80222 @ 1Gib -2: cmp r7, r8 strne r4, [r6, #0x008] @ MEMCONFIG0_OFFSET diff --git a/board/samsung/universal/universal.c b/board/samsung/universal/universal.c index e18c524..9f5c283 100644 --- a/board/samsung/universal/universal.c +++ b/board/samsung/universal/universal.c @@ -1222,7 +1222,8 @@ int dram_init(void) gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; gd->bd->bi_dram[1].start = S5PC110_PHYS_SDRAM_2; - if (board_is_limo_real()) + if (board_is_limo_real() || machine_is_p1p2() || + machine_is_geminus()) gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE + (128 << 20); else -- 2.7.4