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

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>
---
 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

  reply	other threads:[~2021-09-17  9:43 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 ` Uwe Kleine-König [this message]
2021-09-22 10:17   ` [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711 Roland Hieber
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=20210917094152.210494-2-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git