aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-gpio.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-09-10 18:25:09 +0200
committerTom Rini <trini@konsulko.com>2020-10-23 13:33:07 -0400
commit7a462740d09f16a060ac74873a708214524c83d4 (patch)
treefa1039275f64eef40214d6704d0d4c272caede3c /drivers/i2c/i2c-gpio.c
parenta3b3c1d416f189620bab4ec43adaec1fe920bbc4 (diff)
downloadu-boot-7a462740d09f16a060ac74873a708214524c83d4.zip
u-boot-7a462740d09f16a060ac74873a708214524c83d4.tar.gz
u-boot-7a462740d09f16a060ac74873a708214524c83d4.tar.bz2
i2c: i2c-gpio: Convert to use APIs which support live DT
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>
Diffstat (limited to 'drivers/i2c/i2c-gpio.c')
-rw-r--r--drivers/i2c/i2c-gpio.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index cfdeadc..381938c 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;