Re: [PATCH v7 06/11] pinctrl: rp1: Implement RaspberryPi RP1 gpio support

Stefan Wahren
2025-02-08T14:37:01Z

Hi Andrea,

Am 07.02.25 um 22:31 schrieb Andrea della Porta:
> The RP1 is an MFD supporting a gpio controller and /pinmux/pinctrl.
> Add minimum support for the gpio only portion. The driver is in
> pinctrl folder since upcoming patches will add the pinmux/pinctrl
> support where the gpio part can be seen as an addition.
>
> Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
> ---
> MAINTAINERS | 1 +
> drivers/pinctrl/Kconfig | 11 +
> drivers/pinctrl/Makefile | 1 +
> drivers/pinctrl/pinctrl-rp1.c | 789 ++++++++++++++++++++++++++++++++++
> 4 files changed, 802 insertions(+)
> create mode 100644 drivers/pinctrl/pinctrl-rp1.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a4a9555c07c5..f2ba6f565d30 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -19756,6 +19756,7 @@ F: Documentation/devicetree/bindings/misc/pci1de4,1.yaml
> F: Documentation/devicetree/bindings/pci/pci-ep-bus.yaml
> F: Documentation/devicetree/bindings/pinctrl/raspberrypi,rp1-gpio.yaml
> F: drivers/clk/clk-rp1.c
> +F: drivers/pinctrl/pinctrl-rp1.c
> F: include/dt-bindings/clock/rp1.h
> F: include/dt-bindings/misc/rp1.h
>
> diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> index 95a8e2b9a614..53b265cabc26 100644
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -612,6 +612,17 @@ config PINCTRL_MLXBF3
> each pin. This driver can also be built as a module called
> pinctrl-mlxbf3.
>
> +config PINCTRL_RP1
> + tristate "Pinctrl driver for RP1"
> + depends on MISC_RP1
> + default MISC_RP1
> + select PINMUX
> + select PINCONF
> + select GENERIC_PINCONF
> + help
> + Enable the gpio and pinctrl/mux driver for RaspberryPi RP1
> + multi function device.
> +
> source "drivers/pinctrl/actions/Kconfig"
> source "drivers/pinctrl/aspeed/Kconfig"
> source "drivers/pinctrl/bcm/Kconfig"
> diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
> index fba1c56624c0..6fb77de58545 100644
> --- a/drivers/pinctrl/Makefile
> +++ b/drivers/pinctrl/Makefile
> @@ -48,6 +48,7 @@ obj-$(CONFIG_PINCTRL_PIC32) += pinctrl-pic32.o
> obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o
> obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o
> obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
> +obj-$(CONFIG_PINCTRL_RP1) += pinctrl-rp1.o
> obj-$(CONFIG_PINCTRL_SCMI) += pinctrl-scmi.o
> obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
> obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
> diff --git a/drivers/pinctrl/pinctrl-rp1.c b/drivers/pinctrl/pinctrl-rp1.c
> new file mode 100644
> index 000000000000..0d081f75d2ec
> --- /dev/null
> +++ b/drivers/pinctrl/pinctrl-rp1.c
> @@ -0,0 +1,789 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for Raspberry Pi RP1 GPIO unit
> + *
> + * Copyright (C) 2023 Raspberry Pi Ltd.
> + *
> + * This driver is inspired by:
> + * pinctrl-bcm2835.c, please see original file for copyright information
> + */
> +
...
> +
> +static struct irq_chip rp1_gpio_irq_chip = {
> + .name = MODULE_NAME,
> + .irq_enable = rp1_gpio_irq_enable,
> + .irq_disable = rp1_gpio_irq_disable,
> + .irq_set_type = rp1_gpio_irq_set_type,
> + .irq_ack = rp1_gpio_irq_ack,
> + .irq_mask = rp1_gpio_irq_disable,
> + .irq_unmask = rp1_gpio_irq_enable,
> + .flags = IRQCHIP_IMMUTABLE,
Sorry not sure, but doesn't this miss GPIOCHIP_IRQ_RESOURCE_HELPERS here?

Thanks