Rockchip RK3588 使用ddrbin_tool 修改DDR loader文件参数

Rockchip RK3588修改DDR loader文件参数

文章目录

  • Rockchip RK3588修改DDR loader文件参数
    • RK3588 DDR变频介绍
    • DDR参数修改工具ddrbin_tool
      • ddrbin_tool在SDK的路径
      • ddrbin_tool的使用方法
        • 导出ddr参数信息
        • 修改DDR的参数

ddrbin_tool 工具可以用于修改ddr的bin文件内部参数配置,可以修改ddr频率、ddr 串口打印的uart口等等

RK3588 DDR变频介绍

RK3588 DDR支持4频点的变频,4个频点如下:

rk3588_s_evb2:/ $ cat /d/opp/opp_summary                                                                                                                                                                              
 device                rate(Hz)    target(uV)    min(uV)    max(uV)
-------------------------------------------------------------------
 platform-dmc
                      528000000       850000      850000      850000
                     1068000000       850000      850000      850000
                     1560000000       850000      850000      850000
                     2112000000       850000      850000      850000

这四个频点是由ddr的loader决定,kernel变频的时候使用的是档位值分别是:

  • DMC_FREQ_LEVEL_HIGH //最高频率(2112MHz)
  • DMC_FREQ_LEVEL_MID_HIGH //第二档(1560MHz)
  • DMC_FREQ_LEVEL_MID_LOW //第三档(1068MHz)
  • DMC_FREQ_LEVEL_LOW //最低频率(528MHz)

由于硬件设计和走线的差异已经ddr颗粒差异导致有些板子无法跑这么高的频率,导致系统不稳定,就需要修改DDR的最高频率和其他频点。

DDR参数修改工具ddrbin_tool

ddrbin_tool在SDK的路径

rkbin/tools/ddrbin_tool

ddrbin_tool的使用方法

@sys2_206:~/3_Android12_29_debug/rkbin/tools$ ./ddrbin_tool 
version v1.09 20211130
For more details, please refer to the ddrbin_tool_user_guide.txt
This tools support two functions
for example:
fun 1: modify ddr.bin file from ddrbin_param.txt.
    ./ddrbin_tool ddrbin_param.txt px30_ddr_333MHz_v1.15.bin
fun 2: get ddr.bin file config to gen_param.txt file
    ./ddrbin_tool -g gen_param.txt px30_ddr_333MHz_v1.15.bin

The 'V1.11' as follow means the minimum ddr.bin version requirements
+---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+
|   platform    | uart info | ddr freq | ssmod | DDR 2T | sr pd | drv, odt, Vref etc| dis print training info | dis CBT |
+---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+
|    RV1108     |   V1.08   |   V1.08  | V1.10 |  V1.08 | V1.08 |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+
|  PX30/RK3326  |   V1.11   |     X    | V1.16 |  V1.12 | V1.15 |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK1808     |   V1.03   |   V1.03  | V1.05 |  V1.03 | V1.04 |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK322x     |   V1.08   |   V1.08  |   X   |  V1.09 |   X   |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK322xh    |   V1.14   |     X    | V1.17 |  V1.16 | V1.17 |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK3288     |   V1.07   |     X    |   X   |  V1.08 |   X   |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK3308     |   V1.28   |   V1.28  | V1.31 |  V1.29 | V1.30 |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK3368     |   V2.04   |   V2.04  |   X   |  V2.05 |   X   |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK3328     |   V1.14   |     X    | V1.17 |  V1.16 | V1.17 |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
|    RK3399     |   V1.25   |     X    | V1.25 |    X   |   X   |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
| RK3399PRO NPU |   V1.03   |   V1.03  |   X   |  V1.03 |   X   |          X        |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
| RV1126/RV1109 |   V1.00   |   V1.00  | V1.05 |  V1.00 | V1.05 |        V1.05      |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
| RK3566/RK3568 |   V1.00   |   V1.00  | V1.06 |  V1.00 | V1.00 |        V1.06      |          V1.07          |    X    |
+---------------+-----------+----------+-------+--------+-------+---------------------------------------------+---------+
| RK3566/RK3568 |   V1.00   |   V1.00  |   X   |  V1.00 | V1.00 |        V1.00      |            X            |    X    |
+---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+

