]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rockchip: sdram: fix LPDDR5 bank info for sys_reg version 3
authorYouMin Chen <cym@rock-chips.com>
Tue, 12 Dec 2023 07:56:41 +0000 (15:56 +0800)
committerKever Yang <kever.yang@rock-chips.com>
Sun, 4 Feb 2024 10:01:03 +0000 (18:01 +0800)
This patch add support for additional bank info used by LPDDR5.

Series-version: 2

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/sdram.c

index 99ecbdc3412a96b437f220716cd71d401d8a93a0..0d9a0aef6f5ddeb6e7e2b376432245eca06267e4 100644 (file)
@@ -109,7 +109,14 @@ size_t rockchip_sdram_size(phys_addr_t reg)
                cs0_col = 9 + (sys_reg2 >> SYS_REG_COL_SHIFT(ch) &
                          SYS_REG_COL_MASK);
                cs1_col = cs0_col;
-               bk = 3 - ((sys_reg2 >> SYS_REG_BK_SHIFT(ch)) & SYS_REG_BK_MASK);
+               if (dram_type == LPDDR5)
+                       /* LPDDR5: 0:8bank(bk=3), 1:16bank(bk=4) */
+                       bk = 3 + ((sys_reg2 >> SYS_REG_BK_SHIFT(ch)) &
+                       SYS_REG_BK_MASK);
+               else
+                       /* Other: 0:8bank(bk=3), 1:4bank(bk=2) */
+                       bk = 3 - ((sys_reg2 >> SYS_REG_BK_SHIFT(ch)) &
+                       SYS_REG_BK_MASK);
                if (version >= 2) {
                        cs1_col = 9 + (sys_reg3 >> SYS_REG_CS1_COL_SHIFT(ch) &
                                  SYS_REG_CS1_COL_MASK);