All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT
@ 2020-09-10 16:25 Patrick Delaunay
  2020-09-11  4:01 ` Heiko Schocher
  2020-10-24 14:51 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2020-09-10 16:25 UTC (permalink / raw)
  To: u-boot

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/i2c/i2c-gpio.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index cfdeadc752..381938c956 100644
--- a/drivers/i2c/i2c-gpio.c
+++ b/drivers/i2c/i2c-gpio.c
@@ -18,8 +18,6 @@
 #define I2C_ACK		0
 #define I2C_NOACK	1
 
-DECLARE_GLOBAL_DATA_PTR;
-
 enum {
 	PIN_SDA = 0,
 	PIN_SCL,
@@ -334,8 +332,6 @@ static int i2c_gpio_drv_probe(struct udevice *dev)
 static int i2c_gpio_ofdata_to_platdata(struct udevice *dev)
 {
 	struct i2c_gpio_bus *bus = dev_get_priv(dev);
-	const void *blob = gd->fdt_blob;
-	int node = dev_of_offset(dev);
 	int ret;
 
 	ret = gpio_request_list_by_name(dev, "gpios", bus->gpios,
@@ -343,12 +339,12 @@ static int i2c_gpio_ofdata_to_platdata(struct udevice *dev)
 	if (ret < 0)
 		goto error;
 
-	bus->udelay = fdtdec_get_int(blob, node, "i2c-gpio,delay-us",
-				     DEFAULT_UDELAY);
+	bus->udelay = dev_read_u32_default(dev, "i2c-gpio,delay-us",
+					   DEFAULT_UDELAY);
 
 	bus->get_sda = i2c_gpio_sda_get;
 	bus->set_sda = i2c_gpio_sda_set;
-	if (fdtdec_get_bool(blob, node, "i2c-gpio,scl-output-only"))
+	if (dev_read_bool(dev, "i2c-gpio,scl-output-only"))
 		bus->set_scl = i2c_gpio_scl_set_output_only;
 	else
 		bus->set_scl = i2c_gpio_scl_set;
-- 
2.17.1

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

* [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT
  2020-09-10 16:25 [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT Patrick Delaunay
@ 2020-09-11  4:01 ` Heiko Schocher
  2020-10-24 14:51 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko Schocher @ 2020-09-11  4:01 UTC (permalink / raw)
  To: u-boot

Hello Patrick,

Am 10.09.2020 um 18:25 schrieb Patrick Delaunay:
> Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
> driver can support live DT.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> 
>   drivers/i2c/i2c-gpio.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)

Reviewed-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 at denx.de

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

* [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT
  2020-09-10 16:25 [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT Patrick Delaunay
  2020-09-11  4:01 ` Heiko Schocher
@ 2020-10-24 14:51 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-10-24 14:51 UTC (permalink / raw)
  To: u-boot

On Thu, Sep 10, 2020 at 06:25:09PM +0200, Patrick Delaunay wrote:

> Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
> driver can support live DT.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Reviewed-by: Heiko Schocher <hs@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201024/83ba47f6/attachment.sig>

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

end of thread, other threads:[~2020-10-24 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 16:25 [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT Patrick Delaunay
2020-09-11  4:01 ` Heiko Schocher
2020-10-24 14:51 ` Tom Rini

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.