[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <671b7a8f.050a0220.5b160.446a@mx.google.com>
Date: Fri, 25 Oct 2024 13:01:31 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next RFC PATCH v2 3/3] net: phy: Add Airoha AN8855 Internal
Switch Gigabit PHY
On Wed, Oct 23, 2024 at 07:07:08PM +0200, Christian Marangi wrote:
> On Wed, Oct 23, 2024 at 07:00:22PM +0200, Andrew Lunn wrote:
> > > +static int an8855_config_init(struct phy_device *phydev)
> > > +{
> > > + struct air_an8855_priv *priv = phydev->priv;
> > > + int ret;
> > > +
> > > + /* Enable HW auto downshift */
> > > + ret = phy_write(phydev, AN8855_PHY_PAGE_CTRL, AN8855_PHY_EXT_PAGE);
> > > + if (ret)
> > > + return ret;
> > > + ret = phy_set_bits(phydev, AN8855_PHY_EXT_REG_14,
> > > + AN8855_PHY_EN_DOWN_SHFIT);
> > > + if (ret)
> > > + return ret;
> > > + ret = phy_write(phydev, AN8855_PHY_PAGE_CTRL, AN8855_PHY_NORMAL_PAGE);
> > > + if (ret)
> > > + return ret;
> >
> > There are locking issues here, which is why we have the helpers
> > phy_select_page() and phy_restore_page(). The air_en8811h.c gets this
> > right.
>
> Ugh didn't think about it... The switch address is shared with the PHY
> so yes this is a problem.
>
> Consider that this page thing comes from my speculation... Not really
> use if 1f select page...
> From what I observed
> 0x0 PHY page
> 0x1 this strange EXT
> 0x4 acess switch register (every PHY can access the switch)
>
Just to followup on this... I checked air_en8811h registers again and
they match MII access to the switch so yes my speculation is correct.
Also extra happy since I now know what those magic values means at least
for MII.
> >
> > Is there anything in common with the en8811h? Does it also support
> > downshift? Can its LED code be used here?
> >
>
> For some reason part of the LED are controlled by the switch and some
> are by the PHY. I still have to investigate that (not giving priority to
> it... just on my todo)
>
> For downshift as you notice it's a single bit with no count...
> From their comments in the original driver it's said "Enable HW
> autodownshift"
>
> Trying to reach them but currently it's all very obscure.
>
> --
> Ansuel
--
Ansuel
Powered by blists - more mailing lists