public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers
@ 2012-07-20 12:34 Holger Brunck
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set() Holger Brunck
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Holger Brunck @ 2012-07-20 12:34 UTC (permalink / raw)
  To: u-boot

Remove the defines and do this with a C-struct.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Gerlando Falauto <gerlando.falauto@keymile.com>
cc: Marek Vasut <marex@denx.de>
---
changes for v3:
  - new patch as requested on the ML

 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 181b3e7..1c5faab 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -30,20 +30,29 @@
 
 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))
+struct kw_sdram_bank {
+	u32	win_bar;
+	u32	win_sz;
+};
+
+struct kw_sdram_addr_dec {
+	struct kw_sdram_bank	sdram_bank[4];
+};
+
 /*
  * kw_sdram_bar - reads SDRAM Base Address Register
  */
 u32 kw_sdram_bar(enum memory_bank bank)
 {
+	struct kw_sdram_addr_dec *base =
+		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
 	u32 result = 0;
-	u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
+	u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
 
 	if ((!enable) || (bank > BANK3))
 		return 0;
 
-	result = readl(KW_REG_CPUCS_WIN_BAR(bank));
+	result = readl(&base->sdram_bank[bank].win_bar);
 	return result;
 }
 
@@ -52,12 +61,14 @@ u32 kw_sdram_bar(enum memory_bank bank)
  */
 u32 kw_sdram_bs(enum memory_bank bank)
 {
+	struct kw_sdram_addr_dec *base =
+		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
 	u32 result = 0;
-	u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
+	u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
 
 	if ((!enable) || (bank > BANK3))
 		return 0;
-	result = 0xff000000 & readl(KW_REG_CPUCS_WIN_SZ(bank));
+	result = 0xff000000 & readl(&base->sdram_bank[bank].win_sz);
 	result += 0x01000000;
 	return result;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set()
  2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
@ 2012-07-20 12:34 ` Holger Brunck
  2012-07-20 19:00   ` Prafulla Wadaskar
  2012-09-07 18:50   ` Prafulla Wadaskar
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust Holger Brunck
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Holger Brunck @ 2012-07-20 12:34 UTC (permalink / raw)
  To: u-boot

From: Gerlando Falauto <gerlando.falauto@keymile.com>

Some boards might be equipped with different SDRAM configurations.
When that is the case, CPU CS Window Size Register (CS[0]n Size)
should be set to the biggest value through board.cfg file; then its
value can be fixed at runtime according to the detected SDRAM size.

Therefore, implement kw_sdram_bs_set().

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Marek Vasut <marex@denx.de>
---
changes for v3: 
  - remove reviewed by, because there are some chages in
  - use c-struct instead of defines
  - make kw_sdram_bs_set static
changes for v2:
  - added Reviewed-by: Marek Vasut <marex@denx.de>

 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 1c5faab..5e2f9d8 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -39,6 +39,11 @@ struct kw_sdram_addr_dec {
 	struct kw_sdram_bank	sdram_bank[4];
 };
 
+#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)
+
 /*
  * kw_sdram_bar - reads SDRAM Base Address Register
  */
@@ -57,6 +62,25 @@ u32 kw_sdram_bar(enum memory_bank bank)
 }
 
 /*
+ * kw_sdram_bs_set - writes SDRAM Bank size
+ */
+static void kw_sdram_bs_set(enum memory_bank bank, u32 size)
+{
+	struct kw_sdram_addr_dec *base =
+		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
+	/* Read current register value */
+	u32 reg = readl(&base->sdram_bank[bank].win_sz);
+
+	/* Clear window size */
+	reg &= ~KW_REG_CPUCS_WIN_SIZE(0xFF);
+
+	/* Set new window size */
+	reg |= KW_REG_CPUCS_WIN_SIZE((size - 1) >> 24);
+
+	writel(reg, &base->sdram_bank[bank].win_sz);
+}
+
+/*
  * kw_sdram_bs - reads SDRAM Bank size
  */
 u32 kw_sdram_bs(enum memory_bank bank)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set() Holger Brunck
@ 2012-07-20 12:34 ` Holger Brunck
  2012-07-20 19:10   ` Prafulla Wadaskar
                     ` (2 more replies)
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size Holger Brunck
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 19+ messages in thread
From: Holger Brunck @ 2012-07-20 12:34 UTC (permalink / raw)
  To: u-boot

From: Gerlando Falauto <gerlando.falauto@keymile.com>

Size of the SDRAM chips might differ between any two (otherwise
identical) instances of the same board. So add a function which reads
out the current ram size and set them in the SDRAM size register of
kirkwood.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Marek Vasut <marex@denx.de>
---
chages for v3: 
  - rename dram_size_fixup to kw_sdramsize_adjust and move them to kirkwood/dram.c
  
changes for v2:
  - rebase to current u-boot-marvell.git master branch

 arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
 arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 5e2f9d8..9f97964 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	return result;
 }
 
