All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c-gpio: Support the named GPIO binding
@ 2021-08-22  0:25 Samuel Holland
  2021-08-22  8:43 ` Heiko Schocher
  2021-08-23  4:34 ` Heiko Schocher
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Holland @ 2021-08-22  0:25 UTC (permalink / raw)
  To: u-boot, Heiko Schocher; +Cc: Samuel Holland

To avoid confusion about the order of the GPIOs, the i2c-gpio binding
was updated to use a separate property for each GPIO instead of an
array. However, the driver only supports the old binding. Add support
for the new binding as well, so the driver continues to work as device
trees are updated.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 drivers/i2c/i2c-gpio.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index cf8f8f40359..1aedad5c8ed 100644
--- a/drivers/i2c/i2c-gpio.c
+++ b/drivers/i2c/i2c-gpio.c
@@ -336,8 +336,17 @@ static int i2c_gpio_of_to_plat(struct udevice *dev)
 	struct i2c_gpio_bus *bus = dev_get_priv(dev);
 	int ret;
 
+	/* "gpios" is deprecated and replaced by "sda-gpios" + "scl-gpios". */
 	ret = gpio_request_list_by_name(dev, "gpios", bus->gpios,
 					ARRAY_SIZE(bus->gpios), 0);
+	if (ret == -ENOENT) {
+		ret = gpio_request_by_name(dev, "sda-gpios", 0,
+					   &bus->gpios[PIN_SDA], 0);
+		if (ret < 0)
+			goto error;
+		ret = gpio_request_by_name(dev, "scl-gpios", 0,
+					   &bus->gpios[PIN_SCL], 0);
+	}
 	if (ret < 0)
 		goto error;
 
-- 
2.31.1


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

* Re: [PATCH] i2c: i2c-gpio: Support the named GPIO binding
  2021-08-22  0:25 [PATCH] i2c: i2c-gpio: Support the named GPIO binding Samuel Holland
@ 2021-08-22  8:43 ` Heiko Schocher
  2021-08-23  4:34 ` Heiko Schocher
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko Schocher @ 2021-08-22  8:43 UTC (permalink / raw)
  To: Samuel Holland, u-boot

Hello Samuel,

On 22.08.21 02:25, Samuel Holland wrote:
> To avoid confusion about the order of the GPIOs, the i2c-gpio binding
> was updated to use a separate property for each GPIO instead of an
> array. However, the driver only supports the old binding. Add support
> for the new binding as well, so the driver continues to work as device
> trees are updated.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/i2c/i2c-gpio.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviwed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

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

* Re: [PATCH] i2c: i2c-gpio: Support the named GPIO binding
  2021-08-22  0:25 [PATCH] i2c: i2c-gpio: Support the named GPIO binding Samuel Holland
  2021-08-22  8:43 ` Heiko Schocher
@ 2021-08-23  4:34 ` Heiko Schocher
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko Schocher @ 2021-08-23  4:34 UTC (permalink / raw)
  To: Samuel Holland, u-boot

Hello Samuel,

On 22.08.21 02:25, Samuel Holland wrote:
> To avoid confusion about the order of the GPIOs, the i2c-gpio binding
> was updated to use a separate property for each GPIO instead of an
> array. However, the driver only supports the old binding. Add support
> for the new binding as well, so the driver continues to work as device
> trees are updated.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/i2c/i2c-gpio.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

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

end of thread, other threads:[~2021-08-23  4:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22  0:25 [PATCH] i2c: i2c-gpio: Support the named GPIO binding Samuel Holland
2021-08-22  8:43 ` Heiko Schocher
2021-08-23  4:34 ` Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.