netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
Cc: "andrew@lunn.ch" <andrew@lunn.ch>,
	"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"olteanv@gmail.com" <olteanv@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] net: dsa: mv88e6xxx: Support serdes ports on MV88E6123/6131
Date: Tue, 20 Oct 2020 22:34:03 +0100	[thread overview]
Message-ID: <20201020213403.GH1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <d4f6fab0-8099-7cc2-dfce-bd7a3363c131@alliedtelesis.co.nz>

On Tue, Oct 20, 2020 at 09:24:04PM +0000, Chris Packham wrote:
> 
> On 20/10/20 11:18 pm, Russell King - ARM Linux admin wrote:
> > On Tue, Oct 20, 2020 at 04:45:58PM +1300, Chris Packham wrote:
> >> +void mv88e6123_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p)
> >> +{
> >> +	u16 *p = _p;
> >> +	u16 reg;
> >> +	int i;
> >> +
> >> +	if (mv88e6xxx_serdes_get_lane(chip, port) == 0)
> >> +		return;
> >> +
> >> +	for (i = 0; i < 26; i++) {
> >> +		mv88e6xxx_phy_read(chip, port, i, &reg);
> > Shouldn't this deal with a failed read in some way, rather than just
> > assigning the last or possibly uninitialised value to p[i] ?
> 
> mv88e6390_serdes_get_regs() and mv88e6352_serdes_get_regs() also ignore 
> the error. The generic mv88e6xxx_get_regs() memsets p[] to 0xff so if 
> the serdes_get_regs functions just left it alone we'd return 0xffff 
> which is probably better than repeating the last value although it's 
> still ambiguous because 0xffff is a valid value for plenty of these 
> registers.
> 
> Since it looks like I need to come up with an alternative to patch #1 
> I'll concentrate on that but making the serdes_get_regs() a little more 
> error tolerant is a cleanup I can easily tack on onto this series.

Yep, it looks like they all suffer the same problem. Interestingly,
mv88e6xxx_get_regs() does handle the error by avoiding writing the
register entry (so it gets left as 0xffff.)

Incidentally, that's also the value you'll get when reading from a
PHY that doesn't respond, since the MDIO data line is pulled high
when undriven.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

      reply	other threads:[~2020-10-20 21:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  3:45 [PATCH v3 0/3] net: dsa: mv88e6xxx: serdes link without phy Chris Packham
2020-10-20  3:45 ` [PATCH v3 1/3] net: dsa: mv88e6xxx: Don't force link when using in-band-status Chris Packham
2020-10-20 10:15   ` Russell King - ARM Linux admin
2020-10-20 13:49     ` Marek Behun
2020-10-20 14:05       ` Andrew Lunn
2020-10-20 14:15         ` Russell King - ARM Linux admin
2020-10-20 14:51           ` Marek Behun
2020-10-20 14:58             ` Andrew Lunn
2020-10-20 21:04               ` Chris Packham
2020-10-20 21:15                 ` Andrew Lunn
2020-10-20 21:06             ` Chris Packham
2020-10-20 21:18               ` Russell King - ARM Linux admin
2020-10-21  2:20                 ` Chris Packham
2020-10-20  3:45 ` [PATCH v3 2/3] net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185 Chris Packham
2020-10-20  3:45 ` [PATCH v3 3/3] net: dsa: mv88e6xxx: Support serdes ports on MV88E6123/6131 Chris Packham
2020-10-20 10:18   ` Russell King - ARM Linux admin
2020-10-20 21:24     ` Chris Packham
2020-10-20 21:34       ` Russell King - ARM Linux admin [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=20201020213403.GH1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).