+void kw_sdram_size_adjust(void)
+{
+	u32 size;
+
+	/* probe currently equipped RAM size */
+	size = get_ram_size((void *)kw_sdram_bar(0), kw_sdram_bs(0));
+
+	/* adjust SDRAM window size accordingly */
+	kw_sdram_bs_set(0, size);
+}
+
 #ifndef CONFIG_SYS_BOARD_DRAM_INIT
 int dram_init(void)
 {
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h b/arch/arm/include/asm/arch-kirkwood/cpu.h
index d28c51a..128393c 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -159,6 +159,7 @@ void reset_cpu(unsigned long ignored);
 unsigned char get_random_hex(void);
 unsigned int kw_sdram_bar(enum memory_bank bank);
 unsigned int kw_sdram_bs(enum memory_bank bank);
+void kw_sdram_size_adjust(void);
 int kw_config_adr_windows(void);
 void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val,
 		unsigned int gpp0_oe, unsigned int gpp1_oe);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size
  2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set() Holger Brunck
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust Holger Brunck
@ 2012-07-20 12:34 ` Holger Brunck
  2012-07-20 19:11   ` Prafulla Wadaskar
  2012-07-25 16:26   ` [U-Boot] [PATCH v4 " Gerlando Falauto
  2012-07-20 13:48 ` [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Prafulla Wadaskar
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Holger Brunck @ 2012-07-20 12:34 UTC (permalink / raw)
  To: u-boot

Some boards may differ only in the SDRAM size. This function allows to
fix the size accordingly and we can use the same u-boot binary for both
boards.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Marek Vasut <marex@denx.de>
---
chages for v3:
  - new patch

 board/keymile/km_arm/km_arm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 2b2ca39..9a616fc 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -250,7 +250,7 @@ int board_early_init_f(void)
 	tmp = readl(KW_GPIO0_BASE + 4);
 	writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , KW_GPIO0_BASE + 4);
 #endif
-
+	kw_sdram_size_adjust();
 	kirkwood_mpp_conf(kwmpp_config, NULL);
 	return 0;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers
  2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
                   ` (2 preceding siblings ...)
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size Holger Brunck
@ 2012-07-20 13:48 ` Prafulla Wadaskar
  2012-09-06  8:58 ` Holger Brunck
  2012-09-07 18:50 ` Prafulla Wadaskar
  5 siblings, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-07-20 13:48 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 20 July 2012 18:04
> To: u-boot at lists.denx.de
> Cc: Holger Brunck; Prafulla Wadaskar; Valentin Longchamp; Gerlando
> Falauto; Marek Vasut
> Subject: [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM
> addr decode registers
> 
> Remove the defines and do this with a C-struct.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Gerlando Falauto <gerlando.falauto@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> changes for v3:
>   - new patch as requested on the ML
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   23 +++++++++++++++++------
>  1 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 181b3e7..1c5faab 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -30,20 +30,29 @@
> 
>  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))
> +struct kw_sdram_bank {
> +	u32	win_bar;
> +	u32	win_sz;
> +};
> +
> +struct kw_sdram_addr_dec {
> +	struct kw_sdram_bank	sdram_bank[4];
> +};
> +
>  /*
>   * kw_sdram_bar - reads SDRAM Base Address Register
>   */
>  u32 kw_sdram_bar(enum memory_bank bank)
>  {
> +	struct kw_sdram_addr_dec *base =
> +		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
>  	u32 result = 0;
> -	u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
> +	u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
> 
>  	if ((!enable) || (bank > BANK3))
>  		return 0;
> 
> -	result = readl(KW_REG_CPUCS_WIN_BAR(bank));
> +	result = readl(&base->sdram_bank[bank].win_bar);
>  	return result;
>  }
> 
> @@ -52,12 +61,14 @@ u32 kw_sdram_bar(enum memory_bank bank)
>   */
>  u32 kw_sdram_bs(enum memory_bank bank)
>  {
> +	struct kw_sdram_addr_dec *base =
> +		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
>  	u32 result = 0;
> -	u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
> +	u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
> 
>  	if ((!enable) || (bank > BANK3))
>  		return 0;
> -	result = 0xff000000 & readl(KW_REG_CPUCS_WIN_SZ(bank));
> +	result = 0xff000000 & readl(&base->sdram_bank[bank].win_sz);
>  	result += 0x01000000;
>  	return result;
>  }

Hi Holger

First of all, many thanks for this initiative.
Acked-By: Prafulla Wadaskar <Prafulla@marvell.com>

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set()
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set() Holger Brunck
@ 2012-07-20 19:00   ` Prafulla Wadaskar
  2012-09-07 18:50   ` Prafulla Wadaskar
  1 sibling, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-07-20 19:00 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 20 July 2012 18:04
