On Wed, Jun 12, 2019 at 6:53 AM Leonard Crestez <leonard.crestez@xxxxxxx> wrote: > > 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. > As I mentioned before, this patch is now dropped. It is replaced with a one-liner to avoid requesting "emi_slow" clock on i.mx8mq. > 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. > I agree with this approach in principle, but I'd rather focus this series on adding i.MX8MQ support with least amount changes needed. I have a separate series doing a bunch of devres related cleanup on this driver, which I plan to submit once i.MX8MQ is supported and we can (and I'd rather) address the problem there. > > + 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. As a part of my refactoring changes I replaced all of that code with devres, so it should already be addressed there. Thanks, Andrey Smirnov