Skip to content

sunxi: H616: improve DRAM setup and add LPDDR3 support

Andre Przywara linux-sunxi u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5sunxi: dram: make MBUS configuration functions staticarch/arm/mach-sunxi/dram_sun50i_h6.c arch/arm/mach-sunxi/dram_sun50i_h616.c arch/arm/mach-sunxi/dram_sunxi_dw.c+12 -111 reply
2/5sunxi: H616: dram: const-ify DRAM function parametersarch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h arch/arm/mach-sunxi/dram_sun50i_h616.c arch/arm/mach-sunxi/dram_timings/h616_ddr3_1333.c+17 -171 reply
3/5sunxi: H616: dram: split struct dram_paraarch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h arch/arm/mach-sunxi/dram_sun50i_h616.c+101 -912 replies
4/5sunxi: H616: add DRAM type selectionarch/arm/mach-sunxi/Kconfig arch/arm/mach-sunxi/dram_timings/Makefile configs/orangepi_zero2_defconfig +1 more+12 -31 reply
5/5sunxi: H616: add LPDDR3 DRAM supportarch/arm/mach-sunxi/Kconfig arch/arm/mach-sunxi/dram_sun50i_h616.c arch/arm/mach-sunxi/dram_timings/Makefile +1 more+242 -552 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchJernej Skrabec
1/5R-b
2/5R-b
3/5R-b
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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
Signature · 1 line
2.35.8