RE: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never came up
From: Richard Zhu
Date: Mon Oct 25 2021 - 22:18:26 EST
> -----Original Message-----
> From: Mark Brown <broonie@xxxxxxxxxx>
> Sent: Monday, October 25, 2021 7:24 PM
> To: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>
> Cc: Richard Zhu <hongxing.zhu@xxxxxxx>; l.stach@xxxxxxxxxxxxxx;
> bhelgaas@xxxxxxxxxx; lorenzo.pieralisi@xxxxxxx; jingoohan1@xxxxxxxxx;
> linux-pci@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> kernel@xxxxxxxxxxxxxx
> Subject: Re: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never
> came up
>
> On Mon, Oct 25, 2021 at 01:13:12PM +0200, Francesco Dolcini wrote:
>
> > Hello Richard,
> > please see this comment from Mark,
> https://lore.kernel.org/all/YXaGve1ZJq0DGZ9l@xxxxxxxxxxxxx/.
>
> > > + if (imx6_pcie->vpcie
> > > + && regulator_is_enabled(imx6_pcie->vpcie) > 0)
> > > + regulator_disable(imx6_pcie->vpcie);
> > > return ret;
>
> I should probably also say that the check for the regulator looks buggy as well,
> regulators should only be optional if they can be physically absent which does
> not seem likely for PCI devices. If the driver is not doing something to
> reconfigure the hardware to account for a missing supply this is generally a big
> warning sign.
>
> I really don't understand why regulator support is so frequently problematic
> for PCI controllers. :(
[Richard Zhu] Hi Mark:
The _enabled check is used because that this regulator is optional in the HW design.
To make the codes clean and aligned on different HW boards, the _enabled check is added.
The root cause is that the error return is not handled properly by the controller driver.
I.MX PCIe controller doesn't support the Hot-Plug, and it would return -110 error
when PCIe link never came up. Thus, the _probe would be failed in the end.
The clocks/regulator usage balance should be considered by i.MX PCIe controller, that's all.
It's not a general case, and the problem is not caused by the regulator support.
Best Regards
Richard Zhu