Message ID | 20200714230332.28491-1-knaerzche@gmail.com |
---|---|
State | Accepted |
Commit | 90f740a06ae5e5e09ae03b1d204cb88a21df8ea3 |
Delegated to: | Kever Yang |
Headers | show |
Series | rockchip: sdram: fix dram_init_banksize | expand |
Hi Alex, Tanks for your fix. On 2020/7/15 上午7:03, Alex Bee wrote: > Currently 2.5 GB is calculated as DRAM size for a 1 GB RK322x board > if CONFIG_SPL_OPTEE is set. This is troublesome when booting a > linux kernel since this size will be injected in FDT of the kernel. > > gd->bd->bi_dram[0].start (which is basically CONFIG_SYS_SDRAM_BASE) > must not be taken into consideration for calculation of second bank > size, since this offset is already included in calculation of "top". > > After applying this patch 992 MB (1024 MB - 32 MB reserved for > optee-os) is correctly calculated and has also been verified on > 2 GB boards. > > Signed-off-by: Alex Bee <knaerzche@gmail.com> Reviewed-by: Kever Yang<kever.yang@rock-chips.com> Thanks, - Kever > --- > arch/arm/mach-rockchip/sdram.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c > index 24fe6cc8f0..4c637b7767 100644 > --- a/arch/arm/mach-rockchip/sdram.c > +++ b/arch/arm/mach-rockchip/sdram.c > @@ -56,16 +56,14 @@ int dram_init_banksize(void) > - CONFIG_SYS_SDRAM_BASE; > gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr + > tos_parameter->tee_mem.size; > - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start > - + top - gd->bd->bi_dram[1].start; > + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; > } else { > gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; > gd->bd->bi_dram[0].size = 0x8400000; > /* Reserve 32M for OPTEE with TA */ > gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE > + gd->bd->bi_dram[0].size + 0x2000000; > - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start > - + top - gd->bd->bi_dram[1].start; > + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; > } > #else > gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
On 2020/7/18 上午11:13, Kever Yang wrote: > Hi Alex, > > Tanks for your fix. > > On 2020/7/15 上午7:03, Alex Bee wrote: >> Currently 2.5 GB is calculated as DRAM size for a 1 GB RK322x board >> if CONFIG_SPL_OPTEE is set. This is troublesome when booting a >> linux kernel since this size will be injected in FDT of the kernel. >> >> gd->bd->bi_dram[0].start (which is basically CONFIG_SYS_SDRAM_BASE) >> must not be taken into consideration for calculation of second bank >> size, since this offset is already included in calculation of "top". >> >> After applying this patch 992 MB (1024 MB - 32 MB reserved for >> optee-os) is correctly calculated and has also been verified on >> 2 GB boards. >> >> Signed-off-by: Alex Bee <knaerzche@gmail.com> > Reviewed-by: Kever Yang<kever.yang@rock-chips.com> Applied to u-boot-rockchip master for this patch set, thanks. > > Thanks, > - Kever >> --- >> arch/arm/mach-rockchip/sdram.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/arch/arm/mach-rockchip/sdram.c >> b/arch/arm/mach-rockchip/sdram.c >> index 24fe6cc8f0..4c637b7767 100644 >> --- a/arch/arm/mach-rockchip/sdram.c >> +++ b/arch/arm/mach-rockchip/sdram.c >> @@ -56,16 +56,14 @@ int dram_init_banksize(void) >> - CONFIG_SYS_SDRAM_BASE; >> gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr + >> tos_parameter->tee_mem.size; >> - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start >> - + top - gd->bd->bi_dram[1].start; >> + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; >> } else { >> gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; >> gd->bd->bi_dram[0].size = 0x8400000; >> /* Reserve 32M for OPTEE with TA */ >> gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE >> + gd->bd->bi_dram[0].size + 0x2000000; >> - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start >> - + top - gd->bd->bi_dram[1].start; >> + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; >> } >> #else >> gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; > > > >
diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c index 24fe6cc8f0..4c637b7767 100644 --- a/arch/arm/mach-rockchip/sdram.c +++ b/arch/arm/mach-rockchip/sdram.c @@ -56,16 +56,14 @@ int dram_init_banksize(void) - CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr + tos_parameter->tee_mem.size; - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start - + top - gd->bd->bi_dram[1].start; + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; } else { gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].size = 0x8400000; /* Reserve 32M for OPTEE with TA */ gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE + gd->bd->bi_dram[0].size + 0x2000000; - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start - + top - gd->bd->bi_dram[1].start; + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; } #else gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
Currently 2.5 GB is calculated as DRAM size for a 1 GB RK322x board if CONFIG_SPL_OPTEE is set. This is troublesome when booting a linux kernel since this size will be injected in FDT of the kernel. gd->bd->bi_dram[0].start (which is basically CONFIG_SYS_SDRAM_BASE) must not be taken into consideration for calculation of second bank size, since this offset is already included in calculation of "top". After applying this patch 992 MB (1024 MB - 32 MB reserved for optee-os) is correctly calculated and has also been verified on 2 GB boards. Signed-off-by: Alex Bee <knaerzche@gmail.com> --- arch/arm/mach-rockchip/sdram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)