For more details, please refer to the ddrbin_tool_user_guide.txt

导出ddr参数信息

@sys2_206:~/3_Android12_29_debug/rkbin/tools$ ./ddrbin_tool -g gen_param.txt ../bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin 
version v1.09 20211130
version 2
generate info from bin file ok.

导出的信息保存到当前目录的gen_param.txt 文件中

修改DDR的参数

  1. 修改的ddrbin_param.txt文件,这个文件里面的参数默认都是空的,只要修改自己需要的参数就可以。该文件在rkbin/tools/ddrbin_param.txt 文件的具体参数说明可以参考文档rkbin/tools/ddrbin_tool_user_guide.txt
  2. 使用ddrbin_tool导入修改后的ddrbin_param.txt来更新ddr bin文件
 @sys2_206:~/3_Android12_29_debug/rkbin/tools$ ./ddrbin_tool ddrbin_param.txt ../bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin 
version v1.09 20211130
version 2

new bin config:
modify end
  1. 修改成功后,将生产的…/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin 编译到loader中烧写到机器里面即可。

下面介绍如何用ddrbin_tool 修改ddr频率

  • DDR 最高频率修改
  1. 编辑ddrbin_param.txt中的如下参数,先确认使用的DDR的类型
@sys2_206:~/3_Android12_29_debug/rkbin/tools$ git diff
diff --git a/tools/ddrbin_param.txt b/tools/ddrbin_param.txt
index aa60e39..3091d07 100644
--- a/tools/ddrbin_param.txt
+++ b/tools/ddrbin_param.txt
@@ -5,9 +5,9 @@ lp2_freq=
 ddr3_freq=
 lp3_freq=
 ddr4_freq=
-lp4_freq=
-lp4x_freq=
-lp5_freq=
+lp4_freq=1560  //lpddr4的最高频率
+lp4x_freq=1560  //lpddr4x的最高频率
+lp5_freq=1560  //lpddr5的最高频率
 
 uart id=
 uart iomux=
  1. 修改后按上面介绍的步骤重新生产ddr bin文件,并编译烧写即可。
  2. 烧写到机器开机后可以通过cat /d/opp/opp_summary查看修改是否生效,或者看开机ddr初始化的log。
  • DDR变频的各个频点修改
@sys2_206:~/3_Android12_29_debug/rkbin/tools$ git diff
diff --git a/tools/ddrbin_param.txt b/tools/ddrbin_param.txt
index aa60e39..7c4f5ff 100644
--- a/tools/ddrbin_param.txt
+++ b/tools/ddrbin_param.txt
@@ -5,9 +5,9 @@ lp2_freq=
 ddr3_freq=
 lp3_freq=
 ddr4_freq=
-lp4_freq=
-lp4x_freq=
-lp5_freq=
+lp4_freq=1560      //lpddr4的最高频率
+lp4x_freq=1560		//lpddr4x的最高频率
+lp5_freq=1560      //lpddr5的最高频率
 
 uart id=
 uart iomux=
@@ -160,9 +160,9 @@ phy_lp3_dq_sr_when_odtoff=
 phy_lp3_ca_sr_when_odtoff=
 phy_lp3_clk_sr_when_odtoff=
 //LPDDR4的其他三个频点的频率
-lp4_f1_freq_mhz=
-lp4_f2_freq_mhz=
-lp4_f3_freq_mhz=
+lp4_f1_freq_mhz=1068
+lp4_f2_freq_mhz=528
+lp4_f3_freq_mhz=328
 lp4_f4_freq_mhz=
 lp4_f5_freq_mhz=
 phy_lp4_dq_drv_when_odten_ohm=
@@ -214,9 +214,9 @@ ddr4_cs0_dq16_dq31_map=
 ddr4_cs1_dq0_dq15_map=
 ddr4_cs1_dq16_dq31_map=
 //LPDDR4X的其他三个频点的频率
