[RFC] serial: mxc: get the clock frequency from the used clock for the device
michael at walle.cc
Thu Mar 17 15:47:11 CET 2022
>> + struct clk clk;
>> + if(!clk_get_by_name(dev, "ipg", &clk))
>> + rate = clk_get_rate(&clk);
>> + }
>> + /* as fallback we try to get the clk rate that way */
>> + if (rate == 0)
> !rate || IS_ERR_VALUE(rate)
This looked so weird I had to actually look at clk_get_rate()
* clk_get_rate() - Get current clock rate.
* @clk: A clock struct that was previously successfully requested by
* Return: clock rate in Hz on success, 0 for invalid clock, or -ve
* for other errors.
ulong clk_get_rate(struct clk *clk);
How can an ulong return a negative error value? What if the clock speed
happens to be the same as -errno?
More information about the U-Boot