mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: bcm2835: Probe driver earlier
@ 2021-09-17  9:41 Uwe Kleine-König
  2021-09-17  9:41 ` [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711 Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2021-09-17  9:41 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

From: Ahmad Fatoum <ahmad@a3f.at>

coredevice is too late for the console driver and all other pinctrl drivers
are using "core", too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pinctrl/pinctrl-bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index d62c73518189..38c788c82945 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -205,4 +205,4 @@ static struct driver_d bcm2835_gpio_driver = {
 	.of_compatible = DRV_OF_COMPAT(bcm2835_gpio_dt_ids),
 };
 
-coredevice_platform_driver(bcm2835_gpio_driver);
+core_platform_driver(bcm2835_gpio_driver);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711
  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
  2021-09-22 10:17   ` 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
  2 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2021-09-17  9:41 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711
  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
  2021-09-22 10:26   ` Ahmad Fatoum
  1 sibling, 0 replies; 6+ messages in thread
From: Roland Hieber @ 2021-09-22 10:17 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox, Ahmad Fatoum

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] pinctrl: bcm2835: Probe driver earlier
  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:25 ` Ahmad Fatoum
  2021-10-02  8:51 ` Sascha Hauer
  2 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2021-09-22 10:25 UTC (permalink / raw)
  To: Uwe Kleine-König, barebox; +Cc: Ahmad Fatoum

On 17.09.21 11:41, Uwe Kleine-König wrote:
> From: Ahmad Fatoum <ahmad@a3f.at>
> 
> coredevice is too late for the console driver and all other pinctrl drivers
> are using "core", too.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pinctrl/pinctrl-bcm2835.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
> index d62c73518189..38c788c82945 100644
> --- a/drivers/pinctrl/pinctrl-bcm2835.c
> +++ b/drivers/pinctrl/pinctrl-bcm2835.c
> @@ -205,4 +205,4 @@ static struct driver_d bcm2835_gpio_driver = {
>  	.of_compatible = DRV_OF_COMPAT(bcm2835_gpio_dt_ids),
>  };
>  
> -coredevice_platform_driver(bcm2835_gpio_driver);
> +core_platform_driver(bcm2835_gpio_driver);
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] pinctrl: bcm2835: Add support for bcm2711
  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
@ 2021-09-22 10:26   ` Ahmad Fatoum
  1 sibling, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2021-09-22 10:26 UTC (permalink / raw)
  To: Uwe Kleine-König, barebox; +Cc: Ahmad Fatoum

On 17.09.21 11:41, 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: Ahmad Fatoum <ahmad@a3f.at>

> 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 */
>  	}
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] pinctrl: bcm2835: Probe driver earlier
  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:25 ` [PATCH 1/2] pinctrl: bcm2835: Probe driver earlier Ahmad Fatoum
@ 2021-10-02  8:51 ` Sascha Hauer
  2 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2021-10-02  8:51 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox, Ahmad Fatoum

On Fri, Sep 17, 2021 at 11:41:51AM +0200, Uwe Kleine-König wrote:
> From: Ahmad Fatoum <ahmad@a3f.at>
> 
> coredevice is too late for the console driver and all other pinctrl drivers
> are using "core", too.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pinctrl/pinctrl-bcm2835.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-02  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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