From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT
Date: Thu, 10 Sep 2020 18:25:09 +0200 [thread overview]
Message-ID: <20200910162509.27997-1-patrick.delaunay@st.com> (raw)
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
next reply other threads:[~2020-09-10 16:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 16:25 Patrick Delaunay [this message]
2020-09-11 4:01 ` [PATCH] i2c: i2c-gpio: Convert to use APIs which support live DT Heiko Schocher
2020-10-24 14:51 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200910162509.27997-1-patrick.delaunay@st.com \
--to=patrick.delaunay@st.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox