]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ram: rockchip: Compute ddr capacity based on grf split
authorJagan Teki <jagan@edgeble.ai>
Wed, 14 Dec 2022 17:50:49 +0000 (23:20 +0530)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 16 Jan 2023 10:01:10 +0000 (18:01 +0800)
DDR chip capacity is computed based on GRF split in some
Rockchip SoC's like PX30 and RV1126.

Add split argument in ddr print info so-that the respective
ddr driver will pass the grf split.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/include/asm/arch-rockchip/sdram_common.h
drivers/ram/rockchip/sdram_common.c
drivers/ram/rockchip/sdram_px30.c
drivers/ram/rockchip/sdram_rk3328.c
drivers/ram/rockchip/sdram_rk3399.c

index 5efa6e9445d5008d3a655167ea6d7a83d60b2647..a14b37cbc5c90915928268087b57f77506cfa7a5 100644 (file)
@@ -116,7 +116,7 @@ struct sdram_base_params {
 
 void sdram_print_dram_type(unsigned char dramtype);
 void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
-                         struct sdram_base_params *base);
+                         struct sdram_base_params *base, u32 split);
 void sdram_print_stride(unsigned int stride);
 
 void sdram_org_config(struct sdram_cap_info *cap_info,
index ec46ba54575e6315ea1ecd71a923fded56d248b6..60fc90d0a5c02c0f9e68cb693fabcc055d18ed99 100644 (file)
@@ -36,7 +36,7 @@ void sdram_print_dram_type(unsigned char dramtype)
 }
 
 void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
-                         struct sdram_base_params *base)
+                         struct sdram_base_params *base, u32 split)
 {
        u64 cap;
        u32 bg;
@@ -83,6 +83,8 @@ void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
        cap = sdram_get_cs_cap(cap_info, 3, base->dramtype);
        if (cap_info->row_3_4)
                cap = cap * 3 / 4;
+       else if (split)
+               cap = cap / 2 + (split << 24) / 2;
 
        printascii(" Size=");
        printdec(cap >> 20);
@@ -123,7 +125,7 @@ inline void sdram_print_dram_type(unsigned char dramtype)
 }
 
 inline void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
-                                struct sdram_base_params *base)
+                                struct sdram_base_params *base, u32 split)
 {
 }
 
index 86185149a968eac4be578a86657ced97a1166720..2728d93be3225895ac7ad1f4ee2c7bc2058e7b4b 100644 (file)
@@ -711,7 +711,7 @@ int sdram_init(void)
        if (ret)
                goto error;
 
-       sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base);
+       sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base, 0);
 
        printascii("out\n");
        return ret;
index b511c6bf6fe57bd16238a2615094b306cd2c641b..184c93f7763d15cb4a13ff4036d8c481067140c2 100644 (file)
@@ -506,7 +506,7 @@ static int sdram_init_detect(struct dram_info *dram,
                writel(sys_reg3, &dram->grf->os_reg[3]);
        }
 
-       sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base);
+       sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base, 0);
 
        return 0;
 }
index 56fd863ca2c5d78183d2259cdc4681a4d3b7a413..b1fea04e84ae64956efe1c3ab045c5ae11957ee2 100644 (file)
@@ -2986,7 +2986,7 @@ static int sdram_init(struct dram_info *dram,
                        continue;
                }
 
-               sdram_print_ddr_info(cap_info, &params->base);
+               sdram_print_ddr_info(cap_info, &params->base, 0);
                set_memory_map(chan, channel, params);
                cap_info->ddrconfig =
                        calculate_ddrconfig(params, channel);