public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] GPIO: omap_gpio: Fix gpio name names with device tree
@ 2018-08-17 19:37 Adam Ford
  2018-08-26 19:54 ` Derald D. Woods
  2018-09-18 21:24 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Ford @ 2018-08-17 19:37 UTC (permalink / raw)
  To: u-boot

The GPIO bank numbers do not appear in the device tree, so this
patch makes the gpio name based on the address
(ie gpio at 49054000_31 vs gpio4_31)

adam

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index 651f6994e4..0f1ddeff92 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -288,11 +288,9 @@ static int omap_gpio_probe(struct udevice *dev)
 	struct gpio_bank *bank = dev_get_priv(dev);
 	struct omap_gpio_platdata *plat = dev_get_platdata(dev);
 	struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
-	int banknum;
 	char name[18], *str;
 
-	banknum = plat->bank_index;
-	sprintf(name, "GPIO%d_", banknum + 1);
+	sprintf(name, "gpio@%4x_", (unsigned int)plat->base);
 	str = strdup(name);
 	if (!str)
 		return -ENOMEM;
-- 
2.17.1

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

* [U-Boot] [PATCH] GPIO: omap_gpio: Fix gpio name names with device tree
  2018-08-17 19:37 [U-Boot] [PATCH] GPIO: omap_gpio: Fix gpio name names with device tree Adam Ford
@ 2018-08-26 19:54 ` Derald D. Woods
  2018-09-18 21:24 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Derald D. Woods @ 2018-08-26 19:54 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 17, 2018 at 02:37:58PM -0500, Adam Ford wrote:
> The GPIO bank numbers do not appear in the device tree, so this
> patch makes the gpio name based on the address
> (ie gpio at 49054000_31 vs gpio4_31)
> 
> adam
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>

Works for omap3-evm and omap3-beagle-xm.

OMAP3_EVM # gpio status   
Bank gpio at 48310000_:
gpio at 48310000_7: output: 1 [x]
OMAP3_EVM # gpio status -a
Bank gpio at 48310000_:
gpio at 48310000_0: input: 0 [ ]
gpio at 48310000_1: input: 0 [ ]
gpio at 48310000_2: input: 0 [ ]
gpio at 48310000_3: input: 0 [ ]
gpio at 48310000_4: input: 0 [ ]
gpio at 48310000_5: input: 1 [ ]
gpio at 48310000_6: input: 1 [ ]
gpio at 48310000_7: output: 1 [x] 
gpio at 48310000_8: input: 0 [ ]
gpio at 48310000_9: input: 0 [ ]
[...]

BeagleBoard # gpio status
Bank gpio at 49056000_:
gpio at 49056000_19: output: 1 [x] USB PHY1 reset
gpio at 49056000_21: output: 1 [x] led
gpio at 49056000_22: output: 1 [x] led

Bank gpio at 49058000_:
gpio at 49058000_11: input: 0 [x] rev0
gpio at 49058000_12: input: 1 [x] rev1
gpio at 49058000_13: input: 0 [x] rev2
BeagleBoard # gpio status -a
Bank gpio at 48310000_:
gpio at 48310000_0: input: 0 [ ]
gpio at 48310000_1: input: 0 [ ]
gpio at 48310000_2: input: 0 [ ]
gpio at 48310000_3: input: 0 [ ]
gpio at 48310000_4: input: 0 [ ]
gpio at 48310000_5: input: 0 [ ]
gpio at 48310000_6: input: 0 [ ]
gpio at 48310000_7: input: 0 [ ]
gpio at 48310000_8: input: 0 [ ]
gpio at 48310000_9: input: 0 [ ]
[...]

Tested-by: Derald D. Woods <woods.technical@gmail.com>

> 
> diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
> index 651f6994e4..0f1ddeff92 100644
> --- a/drivers/gpio/omap_gpio.c
> +++ b/drivers/gpio/omap_gpio.c
> @@ -288,11 +288,9 @@ static int omap_gpio_probe(struct udevice *dev)
>  	struct gpio_bank *bank = dev_get_priv(dev);
>  	struct omap_gpio_platdata *plat = dev_get_platdata(dev);
>  	struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
> -	int banknum;
>  	char name[18], *str;
>  
> -	banknum = plat->bank_index;
> -	sprintf(name, "GPIO%d_", banknum + 1);
> +	sprintf(name, "gpio@%4x_", (unsigned int)plat->base);
>  	str = strdup(name);
>  	if (!str)
>  		return -ENOMEM;
> -- 
> 2.17.1
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] GPIO: omap_gpio: Fix gpio name names with device tree
  2018-08-17 19:37 [U-Boot] [PATCH] GPIO: omap_gpio: Fix gpio name names with device tree Adam Ford
  2018-08-26 19:54 ` Derald D. Woods
@ 2018-09-18 21:24 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2018-09-18 21:24 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 17, 2018 at 02:37:58PM -0500, Adam Ford wrote:

> The GPIO bank numbers do not appear in the device tree, so this
> patch makes the gpio name based on the address
> (ie gpio at 49054000_31 vs gpio4_31)
> 
> adam
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Tested-by: Derald D. Woods <woods.technical@gmail.com>
> 
> diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
> index 651f6994e4..0f1ddeff92 100644

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180918/cd2a67bb/attachment.sig>

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

end of thread, other threads:[~2018-09-18 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-17 19:37 [U-Boot] [PATCH] GPIO: omap_gpio: Fix gpio name names with device tree Adam Ford
2018-08-26 19:54 ` Derald D. Woods
2018-09-18 21:24 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox