From: Andre Przywara <andre.przywara@arm.com>
To: Simon Glass <sjg@chromium.org>
Cc: "Jernej Škrabec" <jernej.skrabec@gmail.com>,
u-boot@lists.denx.de, "Lukasz Majewski" <lukma@denx.de>,
"Sean Anderson" <seanga2@gmail.com>,
"Jaehoon Chung" <jh80.chung@samsung.com>,
"Tom Rini" <trini@konsulko.com>,
"Cody Eksal" <masterr3c0rd@epochal.quest>,
linux-sunxi@lists.linux.dev, Parthiban <parthiban@linumiz.com>
Subject: Re: [PATCH 2/8] sunxi: pmic_bus: support alternative I2C address
Date: Tue, 21 Jan 2025 00:05:08 +0000 [thread overview]
Message-ID: <20250121000508.22db819a@minigeek.lan> (raw)
In-Reply-To: <CAFLszTjDq4E05Q_esYA2tAGOYdhgbRp3B38gAsF0hX44Nf-34A@mail.gmail.com>
On Mon, 20 Jan 2025 12:21:28 -0700
Simon Glass <sjg@chromium.org> wrote:
Hi Simon,
> On Mon, 20 Jan 2025 at 09:42, Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> >
> > Dne nedelja, 19. januar 2025 ob 23:25:30 Srednjeevropski standardni čas je Andre Przywara napisal(a):
> > > On Sat, 18 Jan 2025 08:21:31 +0100
> > > Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> > >
> > > Hi Jernej,
> > >
> > > many thanks for the review and your opinion.
> > >
> > > > Dne petek, 17. januar 2025 ob 02:45:31 Srednjeevropski standardni čas je Andre Przywara napisal(a):
> > > > > Some of the X-Power AXP PMICs can be ordered with an alternative I2C
> > > > > address, for instance an AXP717 could be shipped with address 0x34 or
> > > > > with address 0x35.
> > > > > The datasheets for the AXP717 and AXP803 list two possible addresses,
> > > > > and they are always consecutive. For DM (DT) based drivers this is no
> > > > > problem, but the Allwinner SPL code relies on a hardcoded address.
> > > > >
> > > > > Add a Kconfig variable that will add "1" to the existing address if it
> > > > > is set.
> > > > > This enables to use the AXP717 as used on boards with the new Allwinner
> > > > > A523 chip.
> > > > >
> > > > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > > >
> > > > This works until some board vendor start mixing one or another address
> > > > PMIC. Note that BSP boot0 does address autodetection, so it's not entirely
> > > > out of the question. Anyway, let's hope we don't see anything like that.
> > >
> > > I looked at the datasheets for all supported PMICs, and they either
> > > state one or two supported addresses, in the latter case both
> > > consecutive. Autodetection sounds nice, but also unnecessary: we surely
> > > know what address it is for a certain board? And with those A523 boards
> > > having two PMICs, autodetection might become sketchy, as we don't know
> > > for sure which PMIC we got?
> >
> > Speaking for T527 BSP boot0 - they check version register to make sure that
> > correct PMIC is installed.
> >
> > >
> > > But that got me thinking: what about putting the I2C address in Kconfig
> > > directly, with defaults depending on the PMIC type?
> > >
> > > config AXP_I2C_ADDR
> > > hex "AXP PMIC I2C address"
> > > depends on ARCH_SUNXI && !SUNXI_NO_PMIC
> > > default 0x36 if AXP305_POWER
> > > ....
> > >
> > > That's should work seamlessly for all supported PMICs, and we just need
> > > one line for the Avaota, same as with this patch here.
> > >
> > > What do you think?
> >
> > Yeah, looks more universal and avoids code changes in pmic_bus.c when
> > adding support for new AXP PMIC, which is very nice indeed.
>
> Shouldn't this be in the devicetree?
It is, and the DM based I2C driver used in U-Boot proper does this
properly, and works fine. But this here is for the SPL, where we don't
have DT support. We need just minimal support to adjust the regulator
for the DRAMs. So far there is one fixed address used by each PMIC, so
this is simply hardcoded, based on which PMIC is selected. The patch I
am now proposing (snippet above) just moves that hardcoding into
Kconfig.
Cheers,
Andre
> [..]
> Regards,
> Simon
>
next prev parent reply other threads:[~2025-01-21 0:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 1:45 [PATCH 0/8] sunxi: (early) Allwinner A133 SoC support Andre Przywara
2025-01-17 1:45 ` [PATCH 1/8] sunxi: clock: improve grouping of default clock register values Andre Przywara
2025-01-18 7:16 ` Jernej Škrabec
2025-01-17 1:45 ` [PATCH 2/8] sunxi: pmic_bus: support alternative I2C address Andre Przywara
2025-01-18 7:21 ` Jernej Škrabec
2025-01-19 22:25 ` Andre Przywara
2025-01-20 16:42 ` Jernej Škrabec
2025-01-20 19:21 ` Simon Glass
2025-01-21 0:05 ` Andre Przywara [this message]
2025-01-23 14:37 ` Simon Glass
2025-03-18 0:34 ` Andre Przywara
2025-01-17 1:45 ` [PATCH 3/8] sunxi: H616: DRAM: rename Kconfig parameters to be more generic Andre Przywara
2025-01-18 7:22 ` Jernej Škrabec
2025-01-17 1:45 ` [PATCH 4/8] clk: sunxi: Add support for the A100/A133 CCU Andre Przywara
2025-01-18 7:24 ` Jernej Škrabec
2025-01-17 1:45 ` [PATCH 5/8] pinctrl: sunxi: add Allwinner A100/A133 pinctrl description Andre Przywara
2025-01-18 7:25 ` Jernej Škrabec
2025-01-17 1:45 ` [PATCH 6/8] power: pmic: sunxi: add SPL support for the AXP803 Andre Przywara
2025-01-18 7:29 ` Jernej Škrabec
2025-01-17 1:45 ` [PATCH 7/8] sunxi: A133: add DRAM init code [WIP!] Andre Przywara
2025-01-18 8:17 ` Jernej Škrabec
2025-01-18 15:20 ` Cody Eksal
2025-01-17 1:45 ` [PATCH 8/8] sunxi: add support for the Allwinner A100/A133 SoC Andre Przywara
2025-01-18 7:35 ` Jernej Škrabec
2025-01-19 23:52 ` 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=20250121000508.22db819a@minigeek.lan \
--to=andre.przywara@arm.com \
--cc=jernej.skrabec@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=lukma@denx.de \
--cc=masterr3c0rd@epochal.quest \
--cc=parthiban@linumiz.com \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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