Re: [PATCH 1/2] dt: watchdog: Add DT binding documentation for jz47xx watchdog timer

Arnd Bergmann
2015-01-27T21:30:12Z

On Tuesday 27 January 2015 12:52:29 Guenter Roeck wrote:
> Driver does this (today):
>
> drvdata->rtc_clk = clk_get(&pdev->dev, "rtc");
>
> Isn't that the name to use ? Just wondering.

Just because the driver uses it at the moment does not mean it's the name
that the IP block uses.

clk_get() has the unpleasant property of doing fuzzy matching
on the name that is passed. It first tries to use the string
as the name of the clock input of the device, but if that is
not there, it falls back to looking for a global clk with a con_id.

In DT, we only support the first kind, but if a driver currently
uses the second, you get the wrong name.

Looking at arch/mips/jz4740/clock.c now, this seems to be exactly
what is going on here: there is no clkdev_add call to associate
the device clocks, so it can only match a global clock entry. :(

Arnd