diff options
-rw-r--r-- | drivers/i2c/muxes/i2c-mux-uclass.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-uclass.c b/drivers/i2c/muxes/i2c-mux-uclass.c index 7a698b62b5a..db086efe612 100644 --- a/drivers/i2c/muxes/i2c-mux-uclass.c +++ b/drivers/i2c/muxes/i2c-mux-uclass.c @@ -86,6 +86,16 @@ static int i2c_mux_post_probe(struct udevice *mux) debug("%s: %s\n", __func__, mux->name); priv->selected = -1; + /* if parent is of i2c uclass already, we'll take that, otherwise + * look if we find an i2c-parent phandle + */ + if (UCLASS_I2C == device_get_uclass_id(mux->parent)) { + priv->i2c_bus = dev_get_parent(mux); + debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus, + priv->i2c_bus->name); + return 0; + } + ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent", &priv->i2c_bus); if (ret) |