#define I2C_ACK 0
#define I2C_NOACK 1
-DECLARE_GLOBAL_DATA_PTR;
-
enum {
PIN_SDA = 0,
PIN_SCL,
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,
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;