[U-Boot] [PATCH] NET: designware: fix clock enable
Dr. Philipp Tomsich
philipp.tomsich at theobroma-systems.com
Mon Feb 26 11:15:12 UTC 2018
> On 6 Feb 2018, at 15:12, Eugeniy Paltsev <Eugeniy.Paltsev at synopsys.com> wrote:
>
> After commit ba1f966725223 "net: designware: add clock support"
> we got NET broken on axs101 and axs103 platforms.
>
> Some clock don't support gating so their clock drivers don't
> implement .enable/.disable callbacks. In such case clk_enable
> returns -ENOSYS.
> Also some clock drivers implement .enable/.disable callbacks not for all
> clock IDs and return -ENOSYS (or -ENOTSUPP) for others.
>
> If we have such clock in 'clocks' list of designware ethernet controller
> node we fail to probe designware ethernet.
>
> Fix it.
>
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev at synopsys.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
See below for recommended changes.
> ---
> drivers/net/designware.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 6d53071..43670a7 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -684,7 +684,7 @@ int designware_eth_probe(struct udevice *dev)
> break;
>
> err = clk_enable(&priv->clocks[i]);
> - if (err) {
> + if (err && err != -ENOSYS && err != -ENOTSUPP) {
I agree on the ENOSYS, but not the ENOTSUPP: if an enable function
exists, it should explicitly handle the requested clock (even if it is just a
no-op due to the driver knowing that it is always enabled).
Just as a side-note: most clock drivers return ENOENT, if they don’t
know about a specific clock… whereas ENOTSUPP should be returned
if a clock is known, but the specific operation on the clock is not supported
(e.g. clk_disable on an always-on clock … or one that is critical to the
system such as a fundamental PLL).
Thanks,
Philipp.
> pr_err("failed to enable clock %d\n", i);
> clk_free(&priv->clocks[i]);
> goto clk_err;
> --
> 2.9.3
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
More information about the U-Boot
mailing list