[PATCH v2 1/2] clk: add gated-fixed-clock driver

Jonas Karlman jonas at kwiboo.se
Tue May 19 16:26:47 CEST 2026


Hi David,

On 5/19/2026 4:09 PM, David Lechner wrote:
> On 5/19/26 6:55 AM, Daniele Briguglio wrote:
>> Add a UCLASS_CLK driver matching the Linux DT binding documented at
>> Documentation/devicetree/bindings/clock/gated-fixed-clock.yaml, a
>> fixed-rate oscillator whose output is enabled by toggling a
>> regulator supply.  The optional enable-gpios variant is not
>> implemented.
>>
> 
> ...
> 
>> +static int clk_gated_fixed_enable(struct clk *clk)
>> +{
>> +	struct clk_gated_fixed_priv *priv = dev_get_priv(clk->dev);
>> +
>> +	return regulator_set_enable_if_allowed(priv->supply, true);
>> +}
>> +
>> +static int clk_gated_fixed_disable(struct clk *clk)
>> +{
>> +	struct clk_gated_fixed_priv *priv = dev_get_priv(clk->dev);
>> +
>> +	return regulator_set_enable_if_allowed(priv->supply, false);
>> +}
>> +
> It seems a bit odd to use regulator_set_enable_if_allowed()
> since the point of the binding is to provide a clock that
> is gated by a regulator. Why would someone use this binding
> with a regulator that can't be enabled/disabled?

The regulator_set_enable_if_allowed() is the main func consumers in
U-Boot should be using when dealing with regulators. Unless the consumer
wants to manually deal with i.e. ENOSYS (no regulator support), EACCES
(always-on), EBUSY (in use) or EALREADY (already enabled) status.

Regards,
Jonas



More information about the U-Boot mailing list