rockchip: sdram-common: fix wrong size for 4GB in 32bit SoC
Subsystems (3)
PATCH v2 1/1 rockchip: sdram-common: fix wrong size for 4GB in 32bit SoC
This is workaround for issue we can't get correct size for 4GB ram in 32bit system and available before we really need ram space out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). The size of 4GB is '0x1 00000000', and this value will be truncated to 0 in 32bit system, and system can not get correct ram size. Rockchip SoCs reserve a blob of space for peripheral near 4GB, and we are now setting SDRAM_MAX_SIZE as max available space for ram in 4GB, so we can use this directly to workaround the issue.
---
Changes in v2:
- update the commit message and comment to show this is a workaround.
arch/arm/mach-rockchip/sdram_common.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm/mach-rockchip/sdram_common.c +18 -0
@@ -48,6 +48,24 @@ size_t rockchip_sdram_size(phys_addr_t reg) rank, col, bk, cs0_row, bw, row_3_4); } +/* +* This is workaround for issue we can't get correct size for 4GB ram +* in 32bit system and available before we really need ram space +* out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). +* The size of 4GB is '0x1 00000000', and this value will be truncated +* to 0 in 32bit system, and system can not get correct ram size. +* Rockchip SoCs reserve a blob of space for peripheral near 4GB, +* and we are now setting SDRAM_MAX_SIZE as max available space for +* ram in 4GB, so we can use this directly to workaround the issue. +* TODO: +* 1. update correct value for SDRAM_MAX_SIZE as what dram +* controller sees. +* 2. update board_get_usable_ram_top() and dram_init_banksize() +* to reserve memory for peripheral space after previous update. +*/ +if (size_mb > (SDRAM_MAX_SIZE >>20 )) + size_mb = (SDRAM_MAX_SIZE >>20 ); +return (size_t )size_mb <<20 ; }
Signature · 1 line
2.20.1
PATCH v2 1/1 rockchip: sdram-common: fix wrong size for 4GB in 32bit SoC
Quoted 8 lines · Kever Yang
This is workaround for issue we can't get correct size for 4GB ram in 32bit system and available before we really need ram space out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). The size of 4GB is '
0x100000000', and this value will be truncated to 0 in 32bit system, and system can not get correct ram size. Rockchip SoCs reserve a blob of space for peripheral near 4GB, and we are now settingSDRAM_MAX_SIZEas max available space for ram in 4GB, so we can use this directly to workaround the issue.
U-Boot SPL 2019.01-rc2+dfsg-1~20181228~1 (Dec 28 2018 - 23:14:06 +0000) Returning to boot ROM...
U-Boot 2019.01-rc2+dfsg-1~20181228~1 (Dec 28 2018 - 23:14:06 +0000)
Model: Firefly-RK3288 DRAM: 4 GiB MMC: dwmmc at ff0c0000: 1, dwmmc at ff0f0000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Model: Firefly-RK3288
Net:
Warning: ethernet at ff290000 (eth0) using random MAC address - 92:d3:c4:69:51:2c
eth0: ethernet at ff290000
Hit any key to stop autoboot: 0
And it boots! First time I've seen u-boot working on the firefly-rk3288 since ... v2018.01
Thanks for all the fixes everyone!
live well,
vagrant
Quoted 41 lines
Signed-off-by Kever Yang <[email protected]>---
Changes in v2:
- update the commit message and comment to show this is a workaround.arch/arm/mach-rockchip/sdram_common.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)arch/arm/mach-rockchip/sdram_common.c +18
-0@@ -48,6 +48,24 @@ size_t rockchip_sdram_size(phys_addr_t reg) rank, col, bk, cs0_row, bw, row_3_4); } +/* +* This is workaround for issue we can't get correct size for 4GB ram +* in 32bit system and available before we really need ram space +* out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). +* The size of 4GB is '0x1 00000000', and this value will be truncated +* to 0 in 32bit system, and system can not get correct ram size. +* Rockchip SoCs reserve a blob of space for peripheral near 4GB, +* and we are now setting SDRAM_MAX_SIZE as max available space for +* ram in 4GB, so we can use this directly to workaround the issue. +* TODO: +* 1. update correct value for SDRAM_MAX_SIZE as what dram +* controller sees. +* 2. update board_get_usable_ram_top() and dram_init_banksize() +* to reserve memory for peripheral space after previous update. +*/ +if (size_mb > (SDRAM_MAX_SIZE >>20 )) + size_mb = (SDRAM_MAX_SIZE >>20 ); +return (size_t )size_mb <<20 ; }Signature · 1 line
2.20.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181228/2c24215a/attachment.sig>
PATCH v2 1/1 rockchip: sdram-common: fix wrong size for 4GB in 32bit SoC
In reply to Kever YangQuoted 13 lines · Kever Yang
This is workaround for issue we can't get correct size for 4GB ram in 32bit system and available before we really need ram space out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). The size of 4GB is '
0x100000000', and this value will be truncated to 0 in 32bit system, and system can not get correct ram size. Rockchip SoCs reserve a blob of space for peripheral near 4GB, and we are now settingSDRAM_MAX_SIZEas max available space for ram in 4GB, so we can use this directly to workaround the issue.
Quoted 1 line
Signed-off-by Kever Yang <[email protected]>
Currently running on Travis … let’s see whether I need to remove the ‘TODO’ to get it to pass ;-)
PATCH v2 1/1 rockchip: sdram-common: fix wrong size for 4GB in 32bit SoC
In reply to Kever YangKever,
I agree that getting LPAE enabled on the RK3288 (in one of the next releases) would be great.
We could then turn on PHYS64_BIT, never worry about this again (and not need a workaround at all) and have the hardware’s capabilities accurately modelled.
Let me know if I can do anything to help towards that goal.
Thanks,
Philipp.
Quoted 52 lines · Kever Yang
This is workaround for issue we can't get correct size for 4GB ram in 32bit system and available before we really need ram space out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). The size of 4GB is '
0x100000000', and this value will be truncated to 0 in 32bit system, and system can not get correct ram size. Rockchip SoCs reserve a blob of space for peripheral near 4GB, and we are now settingSDRAM_MAX_SIZEas max available space for ram in 4GB, so we can use this directly to workaround the issue.Signed-off-by Kever Yang <[email protected]>---
Changes in v2:
- update the commit message and comment to show this is a workaround.
arch/arm/mach-rockchip/sdram_common.c| 18 ++++++++++++++++++1 file changed, 18 insertions(+)arch/arm/mach-rockchip/sdram_common.c +18
-0@@ -48,6 +48,24 @@ size_t rockchip_sdram_size(phys_addr_t reg) rank, col, bk, cs0_row, bw, row_3_4); } +/* +* This is workaround for issue we can't get correct size for 4GB ram +* in 32bit system and available before we really need ram space +* out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). +* The size of 4GB is '0x1 00000000', and this value will be truncated +* to 0 in 32bit system, and system can not get correct ram size. +* Rockchip SoCs reserve a blob of space for peripheral near 4GB, +* and we are now setting SDRAM_MAX_SIZE as max available space for +* ram in 4GB, so we can use this directly to workaround the issue. +* TODO: +* 1. update correct value for SDRAM_MAX_SIZE as what dram +* controller sees. +* 2. update board_get_usable_ram_top() and dram_init_banksize() +* to reserve memory for peripheral space after previous update. +*/ +if (size_mb > (SDRAM_MAX_SIZE >>20 )) + size_mb = (SDRAM_MAX_SIZE >>20 ); +return (size_t )size_mb <<20 ; }Signature · 1 line
2.20.1
PATCH v2 1/1 rockchip: sdram-common: fix wrong size for 4GB in 32bit SoC
In reply to Kever YangQuoted 10 lines · Kever Yang
This is workaround for issue we can't get correct size for 4GB ram in 32bit system and available before we really need ram space out of 4GB, eg.enable ARM LAPE(rk3288 supports 8GB ram). The size of 4GB is '
0x100000000', and this value will be truncated to 0 in 32bit system, and system can not get correct ram size. Rockchip SoCs reserve a blob of space for peripheral near 4GB, and we are now settingSDRAM_MAX_SIZEas max available space for ram in 4GB, so we can use this directly to workaround the issue.
Quoted 8 lines
Signed-off-by Kever Yang <[email protected]>---
Changes in v2:
- update the commit message and comment to show this is a workaround.arch/arm/mach-rockchip/sdram_common.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Tested on chromebook_minnie: