From: Daniel Golle <daniel@makrotopia.org>
To: Alastair D'Silva <alastair@d-silva.org>
Cc: u-boot@lists.u-boot-project.org, Tom Rini <trini@konsulko.com>,
Andre Przywara <andre.przywara@arm.com>,
Hans de Goede <hdegoede@redhat.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Jaehoon Chung <jh80.chung@samsung.com>,
Lukasz Majewski <lukma@nabladev.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Peng Fan <peng.fan@nxp.com>,
Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
Yixun Lan <dlan@kernel.org>, Yixun Lan <dlan@gentoo.org>,
Enzo Adriano <enzo.adriano.code@gmail.com>,
Junhui Liu <junhui.liu@pigmoral.tech>,
Alastair D'Silva <alastair@d-silva.org>
Subject: Re: [PATCH 15/26] sunxi: dram: a733: Add ARC PMU primitives, clock, telemetry, and CBT
Date: Thu, 26 Nov 2026 19:06:25 +0000 [thread overview]
Message-ID: <awiDMTcFCalJb_Q3@makrotopia.org> (raw)
In-Reply-To: <20261113023236.569054-16-alastair@d-silva.org>
Hi Alastair,
I have been running this series on an Orange Pi 4 Pro with 4 GiB LPDDR5
(dual rank, two channels, pin swizzle enabled, 3600 MT/s). On that
board dual-rank training passes in about one attempt out of three (16
of 48 trainings in a loop in SPL); the others end in status 0xff and
the driver falls back or fails. The vendor boot0 trains the same board
reliably each time. The cause is in this patch, with two more problems
in patches 17 and 18 which I will comment on there.
On Fri, 13 Nov 2026 13:32:25 +1100, Alastair D'Silva wrote:
> [...]
> +void pmu_cbt_timing_pulse_coordinator(u16 cal_mode, u32 phase_sel)
> +{
> + u32 zero = 0U;
> + __volatile__ u16 *out_tbl =
> + (__volatile__ u16 *)PMU_DMEM_DELAY_TAP_LUT;
> + __volatile__ u16 *out_sub1 =
> + (__volatile__ u16 *)PMU_DMEM_DELAY_TAP_SUB1;
> + u32 mask_word;
> + u32 phase;
> +
> + out_tbl[0] = 100U;
> +
> + for (phase = 0U; phase < 4U; phase++) {
> + u32 pulse_mask;
> + u16 step;
> + u16 marker;
> +
> + if (phase_sel == 0U) {
> + if (phase == 0U)
> + pulse_mask = 0x7f00U;
> + else if (phase == 1U)
> + pulse_mask = 0x7f0000U;
> + else if (phase == 2U)
> + pulse_mask = 0x7f007f7fUL;
> + else
> + pulse_mask = 0x7f7f007fUL;
> + } else {
> + if (phase == 0U)
> + pulse_mask = 0x7fU;
> + else if (phase == 1U)
> + pulse_mask = 0x7f000000UL;
> + else if (phase == 2U)
> + pulse_mask = 0x7f007f7fUL;
> + else
> + pulse_mask = 0x007f7f7fUL;
> + }
> +
> + mask_word = pulse_mask;
> + step = out_tbl[phase];
> + pmu_cal_marker_pair_set((u16)(step << 2));
> +
> + pmu_cal_sequence_pulse_send(0x41UL << 19, 7U, 8U, 0U,
> + zero, zero, zero);
> + pmu_cal_pad_timing_delay_set(0U, 4U, 1U);
> +
> + pmu_cal_window_params_dispatch((const u8 *)&mask_word, 2U, cal_mode);
The capture masks do not match what the PHY firmware in the vendor
boot0 sends for the two phase selectors, and the last two arguments of
pmu_cal_window_params_dispatch() are swapped: its prototype is
(params_buf, base_val, mode_flags), so cal_mode has to be the base
value and 2 the mode. With the masks as above CBT finds no CA window on
my board and the CA delays stay at their reset value 0x40.
With the change below dual-rank training passes in 48 of 48 attempts,
on the first try each time, and the CA delays of channel 0 end up
within one step of the values boot0 leaves in the PHY:
diff --git a/arch/arm/mach-sunxi/pmu/pmu_cbt.c b/arch/arm/mach-sunxi/pmu/pmu_cbt.c
index 6c97ad8532e..fe2d59f2d96 100644
--- a/arch/arm/mach-sunxi/pmu/pmu_cbt.c
+++ b/arch/arm/mach-sunxi/pmu/pmu_cbt.c
@@ -244,18 +244,18 @@ void pmu_cbt_timing_pulse_coordinator(u16 cal_mode, u32 phase_sel)
u16 step;
u16 marker;
- if (phase_sel == 0U) {
+ if (phase_sel != 0U) {
if (phase == 0U)
pulse_mask = 0x7f00U;
else if (phase == 1U)
pulse_mask = 0x7f0000U;
else if (phase == 2U)
- pulse_mask = 0x7f007f7fUL;
- else
pulse_mask = 0x7f7f007fUL;
+ else
+ pulse_mask = 0x7f007f7fUL;
} else {
if (phase == 0U)
- pulse_mask = 0x7fU;
+ pulse_mask = 0x7f0000U;
else if (phase == 1U)
pulse_mask = 0x7f000000UL;
else if (phase == 2U)
@@ -272,7 +272,7 @@ void pmu_cbt_timing_pulse_coordinator(u16 cal_mode, u32 phase_sel)
zero, zero, zero);
pmu_cal_pad_timing_delay_set(0U, 4U, 1U);
- pmu_cal_window_params_dispatch((const u8 *)&mask_word, 2U, cal_mode);
+ pmu_cal_window_params_dispatch((const u8 *)&mask_word, cal_mode, 2U);
pmu_cal_pad_timing_delay_set(0U, 20U, 1U);
pmu_cal_sequence_pulse_send(1UL << 18, 7U, 4U, 0U,
> [...]
> +
> + *out_num_slices = (u8)(is_ch1 + 1U);
> + return 0U;
pmu_cal_rx_en_pre_init() in patch 18 needs to know which AC slice this
call selected. Please also record it here, at the DMEM byte the CA
sampler pmu_dbyte_deskew_phase_sample() reads (0x80000b66, see my reply
to patch 18 for the name and the rest of that change):
diff --git a/arch/arm/mach-sunxi/pmu/pmu_telemetry.c b/arch/arm/mach-sunxi/pmu/pmu_telemetry.c
index ea47e991fcf..0e004448fea 100644
--- a/arch/arm/mach-sunxi/pmu/pmu_telemetry.c
+++ b/arch/arm/mach-sunxi/pmu/pmu_telemetry.c
@@ -565,6 +565,7 @@ u32 pmu_cal_channel_rank_config_get(u32 rank, u16 *out_cfg, u8 *out_mode_sel,
return 1U;
*out_num_slices = (u8)(is_ch1 + 1U);
+ dmem_write8(PMU_DMEM_ACTIVE_SLICE, (u8)is_ch1);
return 0U;
}
Tested on the Orange Pi 4 Pro only: 48 trainings per step of the three
changes, each 48 of 48, plus ten boots of the result; training then
takes 4.65 s from the SPL banner, boot0 needs 5.04 s. The three
functions were also compared call by call against the boot0 firmware in
an emulator for other inputs (single rank, single channel, swizzle off,
other step sizes and data rates), where they behave the same; nothing
but the 4 GiB board has run on hardware.
For transparency: an LLM coding assistant was used for the emulator
comparison and for drafting these changes; the numbers above were
measured on the board.
Cheers
Daniel
next prev parent reply other threads:[~2026-11-26 19:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 2:32 [PATCH 00/26] sunxi: Add Allwinner A733 (sun60i) and Orange Pi 4 Pro support Alastair D'Silva
2026-11-13 2:32 ` [PATCH 01/26] power: regulator: axp: Fix AXP318W ELDO voltage mask Alastair D'Silva
2026-11-20 0:06 ` Andre Przywara
2026-11-13 2:32 ` [PATCH 02/26] power: pmic: axp: Fix AXP318W sysreset shutdown register Alastair D'Silva
2026-11-13 2:32 ` [PATCH 03/26] power: axp: Extend AXP318W SPL support with DCDC6/7 and LDOs Alastair D'Silva
2026-11-13 2:32 ` [PATCH 04/26] dt-bindings: clk: sun60i-a733-ccu: Add Allwinner A733 support Alastair D'Silva
2026-11-13 2:32 ` [PATCH 05/26] mmc: sunxi: Scale data transfer timeout with transfer size Alastair D'Silva
2026-11-13 2:32 ` [PATCH 06/26] gpio: a733: add initial support Alastair D'Silva
2026-11-13 2:32 ` [PATCH 07/26] pinctrl: sunxi: " Alastair D'Silva
2026-11-13 2:32 ` [PATCH 08/26] clock: reset: " Alastair D'Silva
2026-11-13 2:32 ` [PATCH 09/26] clock: a733: implement support for mmc/uart Alastair D'Silva
2026-11-13 2:32 ` [PATCH 10/26] sunxi: mmc: enable support for A733 Alastair D'Silva
2026-11-13 2:32 ` [PATCH 11/26] sunxi: a733: uart: setup serial console Alastair D'Silva
2026-11-13 2:32 ` [PATCH 12/26] arm64: spl: Support disposable .init.rodata section after _image_binary_end Alastair D'Silva
2026-11-13 2:32 ` [PATCH 13/26] sunxi: fel: Add Allwinner A733 ERET FEL return support Alastair D'Silva
2026-11-19 23:53 ` Andre Przywara
2026-11-13 2:32 ` [PATCH 14/26] sunxi: dram: a733: Add ARC PMU register, ABI, and build definitions Alastair D'Silva
2026-11-13 2:32 ` [PATCH 15/26] sunxi: dram: a733: Add ARC PMU primitives, clock, telemetry, and CBT Alastair D'Silva
2026-11-26 19:06 ` Daniel Golle [this message]
2026-11-13 2:32 ` [PATCH 16/26] sunxi: dram: a733: Add ARC PMU deskew and BIST training firmware Alastair D'Silva
2026-11-13 2:32 ` [PATCH 17/26] sunxi: dram: a733: Add ARC PMU 1D/2D eye " Alastair D'Silva
2026-11-26 19:06 ` Daniel Golle
2026-11-13 2:32 ` [PATCH 18/26] sunxi: dram: a733: Add ARC PMU training state machine Alastair D'Silva
2026-11-26 19:07 ` Daniel Golle
2026-11-13 2:32 ` [PATCH 19/26] sunxi: dram: a733: Add Allwinner A733 LPDDR5 DRAM driver Alastair D'Silva
2026-11-13 2:32 ` [PATCH 20/26] sunxi: sun60i: initial support for A733 SoC Alastair D'Silva
2026-11-13 2:32 ` [PATCH 21/26] doc: sunxi: Document Allwinner A733 LPDDR5 PMU architecture Alastair D'Silva
2026-11-13 2:32 ` [PATCH 22/26] phy: sunxi: Add Allwinner A733 Cadence Combo PHY driver Alastair D'Silva
2026-11-13 2:32 ` [PATCH 23/26] pci: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver Alastair D'Silva
2026-11-20 19:43 ` Neil Armstrong
2026-11-13 2:32 ` [PATCH 24/26] sunxi: Add NVMe to distro boot targets Alastair D'Silva
2026-11-13 2:32 ` [PATCH 25/26] arm64: dts: allwinner: add A733 SoC description Alastair D'Silva
2026-11-13 2:32 ` [PATCH 26/26] sunxi: Add Xunlong Orange Pi 4 Pro board support Alastair D'Silva
2026-11-13 7:28 ` [PATCH 00/26] sunxi: Add Allwinner A733 (sun60i) and Orange Pi 4 Pro support Alastair D'Silva
2026-11-20 0:31 ` 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=awiDMTcFCalJb_Q3@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=alastair@d-silva.org \
--cc=andre.przywara@arm.com \
--cc=dlan@gentoo.org \
--cc=dlan@kernel.org \
--cc=enzo.adriano.code@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jh80.chung@samsung.com \
--cc=junhui.liu@pigmoral.tech \
--cc=lukma@nabladev.com \
--cc=neil.armstrong@linaro.org \
--cc=peng.fan@nxp.com \
--cc=tanmay.kathpalia@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.