kirkwood: use c-struct for access to SDRAM addr decode registers
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.
---
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(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +17 -6
@@ -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; }
Signature · 1 line
1.7.1
PATCH v3 1/4 kirkwood: use c-struct for access to SDRAM addr decode registers
Hi Prafulla,
Quoted 7 lines · Holger Brunck
Remove the defines and do this with a C-struct.
Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Gerlando Falauto <[email protected]>cc Marek Vasut <[email protected]>
Quoted 7 lines
---
changes for v3:
- new patch as requested on the MLarch/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
PATCH v3 1/4 kirkwood: use c-struct for access to SDRAM addr decode registers
Dear Holger Brunck,
Quoted 15 lines
Hi Prafulla,
Quoted 12 lines · Holger Brunck
Remove the defines and do this with a C-struct.
Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Gerlando Falauto <[email protected]>cc Marek Vasut <[email protected]>---
changes for v3:
- new patch as requested on the ML
Quoted 6 lines
Quoted 2 lines
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.
Quoted 2 lines
Regards
Holger
Best regards,
Marek Vasut
PATCH v3 2/4 kirkwood: implement kw_sdram_bs_set()
In reply to Holger BrunckFrom: Gerlando Falauto <[email protected]>
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().
---
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 <[email protected]>
arch/arm/cpu/arm926ejs/kirkwood/dram.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +24 -0
@@ -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)
Signature · 1 line
1.7.1
PATCH v3 2/4 kirkwood: implement kw_sdram_bs_set()
Quoted 70 lines
-----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: implementkw_sdram_bs_set()From: Gerlando Falauto <[email protected]>
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 <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
changes for v3:
- remove reviewed by, because there are some chages in
- use c-struct instead of defines
- makekw_sdram_bs_setstatic
changes for v2:
- added Reviewed-by: Marek Vasut <[email protected]>arch/arm/cpu/arm926ejs/kirkwood/dram.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +18
-0@@ -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 */
arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bar(enum memory_bank bank)
Quoted 10 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +6
-1+ 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) --
Regards...
Prafulla . . .
PATCH v3 2/4 kirkwood: implement kw_sdram_bs_set()
In reply to Holger BrunckQuoted 80 lines
-----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: implementkw_sdram_bs_set()From: Gerlando Falauto <[email protected]>
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 <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
changes for v3:
- remove reviewed by, because there are some chages in
- use c-struct instead of defines
- makekw_sdram_bs_setstatic
changes for v2:
- added Reviewed-by: Marek Vasut <[email protected]>arch/arm/cpu/arm926ejs/kirkwood/dram.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +24
-1@@ -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) --
Quoted 1 line
1.7.1
Applied to u-boot-marvell.git master branch
Regards...
Prafulla . . .
PATCH v3 3/4 kirkwood: implement kw_sdram_size_adjust
In reply to Holger BrunckFrom: Gerlando Falauto <[email protected]>
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.
---
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(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +11 -0
@@ -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 ) {
arch/arm/include/asm/arch-kirkwood/cpu.h +1 -0
@@ -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);
Signature · 1 line
1.7.1
PATCH v3 3/4 kirkwood: implement kw_sdram_size_adjust
Quoted 40 lines
-----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: implementkw_sdram_size_adjustFrom: Gerlando Falauto <[email protected]>
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 <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
chages for v3:
- renamedram_size_fixuptokw_sdramsize_adjustand move them tokirkwood/dram.cchanges for v2:
- rebase to current u-boot-marvell.git master brancharch/arm/cpu/arm926ejs/kirkwood/dram.c | 11 +++++++++++ arch/arm/include/asm/arch-kirkwood/cpu.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +0
-0
arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 100
Quoted 4 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +1
-0@@ -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 . . .
Quoted 29 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +10
-0+{ +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 ) {arch/arm/include/asm/arch-kirkwood/cpu.h +1
-0@@ -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 intgpp1_oe);
--
1.7.1
PATCH v4 3/4 kirkwood: implement kw_sdram_size_adjust
In reply to Holger BrunckSize 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.
---
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(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +11 -0
@@ -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 ) {
arch/arm/include/asm/arch-kirkwood/cpu.h +1 -0
@@ -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);
Signature · 1 line
1.7.1
PATCH v4 3/4 kirkwood: implement kw_sdram_size_adjust
Quoted 74 lines
-----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: implementkw_sdram_size_adjustSize 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 <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>---
changes for v4:
- add bank parameter tokw_sdram_size_adjust()changes for v3:
- renamedram_size_fixuptokw_sdramsize_adjustand move them tokirkwood/dram.cchanges for v2:
- rebase to current u-boot-marvell.git master brancharch/arm/cpu/arm926ejs/kirkwood/dram.c | 11 +++++++++++ arch/arm/include/asm/arch-kirkwood/cpu.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +11
-0@@ -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 ){
arch/arm/include/asm/arch-kirkwood/cpu.h +1
-0@@ -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,
Quoted 2 lines
unsigned int
gpp0_oe, unsigned intgpp1_oe);
--
Applied to u-boot-marvell.git master branch
Regards...
Prafulla . . .
PATCH v3 3/4 kirkwood: implement kw_sdram_size_adjust
In reply to Holger BrunckQuoted 53 lines
-----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: implementkw_sdram_size_adjustQuoted 8 lines
-----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: implementkw_sdram_size_adjustQuoted 4 lines
From: Gerlando Falauto <[email protected]>
Size of the SDRAM chips might differ between any two (otherwise identical) instances of the same board. So add a function which
reads
Quoted 29 lines
out the current ram size and set them in the SDRAM size register of kirkwood.
Signed-off-by Gerlando Falauto <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
chages for v3:
- renamedram_size_fixuptokw_sdramsize_adjustand move them tokirkwood/dram.cchanges for v2:
- rebase to current u-boot-marvell.git master brancharch/arm/cpu/arm926ejs/kirkwood/dram.c | 11 +++++++++++ arch/arm/include/asm/arch-kirkwood/cpu.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +0
-0@@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)return result; }
Quoted 4 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 100
Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +1
-0+void kw_sdram_size_adjust (void )I think you must pass
bank_idto 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 . . .
PATCH v3 3/4 kirkwood: implement kw_sdram_size_adjust
Quoted 58 lines · Prafulla Wadaskar
Quoted 53 lines
-----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: implementkw_sdram_size_adjustQuoted 8 lines
-----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: implementkw_sdram_size_adjustQuoted 4 lines
From: Gerlando Falauto <[email protected]>
Size of the SDRAM chips might differ between any two (otherwise identical) instances of the same board. So add a function which
reads
Quoted 29 lines
out the current ram size and set them in the SDRAM size register of kirkwood.
Signed-off-by Gerlando Falauto <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
chages for v3:
- renamedram_size_fixuptokw_sdramsize_adjustand move them tokirkwood/dram.cchanges for v2:
- rebase to current u-boot-marvell.git master brancharch/arm/cpu/arm926ejs/kirkwood/dram.c | 11 +++++++++++ arch/arm/include/asm/arch-kirkwood/cpu.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +0
-0@@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)return result; }Quoted 4 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 100
Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +1
-0+void kw_sdram_size_adjust (void )I think you must pass
bank_idto this function so that one can tune any/all of the four available DRAM banks.
Quoted 5 lines
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
PATCH v3 3/4 kirkwood: implement kw_sdram_size_adjust
Quoted 74 lines
-----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: implementkw_sdram_size_adjustQuoted 8 lines · Prafulla Wadaskar
Quoted 8 lines
-----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_adjustQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----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: implementkw_sdram_size_adjustQuoted 6 lines
Quoted 6 lines
Quoted 4 lines
From: Gerlando Falauto <[email protected]>
Size of the SDRAM chips might differ between any two (otherwise identical) instances of the same board. So add a function which
reads
Quoted 1 line
out the current ram size and set them in the SDRAM size register
of
Quoted 36 lines
Quoted 28 lines
Quoted 28 lines
kirkwood.
Signed-off-by Gerlando Falauto <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
chages for v3:
- renamedram_size_fixuptokw_sdramsize_adjustand move them tokirkwood/dram.cchanges for v2:
- rebase to current u-boot-marvell.git master brancharch/arm/cpu/arm926ejs/kirkwood/dram.c | 11 +++++++++++ arch/arm/include/asm/arch-kirkwood/cpu.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +0
-0@@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)return result; }Quoted 4 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 100
Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +1
-0+void kw_sdram_size_adjust (void )I think you must pass
bank_idto 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.
Quoted 8 lines
Quoted 2 lines
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 . . .
PATCH v3 1/4 kirkwood: use c-struct for access to SDRAM addr decode registers
In reply to Holger BrunckQuoted 73 lines
-----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 registersRemove the defines and do this with a C-struct.
Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Gerlando Falauto <[email protected]>cc Marek Vasut <[email protected]>---
changes for v3:
- new patch as requested on the MLarch/arm/cpu/arm926ejs/kirkwood/dram.c | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +13
-4@@ -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;}
arch/arm/cpu/arm926ejs/kirkwood/dram.c +2
-0@@ -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 ;
arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bar(enum memory_bank bank) · line 74
Quoted 10 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +2
-2-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.
Regards...
Prafulla . . .
PATCH v3 4/4 arm/km: use kw_sdram_size_adjust to adjust SDRAM size
In reply to Holger BrunckSome 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.
---
chages for v3:
- new patch
board/keymile/km_arm/km_arm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
board/keymile/km_arm/km_arm.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.1
PATCH v3 4/4 arm/km: use kw_sdram_size_adjust to adjust SDRAM size
Quoted 34 lines
-----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: usekw_sdram_size_adjustto adjust SDRAM sizeSome 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 <[email protected]>Signed-off-by Gerlando Falauto <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Marek Vasut <[email protected]>---
chages for v3:
- new patchboard/keymile/km_arm/km_arm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)board/keymile/km_arm/km_arm.c +0
-0
board/keymile/km_arm/km_arm.c int board_early_init_f(void) · line 253
Quoted 5 lines
board/keymile/km_arm/km_arm.c +1
-1@@ -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 . . .
PATCH v4 4/4 arm/km: use kw_sdram_size_adjust to adjust SDRAM size
In reply to Holger BrunckFrom: Holger Brunck <[email protected]>
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.
---
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(-)
board/keymile/km_arm/km_arm.c +2 -1
@@ -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 ; }
Signature · 1 line
1.7.1
PATCH v4 4/4 arm/km: use kw_sdram_size_adjust to adjust SDRAM size
Quoted 48 lines
-----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: usekw_sdram_size_adjustto adjust SDRAM sizeFrom: Holger Brunck <[email protected]>
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 <[email protected]>Signed-off-by Gerlando Falauto <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>---
changes for v4:
- add bank parameter tokw_sdram_size_adjust()changes for v3:
- new patchboard/keymile/km_arm/km_arm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)board/keymile/km_arm/km_arm.c +2
-2@@ -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 ; } --
Quoted 1 line
1.7.1
Applied to u-boot-marvell.git master branch
Regards...
Prafulla . . .
PATCH v3 1/4 kirkwood: use c-struct for access to SDRAM addr decode registers
In reply to Holger BrunckQuoted 84 lines
-----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 registersRemove the defines and do this with a C-struct.
Signed-off-by Holger Brunck <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Valentin Longchamp <[email protected]>cc Gerlando Falauto <[email protected]>cc Marek Vasut <[email protected]>---
changes for v3:
- new patch as requested on the MLarch/arm/cpu/arm926ejs/kirkwood/dram.c | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +13
-4@@ -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;}
arch/arm/cpu/arm926ejs/kirkwood/dram.c +4
-3@@ -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; } --
Quoted 1 line
1.7.1
Applied to u-boot-marvell.git master branch
Regards...
Prafulla . . .