This is a note to let you know that I've just added the patch titled pinctrl: bcm2835: Refactor platform data to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pinctrl-bcm2835-refactor-platform-data.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Thu Jan 27 04:40:37 PM CET 2022 From: Florian Fainelli <f.fainelli@xxxxxxxxx> Date: Tue, 25 Jan 2022 11:42:17 -0800 Subject: pinctrl: bcm2835: Refactor platform data To: stable@xxxxxxxxxxxxxxx Cc: Stefan Wahren <stefan.wahren@xxxxxxxx>, Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, Florian Fainelli <f.fainelli@xxxxxxxxx>, Rob Herring <robh+dt@xxxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Ray Jui <rjui@xxxxxxxxxxxx>, Scott Branden <sbranden@xxxxxxxxxxxx>, bcm-kernel-feedback-list@xxxxxxxxxxxx (maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...), Eric Anholt <eric@xxxxxxxxxx>, Stefan Wahren <wahrenst@xxxxxxx>, Nicolas Saenz Julienne <nsaenz@xxxxxxxxxx>, Phil Elwell <phil@xxxxxxxxxxxxxxx>, devicetree@xxxxxxxxxxxxxxx (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@xxxxxxxxxxxxxxx (open list), linux-gpio@xxxxxxxxxxxxxxx (open list:PIN CONTROL SUBSYSTEM), linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@xxxxxxxxxxxxxxxxxxx (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE) Message-ID: <20220125194222.12783-3-f.fainelli@xxxxxxxxx> From: Stefan Wahren <stefan.wahren@xxxxxxxx> commit 90bfaf028d61a6d523c685b63c2bcc94eebb8057 upstream This prepares the platform data to be easier to extend for more GPIOs. Except of this there is no functional change. Signed-off-by: Stefan Wahren <stefan.wahren@xxxxxxxx> Link: https://lore.kernel.org/r/1581166975-22949-3-git-send-email-stefan.wahren@xxxxxxxx Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 57 ++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 13 deletions(-) --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -82,6 +82,7 @@ struct bcm2835_pinctrl { struct pinctrl_dev *pctl_dev; struct gpio_chip gpio_chip; + struct pinctrl_desc pctl_desc; struct pinctrl_gpio_range gpio_range; raw_spinlock_t irq_lock[BCM2835_NUM_BANKS]; @@ -1051,7 +1052,7 @@ static const struct pinconf_ops bcm2711_ .pin_config_set = bcm2711_pinconf_set, }; -static struct pinctrl_desc bcm2835_pinctrl_desc = { +static const struct pinctrl_desc bcm2835_pinctrl_desc = { .name = MODULE_NAME, .pins = bcm2835_gpio_pins, .npins = ARRAY_SIZE(bcm2835_gpio_pins), @@ -1061,19 +1062,47 @@ static struct pinctrl_desc bcm2835_pinct .owner = THIS_MODULE, }; -static struct pinctrl_gpio_range bcm2835_pinctrl_gpio_range = { +static const struct pinctrl_desc bcm2711_pinctrl_desc = { + .name = MODULE_NAME, + .pins = bcm2835_gpio_pins, + .npins = ARRAY_SIZE(bcm2835_gpio_pins), + .pctlops = &bcm2835_pctl_ops, + .pmxops = &bcm2835_pmx_ops, + .confops = &bcm2711_pinconf_ops, + .owner = THIS_MODULE, +}; + +static const struct pinctrl_gpio_range bcm2835_pinctrl_gpio_range = { .name = MODULE_NAME, .npins = BCM2835_NUM_GPIOS, }; +struct bcm_plat_data { + const struct gpio_chip *gpio_chip; + const struct pinctrl_desc *pctl_desc; + const struct pinctrl_gpio_range *gpio_range; +}; + +static const struct bcm_plat_data bcm2835_plat_data = { + .gpio_chip = &bcm2835_gpio_chip, + .pctl_desc = &bcm2835_pinctrl_desc, + .gpio_range = &bcm2835_pinctrl_gpio_range, +}; + +static const struct bcm_plat_data bcm2711_plat_data = { + .gpio_chip = &bcm2835_gpio_chip, + .pctl_desc = &bcm2711_pinctrl_desc, + .gpio_range = &bcm2835_pinctrl_gpio_range, +}; + static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible = "brcm,bcm2835-gpio", - .data = &bcm2835_pinconf_ops, + .data = &bcm2835_plat_data, }, { .compatible = "brcm,bcm2711-gpio", - .data = &bcm2711_pinconf_ops, + .data = &bcm2711_plat_data, }, {} }; @@ -1082,6 +1111,7 @@ static int bcm2835_pinctrl_probe(struct { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + const struct bcm_plat_data *pdata; struct bcm2835_pinctrl *pc; struct gpio_irq_chip *girq; struct resource iomem; @@ -1108,7 +1138,13 @@ static int bcm2835_pinctrl_probe(struct if (IS_ERR(pc->base)) return PTR_ERR(pc->base); - pc->gpio_chip = bcm2835_gpio_chip; + match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node); + if (!match) + return -EINVAL; + + pdata = match->data; + + pc->gpio_chip = *pdata->gpio_chip; pc->gpio_chip.parent = dev; pc->gpio_chip.of_node = np; @@ -1159,19 +1195,14 @@ static int bcm2835_pinctrl_probe(struct return err; } - match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node); - if (match) { - bcm2835_pinctrl_desc.confops = - (const struct pinconf_ops *)match->data; - } - - pc->pctl_dev = devm_pinctrl_register(dev, &bcm2835_pinctrl_desc, pc); + pc->pctl_desc = *pdata->pctl_desc; + pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); if (IS_ERR(pc->pctl_dev)) { gpiochip_remove(&pc->gpio_chip); return PTR_ERR(pc->pctl_dev); } - pc->gpio_range = bcm2835_pinctrl_gpio_range; + pc->gpio_range = *pdata->gpio_range; pc->gpio_range.base = pc->gpio_chip.base; pc->gpio_range.gc = &pc->gpio_chip; pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); Patches currently in stable-queue which might be from f.fainelli@xxxxxxxxx are queue-5.4/pinctrl-bcm2835-drop-unused-define.patch queue-5.4/arm-dts-gpio-ranges-property-is-now-required.patch queue-5.4/pinctrl-bcm2835-add-support-for-wake-up-interrupts.patch queue-5.4/pinctrl-bcm2835-change-init-order-for-gpio-hogs.patch queue-5.4/pinctrl-bcm2835-refactor-platform-data.patch queue-5.4/pinctrl-bcm2835-match-bcm7211-compatible-string.patch queue-5.4/pinctrl-bcm2835-add-support-for-all-gpios-on-bcm2711.patch