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>
Reviewed-by: Heiko Schocher <hs@denx.de>
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;