[PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ahmad Fatoum <ahmad@xxxxxx>

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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux