[PATCH 0/5] sunxi: H616: improve DRAM setup and add LPDDR3 support

Andre Przywara andre.przywara at arm.com
Wed Jun 7 02:07:40 CEST 2023


Hi,

this series picks up on Mikhail's H616 LPDDR3 DRAM support (many thanks
again for sending that!), and prepends some patches that help to keep
the code size down.
This was triggered by Mikhail's patches creating bigger binaries, even
though the DRAM type is known at compile time, and the compiler should
optimise out the unused code parts.
Looking at the disassembly I found some issues that this series fixes:
- One function was not declared static, so was issued separately in the
  object file (patch 1/5).
- Many functions do not change the values in the struct that gets passed
  in, so we should mark this pointer as "const", to help the compiler
  with the "constant propagation" optimisation (patch 2/5).
- This alone does not really help, as this structure contains both
  variable and fixed fields. Patch 3/5 splits that up, so we can define
  one struct as "static const", which finally convinces the compiler to
  fold the compile-time constants into the code, and removes the code
  for the unused DRAM variant, along with other code parts. Even without
  the LPDDR3 support this reduces the code size by about 2KB(!), and
  allows the LPDDR3 patches to come for free, code-size wise.
- The final two patches are Mikhail's patches, slightly massaged: white
  space issue, keeping the static const phy_init[] array, rebased on
  top of the "const" work above. I haven't reviewed the patch in anger,
  though.

Please have a look and test.

Cheers,
Andre

Andre Przywara (3):
  sunxi: dram: make MBUS configuration functions static
  sunxi: H616: dram: const-ify DRAM function parameters
  sunxi: H616: dram: split struct dram_para

iuncuim (2):
  sunxi: H616: add DRAM type selection
  sunxi: H616: add LPDDR3 DRAM support

 .../include/asm/arch-sunxi/dram_sun50i_h616.h |  12 +-
 arch/arm/mach-sunxi/Kconfig                   |  18 +-
 arch/arm/mach-sunxi/dram_sun50i_h6.c          |   3 +-
 arch/arm/mach-sunxi/dram_sun50i_h616.c        | 383 +++++++++++-------
 arch/arm/mach-sunxi/dram_sunxi_dw.c           |  18 +-
 arch/arm/mach-sunxi/dram_timings/Makefile     |   4 +-
 .../mach-sunxi/dram_timings/h616_ddr3_1333.c  |   2 +-
 .../arm/mach-sunxi/dram_timings/h616_lpddr3.c |  95 +++++
 configs/orangepi_zero2_defconfig              |   1 +
 configs/x96_mate_defconfig                    |   1 +
 10 files changed, 372 insertions(+), 165 deletions(-)
 create mode 100644 arch/arm/mach-sunxi/dram_timings/h616_lpddr3.c

-- 
2.35.8



More information about the U-Boot mailing list