Re: [PATCH 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks

Ahmad Fatoum
2024-12-20T06:30:41Z

Hi Peng,

On 20.12.24 07:18, Peng Fan wrote:
> On Thu, Dec 19, 2024 at 08:27:37AM +0100, Ahmad Fatoum wrote:
>> The IMX8MPCEC datasheet lists maximum frequencies allowed for different
>> modules. Some of these limits are universal, but some depend on
>> whether the SoC is operating in nominal or in overdrive mode.
>>
>> The imx8mp.dtsi currently assumes overdrive mode and configures some
>> clocks in accordance with this. Boards wishing to make use of nominal
>> mode will need to override some of the clock rates manually.
>>
>> As operating the clocks outside of their allowed range can lead to
>> difficult to debug issues, it makes sense to register the maximum rates
>> allowed in the driver, so the CCF can take them into account.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

>> + imx8mp_clocks_apply_constraints(imx8mp_clock_common_constraints);
>> +
>> + if (of_property_read_bool(np, "fsl,nominal-mode"))
>> + imx8mp_clocks_apply_constraints(imx8mp_clock_nominal_constraints);
>> + else if (of_property_read_bool(np, "fsl,overdrive-mode"))
>> + imx8mp_clocks_apply_constraints(imx8mp_clock_overdrive_constraints);
>
> As I replied, a boot parameter should be better? the mode is a soc level mode,
> not just clock controller.

I think it's counterproductive for a sanity check to be enforced via kernel
command-line.

The Skov board shouldn't run with overdrive frequencies and I prefer to encode
that in the same device tree, where I define the permissible VDD_SOC range
and configure the initial clock rates.

The mode is selected by the VDD_SOC voltage, but affects AFAICS only the clock
tree. IMO, the clock controller module is thus a natural place for the property.

Cheers,
Ahmad

>
> Thanks,
> Peng
>
>> +
>> err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
>> if (err < 0) {
>> dev_err(dev, "failed to register hws for i.MX8MP\n");
>>
>> --
>> 2.39.5
>>
>

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |