Re: [PATCH 3/3] PCI: mediatek-gen3: Move reset/assert callbacks in .power_up()

Bjorn Helgaas
2024-11-08T16:48:18Z

On Fri, Nov 08, 2024 at 02:51:15AM +0000, Jianjun Wang (王建军) wrote:
> On Thu, 2024-11-07 at 10:21 -0600, Bjorn Helgaas wrote:
> > On Thu, Nov 07, 2024 at 05:08:55PM +0100, Lorenzo Bianconi wrote:
> > > > On Thu, Nov 07, 2024 at 02:50:55PM +0100, Lorenzo Bianconi wrote:
> > > > > In order to make the code more readable, move phy and mac
> > > > > reset lines assert/de-assert configuration in .power_up
> > > > > callback (mtk_pcie_en7581_power_up/mtk_pcie_power_up).
> > >
> > > ...
> > > > Is there a requirement that the PHY and MAC reset ordering be
> > > > different for EN7581 vs other chips?
> > > >
> > > > EN7581:
> > > >
> > > > assert PHY reset
> > > > assert MAC reset
> > > > power on PHY
> > > > deassert PHY reset
> > > > deassert MAC reset
> > > >
> > > > others:
> > > >
> > > > assert PHY reset
> > > > assert MAC reset
> > > > deassert PHY reset
> > > > power on PHY
> > > > deassert MAC reset
> > > >
> > > > Is there one order that would work for both?
> > >
> > > EN7581 requires to run phy_init()/phy_power_on() before deassert
> > > PHY reset lines.
> >
> > And the other chips require the PHY power-on to be *after*
> > deasserting PHY reset?
>
> For MediaTek's chips, the reset will clear all register values and
> reset the hardware state. Therefore, we can only initialize and
> power-on the MAC and PHY after deasserting their resets.

OK, it sounds like you're saying the Airoha EN7581 is not a MediaTek
chip and does require a different ordering of PHY reset deassert and
PHY power-on:

- EN7581 requires PHY power-on before PHY reset deassert,

- other chips require PHY reset deassert before PHY power-on.

That's fine and probably worth a short comment in
mtk_pcie_en7581_power_up(), e.g., "Unlike the MediaTek controllers,
the Airoha EN7581 requires PHY power-on before PHY reset deassert".

Bjorn