mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: barebox@lists.infradead.org, Ahmad Fatoum <ahmad@a3f.at>
Subject: Re: [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711
Date: Wed, 22 Sep 2021 12:17:12 +0200	[thread overview]
Message-ID: <20210922101711.jsssbde6pie743nt@pengutronix.de> (raw)
In-Reply-To: <20210917094152.210494-2-u.kleine-koenig@pengutronix.de>

On Fri, Sep 17, 2021 at 11:41:52AM +0200, Uwe Kleine-König wrote:
> From: Ahmad Fatoum <ahmad@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-koenig@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.hieber@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

  reply	other threads:[~2021-09-22 10:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  9:41 [PATCH 1/2] pinctrl: bcm2835: Probe driver earlier Uwe Kleine-König
2021-09-17  9:41 ` [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711 Uwe Kleine-König
2021-09-22 10:17   ` Roland Hieber [this message]
2021-09-22 10:26   ` Ahmad Fatoum
2021-09-22 10:25 ` [PATCH 1/2] pinctrl: bcm2835: Probe driver earlier Ahmad Fatoum
2021-10-02  8:51 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210922101711.jsssbde6pie743nt@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox