[PATCH v6 09/12] imx: power-domain: Add support for the MEDIAMIX control block

Miquel Raynal miquel.raynal at bootlin.com
Fri Apr 4 08:30:21 CEST 2025


Hi Adam,

>> +       /* Enable upstream clocks */
>> +       ret = clk_enable(&priv->clk_apb);
>> +       if (ret)
>> +               goto dis_bus_pd;
>> +
>> +       ret = clk_enable(&priv->clk_axi);
>> +       if (ret)
>> +               goto dis_apb_clk;
>> +
>> +       /* Enable blk-ctrl clock to allow reset to propagate */
>> +       ret = clk_enable(clk);
>
> I am only offering a suggestion if you ever need to push another rev.
> It appears that all the clocks are either on or off and if any fail,
> you immediately turn off any clocks that were enabled.  There are some
> bulk clock options where you can basically tell the driver to turn
> them all on or all off.
>
> clk_get_bulk, clk_enable_bulk, clk_disable_bulk, and clk_release_all
> are the functions I am thinking of.  Your imx8mp_mediamix_priv
> structure could then replace all the individual clocks with struct
> clk_bulk.
>
> That might shrink the overall code and simplify the readability.

These bulk functions only work if you get all clocks from a list. We
currently do not want all the clocks (simply because some are useless in
this case and also because they have not yet been defined). The clks
property define all these:
"apb", "axi", "cam1", "cam2", "disp1", "disp2", "isp", "phy";

>> +       if (ret)
>> +               goto dis_axi_clk;
>> +       setbits_le32(priv->base + BLK_CLK_EN, reset);
>> +
>> +       /* Power up upstream GPC domain */
>> +       ret = power_domain_on(domain);
>> +       if (ret)
>> +               goto dis_lcdif_clk;
>> +
>> +       /* Wait for reset to propagate */
>> +       udelay(5);
>
> On Linux, the GPCv2 driver was updated to increase a delay from 5 to
> 10 uSeconds [1] .  I don't know if that's needed here, but it's
> something to consider.

Thanks a lot for the pointer, I will integrate this change, even if it
is experimental, let's spare ourselves a round of ghost bug hunting.

> adam
>
> [1] -
> https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/pmdomain/imx?h=next-20250403&id=2379fb937de5333991c567eefd7d11b98977d059

Thanks!
Miquèl


More information about the U-Boot mailing list