TPL max size for Rockchip PX30 SoC is very low, but 10240 bytes are
enough to store in two DDR configuration parameters sets if option
CONFIG_RAM_ROCKCHIP_DEBUG is deselected.

The approach is trivial: apply supported DDR config sets in a predefined
order (DDR4, LPDDR2, LPDDR3, DDR3) stopping at the first one that makes
SDRAM initialization function to complete with success. If a smarter
cleverer or more reliable approach exists, suggestions are welcome.

The patches have been tested on two boards, one equipped with DDR3 and
the other with DDR4. All possible sets selections have been tested,
even with orders different from predefined one (e.g. DDR3, LPDDR2,
LPDDR3, DDR4). It would be useful if further tests will be run on other
PX30 based boards.

The patches does not affect binary code of TPL for any of the existing
U-Boot configurations.

The first patch improves clarity of DDR type support selection for
Rockchip SoCs at Kconfig level. Not all the DDR type config options
named in the Kconfig are supported by each one of the Rockchip SoCs.
Moreover, the LPDDR4 option has a different meaning in the context of
the RK3399 SoC than in the RV1126 one. Thus, split options with ad-hoc
specific help sections and use depends on conditionals.

The second patch splits RV1126 options (at most one should be selected)
from PX30 options (more options can be selected), and adds DDR3 option
for PX30. The PX30 sdram driver includes all of the selected DDR type
sets or just the DDR3 one if none is selected: not like it too much but
I preferred to preserve default fallback behavior (include DDR3 support
if no option is selected) to avoid modifing boards configs relying on
it. The parameters sets are applied as already described.

Signed-off-by: Massimo Pegorer <[email protected]>
---
Massimo Pegorer (2):
      ram: rockchip: improve ddr type configs selection
      ram: rockchip: px30: allow multiple DDR types selection

 drivers/ram/rockchip/Kconfig      | 78 ++++++++++++++++++++++++++++++++++++---
 drivers/ram/rockchip/sdram_px30.c | 35 +++++++++++-------
 2 files changed, 93 insertions(+), 20 deletions(-)
---
base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc
change-id: 20260828-ddr-multi-2c4fd64344c8

Best regards,
--  
Massimo Pegorer <[email protected]>

Reply via email to