[PATCH 0/5] sunxi: h6/h616: consolidate DRAM code

Jernej Skrabec jernej.skrabec at gmail.com
Fri Apr 11 18:14:34 CEST 2025


While working on A523 support, it became obvious that newer sunxi DRAM
drivers are similar in many ways, so it makes sense to share some code
between them. Let's start with DRAM size and ranks detection. There were
many fixes for it in H616 driver, so make sense to unify code interface
and split out h616 part into separate file and reuse it for h6 too. This
will probably solve some DRAM size detection issues on h6 reported
through the years.

Patch 1 adds more error reporting in case rows or column size is not
correctly detected.

Patches 2-4 bring h6 code close enough to h616 so code sharing is
possible.

Patch 5 splits out h616 code and reuse it on h6.

Note I'm currently not able test the code, so if anyone else could do it
I would appreciate very much.

There are further possibilities regarding code sharing in the future,
like:
- memory controller is pretty similar for H6, H616 and A523
- unify config and parameters structures

Best regards,
Jernej

Jernej Skrabec (5):
  sunxi: h616: Panic if DRAM size is not detected
  sunxi: H6: Remove useless DRAM timings parameter
  sunxi: H6: DRAM: Constify function parameters
  sunxi: h6: dram: split dram_para struct
  sunxi: h6/h616: Reuse common DRAM infrastructure

 .../include/asm/arch-sunxi/dram_dw_helpers.h  |  22 +++
 .../include/asm/arch-sunxi/dram_sun50i_h6.h   |   9 +-
 arch/arm/mach-sunxi/Makefile                  |   4 +-
 arch/arm/mach-sunxi/dram_dw_helpers.c         | 160 ++++++++++++++++
 arch/arm/mach-sunxi/dram_sun50i_h6.c          | 180 +++++-------------
 arch/arm/mach-sunxi/dram_sun50i_h616.c        | 145 +-------------
 .../mach-sunxi/dram_timings/h6_ddr3_1333.c    |   2 +-
 arch/arm/mach-sunxi/dram_timings/h6_lpddr3.c  |   2 +-
 8 files changed, 247 insertions(+), 277 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/dram_dw_helpers.h
 create mode 100644 arch/arm/mach-sunxi/dram_dw_helpers.c

-- 
2.49.0



More information about the U-Boot mailing list