From: Andre Przywara <andre.przywara@arm.com>
To: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>,
u-boot@lists.u-boot-project.org
Cc: Tom Rini <trini@konsulko.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH] sunxi: Limit the PIO power mode copy to SoCs with the H6 layout
Date: Tue, 3 Nov 2026 15:06:08 +0100 [thread overview]
Message-ID: <bae86d13-eaea-4dea-a67d-64b166fb3ddd@arm.com> (raw)
In-Reply-To: <20261103112845.26721-1-vinicius.eduardo.pedrosa@gmail.com>
Hi Vinicius,
On 11/3/26 12:28, Vinicius Pedrosa wrote:
> gpio_init() copies PIO+0x348 (POW_MOD_VAL) to PIO+0x340 (POW_MOD_SEL)
> on the H6 generation and, as intended by commit 4a9e89a3e390 ("sunxi:
> introduce NCAT2 generation model"), on NCAT2 SoCs. The NCAT2 half has
> never been active, because the guard checks CONFIG_SUN50I_GEN_NCAT2
> while the Kconfig symbol is CONFIG_SUNXI_GEN_NCAT2.
>
> Fixing only the spelling would enable the copy on every NCAT2 SoC.
> That is right for the R528/T113: the T113-S3 user manual describes
> these registers at 0x340/0x348 like the H616 user manual, with each
> port's power value bit at the same position and polarity as its
> power mode select bit. It is wrong for the A523 family: its power mode
> registers are at 0x380/0x388, so the copy would write an interrupt
> configuration register at 0x340 instead.
>
> Enable the copy for the R528 explicitly instead of for all NCAT2 SoCs,
> and leave the A523 alone until it gets its own handling.
I think you can do better: instead of this untested patch that fixes a
non-issue, you should be able to do it right: In contrast to Linux,
U-Boot binaries are per-SoC, at best, so we can have compile time values
the differ between SoCs. So just adjusting SUN50I_H6_GPIO_POW_MOD_VAL
and friends for the A523 should do the trick.
The only added complication is the difference between R_PIO and PIO, then.
Cheers,
Andre
>
> Fixes: 4a9e89a3e390 ("sunxi: introduce NCAT2 generation model")
> Link: https://lore.kernel.org/u-boot/20260723105705.3338923-1-fugininsane@googlemail.com/
> Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
> ---
> Sören Hantel found the misspelled guard and posted the patch linked
> above. This replaces it, at his request.
>
> Build-tested only: I have no R528/T113 hardware. In reproducible
> builds on next ed869863, the SPL changes only for mangopi_mq_r (R528),
> which now has the copy. The SPLs for avaota-a1, orangepi_4a,
> radxa-cubie-a5e and x96q_pro_plus (A523), pine_h64 (H6),
> orangepi_zero2 (H616) and liontron-h-a133l (A133) are byte-identical.
>
> A Tested-by from anyone with an R528 or T113 board would be welcome.
>
> arch/arm/mach-sunxi/board.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index 432b1c10f9..75aede14b2 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -196,12 +196,13 @@ static int gpio_init(void)
>
> /*
> * Update PIO power bias configuration by copying the hardware
> - * detected value.
> + * detected value. This relies on the H6 layout (SEL at 0x340, VAL
> + * at 0x348, matching per-port bit meanings). Not all NCAT2 SoCs
> + * have it: the A523 needs different handling.
> */
> if (IS_ENABLED(CONFIG_SUN50I_GEN_H6) ||
> - IS_ENABLED(CONFIG_SUN50I_GEN_NCAT2)) {
> + IS_ENABLED(CONFIG_MACH_SUN8I_R528)) {
> val = readl(SUNXI_PIO_BASE + SUN50I_H6_GPIO_POW_MOD_VAL);
> - /* TODO: A523: keep only the lower two bits? */
> writel(val, SUNXI_PIO_BASE + SUN50I_H6_GPIO_POW_MOD_SEL);
> }
> if (IS_ENABLED(CONFIG_SUN50I_GEN_H6)) {
next prev parent reply other threads:[~2026-11-03 14:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 11:28 [PATCH] sunxi: Limit the PIO power mode copy to SoCs with the H6 layout Vinicius Pedrosa
2026-11-03 14:06 ` Andre Przywara [this message]
2026-11-04 10:38 ` [PATCH v2] sunxi: a523: set up the PIO withstand voltage mode Vinicius Pedrosa
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=bae86d13-eaea-4dea-a67d-64b166fb3ddd@arm.com \
--to=andre.przywara@arm.com \
--cc=ilias.apalodimas@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=vinicius.eduardo.pedrosa@gmail.com \
/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