From: Sean Anderson <sean.anderson@seco.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: [RFC net-next PATCH 16/16] net: sfp: Add quirk to ignore PHYs
Date: Tue, 5 Oct 2021 16:38:23 -0400 [thread overview]
Message-ID: <55f6cec4-2497-45a4-cb1a-3edafa7d80d3@seco.com> (raw)
In-Reply-To: <YVyjj64t2K7YOiM+@shell.armlinux.org.uk>
On 10/5/21 3:12 PM, Russell King (Oracle) wrote:
> On Tue, Oct 05, 2021 at 12:45:28PM -0400, Sean Anderson wrote:
>>
>>
>> On 10/5/21 6:33 AM, Russell King (Oracle) wrote:
>> > On Mon, Oct 04, 2021 at 03:15:27PM -0400, Sean Anderson wrote:
>> > > Some modules have something at SFP_PHY_ADDR which isn't a PHY. If we try to
>> > > probe it, we might attach genphy anyway if addresses 2 and 3 return
>> > > something other than all 1s. To avoid this, add a quirk for these modules
>> > > so that we do not probe their PHY.
>> > >
>> > > The particular module in this case is a Finisar SFP-GB-GE-T. This module is
>> > > also worked around in xgbe_phy_finisar_phy_quirks() by setting the support
>> > > manually. However, I do not believe that it has a PHY in the first place:
>> > >
>> > > $ i2cdump -y -r 0-31 $BUS 0x56 w
>> > > 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
>> > > 00: ff01 ff01 ff01 c20c 010c 01c0 0f00 0120
>> > > 08: fc48 000e ff78 0000 0000 0000 0000 00f0
>> > > 10: 7800 00bc 0000 401c 680c 0300 0000 0000
>> > > 18: ff41 0000 0a00 8890 0000 0000 0000 0000
>> >
>> > Actually, I think that is a PHY. It's byteswapped (which is normal using
>> > i2cdump in this way).The real contents of the registers are:
>> >
>> > 00: 01ff 01ff 01ff 0cc2 0c01 c001 000f 2001
>> > 08: 48fc 0e00 78ff 0000 0000 0000 0000 f000
>> > 10: 0078 bc00 0000 1c40 0c68 0003 0000 0000
>> > 18: 41ff 0000 000a 9088 0000 0000 0000 0000
>>
>> Ah, thanks for catching this.
>>
>> > It's advertising pause + asym pause, 1000BASE-T FD, link partner is also
>> > advertising 1000BASE-T FD but no pause abilities.
>> >
>> > When comparing this with a Marvell 88e1111:
>> >
>> > 00: 1140 7949 0141 0cc2 05e1 0000 0004 2001
>> > 08: 0000 0e00 4000 0000 0000 0000 0000 f000
>> > 10: 0078 8100 0000 0040 0568 0000 0000 0000
>> > 18: 4100 0000 0002 8084 0000 0000 0000 0000
>> >
>> > It looks remarkably similar. However, The first few reads seem to be
>> > corrupted with 0x01ff. It may be that the module is slow to allow the
>> > PHY to start responding - we've had similar with Champion One SFPs.
>>
>> Do you have an an example of how to work around this? Even reading one
>> register at a time I still get the bogus 0x01ff. Reading bytewise, a
>> reasonable-looking upper byte is returned every other read, but the
>> lower byte is 0xff every time.
>
> I think the Champion One modules just don't respond to the I2C
> transactions, so we keep retrying for a while. We try every
> 50ms for 12 retries, which seems to be long enough for their
> modules.
>
>> > It looks like it's a Marvell 88e1111. The register at 0x11 is the
>> > Marvell status register, and 0xbc00 indicates 1000Mbit, FD, AN
>> > resolved, link up which agrees with what's in the various other
>> > registers.
>>
>> That matches some supplemental info on the manufacturer's website
>> (which was frustratingly not associated with the model number of
>> this particular module).
>
> The interesting thing is, many modules use 88e1111, which is about
> the only PHY that I'm aware that supports I2C access mode natively.
> So, it's really surprising that you're getting corrupted data,
> unless...
>
> There's been a history of using too strong pull-ups on the SFP I2C
> lines. The SFP MSA gives a minimum value of the resistors (4.7k).
> SFP+ lowers the minimum value and raises the maximum clock frequency.
> Some SFP modules are unable to drive the I2C bus low against the
> lower resistances resulting in corrupted data (or worse, it can
> corrupt the EEPROMs.)
There is a level shifter. Between the shifter and the SoC there were
1.8k (!) pull-ups, and between the shifter and the SFP there were 10k
pull-ups. I tried replacing the pull-ups between the SoC and the shifter
with 10k pull-ups, but noticed no difference. I have also noticed no
issues accessing the EEPROM, and I have not noticed any difference
accessing other registers (see below). Additionally, this same error is
"present" already in xgbe_phy_finisar_phy_quirks(), as noted in the
commit message.
> Other problems on some platforms have been with I2C level shifters
> locking up, but that doesn't look like what's happening here - they
> lockup at logic low not logic high. Even so-called "impossible to
> lockup" level shifters have locked up despite their manufacturer
> stating that it is impossible.
>
> Is it always the same addresses?
Yes.
> What if you read from a different offset?
Same thing.
> What if you re-read after it seems to have cleared?
Here are some various transfers which hopefully will clarify the
behavior:
First, reading two bytes at a time
$ i2ctransfer -y 2 w1@0x56 2 r2
0x01 0xff
This behavior is repeatable
$ i2ctransfer -y 2 w1@0x56 2 r2
0x01 0xff
Now, reading one byte at a time
$ i2ctransfer -y 2 w1@0x56 2 r1
0x01
A second write/single read gets us the first byte again.
$ i2ctransfer -y 2 w1@0x56 2 r1
0x41
And doing it for a third time gets us the first byte again.
$ i2ctransfer -y 2 w1@0x56 2 r1
0x01
If we start another one-byte read without writing the address, we get
the second byte
$ i2ctransfer -y 2 r1@0x56
0x41
And continuing this pattern, we get the next byte.
$ i2ctransfer -y 2 r1@0x56
0x0c
This can be repeated indefinitely
$ i2ctransfer -y 2 r1@0x56
0xc2
$ i2ctransfer -y 2 r1@0x56
0x0c
But stopping in the "middle" of a register fails
$ i2ctransfer -y 2 w1@0x56 2 r1
Error: Sending messages failed: Input/output error
We don't have to immediately read a byte:
$ i2ctransfer -y 2 w1@0x56 2
$ i2ctransfer -y 2 r1@0x56
0x01
$ i2ctransfer -y 2 r1@0x56
0x41
We can read two bytes indefinitely after "priming the pump"
$ i2ctransfer -y 2 w1@0x56 2 r1
0x01
$ i2ctransfer -y 2 r1@0x56
0x41
$ i2ctransfer -y 2 r2@0x56
0x0c 0xc2
$ i2ctransfer -y 2 r2@0x56
0x0c 0x01
$ i2ctransfer -y 2 r2@0x56
0x00 0x00
$ i2ctransfer -y 2 r2@0x56
0x00 0x04
$ i2ctransfer -y 2 r2@0x56
0x20 0x01
$ i2ctransfer -y 2 r2@0x56
0x00 0x00
But more than that "runs out"
$ i2ctransfer -y 2 w1@0x56 2 r1
0x01
$ i2ctransfer -y 2 r1@0x56
0x41
$ i2ctransfer -y 2 r4@0x56
0x0c 0xc2 0x0c 0x01
$ i2ctransfer -y 2 r4@0x56
0x00 0x00 0x00 0x04
$ i2ctransfer -y 2 r4@0x56
0x20 0x01 0xff 0xff
$ i2ctransfer -y 2 r4@0x56
0x01 0xff 0xff 0xff
However, the above multi-byte reads only works when starting at register
2 or greater.
$ i2ctransfer -y 2 w1@0x56 0 r1
0x01
$ i2ctransfer -y 2 r1@0x56
0x40
$ i2ctransfer -y 2 r2@0x56
0x01 0xff
Based on the above session, I believe that it may be best to treat this
phy as having an autoincrementing register address which must be read
one byte at a time, in multiples of two bytes. I think that existing SFP
phys may compatible with this, but unfortunately I do not have any on
hand to test with.
--Sean
next prev parent reply other threads:[~2021-10-05 20:38 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 19:15 [RFC net-next PATCH 00/16] Add support for Xilinx PCS Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 01/16] dt-bindings: net: Add pcs property Sean Anderson
2021-10-05 9:39 ` Russell King (Oracle)
2021-10-05 16:18 ` Sean Anderson
2021-10-12 13:16 ` Rob Herring
2021-10-12 16:18 ` Sean Anderson
2021-10-12 16:44 ` Rob Herring
2021-10-12 17:01 ` Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 02/16] dt-bindings: net: Add binding for Xilinx PCS Sean Anderson
2021-10-05 12:26 ` Rob Herring
2021-10-04 19:15 ` [RFC net-next PATCH 03/16] net: sfp: Fix typo in state machine debug string Sean Anderson
2021-10-04 21:31 ` Andrew Lunn
2021-10-04 19:15 ` [RFC net-next PATCH 04/16] net: phylink: Move phylink_set_pcs before phylink_create Sean Anderson
2021-10-05 9:43 ` Russell King (Oracle)
2021-10-04 19:15 ` [RFC net-next PATCH 05/16] net: phylink: Automatically attach PCS devices Sean Anderson
2021-10-05 9:48 ` Russell King (Oracle)
2021-10-05 16:42 ` Sean Anderson
2021-10-07 10:23 ` Russell King (Oracle)
2021-10-08 0:14 ` Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 06/16] net: phylink: Add function for optionally adding a PCS Sean Anderson
2021-10-05 9:51 ` Russell King (Oracle)
2021-10-05 13:43 ` Andrew Lunn
2021-10-05 16:17 ` Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 07/16] net: phylink: Add helpers for c22 registers without MDIO Sean Anderson
2021-10-22 12:33 ` Russell King (Oracle)
2021-10-04 19:15 ` [RFC net-next PATCH 08/16] net: macb: Clean up macb_validate Sean Anderson
2021-10-04 23:04 ` Russell King (Oracle)
2021-10-04 23:09 ` Sean Anderson
2021-10-07 13:22 ` Nicolas Ferre
2021-10-08 0:20 ` Sean Anderson
2021-10-08 8:12 ` Nicolas Ferre
2021-10-04 19:15 ` [RFC net-next PATCH 09/16] net: macb: Move most of mac_prepare to mac_config Sean Anderson
2021-10-04 23:05 ` Russell King (Oracle)
2021-10-04 23:09 ` Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 10/16] net: macb: Move PCS settings to PCS callbacks Sean Anderson
2021-10-05 10:06 ` Russell King (Oracle)
2021-10-05 16:03 ` Sean Anderson
2021-10-05 18:53 ` Russell King (Oracle)
2021-10-05 21:44 ` Sean Anderson
2021-10-05 22:19 ` Russell King (Oracle)
2021-10-07 10:34 ` Russell King (Oracle)
2021-10-07 11:29 ` Russell King (Oracle)
2021-10-07 16:23 ` Russell King (Oracle)
2021-10-07 17:04 ` Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 11/16] net: macb: Support restarting PCS autonegotiation Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 12/16] net: macb: Support external PCSs Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 13/16] net: phy: Export get_phy_c22_id Sean Anderson
2021-10-05 10:12 ` Russell King (Oracle)
2021-10-04 19:15 ` [RFC net-next PATCH 14/16] net: mdio: Add helper functions for accessing MDIO devices Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 15/16] net: pcs: Add Xilinx PCS driver Sean Anderson
2021-10-04 19:15 ` [RFC net-next PATCH 16/16] net: sfp: Add quirk to ignore PHYs Sean Anderson
2021-10-04 22:01 ` Andrew Lunn
2021-10-05 10:33 ` Russell King (Oracle)
2021-10-05 16:45 ` Sean Anderson
2021-10-05 18:10 ` Sean Anderson
2021-10-05 19:12 ` Russell King (Oracle)
2021-10-05 20:38 ` Sean Anderson [this message]
2021-10-05 22:17 ` Russell King (Oracle)
2021-10-05 23:16 ` Sean Anderson
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=55f6cec4-2497-45a4-cb1a-3edafa7d80d3@seco.com \
--to=sean.anderson@seco.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
/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).