-lp4x_f1_freq_mhz=
-lp4x_f2_freq_mhz=
-lp4x_f3_freq_mhz=
+lp4x_f1_freq_mhz=1068
+lp4x_f2_freq_mhz=528
+lp4x_f3_freq_mhz=328
 lp4x_f4_freq_mhz=
 lp4x_f5_freq_mhz=
 phy_lp4x_dq_drv_when_odten_ohm=
@@ -255,9 +255,9 @@ phy_lp4x_dq_vref_when_odtoff=
 lp4x_dq_vref_when_odtoff=
 lp4x_ca_vref_when_odtoff=
 //LPDDR5的其他三个频点的频率
-lp5_f1_freq_mhz=
-lp5_f2_freq_mhz=
-lp5_f3_freq_mhz=
+lp5_f1_freq_mhz=1068
+lp5_f2_freq_mhz=528
+lp5_f3_freq_mhz=328
 lp5_f4_freq_mhz=
 lp5_f5_freq_mhz=
 phy_lp5_dq_drv_when_odten_ohm=
  1. 修改后按上面介绍的步骤重新生产ddr bin文件,并编译烧写即可。
  2. 烧写到机器开机后可以通过cat /d/opp/opp_summary查看修改是否生效。
  • 修改loader阶段的串口打印配置
* UART info
uart id: uart number. 0 for uart0, 1 for uart1, 2 for uart2..., 0xf will disable uart.
uart iomux: uart iomux info, 0 for uartn_m0, 1 for uartn_m1, 2 for uartn_m2...(like uart2_m0, uart2_m1,uart2_m2),
or 1 for uartn_a, 2 for uartn_b, 3 for uartn_c.(like uar2a, uart2b, uart2c).
uart baudrate: uart baudrate should be 115200 or 1500000.
  1. 编辑ddrbin_param.txt中的如下参数

下面实例是修改debug串口为uart2 的uart2_m1口。波特率是1500000

wlq@sys2_206:~/3_Android12_29_debug/rkbin/tools$ git diff
diff --git a/tools/ddrbin_param.txt b/tools/ddrbin_param.txt
index aa60e39..df14667 100644
--- a/tools/ddrbin_param.txt
+++ b/tools/ddrbin_param.txt
@@ -9,9 +9,9 @@ lp4_freq=
 lp4x_freq=
 lp5_freq=
 
-uart id=
-uart iomux=
-uart baudrate=
+uart id=2
+uart iomux=1
+uart baudrate=1500000
  1. 修改后按上面介绍的步骤重新生产ddr bin文件,替换到原路径的ddr bin文件,ddr bin文件的路径可以通过如下文件确认:
    其中:Path1=bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin就是ddr bin的文件路径,替换改文件即可。
@sys2_206:~/3_Android12_29_debug/rkbin$ vim RKBOOT/RK3588MINIALL.ini 
[CHIP_NAME]
NAME=RK3588
[VERSION]
MAJOR=1
MINOR=11
[CODE471_OPTION]
NUM=1
Path1=bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin
Sleep=1
[CODE472_OPTION]
NUM=1
Path1=bin/rk35/rk3588_usbplug_v1.08.bin
[LOADER_OPTION]
NUM=2
LOADER1=FlashData
LOADER2=FlashBoot
FlashData=bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin
FlashBoot=bin/rk35/rk3588_spl_v1.11.bin
[OUTPUT]
PATH=rk3588_spl_loader_v1.07.111.bin
[SYSTEM]
NEWIDB=true
[FLAG]
471_RC4_OFF=true
RC4_OFF=true
[BOOT1_PARAM]
WORD_0=0x0
WORD_1=0x0
WORD_2=0x0
WORD_3=0x0
WORD_4=0x0
WORD_5=0x0
WORD_6=0x0
WORD_7=0x0
  1. 以上修改完需要在u-boot下面重新编译uboot,然后烧写u-boot下生成的rk3588_spl_loader_v_xxx.bin, 如果是build.sh完整编译则可以烧写rockdev下的MiniLoaderAll.bin

  2. 如果要关掉loader阶段的串口打印,只要将uart id设置为0xf即可

返回博客首页,了解更多RK3588

你可能感兴趣的:(RK3588,android,嵌入式硬件,linux,驱动开发,RK3588)