mbox series

[v3,00/14] pinctrl: add BCM63XX pincontrol support

Message ID 20210303142310.6371-1-noltari@gmail.com (mailing list archive)
Headers show
Series pinctrl: add BCM63XX pincontrol support | expand

Message

Álvaro Fernández Rojas March 3, 2021, 2:22 p.m. UTC
First of all, I've based this on the patches sent by Jonas Gorski back in
2016:
https://www.spinics.net/lists/linux-gpio/msg15983.html
http://patchwork.ozlabs.org/project/linux-gpio/patch/1471604025-21575-2-git-send-email-jonas.gorski@gmail.com/

I've tried to address all coments from Linus Walleij, but I know that
this may still need some other modifications

This patchset adds appropriate binding documentation and drivers for
pin controller cores found in the BCM63XX MIPS SoCs currently supported.

While the GPIO part is always the same, the pinmux part varies quite a
lot between different SoCs. Sometimes they have defined groups which
can be muxed into different functions, sometimes each function has a
different group. Sometimes you can mux individual pins. Often it is a
combination of single pins and groups.

Some core versions require the GPIO direction to be set according to the
function, most do not. Sometimes the mux register(s) contain bits for
unrelated other functions.

v3: introduce new files for shared code and add more changes suggested by
 Linus Walleij. Also add a new patch needed for properly parsing gpio-ranges.
v2: introduce changes suggested by Linus Walleij and remove interrupts
 - In order to use GPIO_REGMAP, the need to get gpio_chip from gpio_regmap
 and use it for pinctrl_add_gpio_range() and gpio_chip.direction_input()
 and gpio_chip.direction_output().

Álvaro Fernández Rojas (14):
  gpio: regmap: set gpio_chip of_node
  pinctrl: bcm: add bcm63xx base code
  Documentation: add BCM6328 pincontroller binding documentation
  pinctrl: add a pincontrol driver for BCM6328
  Documentation: add BCM6358 pincontroller binding documentation
  pinctrl: add a pincontrol driver for BCM6358
  Documentation: add BCM6362 pincontroller binding documentation
  pinctrl: add a pincontrol driver for BCM6362
  Documentation: add BCM6368 pincontroller binding documentation
  pinctrl: add a pincontrol driver for BCM6368
  Documentation: add BCM63268 pincontroller binding documentation
  pinctrl: add a pincontrol driver for BCM63268
  Documentation: add BCM6318 pincontroller binding documentation
  pinctrl: add a pincontrol driver for BCM6318

 .../pinctrl/brcm,bcm6318-pinctrl.yaml         | 187 +++++
 .../pinctrl/brcm,bcm63268-pinctrl.yaml        | 208 ++++++
 .../pinctrl/brcm,bcm6328-pinctrl.yaml         | 171 +++++
 .../pinctrl/brcm,bcm6358-pinctrl.yaml         | 137 ++++
 .../pinctrl/brcm,bcm6362-pinctrl.yaml         | 250 +++++++
 .../pinctrl/brcm,bcm6368-pinctrl.yaml         | 261 +++++++
 drivers/gpio/gpio-regmap.c                    |   1 +
 drivers/pinctrl/bcm/Kconfig                   |  57 ++
 drivers/pinctrl/bcm/Makefile                  |   7 +
 drivers/pinctrl/bcm/pinctrl-bcm6318.c         | 496 ++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm63268.c        | 643 ++++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6328.c         | 403 +++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6358.c         | 369 ++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6362.c         | 617 +++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6368.c         | 523 ++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm63xx.c         | 113 +++
 drivers/pinctrl/bcm/pinctrl-bcm63xx.h         |  46 ++
 include/linux/gpio/regmap.h                   |   3 +
 18 files changed, 4492 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6318.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63268.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6328.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6358.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6362.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6368.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.h

Comments

Linus Walleij March 3, 2021, 3:29 p.m. UTC | #1
On Wed, Mar 3, 2021 at 3:23 PM Álvaro Fernández Rojas <noltari@gmail.com> wrote:

> v3: introduce new files for shared code and add more changes suggested by
>  Linus Walleij. Also add a new patch needed for properly parsing gpio-ranges.

This looks very appetizing, I am ready to merge this once we cut some
slack for DT review (a week or two).

I'd like to merge it soon so you can start working on the IRQ add-on.

I'd probably drop the IRQ-related selects from Kconfig
when applying though (no big deal, no need to resend over that).

Yours,
Linus Walleij
Álvaro Fernández Rojas March 3, 2021, 4:23 p.m. UTC | #2
Hi Linus,

> El 3 mar 2021, a las 16:29, Linus Walleij <linus.walleij@linaro.org> escribió:
> 
> On Wed, Mar 3, 2021 at 3:23 PM Álvaro Fernández Rojas <noltari@gmail.com> wrote:
> 
>> v3: introduce new files for shared code and add more changes suggested by
>> Linus Walleij. Also add a new patch needed for properly parsing gpio-ranges.
> 
> This looks very appetizing, I am ready to merge this once we cut some
> slack for DT review (a week or two).
> 
> I'd like to merge it soon so you can start working on the IRQ add-on.
> 
> I'd probably drop the IRQ-related selects from Kconfig
> when applying though (no big deal, no need to resend over that).

About that, it seems that GPIO_REGMAP should select GPIOLIB_IRQCHIP, since I couldn’t build the kernel due to the following error when I removed the IRQ-related selects:
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
mips-linux-gnu-ld: drivers/gpio/gpio-regmap.o: in function `gpio_regmap_register':
gpio-regmap.c:(.text+0x704): undefined reference to `gpiochip_irqchip_add_domain'
make: *** [Makefile:1197: vmlinux] Error 1

Or maybe we could guard these lines of gpio-regmap.c with #ifdef GPIOLIB_IRQCHIP:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpio-regmap.c#L282-L286

> 
> Yours,
> Linus Walleij

Best regards,
Álvaro.
Linus Walleij March 4, 2021, 12:13 a.m. UTC | #3
On Wed, Mar 3, 2021 at 5:23 PM Álvaro Fernández Rojas <noltari@gmail.com> wrote:

> Or maybe we could guard these lines of gpio-regmap.c with #ifdef GPIOLIB_IRQCHIP:
> https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpio-regmap.c#L282-L286

That's the best approach. I wasn't a big fan of this ability to insert
an external
irqdomain in the first place, so it should be as optional as possible.

Yours,
Linus Walleij