> To: u-boot at lists.denx.de
> Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
> Longchamp; Marek Vasut
> Subject: [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set()
> 
> From: Gerlando Falauto <gerlando.falauto@keymile.com>
> 
> Some boards might be equipped with different SDRAM configurations.
> When that is the case, CPU CS Window Size Register (CS[0]n Size)
> should be set to the biggest value through board.cfg file; then its
> value can be fixed at runtime according to the detected SDRAM size.
> 
> Therefore, implement kw_sdram_bs_set().
> 
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> changes for v3:
>   - remove reviewed by, because there are some chages in
>   - use c-struct instead of defines
>   - make kw_sdram_bs_set static
> changes for v2:
>   - added Reviewed-by: Marek Vasut <marex@denx.de>
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   24
> ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 1c5faab..5e2f9d8 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -39,6 +39,11 @@ struct kw_sdram_addr_dec {
>  	struct kw_sdram_bank	sdram_bank[4];
>  };
> 
> +#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)
> +
>  /*
>   * kw_sdram_bar - reads SDRAM Base Address Register
>   */
> @@ -57,6 +62,25 @@ u32 kw_sdram_bar(enum memory_bank bank)
>  }
> 
>  /*
> + * kw_sdram_bs_set - writes SDRAM Bank size
> + */
> +static void kw_sdram_bs_set(enum memory_bank bank, u32 size)
> +{
> +	struct kw_sdram_addr_dec *base =
> +		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
> +	/* Read current register value */
> +	u32 reg = readl(&base->sdram_bank[bank].win_sz);
> +
> +	/* Clear window size */
> +	reg &= ~KW_REG_CPUCS_WIN_SIZE(0xFF);
> +
> +	/* Set new window size */
> +	reg |= KW_REG_CPUCS_WIN_SIZE((size - 1) >> 24);
> +
> +	writel(reg, &base->sdram_bank[bank].win_sz);
> +}
> +
> +/*
>   * kw_sdram_bs - reads SDRAM Bank size
>   */
>  u32 kw_sdram_bs(enum memory_bank bank)
> --

Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust Holger Brunck
@ 2012-07-20 19:10   ` Prafulla Wadaskar
  2012-07-25 16:23   ` [U-Boot] [PATCH v4 " Gerlando Falauto
  2012-09-06 23:20   ` [U-Boot] [PATCH v3 " Prafulla Wadaskar
  2 siblings, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-07-20 19:10 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 20 July 2012 18:04
> To: u-boot at lists.denx.de
> Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
> Longchamp; Marek Vasut
> Subject: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
> 
> From: Gerlando Falauto <gerlando.falauto@keymile.com>
> 
> Size of the SDRAM chips might differ between any two (otherwise
> identical) instances of the same board. So add a function which reads
> out the current ram size and set them in the SDRAM size register of
> kirkwood.
> 
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> chages for v3:
>   - rename dram_size_fixup to kw_sdramsize_adjust and move them to
> kirkwood/dram.c
> 
> changes for v2:
>   - rebase to current u-boot-marvell.git master branch
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
>  arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 5e2f9d8..9f97964 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
>  	return result;
>  }
> 
> +void kw_sdram_size_adjust(void)

I think you must pass bank_id to this function so that one can tune any/all of the four available DRAM banks.

Regards..
Prafulla . . .

> +{
> +	u32 size;
> +
> +	/* probe currently equipped RAM size */
> +	size = get_ram_size((void *)kw_sdram_bar(0), kw_sdram_bs(0));
> +
> +	/* adjust SDRAM window size accordingly */
> +	kw_sdram_bs_set(0, size);
> +}
> +
>  #ifndef CONFIG_SYS_BOARD_DRAM_INIT
>  int dram_init(void)
>  {
> diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h
> b/arch/arm/include/asm/arch-kirkwood/cpu.h
> index d28c51a..128393c 100644
> --- a/arch/arm/include/asm/arch-kirkwood/cpu.h
> +++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
> @@ -159,6 +159,7 @@ void reset_cpu(unsigned long ignored);
>  unsigned char get_random_hex(void);
>  unsigned int kw_sdram_bar(enum memory_bank bank);
>  unsigned int kw_sdram_bs(enum memory_bank bank);
> +void kw_sdram_size_adjust(void);
>  int kw_config_adr_windows(void);
>  void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int
> gpp1_oe_val,
>  		unsigned int gpp0_oe, unsigned int gpp1_oe);
> --
> 1.7.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size Holger Brunck
@ 2012-07-20 19:11   ` Prafulla Wadaskar
  2012-07-25 16:26   ` [U-Boot] [PATCH v4 " Gerlando Falauto
  1 sibling, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-07-20 19:11 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 20 July 2012 18:04
> To: u-boot at lists.denx.de
> Cc: Holger Brunck; Gerlando Falauto; Prafulla Wadaskar; Valentin
> Longchamp; Marek Vasut
> Subject: [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust
> SDRAM size
> 
> Some boards may differ only in the SDRAM size. This function allows to
> fix the size accordingly and we can use the same u-boot binary for
> both
> boards.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> chages for v3:
>   - new patch
> 
>  board/keymile/km_arm/km_arm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/board/keymile/km_arm/km_arm.c
> b/board/keymile/km_arm/km_arm.c
> index 2b2ca39..9a616fc 100644
> --- a/board/keymile/km_arm/km_arm.c
> +++ b/board/keymile/km_arm/km_arm.c
> @@ -250,7 +250,7 @@ int board_early_init_f(void)
>  	tmp = readl(KW_GPIO0_BASE + 4);
>  	writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , KW_GPIO0_BASE + 4);
>  #endif
> -
> +	kw_sdram_size_adjust();

If bank_id is considered then this call will change.

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v4 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust Holger Brunck
  2012-07-20 19:10   ` Prafulla Wadaskar
@ 2012-07-25 16:23   ` Gerlando Falauto
  2012-09-07 18:49     ` Prafulla Wadaskar
  2012-09-06 23:20   ` [U-Boot] [PATCH v3 " Prafulla Wadaskar
  2 siblings, 1 reply; 19+ messages in thread
From: Gerlando Falauto @ 2012-07-25 16:23 UTC (permalink / raw)
  To: u-boot

Size of the SDRAM chips might differ between any two (otherwise
identical) instances of the same board.

So add a function kw_sdram_size_adjust() which reads out the current
ram size for a given bank, and adjusts the Kirkwood's SDRAM window size
register accordingly.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
---
changes for v4:
  - add bank parameter to kw_sdram_size_adjust()
 
changes for v3: 
  - rename dram_size_fixup to kw_sdramsize_adjust and move them to kirkwood/dram.c
  
changes for v2:
  - rebase to current u-boot-marvell.git master branch

 arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
 arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 5e2f9d8..807894f 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	return result;
 }
 
+void kw_sdram_size_adjust(enum memory_bank bank)
+{
+	u32 size;
+
+	/* probe currently equipped RAM size */
+	size = get_ram_size((void *)kw_sdram_bar(bank), kw_sdram_bs(bank));
+
+	/* adjust SDRAM window size accordingly */
+	kw_sdram_bs_set(bank, size);
+}
+
 #ifndef CONFIG_SYS_BOARD_DRAM_INIT
 int dram_init(void)
 {
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h b/arch/arm/include/asm/arch-kirkwood/cpu.h
index d28c51a..23783d5 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -159,6 +159,7 @@ void reset_cpu(unsigned long ignored);
 unsigned char get_random_hex(void);
 unsigned int kw_sdram_bar(enum memory_bank bank);
 unsigned int kw_sdram_bs(enum memory_bank bank);
+void kw_sdram_size_adjust(enum memory_bank bank);
 int kw_config_adr_windows(void);
 void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val,
 		unsigned int gpp0_oe, unsigned int gpp1_oe);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v4 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size Holger Brunck
  2012-07-20 19:11   ` Prafulla Wadaskar
@ 2012-07-25 16:26   ` Gerlando Falauto
  2012-09-07 18:49     ` Prafulla Wadaskar
  1 sibling, 1 reply; 19+ messages in thread
From: Gerlando Falauto @ 2012-07-25 16:26 UTC (permalink / raw)
  To: u-boot

From: Holger Brunck <holger.brunck@keymile.com>

Some boards may differ only in the SDRAM size. This function allows to
fix the size accordingly and we can use the same u-boot binary for both
boards.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
---
changes for v4:
  - add bank parameter to kw_sdram_size_adjust()

changes for v3:
  - new patch

 board/keymile/km_arm/km_arm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 2b2ca39..ac14a2f 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -250,7 +250,8 @@ int board_early_init_f(void)
 	tmp = readl(KW_GPIO0_BASE + 4);
 	writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , KW_GPIO0_BASE + 4);
 #endif
-
+	/* adjust SDRAM size for bank 0 */
+	kw_sdram_size_adjust(0);
 	kirkwood_mpp_conf(kwmpp_config, NULL);
 	return 0;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers
  2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
                   ` (3 preceding siblings ...)
  2012-07-20 13:48 ` [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Prafulla Wadaskar
@ 2012-09-06  8:58 ` Holger Brunck
  2012-09-06  9:18   ` Marek Vasut
  2012-09-07 18:50 ` Prafulla Wadaskar
  5 siblings, 1 reply; 19+ messages in thread
From: Holger Brunck @ 2012-09-06  8:58 UTC (permalink / raw)
  To: u-boot

Hi Prafulla,

On 07/20/2012 02:34 PM, Holger Brunck wrote:
> Remove the defines and do this with a C-struct.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Gerlando Falauto <gerlando.falauto@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> changes for v3:
>   - new patch as requested on the ML
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   23 +++++++++++++++++------
>  1 files changed, 17 insertions(+), 6 deletions(-)
> 

I saw your pull request for the mavell git branch. This patch serie is not
included in your branch but already reviewed and acked. Did you miss this serie?

Regards
Holger

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers
  2012-09-06  8:58 ` Holger Brunck
@ 2012-09-06  9:18   ` Marek Vasut
  0 siblings, 0 replies; 19+ messages in thread
From: Marek Vasut @ 2012-09-06  9:18 UTC (permalink / raw)
  To: u-boot

Dear Holger Brunck,

> Hi Prafulla,
> 
> On 07/20/2012 02:34 PM, Holger Brunck wrote:
> > Remove the defines and do this with a C-struct.
> > 
> > Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> > cc: Prafulla Wadaskar <prafulla@marvell.com>
> > cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> > cc: Gerlando Falauto <gerlando.falauto@keymile.com>
> > cc: Marek Vasut <marex@denx.de>
> > ---
> > 
> > changes for v3:
> >   - new patch as requested on the ML
> >  
> >  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   23 +++++++++++++++++------
> >  1 files changed, 17 insertions(+), 6 deletions(-)
> 
> I saw your pull request for the mavell git branch. This patch serie is not
> included in your branch but already reviewed and acked. Did you miss this
> serie?

I assigned it to PW in PW ( :-D ) and bumped his email.

> Regards
> Holger

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust Holger Brunck
  2012-07-20 19:10   ` Prafulla Wadaskar
  2012-07-25 16:23   ` [U-Boot] [PATCH v4 " Gerlando Falauto
@ 2012-09-06 23:20   ` Prafulla Wadaskar
  2012-09-07  6:47     ` Holger Brunck
  2 siblings, 1 reply; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-09-06 23:20 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Prafulla Wadaskar
> Sent: 20 July 2012 12:10
> To: 'Holger Brunck'; u-boot at lists.denx.de
> Cc: Gerlando Falauto; Valentin Longchamp; Marek Vasut
> Subject: RE: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
> 
> 
> 
> > -----Original Message-----
> > From: Holger Brunck [mailto:holger.brunck at keymile.com]
> > Sent: 20 July 2012 18:04
> > To: u-boot at lists.denx.de
> > Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
> > Longchamp; Marek Vasut
> > Subject: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
> >
> > From: Gerlando Falauto <gerlando.falauto@keymile.com>
> >
> > Size of the SDRAM chips might differ between any two (otherwise
> > identical) instances of the same board. So add a function which
> reads
> > out the current ram size and set them in the SDRAM size register of
> > kirkwood.
> >
> > Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> > Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> > cc: Prafulla Wadaskar <prafulla@marvell.com>
> > cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> > cc: Marek Vasut <marex@denx.de>
> > ---
> > chages for v3:
> >   - rename dram_size_fixup to kw_sdramsize_adjust and move them to
> > kirkwood/dram.c
> >
> > changes for v2:
> >   - rebase to current u-boot-marvell.git master branch
> >
> >  arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
> >  arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
> >  2 files changed, 12 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > index 5e2f9d8..9f97964 100644
> > --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > @@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
> >  	return result;
> >  }
> >
> > +void kw_sdram_size_adjust(void)
> 
> I think you must pass bank_id to this function so that one can tune
> any/all of the four available DRAM banks.

Hi Hogler
This has not yet closed hence not pulled this patch series.

Do you have any comments on this?

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-09-06 23:20   ` [U-Boot] [PATCH v3 " Prafulla Wadaskar
@ 2012-09-07  6:47     ` Holger Brunck
  2012-09-07 16:56       ` Prafulla Wadaskar
  0 siblings, 1 reply; 19+ messages in thread
From: Holger Brunck @ 2012-09-07  6:47 UTC (permalink / raw)
  To: u-boot

On 09/07/2012 01:20 AM, Prafulla Wadaskar wrote:
> 
> 
>> -----Original Message-----
>> From: Prafulla Wadaskar
>> Sent: 20 July 2012 12:10
>> To: 'Holger Brunck'; u-boot at lists.denx.de
>> Cc: Gerlando Falauto; Valentin Longchamp; Marek Vasut
>> Subject: RE: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
>>
>>
>>
>>> -----Original Message-----
>>> From: Holger Brunck [mailto:holger.brunck at keymile.com]
>>> Sent: 20 July 2012 18:04
>>> To: u-boot at lists.denx.de
>>> Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
>>> Longchamp; Marek Vasut
>>> Subject: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
>>>
>>> From: Gerlando Falauto <gerlando.falauto@keymile.com>
>>>
>>> Size of the SDRAM chips might differ between any two (otherwise
>>> identical) instances of the same board. So add a function which
>> reads
>>> out the current ram size and set them in the SDRAM size register of
>>> kirkwood.
>>>
>>> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
>>> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
>>> cc: Prafulla Wadaskar <prafulla@marvell.com>
>>> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
>>> cc: Marek Vasut <marex@denx.de>
>>> ---
>>> chages for v3:
>>>   - rename dram_size_fixup to kw_sdramsize_adjust and move them to
>>> kirkwood/dram.c
>>>
>>> changes for v2:
>>>   - rebase to current u-boot-marvell.git master branch
>>>
>>>  arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
>>>  arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
>>>  2 files changed, 12 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> index 5e2f9d8..9f97964 100644
>>> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> @@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
>>>  	return result;
>>>  }
>>>
>>> +void kw_sdram_size_adjust(void)
>>
>> I think you must pass bank_id to this function so that one can tune
>> any/all of the four available DRAM banks.
> 
> Hi Hogler
> This has not yet closed hence not pulled this patch series.
> 
> Do you have any comments on this?
> 

updates concerning these change request were send long time ago. The references are:

http://lists.denx.de/pipermail/u-boot/2012-July/129116.html
http://lists.denx.de/pipermail/u-boot/2012-July/129117.html

Regards
Holger

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-09-07  6:47     ` Holger Brunck
@ 2012-09-07 16:56       ` Prafulla Wadaskar
  0 siblings, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-09-07 16:56 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 06 September 2012 23:47
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Gerlando Falauto; Valentin Longchamp; Marek
> Vasut
> Subject: Re: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
> 
> On 09/07/2012 01:20 AM, Prafulla Wadaskar wrote:
> >
> >
> >> -----Original Message-----
> >> From: Prafulla Wadaskar
> >> Sent: 20 July 2012 12:10
> >> To: 'Holger Brunck'; u-boot at lists.denx.de
> >> Cc: Gerlando Falauto; Valentin Longchamp; Marek Vasut
> >> Subject: RE: [PATCH v3 3/4] kirkwood: implement
> kw_sdram_size_adjust
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> >>> Sent: 20 July 2012 18:04
> >>> To: u-boot at lists.denx.de
> >>> Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
> >>> Longchamp; Marek Vasut
> >>> Subject: [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust
> >>>
> >>> From: Gerlando Falauto <gerlando.falauto@keymile.com>
> >>>
> >>> Size of the SDRAM chips might differ between any two (otherwise
> >>> identical) instances of the same board. So add a function which
> >> reads
> >>> out the current ram size and set them in the SDRAM size register
> of
> >>> kirkwood.
> >>>
> >>> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> >>> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> >>> cc: Prafulla Wadaskar <prafulla@marvell.com>
> >>> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> >>> cc: Marek Vasut <marex@denx.de>
> >>> ---
> >>> chages for v3:
> >>>   - rename dram_size_fixup to kw_sdramsize_adjust and move them to
> >>> kirkwood/dram.c
> >>>
> >>> changes for v2:
> >>>   - rebase to current u-boot-marvell.git master branch
> >>>
> >>>  arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
> >>>  arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
> >>>  2 files changed, 12 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> index 5e2f9d8..9f97964 100644
> >>> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> @@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
> >>>  	return result;
> >>>  }
> >>>
> >>> +void kw_sdram_size_adjust(void)
> >>
> >> I think you must pass bank_id to this function so that one can tune
> >> any/all of the four available DRAM banks.
> >
> > Hi Hogler
> > This has not yet closed hence not pulled this patch series.
> >
> > Do you have any comments on this?
> >
> 
> updates concerning these change request were send long time ago. The
> references are:
> 
> http://lists.denx.de/pipermail/u-boot/2012-July/129116.html
> http://lists.denx.de/pipermail/u-boot/2012-July/129117.html

Thanks Holger,
I will pull them soon.

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v4 3/4] kirkwood: implement kw_sdram_size_adjust
  2012-07-25 16:23   ` [U-Boot] [PATCH v4 " Gerlando Falauto
@ 2012-09-07 18:49     ` Prafulla Wadaskar
  0 siblings, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-09-07 18:49 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Gerlando Falauto [mailto:gerlando.falauto at keymile.com]
> Sent: 25 July 2012 09:24
> To: u-boot at lists.denx.de
> Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
> Longchamp
> Subject: [PATCH v4 3/4] kirkwood: implement kw_sdram_size_adjust
> 
> Size of the SDRAM chips might differ between any two (otherwise
> identical) instances of the same board.
> 
> So add a function kw_sdram_size_adjust() which reads out the current
> ram size for a given bank, and adjusts the Kirkwood's SDRAM window
> size
> register accordingly.
> 
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> ---
> changes for v4:
>   - add bank parameter to kw_sdram_size_adjust()
> 
> changes for v3:
>   - rename dram_size_fixup to kw_sdramsize_adjust and move them to
> kirkwood/dram.c
> 
> changes for v2:
>   - rebase to current u-boot-marvell.git master branch
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c   |   11 +++++++++++
>  arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 5e2f9d8..807894f 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
>  	return result;
>  }
> 
> +void kw_sdram_size_adjust(enum memory_bank bank)
> +{
> +	u32 size;
> +
> +	/* probe currently equipped RAM size */
> +	size = get_ram_size((void *)kw_sdram_bar(bank),
> kw_sdram_bs(bank));
> +
> +	/* adjust SDRAM window size accordingly */
> +	kw_sdram_bs_set(bank, size);
> +}
> +
>  #ifndef CONFIG_SYS_BOARD_DRAM_INIT
>  int dram_init(void)
>  {
> diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h
> b/arch/arm/include/asm/arch-kirkwood/cpu.h
> index d28c51a..23783d5 100644
> --- a/arch/arm/include/asm/arch-kirkwood/cpu.h
> +++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
> @@ -159,6 +159,7 @@ void reset_cpu(unsigned long ignored);
>  unsigned char get_random_hex(void);
>  unsigned int kw_sdram_bar(enum memory_bank bank);
>  unsigned int kw_sdram_bs(enum memory_bank bank);
> +void kw_sdram_size_adjust(enum memory_bank bank);
>  int kw_config_adr_windows(void);
>  void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int
> gpp1_oe_val,
>  		unsigned int gpp0_oe, unsigned int gpp1_oe);
> --

