From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@ew.tq-group.com
Subject: Re: [PATCH net] net: dsa: mv88e6xx: fix supported_interfaces setup in mv88e6250_phylink_get_caps()
Date: Wed, 17 Apr 2024 12:07:32 +0200 [thread overview]
Message-ID: <6f64a875911eff522674e9a22b6dc23ec629db3a.camel@ew.tq-group.com> (raw)
In-Reply-To: <5f09543db3de88e83116c5b2f6e3d9edbfdb4af8.camel@ew.tq-group.com>
On Wed, 2024-04-17 at 09:13 +0200, Matthias Schiffer wrote:
> On Tue, 2024-04-16 at 17:56 +0100, Russell King (Oracle) wrote:
> > On Tue, Apr 16, 2024 at 05:50:54PM +0200, Matthias Schiffer wrote:
> > > +int mv88e6250_port_get_mode(struct mv88e6xxx_chip *chip, int port,
> > > + phy_interface_t *mode)
> > > +{
> > > + int err;
> > > + u16 reg;
> > > +
> > > + if (port < 5) {
> > > + *mode = PHY_INTERFACE_MODE_INTERNAL;
> > > + return 0;
> > > + }
> >
> > Note that if mv88e6xxx_phy_is_internal() returns TRUE for the port,
> > then this will be handled automatically.
> >
> > > +
> > > + err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, ®);
> > > + if (err)
> > > + return err;
> > > +
> > > + switch (reg & MV88E6250_PORT_STS_PORTMODE_MASK) {
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_10_HALF_PHY:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_100_HALF_PHY:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_10_FULL_PHY:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_100_FULL_PHY:
> > > + *mode = PHY_INTERFACE_MODE_REVMII;
> > > + break;
> > > +
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_HALF:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_FULL:
> > > + *mode = PHY_INTERFACE_MODE_MII;
> > > + break;
> > > +
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_DUAL_100_RMII_FULL_PHY:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_200_RMII_FULL_PHY:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_10_100_RMII_HALF_PHY:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_10_100_RMII_FULL_PHY:
> > > + *mode = PHY_INTERFACE_MODE_REVRMII;
> > > + break;
> > > +
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_DUAL_100_RMII_FULL:
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_10_100_RMII_FULL:
> > > + *mode = PHY_INTERFACE_MODE_RMII;
> > > + break;
> > > +
> > > + case MV88E6250_PORT_STS_PORTMODE_MII_100_RGMII:
> > > + *mode = PHY_INTERFACE_MODE_RGMII;
> > > + break;
> > > +
> > > + default:
> > > + *mode = PHY_INTERFACE_MODE_NA;
> >
> > What does this mean? I don't allow PHY_INTERFACE_MODE_NA to be set in
> > the list of supported interfaces because it isn't an interface mode.
> > If it's invalid, then it's probably best to return an error.
> >
> > I wonder whether it would just be better to pass the
> > supported_interfaces bitmap into this function and have it set the
> > appropriate bit itself, renaming the function to something more
> > better suited to that purpose.
> >
> > Thanks.
>
> I'm explicitly checking for PHY_INTERFACE_MODE_NA in the caller to handle the "this interface isn't
> useable" case. Passing supported_interfaces into the function handling the port modes is fine with
> me, too - will send a v2 later.
>
> Best regards,
> Matthias
... and I realize I don't even check for PHY_INTERFACE_MODE_NA in the caller in the version of the
patch I submitted. Oh well, time for v2.
>
>
> >
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/
prev parent reply other threads:[~2024-04-17 10:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 15:50 Matthias Schiffer
2024-04-16 16:56 ` Russell King (Oracle)
2024-04-17 7:13 ` Matthias Schiffer
2024-04-17 10:07 ` Matthias Schiffer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6f64a875911eff522674e9a22b6dc23ec629db3a.camel@ew.tq-group.com \
--to=matthias.schiffer@ew.tq-group.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@ew.tq-group.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®