public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Kever Yang <kever.yang@rock-chips.com>
Subject: Re: [PATCH/RFC] rockchip: derive GPIO bank from alias if available
Date: Wed, 27 Jul 2022 17:27:32 +0100	[thread overview]
Message-ID: <YuFndCILv5iTV8AU@donbot> (raw)
In-Reply-To: <CAPnjgZ3j7YVJt+B-uEKS_rsSRBSR-kmyLujV3RozL7kbFNrqFw@mail.gmail.com>

Hi Simon,

On Tue, Jul 26, 2022 at 01:53:44PM -0600, Simon Glass wrote:
> On Tue, 26 Jul 2022 at 10:25, John Keeping <john@metanate.com> wrote:
> >
> > Upstream device trees now use standard node names like "gpio@ff..." but
> > the rk_gpio driver expects a name like "gpio0@ff..." (note the index
> > before the @).
> >
> > This is not a change that can be made in a -u-boot.dtsi file, so
> > updating to the latest upstream device trees requires updating the
> > driver.
> >
> > When a sequence number is given explicitly via an alias it makes sense
> > to use this for the bank number (and aliases can be added via
> > -u-boot.dtsi when they are not present upstream), so make this the
> > preferred scheme for assigning a bank index, falling back to the current
> > method if no alias is defined.
> >
> > Signed-off-by: John Keeping <john@metanate.com>
> > ---
> > I'm not sure if it would be better just to use dev_seq(dev)
> > unconditionally here.  If no aliases are defined, then the device tree
> > nodes are in the right order for all Rockchip SoCs anyway so the
> > sequence numbers will be sensible.
> 
> Well dev_seq() should now match the alias numbers if provided, so it
> seems better.

Right, when there are aliases dev_seq() is definitely right, but
currently the bank number is derived from a node like:

	gpio0: gpio0@ff750000 {

where the name is "gpio0@..." and it's that zero that is used to
determine the bank.

I don't think all boards define aliases for the GPIOs, so I thought it
might be better to preserve the existing node-name scheme when no alias
is set.  But there seems to be quite a push towards standardised node
names upstream so eventually updating the device trees from upstream
will break this scheme.

Having looked around a bit more, it seems that of the drivers generating
a bank name with 'A'+index, while PIC32 uses the same node name scheme
as Rockchip, both octeon and mvebu use dev_seq(), so it does seem
sensible to just switch to dev_seq() as the right way to do this.


Regards,
John

      reply	other threads:[~2022-07-27 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 16:25 [PATCH/RFC] rockchip: derive GPIO bank from alias if available John Keeping
2022-07-26 19:53 ` Simon Glass
2022-07-27 16:27   ` John Keeping [this message]

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=YuFndCILv5iTV8AU@donbot \
    --to=john@metanate.com \
    --cc=kever.yang@rock-chips.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --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