[Redo without the HTML] On Fri, 19 Apr 2024 at 04:59, Florian Fainelli <florian.fainelli@xxxxxxxxxxxx> 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@xxxxxxxxxxxx> 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