diff --git a/tools/ddrbin_tool.py b/tools/ddrbin_tool.py index 7c48a18a..5242dc86 100755 --- a/tools/ddrbin_tool.py +++ b/tools/ddrbin_tool.py @@ -21,7 +21,7 @@ chip_list = ['px30', 'px30s', 'px3se', 'px5', 'rk1808', 'rk2118', 'rk312x', 'rk3 'rk3128h', 'rk322x', 'rk3228a', 'rk3228b', 'rk3228h', 'rk322xh', 'rk3229', 'rk3308', 'rk3288', 'rk3326', 'rk3326s', 'rk3328', 'rk3368', 'rk3399', 'rk3506', 'rk3528', 'rk356x', 'rk3562', 'rk3566', 'rk3568', 'rk3576', 'rk3588', 'rv1103', 'rv1103b', 'rv1106', 'rv1108', 'rv1109', - 'rv1126'] + 'rv1126', 'rv1126b'] version_old_list = ['rk322xh', 'rk3328', 'rk3318'] @@ -1133,6 +1133,27 @@ def modify_global_uart_2_uart_iomux(info_from_txt, ddrbin_index, version): return 0 +def txt_data_check_availability(info_from_txt, chip_info): + # RV1126B: lp4_f1_freq_mhz and lp4x_f1_freq_mhz required less than 400MHz. + if chip_info == 'rv1126b': + for key in ['lp4_f1_freq_mhz', 'lp4x_f1_freq_mhz']: + if info_from_txt[key]['value'] > 400: + print("Error: {}={} out of range, required 324MHz-400MHz.".format(key, info_from_txt[key]['value'])) + return -1 + + # RK3588,RK3576: the frequency of F0 must be maximum. + if chip_info in ['rk3588', 'rk3576']: + lp4_freq_keys = ['lp4_freq', 'lp4_f1_freq_mhz', 'lp4_f2_freq_mhz', 'lp4_f3_freq_mhz'] + lp4x_freq_keys = ['lp4x_freq', 'lp4x_f1_freq_mhz', 'lp4x_f2_freq_mhz', 'lp4x_f3_freq_mhz'] + lp5_freq_keys = ['lp5_freq', 'lp5_f1_freq_mhz', 'lp5_f2_freq_mhz', 'lp5_f3_freq_mhz'] + for freq_keys in lp4_freq_keys, lp4x_freq_keys, lp5_freq_keys: + if info_from_txt[freq_keys[0]]['value'] != max([info_from_txt[key]['value'] for key in freq_keys]): + freq_values = {key: info_from_txt[key]['value'] for key in freq_keys} + print("Error: {} value must be maximum, current {}.".format(freq_keys[0], freq_values)) + return -1 + + return 0 + #info from bin + info from txt generate to loader parameters def txt_data_2_bin_data(info_from_txt, info_from_bin, ddrbin_index, write_in, version): print("\nnew bin config:") @@ -1325,7 +1346,7 @@ def ddrbin_tool(argc, argv): verinfo_editable_offset = 0 verinfo_editable_length = 17 - print("version v1.22 20250115") + print("version v1.23 20250516") print("python {}, {}, {}".format(sys.version.split(' ', 1)[0], platform.system(), platform.machine())) if sys.version_info < (3, 6): print("Warning: Please installed Python 3.6 or later.") @@ -1563,6 +1584,11 @@ def ddrbin_tool(argc, argv): filebin.close() return -1 + if txt_data_check_availability(info_from_txt, chip_info) != 0: + filebin.close() + print("Error: modify ddrbin failed") + return -1 + ret = txt_data_2_bin_data(info_from_txt, info_from_bin, ddrbin_index, write_in, version) if ret != 0: filebin.close() diff --git a/tools/ddrbin_tool_user_guide.txt b/tools/ddrbin_tool_user_guide.txt index e4d08f24..83c1bde0 100644 --- a/tools/ddrbin_tool_user_guide.txt +++ b/tools/ddrbin_tool_user_guide.txt @@ -52,27 +52,29 @@ The detail information as following: +---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+----------------------+ | RV1106/RV1103 | V1.10 | V1.10 | V1.10 | V1.10 | V1.10 | X | X | X | X | +---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+----------------------+ + | RV1126B/BP | V1.00 | V1.00 | V1.00 | V1.00 | V1.00 | V1.00 | V1.00 | X | V1.00 | + +---------------+-----------+----------+-------+--------+-------+-------------------+-------------------------+---------+----------------------+ -| function | platform and ddrbin version | -| ------------------------------------- | ------------------------------------------ | -| first scan channel/channel mask | RK3588 V1.00/RK3399 V1.25/RK3288 V1.11 | -| stride type | RK3588 V1.00/RK3399 V1.25/RK3288 V1.11 | -| ext_temp_ref | RK356x V1.16/RK3528 V1.07/RK1808 V1.06 | -| link_ecc_en | Null | -| per_bank_ref_en | RK3588 V1.09 | -| derate_en | RK3588 V1.09/RK356x V1.19/RK3528 V1.07 | -| auto_precharge_en | Null | -| res_space_remap_portion | RK3588 V1.09 | -| res_space_remap_all | RK3588 V1.09 | -| rd_vref_scan_en | RK3588 V1.08 | -| wr_vref_scan_en | RK3588 V1.08 | -| eye_2d_scan_en | RK3588 V1.08 | -| ch/bank/rank_mask | RK3588 V1.00 | -| pstore base_addr/buf_size | RK3588 V1.09 | -| uboot/atf/optee/spl/tpl log en | RK3588 V1.09 | -| boot_fsp | RK3588 V1.09 | -| pageclose | RK3588 V1.10 | -| first_init_dram_type/dfs_disable | RK3588 V1.11 | +| function | platform and ddrbin version | +| ------------------------------------- | ------------------------------------------ | +| first scan channel/channel mask | RK3588 V1.00/RK3399 V1.25/RK3288 V1.11 | +| stride type | RK3588 V1.00/RK3399 V1.25/RK3288 V1.11 | +| ext_temp_ref | RK356x V1.16/RK3528 V1.07/RK1808 V1.06/RV1126B V1.00 | +| link_ecc_en | Null | +| per_bank_ref_en | RK3588 V1.09/RV1126B V1.00 | +| derate_en | RK3588 V1.09/RK356x V1.19/RK3528 V1.07/RV1126B V1.00 | +| auto_precharge_en | Null | +| res_space_remap_portion | RK3588 V1.09 | +| res_space_remap_all | RK3588 V1.09 | +| rd_vref_scan_en | RK3588 V1.08/RV1126B V1.00 | +| wr_vref_scan_en | RK3588 V1.08/RV1126B V1.00 | +| eye_2d_scan_en | RK3588 V1.08 | +| ch/bank/rank_mask | RK3588 V1.00 | +| pstore base_addr/buf_size | RK3588 V1.09 | +| uboot/atf/optee/spl/tpl log en | RK3588 V1.09 | +| boot_fsp | RK3588 V1.09 | +| pageclose | RK3588 V1.10/RV1126B V1.00 | +| first_init_dram_type/dfs_disable | RK3588 V1.11/RV1126B V1.00 | * UART info @@ -247,6 +249,12 @@ The 'X' as follows means not support change frequencies by tool. +---------------+-----------------------------------------------------------------+ | RV1106/RV1103 | DDR2: 528MHz; DDR3: 324,660,792,924; | +---------------+-----------------------------------------------------------------+ +| RV1126B | DDR3/LP3: [324MHz - 1056MHz]; LP4/LP4X/DDR4: [324MHz - 1392MHz] | +| | LP4/LP4X f1: [324MHz - 400MHz] | ++---------------+-----------------------------------------------------------------+ +| RV1126BP | [324MHz - 1056MHz] | +| | LP4/LP4X f1: [324MHz - 400MHz] | ++---------------+-----------------------------------------------------------------+ * DDR frequencies(add more) @@ -339,6 +347,13 @@ The phy side driver strength support value as follows: | | 29,28 | 30,29 | | 35,33,32,31 | 37,35,33,32,31,| 37,35,33,32,31,| | | | | | | | 30 | 30 | | +---------------+-------------------+-------------------+--------------+-----------------+----------------+----------------+-------------+ +| | 573,289,195,145, | 595,300,202,151, | | 654,328,221,165,| 586,297,202, | 558,282,190, | | +| | 117,99,85,73,66, | 122,102,89,76,68, | |133,112,97,83,74,| 150,122,103,90,| 142,115,96,84, | | +| RV1126B/BP | 60,55,50,47,44,41,| 62,57,52,49,46,43,| follow DDR4 | 67,62,57,53,49, | 76,69,63,58,53,| 72,64,58,54,49,| X | +| | 38,36,35,33,32,30,| 40,38,36,34,33,31,| | 46,43,41,39,37, | 49,47,44,41,39,| 46,43,40,38,36,| | +| | 29,28 | 30,29 | | 35,34,33,31 | 37,35,34,33,31,| 34,32,31,30,29,| | +| | | | | | 30 | 28 | | ++---------------+-------------------+-------------------+--------------+-----------------+----------------+----------------+-------------+ The DRAM side driver strength support value as follows: +---------------+-------------------+-------------------+----------------+----------------------+----------------+-------------+ @@ -388,6 +403,14 @@ The ODT "0" means disabled ODT. | | 29,28 | 30,29 | | 35,33,32,31 | 37,35,33,32,31,| 37,35,33,32,31,| | | | | | | | 30 | 30 | | +---------------+-------------------+--------------------+--------------+-------------------+----------------+----------------+-------------+ +| | 573,289,195,145, | 595,300,202,151, | | 654,328,221,165, | 586,297,202, | 558,282,190, | | +| | 117,99,85,73,66, | 122,102,89,76,68, | |133,112,97,83,74, | 150,122,103,90,| 142,115,96,84, | | +| RV1126B/BP | 60,55,50,47,44,41,| 62,57,52,49,46,43, | follow DDR4 | 67,62,57,53,49, | 76,69,63,58,53,| 72,64,58,54,49,| X | +| | 38,36,35,33,32,30,| 40,38,36,34,33,31, | | 46,43,41,39,37, | 49,47,44,41,39,| 46,43,40,38,36,| | +| | 29,28 | 30,29 | | 35,34,33,31 | 37,35,34,33,31,| 34,32,31,30,29,| | +| | | | | | 30 | 28 | | ++---------------+-------------------+--------------------+--------------+-------------------+----------------+----------------+-------------+ + The DRAM side ODT support value as follows: +---------------+-------------------+-------------------+--------------+-----------------------+----------------+---------------+ | platform | DDR3 | DDR4 | LP3 | LP4(include DQ and CA)| LP4X | LP5 |