Applied to u-boot-marvell.git master branch

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v4 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size
  2012-07-25 16:26   ` [U-Boot] [PATCH v4 " Gerlando Falauto
@ 2012-09-07 18:49     ` Prafulla Wadaskar
  0 siblings, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-09-07 18:49 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Gerlando Falauto [mailto:gerlando.falauto at keymile.com]
> Sent: 25 July 2012 09:26
> To: u-boot at lists.denx.de
> Cc: Holger Brunck; Gerlando Falauto; Prafulla Wadaskar; Valentin
> Longchamp
> Subject: [PATCH v4 4/4] arm/km: use kw_sdram_size_adjust to adjust
> SDRAM size
> 
> From: Holger Brunck <holger.brunck@keymile.com>
> 
> Some boards may differ only in the SDRAM size. This function allows to
> fix the size accordingly and we can use the same u-boot binary for
> both
> boards.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> ---
> changes for v4:
>   - add bank parameter to kw_sdram_size_adjust()
> 
> changes for v3:
>   - new patch
> 
>  board/keymile/km_arm/km_arm.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/board/keymile/km_arm/km_arm.c
> b/board/keymile/km_arm/km_arm.c
> index 2b2ca39..ac14a2f 100644
> --- a/board/keymile/km_arm/km_arm.c
> +++ b/board/keymile/km_arm/km_arm.c
> @@ -250,7 +250,8 @@ int board_early_init_f(void)
>  	tmp = readl(KW_GPIO0_BASE + 4);
>  	writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , KW_GPIO0_BASE + 4);
>  #endif
> -
> +	/* adjust SDRAM size for bank 0 */
> +	kw_sdram_size_adjust(0);
>  	kirkwood_mpp_conf(kwmpp_config, NULL);
>  	return 0;
>  }
> --
> 1.7.1

Applied to u-boot-marvell.git master branch

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers
  2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
                   ` (4 preceding siblings ...)
  2012-09-06  8:58 ` Holger Brunck
@ 2012-09-07 18:50 ` Prafulla Wadaskar
  5 siblings, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-09-07 18:50 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 20 July 2012 05:34
> To: u-boot at lists.denx.de
> Cc: Holger Brunck; Prafulla Wadaskar; Valentin Longchamp; Gerlando
> Falauto; Marek Vasut
> Subject: [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM
> addr decode registers
> 
> Remove the defines and do this with a C-struct.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Gerlando Falauto <gerlando.falauto@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> changes for v3:
>   - new patch as requested on the ML
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   23 +++++++++++++++++------
>  1 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 181b3e7..1c5faab 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -30,20 +30,29 @@
> 
>  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))
> +struct kw_sdram_bank {
> +	u32	win_bar;
> +	u32	win_sz;
> +};
> +
> +struct kw_sdram_addr_dec {
> +	struct kw_sdram_bank	sdram_bank[4];
> +};
> +
>  /*
>   * kw_sdram_bar - reads SDRAM Base Address Register
>   */
>  u32 kw_sdram_bar(enum memory_bank bank)
>  {
> +	struct kw_sdram_addr_dec *base =
> +		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
>  	u32 result = 0;
> -	u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
> +	u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
> 
>  	if ((!enable) || (bank > BANK3))
>  		return 0;
> 
> -	result = readl(KW_REG_CPUCS_WIN_BAR(bank));
> +	result = readl(&base->sdram_bank[bank].win_bar);
>  	return result;
>  }
> 
> @@ -52,12 +61,14 @@ u32 kw_sdram_bar(enum memory_bank bank)
>   */
>  u32 kw_sdram_bs(enum memory_bank bank)
>  {
> +	struct kw_sdram_addr_dec *base =
> +		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
>  	u32 result = 0;
> -	u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
> +	u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
> 
>  	if ((!enable) || (bank > BANK3))
>  		return 0;
> -	result = 0xff000000 & readl(KW_REG_CPUCS_WIN_SZ(bank));
> +	result = 0xff000000 & readl(&base->sdram_bank[bank].win_sz);
>  	result += 0x01000000;
>  	return result;
>  }
> --
> 1.7.1


Applied to u-boot-marvell.git master branch

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set()
  2012-07-20 12:34 ` [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set() Holger Brunck
  2012-07-20 19:00   ` Prafulla Wadaskar
@ 2012-09-07 18:50   ` Prafulla Wadaskar
  1 sibling, 0 replies; 19+ messages in thread
From: Prafulla Wadaskar @ 2012-09-07 18:50 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Holger Brunck [mailto:holger.brunck at keymile.com]
> Sent: 20 July 2012 05:34
> To: u-boot at lists.denx.de
> Cc: Gerlando Falauto; Holger Brunck; Prafulla Wadaskar; Valentin
> Longchamp; Marek Vasut
> Subject: [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set()
> 
> From: Gerlando Falauto <gerlando.falauto@keymile.com>
> 
> Some boards might be equipped with different SDRAM configurations.
> When that is the case, CPU CS Window Size Register (CS[0]n Size)
> should be set to the biggest value through board.cfg file; then its
> value can be fixed at runtime according to the detected SDRAM size.
> 
> Therefore, implement kw_sdram_bs_set().
> 
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Marek Vasut <marex@denx.de>
> ---
> changes for v3:
>   - remove reviewed by, because there are some chages in
>   - use c-struct instead of defines
>   - make kw_sdram_bs_set static
> changes for v2:
>   - added Reviewed-by: Marek Vasut <marex@denx.de>
> 
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   24
> ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 1c5faab..5e2f9d8 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -39,6 +39,11 @@ struct kw_sdram_addr_dec {
>  	struct kw_sdram_bank	sdram_bank[4];
>  };
> 
> +#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)
> +
>  /*
>   * kw_sdram_bar - reads SDRAM Base Address Register
>   */
> @@ -57,6 +62,25 @@ u32 kw_sdram_bar(enum memory_bank bank)
>  }
> 
>  /*
> + * kw_sdram_bs_set - writes SDRAM Bank size
> + */
> +static void kw_sdram_bs_set(enum memory_bank bank, u32 size)
> +{
> +	struct kw_sdram_addr_dec *base =
> +		(struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
> +	/* Read current register value */
> +	u32 reg = readl(&base->sdram_bank[bank].win_sz);
> +
> +	/* Clear window size */
> +	reg &= ~KW_REG_CPUCS_WIN_SIZE(0xFF);
> +
> +	/* Set new window size */
> +	reg |= KW_REG_CPUCS_WIN_SIZE((size - 1) >> 24);
> +
> +	writel(reg, &base->sdram_bank[bank].win_sz);
> +}
> +
> +/*
>   * kw_sdram_bs - reads SDRAM Bank size
>   */
>  u32 kw_sdram_bs(enum memory_bank bank)
> --
> 1.7.1

Applied to u-boot-marvell.git master branch

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-09-07 18:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-20 12:34 [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Holger Brunck
2012-07-20 12:34 ` [U-Boot] [PATCH v3 2/4] kirkwood: implement kw_sdram_bs_set() Holger Brunck
2012-07-20 19:00   ` Prafulla Wadaskar
2012-09-07 18:50   ` Prafulla Wadaskar
2012-07-20 12:34 ` [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust Holger Brunck
2012-07-20 19:10   ` Prafulla Wadaskar
2012-07-25 16:23   ` [U-Boot] [PATCH v4 " Gerlando Falauto
2012-09-07 18:49     ` Prafulla Wadaskar
2012-09-06 23:20   ` [U-Boot] [PATCH v3 " Prafulla Wadaskar
2012-09-07  6:47     ` Holger Brunck
2012-09-07 16:56       ` Prafulla Wadaskar
2012-07-20 12:34 ` [U-Boot] [PATCH v3 4/4] arm/km: use kw_sdram_size_adjust to adjust SDRAM size Holger Brunck
2012-07-20 19:11   ` Prafulla Wadaskar
2012-07-25 16:26   ` [U-Boot] [PATCH v4 " Gerlando Falauto
2012-09-07 18:49     ` Prafulla Wadaskar
2012-07-20 13:48 ` [U-Boot] [PATCH v3 1/4] kirkwood: use c-struct for access to SDRAM addr decode registers Prafulla Wadaskar
2012-09-06  8:58 ` Holger Brunck
2012-09-06  9:18   ` Marek Vasut
2012-09-07 18:50 ` Prafulla Wadaskar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox