On Fri, Sep 17, 2021 at 11:41:52AM +0200, Uwe Kleine-König wrote: > From: Ahmad Fatoum <ah...@a3f.at> > > bcm2711-rpi-4-b.dts lists 58 gpio names and the linux driver also uses > 58 GPIOs for bcm2711. > > Signed-off-by: Uwe Kleine-König <u.kleine-koe...@pengutronix.de>
Ahmad's S-o-b is missing on both. - Roland > --- > drivers/pinctrl/pinctrl-bcm2835.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/pinctrl-bcm2835.c > b/drivers/pinctrl/pinctrl-bcm2835.c > index 38c788c82945..684ead2f8e5e 100644 > --- a/drivers/pinctrl/pinctrl-bcm2835.c > +++ b/drivers/pinctrl/pinctrl-bcm2835.c > @@ -52,6 +52,10 @@ struct bcm2835_gpio_chip { > struct pinctrl_device pctl; > }; > > +struct plat_data { > + unsigned ngpios; > +}; > + > static int bcm2835_set_function(struct gpio_chip *chip, unsigned gpio, int > function) > { > struct bcm2835_gpio_chip *bcmgpio = container_of(chip, struct > bcm2835_gpio_chip, chip); > @@ -149,10 +153,13 @@ static struct pinctrl_ops bcm2835_pinctrl_ops = { > > static int bcm2835_gpio_probe(struct device_d *dev) > { > + const struct plat_data *plat_data; > struct resource *iores; > struct bcm2835_gpio_chip *bcmgpio; > int ret; > > + plat_data = device_get_match_data(dev); > + > bcmgpio = xzalloc(sizeof(*bcmgpio)); > iores = dev_request_mem_resource(dev, 0); > if (IS_ERR(iores)) > @@ -160,7 +167,8 @@ static int bcm2835_gpio_probe(struct device_d *dev) > bcmgpio->base = IOMEM(iores->start); > bcmgpio->chip.ops = &bcm2835_gpio_ops; > bcmgpio->chip.base = 0; > - bcmgpio->chip.ngpio = 54; > + bcmgpio->chip.ngpio = plat_data->ngpios; > + > bcmgpio->chip.dev = dev; > bcmgpio->pctl.ops = &bcm2835_pinctrl_ops; > bcmgpio->pctl.dev = dev; > @@ -191,9 +199,21 @@ err: > return ret; > } > > +static const struct plat_data bcm2835_plat_data = { > + .ngpios = 54, > +}; > + > +static const struct plat_data bcm2711_plat_data = { > + .ngpios = 58, > +}; > + > static __maybe_unused struct of_device_id bcm2835_gpio_dt_ids[] = { > { > .compatible = "brcm,bcm2835-gpio", > + .data = &bcm2835_plat_data, > + }, { > + .compatible = "brcm,bcm2711-gpio", > + .data = &bcm2711_plat_data, > }, { > /* sentinel */ > } > -- > 2.30.2 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox -- Roland Hieber, Pengutronix e.K. | r.hie...@pengutronix.de | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox