[PATCH/RFC] rockchip: derive GPIO bank from alias if available
John Keeping
john at metanate.com
Wed Jul 27 18:27:32 CEST 2022
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 at metanate.com> wrote:
> >
> > Upstream device trees now use standard node names like "gpio at ff..." but
> > the rk_gpio driver expects a name like "gpio0 at 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 at 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 at ff750000 {
where the name is "gpio0 at ..." 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
More information about the U-Boot
mailing list