Re: [U-Boot] [PATCH 1/2] KW: Move the memory register definitions into kirkwood.h

2012-06-29 Thread Marek Vasut
Dear Gerlando Falauto,

 Dear Maruk,
 
 I am currently trying to address the exact same issue (SDRAM size
 detection and fixup).
 My idea was however (as opposed to moving register definition as you
 did), to add a fixup function to dram.c, say:
 
 /*
   * kw_sdram_bs - writes SDRAM Bank size
   */
 void kw_sdram_bs_set(enum memory_bank bank, u32 size)
 {
   /* Read current register value */
   u32 reg = readl(KW_REG_CPUCS_WIN_SZ(bank));
 
   printf(Current value: %x\n, reg);
   /* Clear window size */
   reg = ~KW_REG_CPUCS_WIN_SIZE(0xFF);
 
   /* Set new window size */
   reg |= KW_REG_CPUCS_WIN_SIZE((size - 1)  24);
 
   printf(Writing: %x\n, reg);
   writel(reg, KW_REG_CPUCS_WIN_SZ(bank));
 }
 
 which would then be called to fix the window size according to the total
 memory size as reported by get_ram_size().

Read up at [1].

http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/133991

 What do you think?
 
 Thank you,
 Gerlando

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] KW: Move the memory register definitions into kirkwood.h

2012-06-26 Thread Marek Vasut
Also add the CPUCS register definition.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Prafulla Wadaskar prafu...@marvell.com
Cc: Wolfgang Denk w...@denx.de
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c|2 --
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |9 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c 
b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 181b3e7..ccb6b03 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -30,8 +30,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define KW_REG_CPUCS_WIN_BAR(x)(KW_REGISTER(0x1500) + (x * 
0x08))
-#define KW_REG_CPUCS_WIN_SZ(x) (KW_REGISTER(0x1504) + (x * 0x08))
 /*
  * kw_sdram_bar - reads SDRAM Base Address Register
  */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index 47771d5..33ae827 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -77,6 +77,15 @@
 #define MVCPU_WIN_ENABLE   KWCPU_WIN_ENABLE
 #define MVCPU_WIN_DISABLE  KWCPU_WIN_DISABLE
 
+/* Kirkwood memory registers */
+#define KW_REG_CPUCS_WIN_BAR(x)(KW_REGISTER(0x1500) + ((x) * 
0x08))
+#define KW_REG_CPUCS_WIN_SZ(x) (KW_REGISTER(0x1504) + ((x) * 0x08))
+
+#define KW_REG_CPUCS_WIN_ENABLE(1  0)
+#define KW_REG_CPUCS_WIN_WR_PROTECT(1  1)
+#define KW_REG_CPUCS_WIN_WIN0_CS(x)(((x)  0x3)  2)
+#define KW_REG_CPUCS_WIN_SIZE(x)   (((x)  0xff)  24)
+
 #if defined (CONFIG_KW88F6281)
 #include asm/arch/kw88f6281.h
 #elif defined (CONFIG_KW88F6192)
-- 
1.7.10

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot