From: Phil Elwell <phil@raspberrypi.com>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Doug Berger <opendmb@gmail.com>, linux-gpio@vger.kernel.org
Subject: Re: Advice on using gpio-brcmstb with gpio-ranges
Date: Fri, 19 Apr 2024 09:36:00 +0100 [thread overview]
Message-ID: <CAMEGJJ3yDvyRvNM8y+mZzJyz0Y3+k8YRJim9cPXYaFiAgFb8vA@mail.gmail.com> (raw)
In-Reply-To: <4a0c4893-0c34-45f8-aef3-e8a7c2fc88b5@broadcom.com>
[Redo without the HTML]
On Fri, 19 Apr 2024 at 04:59, Florian Fainelli
<florian.fainelli@broadcom.com> wrote:
>
> On 4/18/2024 4:36 AM, Phil Elwell wrote:
> > Hello,
> >
> > I'm having difficulty using the gpio-brcmstb driver with the
> > gpio-ranges property. gpio-brcmstb allows multiple banks of up to 32
> > GPIO lines to be declared using a single DT node. However, if you do
> > that, any declared gpio-ranges get applied to all banks without any
> > kind of filtering or adjustment. This is because the gpio-brcmstb
> > makes use of gpio-mmio, which requires one gpio_chip per bank. These
> > gpio_chips have the same DT node, hence the same ranges, but are
> > unaware that only a subset applies to them.
> >
> > The GPIO<->pinctrl mapping can be configured in driver code, but this
> > is deprecated (as is forcing global GPIO base numbers to start at
> > zero, but the driver does it anyway).
>
> More like it has not been converted to use a dynamic base, that is on
> our TODO.
Then this may be a helpful starting point:
https://github.com/raspberrypi/linux/commit/2c6ef57c11137c07d5961c3dda2021e0403628ae
> > What is the best way forward? Does one have to say that in
> > gpio-brcmstb, gpio-ranges and multiple banks are mutually
> > incompatible?
>
> Do you have a DT snippet of what you would like to achieve?
Sure, but it's not very elaborate:
gio: gpio@7d508500 {
compatible = "brcm,brcmstb-gpio";
reg = <0x7d508500 0x40>;
interrupt-parent = <&main_irq>;
interrupts = <0>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
brcm,gpio-bank-widths = <32 22>;
brcm,gpio-direct;
gpio-ranges = <&pinctrl 0 0 54>;
};
Phil
On Fri, 19 Apr 2024 at 04:59, Florian Fainelli
<florian.fainelli@broadcom.com> wrote:
>
>
>
> On 4/18/2024 4:36 AM, Phil Elwell wrote:
> > Hello,
> >
> > I'm having difficulty using the gpio-brcmstb driver with the
> > gpio-ranges property. gpio-brcmstb allows multiple banks of up to 32
> > GPIO lines to be declared using a single DT node. However, if you do
> > that, any declared gpio-ranges get applied to all banks without any
> > kind of filtering or adjustment. This is because the gpio-brcmstb
> > makes use of gpio-mmio, which requires one gpio_chip per bank. These
> > gpio_chips have the same DT node, hence the same ranges, but are
> > unaware that only a subset applies to them.
> >
> > The GPIO<->pinctrl mapping can be configured in driver code, but this
> > is deprecated (as is forcing global GPIO base numbers to start at
> > zero, but the driver does it anyway).
>
> More like it has not been converted to use a dynamic base, that is on
> our TODO.
>
> >
> > What is the best way forward? Does one have to say that in
> > gpio-brcmstb, gpio-ranges and multiple banks are mutually
> > incompatible?
>
> Do you have a DT snippet of what you would like to achieve?
>
> >
> > Thanks,
> >
> > Phil
>
> --
> Florian
prev parent reply other threads:[~2024-04-19 8:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 11:36 Advice on using gpio-brcmstb with gpio-ranges Phil Elwell
2024-04-19 3:59 ` Florian Fainelli
2024-04-19 8:36 ` Phil Elwell [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=CAMEGJJ3yDvyRvNM8y+mZzJyz0Y3+k8YRJim9cPXYaFiAgFb8vA@mail.gmail.com \
--to=phil@raspberrypi.com \
--cc=florian.fainelli@broadcom.com \
--cc=linux-gpio@vger.kernel.org \
--cc=opendmb@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).