ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
	Mikhail Kalashnikov <iuncuim@gmail.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Icenowy Zheng <uwu@icenowy.me>,
	Piotr Oniszczuk <piotr.oniszczuk@gmail.com>,
	u-boot@lists.denx.de, linux-sunxi@lists.linux.dev
Subject: [PATCH 0/5] sunxi: H616: improve DRAM setup and add LPDDR3 support
Date: Wed,  7 Jun 2023 01:07:40 +0100	[thread overview]
Message-ID: <20230607000745.10245-1-andre.przywara@arm.com> (raw)

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


             reply	other threads:[~2023-06-07  0:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  0:07 Andre Przywara [this message]
2023-06-07  0:07 ` [PATCH 1/5] sunxi: dram: make MBUS configuration functions static Andre Przywara
2023-06-09 20:24   ` Jernej Škrabec
2023-06-07  0:07 ` [PATCH 2/5] sunxi: H616: dram: const-ify DRAM function parameters Andre Przywara
2023-06-09 20:24   ` Jernej Škrabec
2023-06-07  0:07 ` [PATCH 3/5] sunxi: H616: dram: split struct dram_para Andre Przywara
2023-06-09 20:26   ` Jernej Škrabec
2023-06-09 22:48     ` Andre Przywara
2023-06-07  0:07 ` [PATCH 4/5] sunxi: H616: add DRAM type selection Andre Przywara
2023-06-09 20:29   ` Jernej Škrabec
2023-06-07  0:07 ` [PATCH 5/5] sunxi: H616: add LPDDR3 DRAM support Andre Przywara
2023-06-09 20:38   ` Jernej Škrabec
2023-06-09 21:15     ` Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230607000745.10245-1-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=iuncuim@gmail.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=piotr.oniszczuk@gmail.com \
    --cc=samuel@sholland.org \
    --cc=u-boot@lists.denx.de \
    --cc=uwu@icenowy.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox