On 07.06.2019 23:03, Andrey Smirnov wrote:

> There are no clocks that the CAAM driver needs to initialise on the
> i.MX8.

The clk handling inside CAAM is very convoluted and this patch doesn't 
help. All the driver actually does is "enable all required clocks", this 
shouldn't be complicated.

I propose adding a const caam_soc_data struct which has a bool flag 
marking if each clock is required or not, the replace all the 
of_machine_is_compatible() logic with statements of the form:

if (ctrlpriv->soc_data->need_ipg_clk)
     ctrlpriv->caam_ipg = devm_clk_get("ipg");

You could even make all clks optional and claim that if a clk is not 
listed in DT then it's assumed to be always on. However that means that 
on some SOCs if DT is incorrect you can get a hang (due to missing clk) 
instead of a probe error.

> +     clk_disable_unprepare(ctrlpriv->caam_ipg);
> +     if (ctrlpriv->caam_mem)
> +             clk_disable_unprepare(ctrlpriv->caam_mem);
> +     clk_disable_unprepare(ctrlpriv->caam_aclk);
> +     if (ctrlpriv->caam_emi_slow)
> +             clk_disable_unprepare(ctrlpriv->caam_emi_slow);

Clock APIs have no effect if clk argument is NULL, please just drop 
these if statements.

--
Regards,
Leonard

Reply via email to