> The K1 I2C controller requires both its functional clock and APB bus
> clock to operate. The device tree provides them as "func" and "bus", but
> the driver currently acquires and enables only the first clock.
>
> Acquire both clocks by name and enable them during probe. Use explicit
> named lookups instead of the bulk clock API to align with the K1 Linux
> driver and keep the roles of the two clocks clear if functional clock
> rate configuration is needed later.

[...]

> @@ -487,15 +487,21 @@ static int k1_i2c_probe(struct udevice *bus)
>               return ret;
>       }
>
> -     ret = clk_get_by_index(bus, 0, &priv->clk);
> +     ret = clk_get_by_name(bus, "func", &clk);
>       if (ret)
>               return ret;
>
> -     ret = clk_enable(&priv->clk);
> -     if (ret && ret != -ENOSYS && ret != -EOPNOTSUPP) {
> -             debug("%s: failed to enable clock\n", __func__);
> +     ret = clk_enable(&clk);
> +     if (ret)
> +             return ret;
> +
> +     ret = clk_get_by_name(bus, "bus", &clk);
> +     if (ret)
> +             return ret;
> +
> +     ret = clk_enable(&clk);
> +     if (ret)
>               return ret;
> -     }

Once the functional clock has been enabled, failure to acquire or enable
the bus clock returns without disabling the functional clock.

                                            - Troy

Attachment: signature.asc
Description: PGP signature

Reply via email to