netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
@ 2018-03-16 16:48 Frantisek Rysanek
  2018-03-16 18:42 ` Andrew Lunn
  0 siblings, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-16 16:48 UTC (permalink / raw)
  To: netdev

Dear polite inhabitants of the "netdev" mailing list,

this is for a skunkworks project at the fringe of my job...
More of a DIY hobby thing :-) I'm tinkering and having fun.

The wizards from linux-ptp have taught me how to use the i210 for 
precise timestamping, which works fine at all copper speeds 
and likely also for gigabit fiber (SERDES) which the i210 natively 
supports (and which links fine).

The catch is: I'm trying to get this to work on 100Base-FX :-) 
which is not a native interface for the i210.
It can do SERDES only at 1Gb. But, it can do SGMII.
I've managed to find an i210-based NIC from DeLock with an SFP slot
and I've managed to find two models of 100Base-FX SGMII SFP's.

My assumption is that the SFP's have SGMII instead of SERDES
and MDIO instead of SPD I2C - and the manufacturers of the board
and of the SFP's don't dispute that. Yet they have both vaguely 
warned me in advance that it would not work work :-)
Well I've given it a try anyway, and I'm stuck at the MDIO level.

With one of the SFP's, I know for a fact that it's based on the 
BCM5461S. The actual marking on the chip goes BCM5461SA... etc.

I've managed to modify the EEPROM of the NIC with EEUPDATE.
The Device ID wouldn't change, but the "flash config words" that I 
needed were all willing to accept the change. So I can switch the 
chip to SGMII with external MDIO, and I can even see the chip
generate an MDIO read transaction right after power-up.
http://support.fccps.cz/download/adv/frr/ptp/MDIO_oscillograms.zip

And this is where I'm stuck:
the BCM chip does not respond to the i210 MDIO requests.

I've hacked the igb driver a little, adding printks where I needed 
them, to see what's going on... I believe I've also 
spotted a minor bug where some PHY detection routine
tries to read the status register before the phy.addr is even 
initialized...

This is what the Intel chip does on power up:
"read PHY reg. 0 from PHY addr <whatever I specify in the flash> ".
(= read PHY_CONTROL)


The igb driver does:

1) ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084);
...which succeeds, as apparently there's no "ACK bit" in the write 
sequence. The MDIO master never gets to know if the slave PHY is 
alive or not :-)

2) read "PHY control" == read PHY register 0
... this fails. The PHY just doesn't do its part, and the MDIO 
controller HW in the MAC doesn't raise the status flag saying 
"transaction completed".
The PHY just doesn't take over. It seems as if the i210 does not even 
continue sending CLK pulses - as if waiting for an active 0 (ACK?) 
from the PHY, and the ACK never comes.

I have modified the igb driver to just go ahead and try the next 
step:

3) read PHY device ID == read PHY_ID1 == PHY register 0x02.
...which fails.

I did not bother to try other registers.

The one thing I'm not certain about is the required PHY addr.
Not sure if this is hardwired in the PHY chip, or set by pin straps,
or set by soft straps in the SFP's EEPROM or something.
(Not that I've seen an EEPROM inside the SFP.)
I've noticed some earlier suggested patches by Jonathan Toppins and 
Alan Liebthal of Cumulus Networks (from mid 2015) who seem to have 
gotten the "server ATOM's" MAC to work with a BCM5461S.
Their code mentioned phy_addr = 5, which was possibly board-specific
in their hardware.

I've actually tried wrapping the steps 1) 2) 3) above in a FOR loop,
iterating over phy_addr from 1 to 31.
I can see on an oscilloscope that the i210's MDIO controller keeps 
trying different PHY addresses in the respective 5 bits of phy_addr, 
but the SFP just doesn't respond to any read transaction.
The MDC (clock) from the i210 is a nice 50:50 rectangle at 2 MHz.

I have reasons to believe that the SFP is powered. There's a P-FET in 
3.3Vcc driven by SDP3, which opens when SDP3 goes log.0. 
Which does happen - the required state of SDP3 is encoded 
in the flash and the driver also writes the CTRL_EXT at runtime 
just in case.
Also, it works in SERDES mode, where the NIC links just fine.

And, I believe I can see some erratic responses from the SFP if I 
turn off external MDIO = when the i210 SGMII tries to run with i2c 
for management access to the PHY. In i2c mode, the controller runs 
the clock line at 100 kHz (and obviously the framing/protocol is 
different) - seems to me on the scope that the PHY starts babbling 
something on the data line. The read transactions in i2c mode even 
seem to succeed, but they read garbage. Interestingly regular, 
garbage. Mii-diag says:
Basic registers of MII PHY #1:  
   7fff ff80 8000 007f 7fff ff80 8000 00ff.
And that pattern repeats always the same.

The SPF vendor has already replied that, as per spec, the BCM PHY
should support up to 2.5 MHz MDC. And, they provided a framing 
diagram which looks like a perfect IEEE clause 22.

Still I'm wondering if I should try to marry the igb driver with the 
"phylib" (which has some specific support for the BCM5461) and 
specifically with the bit-banging MDIO driver.

Bit-banging might get me around some protocol incompatibility in MDIO 
(Broadcom vs. Intel) but I would face another problem:
the way I understand it, the i210 needs to auto-configure the MAC 
block based on data it gets via MDIO autonomously from the PHY. (I 
understand that the high-speed SGMII lane for payload cannot 
transport PHY management data in-band, is that correct?)
So if I bit-bang the MDIO protocol, and even get to talk to the SFP, 
I probably won't be able to configure the MAC accordingly 
explicitly...

After a few hours of playing with this, I finally stumbled (a little 
too late) across this FAQ entry in an Intel i210/i211 FAQ PDF:

"For external PHY use SerDes SKU and configure to use SGMII with 
SGMII capable PHY such as a Marvell 88e1112.  Be advised, ND has not 
been able to inter-operate with BRCM SGMII PHY so far."

Which does not explain any details. The full PDF is here:
https://www.intel.com/content/dam/www/public/us/en/documents/faqs/ethe
rnet-controller-i210-i211-faq.pdf

Anyway... if you've read this far, thanks for your kind attention
- and, any sort of comments are welcome :-)

Frank Rysanek

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-16 16:48 HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests? Frantisek Rysanek
@ 2018-03-16 18:42 ` Andrew Lunn
  2018-03-16 20:40   ` Frantisek Rysanek
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Lunn @ 2018-03-16 18:42 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

On Fri, Mar 16, 2018 at 05:48:20PM +0100, Frantisek Rysanek wrote:
> Dear polite inhabitants of the "netdev" mailing list,
> 
> this is for a skunkworks project at the fringe of my job...
> More of a DIY hobby thing :-) I'm tinkering and having fun.
> 
> The wizards from linux-ptp have taught me how to use the i210 for 
> precise timestamping, which works fine at all copper speeds 
> and likely also for gigabit fiber (SERDES) which the i210 natively 
> supports (and which links fine).
> 
> The catch is: I'm trying to get this to work on 100Base-FX :-) 
> which is not a native interface for the i210.
> It can do SERDES only at 1Gb. But, it can do SGMII.
> I've managed to find an i210-based NIC from DeLock with an SFP slot
> and I've managed to find two models of 100Base-FX SGMII SFP's.
> 
> My assumption is that the SFP's have SGMII instead of SERDES
> and MDIO instead of SPD I2C - and the manufacturers of the board
> and of the SFP's don't dispute that. Yet they have both vaguely 
> warned me in advance that it would not work work :-)
> Well I've given it a try anyway, and I'm stuck at the MDIO level.
> 
> With one of the SFP's, I know for a fact that it's based on the 
> BCM5461S. The actual marking on the chip goes BCM5461SA... etc.

Hi Frantisek

This seems a bit odd. The SFP cage only has i2c, not MDIO. It is
possible to carry MDIO over i2c, which is what is done when the SFP
module is copper, not fibre. But you are doing 100Base-FX, so fibre.

The BCM5461 is a copper PHY. There are some PHYs which are designed to
act as translators. You can feed SERDES in one side, and get SGMII out
the other side, for example. Such PHYs can be used between a MAC and
an SFP socket. But from what i can find online about the BCM5461, it
does not have this capability.

Can you tell us the exact make/model of the DeLock card and the SFP
modules.

	Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-16 18:42 ` Andrew Lunn
@ 2018-03-16 20:40   ` Frantisek Rysanek
  2018-03-16 21:02     ` Andrew Lunn
  0 siblings, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-16 20:40 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

On 16 Mar 2018 at 19:42, Andrew Lunn wrote:
> Hi Frantisek
> 
> This seems a bit odd. The SFP cage only has i2c, not MDIO. It is
> possible to carry MDIO over i2c, which is what is done when the SFP
> module is copper, not fibre. But you are doing 100Base-FX, so fibre.
> 
> The BCM5461 is a copper PHY. There are some PHYs which are designed to
> act as translators. You can feed SERDES in one side, and get SGMII out
> the other side, for example. Such PHYs can be used between a MAC and
> an SFP socket. But from what i can find online about the BCM5461, it
> does not have this capability.
> 
> Can you tell us the exact make/model of the DeLock card and the SFP
> modules.
> 
> 	Andrew
>

Hello Andrew,

thanks for your polite response.

The DeLock board is this beauty:
http://www.delock.de/produkte/G_89481/merkmale.html?setLanguage=en
DeLock techsupport were so kind as to provide me with a schematic 
snippet, showing the wiring of the i210 fiber SKU's dedicated 
I2C/MDIO pins to the SFP socket's standard I2C pins. There are 
pull-up resistors on the board for SDA/SCL. Nothing outright custom 
here - more likely close to some Intel reference design. The board 
works just fine.

Interesting - I've noticed before that the sparse Broadcom data brief
for the BCM5461S doesn't cotain a word about 100Base-FX.
This might be a good question to the SFP vendor's techsupport :-)
The 54616S datasheet does mention 100Base-FX, but I have no reason to 
believe that my SFP contains that chip.

It was mostly my naive assumption that the BCM5461S would speak 
MDIO/MDC via the SFP slot's I2C lines :-) The i210 pinout allows for 
that and the BCM5461S doesn't seem to have I2C for management. It 
does have MDIO and MDC. I've tried the "SGMII with i2c management" 
option too - as I said the SFP seems to be responding, but the 
response is some junk. Not corresponding to what the Intel driver 
expects.

As for the SFP's... 

The one that I actually bought as shiny new and speaking SGMII, and 
that contains a chip labeled 5461SA, is sold as Huwei-compatible. 
I do not know what that means at pinout level and protocol level :-)  
"got it at e-bay" says it all. Yet, I have to say that I've been 
politely and firmly warned by the selling party that it's not gonna 
work in my Intel board. I bought it anyway, out of curiosity. So I'm 
not going to provide a link, unless I find something to praise on the 
product :-)
I cannot exclude the possibility that the SFP is a fake, despite 
being mechanically/visually a masterpiece.

The other SFP I got for free, with a comment that "it's some Chinese 
junk, supposedly SGMII compatible, but it hasn't ever worked for us 
in any hardware. Here you go, have it." And the chips inside are 
obscured between two PCB's = no idea what they are, unless I take
a hot air pen to it.

I'll probably take some macro photoes of the SFP internals
(on monday) and post them. Perhaps the set of chips may ring a bell 
with someone here :-)

For the moment, thanks for your attention.

Frank Rysanek

Customer support
FCC prumyslove systemy s.r.o.
Usti nad Labem
Czech Republic
+420 47 2774 173 (office)
+420 736 630 449 (mobile)
rysanek@fccps.cz

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-16 20:40   ` Frantisek Rysanek
@ 2018-03-16 21:02     ` Andrew Lunn
  2018-03-17  7:39       ` Frantisek Rysanek
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Lunn @ 2018-03-16 21:02 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

> The DeLock board is this beauty:
> http://www.delock.de/produkte/G_89481/merkmale.html?setLanguage=en
> DeLock techsupport were so kind as to provide me with a schematic 
> snippet, showing the wiring of the i210 fiber SKU's dedicated 
> I2C/MDIO pins to the SFP socket's standard I2C pins. There are 
> pull-up resistors on the board for SDA/SCL. Nothing outright custom 
> here - more likely close to some Intel reference design. The board 
> works just fine.

I would suggest you ignore MDIO and try looking on the I2C bus.

Does ethtool -m show anything useful?

     Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-16 21:02     ` Andrew Lunn
@ 2018-03-17  7:39       ` Frantisek Rysanek
  2018-03-17 14:50         ` Andrew Lunn
  0 siblings, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-17  7:39 UTC (permalink / raw)
  To: Andrew Lunn, netdev

On 16 Mar 2018 at 22:02, Andrew Lunn wrote:
> 
> Does ethtool -m show anything useful?
> 

Not much. "unsupported".
Probably the ioctl() is not implemented or something, I haven't 
investigated. Maybe I should.

Right now I've modded igb_init_i2c() to engage the bit-banging
i2c driver for the i210 too, if SGMII active and external MDIO off.
Which gets me a /dev/i2c-8 created (with modprobe i2c-dev),
and I'm trying an 8bit read transaction on slave addresses from 0 to 
127, which yields no responses.
Maybe the 8bit transaction is not the right way to do it,
maybe I should use indirect access, I'm just a little scared of that,
I'd hate to reprogram the SFP inadvertently :-)

I know that I'd have to pipe this bit-banging stuff into the Ethtool 
ioctl handling stuff, to get it to work via ethtool -m. 

The way I have hacked the driver, I've noticed that if I enable the 
BB mode in I2CPARAMS, the driver won't load completely,
because the HW-based I2C controller is defunct, and the driver gets 
nothing at all when trying to read the PHY_ID.
But if I first leave I2CPARAMS configured for HW-driven I2C,
load the driver, and then switch I2CPARAMS to BB mode,
I get the bit-banged I2C device loaded and the bit-twiddling
callbacks in igb.ko do get called.

I'm currently using devmem2 to tweak I2CPARAMS:
devmem2 0xF750102C w 0x00007646
devmem2 0xF750102C w 0x00007746
I should probably decide which way to go, HW i2c or SW i2c :-)
and mod the driver accordingly.

I'm currently looking at the bb i2c callbacks in igb.ko with some 
suspicion... they seem a little too coarse to me. I'd expect some 
finer timing around "tri-state the pin, wait a few us and only then 
read the input". E.g. when checking for an ACK from the slave.

I'm not sure if I should "take the i210 HW semaphore" while
bit-banging the i2c stuff. Currently the BB code doesn't do that.
Not sure if this prevents the bits from getting in and out
at the PCB traces. Will have to check on monday.

I've also noticed the drivers/net/phy/mdio-i2c.c .
Maybe I should engage this instead or on top of the generic I2C 
bit-banging framework :-)

=> I haven't tried all my ideas yet and will have to stop tweaking 
for now... I'm playing with this remotely at home via SSH, 
so I don't see the 'scope (if anything happens on the bus in the BB 
mode). And it's time for breakfast :-)

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-17  7:39       ` Frantisek Rysanek
@ 2018-03-17 14:50         ` Andrew Lunn
  2018-03-17 15:20           ` Frantisek Rysanek
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Lunn @ 2018-03-17 14:50 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

On Sat, Mar 17, 2018 at 08:39:00AM +0100, Frantisek Rysanek wrote:
> On 16 Mar 2018 at 22:02, Andrew Lunn wrote:
> > 
> > Does ethtool -m show anything useful?
> > 
> 
> Not much. "unsupported".

static int igb_get_module_info(struct net_device *netdev,
                               struct ethtool_modinfo *modinfo)
{
        struct igb_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
        u32 status = 0;
        u16 sff8472_rev, addr_mode;
        bool page_swap = false;

        if ((hw->phy.media_type == e1000_media_type_copper) ||
            (hw->phy.media_type == e1000_media_type_unknown))
                return -EOPNOTSUPP;

Suggests that the driver does not know you have a fibre module.

> Right now I've modded igb_init_i2c() to engage the bit-banging
> i2c driver for the i210 too

I don't think that will work. The datasheet for the i210 talks about
two registers for I2C/MDIO which are not bit-banging. Only the i350
uses bit-banging.

     Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-17 14:50         ` Andrew Lunn
@ 2018-03-17 15:20           ` Frantisek Rysanek
  0 siblings, 0 replies; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-17 15:20 UTC (permalink / raw)
  To: Andrew Lunn, netdev

On 17 Mar 2018 at 15:50, Andrew Lunn wrote:
> On Sat, Mar 17, 2018 at 08:39:00AM +0100, Frantisek Rysanek wrote:
> > On 16 Mar 2018 at 22:02, Andrew Lunn wrote:
> > > 
> > > Does ethtool -m show anything useful?
> > > 
> > 
> > Not much. "unsupported".
> 
> static int igb_get_module_info(struct net_device *netdev,
>                                struct ethtool_modinfo *modinfo)
> {
>         struct igb_adapter *adapter = netdev_priv(netdev);
>         struct e1000_hw *hw = &adapter->hw;
>         u32 status = 0;
>         u16 sff8472_rev, addr_mode;
>         bool page_swap = false;
> 
>         if ((hw->phy.media_type == e1000_media_type_copper) ||
>             (hw->phy.media_type == e1000_media_type_unknown))
>                 return -EOPNOTSUPP;
> 
> Suggests that the driver does not know you have a fibre module.
>
Good! I'll check this out.
Even if it means that I have to hack the "sequence of initialization" 
in the flow of driver code... (again.)
 
> > Right now I've modded igb_init_i2c() to engage the bit-banging
> > i2c driver for the i210 too
> 
> I don't think that will work. The datasheet for the i210 talks about
> two registers for I2C/MDIO which are not bit-banging. Only the i350
> uses bit-banging.
> 
>From the i210 datasheet, page 477:
chapter 8.17.9 "SFP I2C Parameters" - reg. I2CPARAMS (0x102C; R/W)
bit 8 "I2CBB_EN" = I2C bit-bang enable.
And about 6 more bits for SDA and SCL direction, input and output.
Looking through existing code of the bit-banging callbacks for i350, 
their function would seem identical between the i210 and i350.
I may check the bit definition macros again, if the scope shows 
nothing.

If the HW implementation of the I2C protocol doesn't work for some 
reason, I can as well try bit-banging it.

Thanks for your continued input :-)

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-21 12:58 ` Andrew Lunn
@ 2018-03-21 14:07   ` Frantisek Rysanek
  0 siblings, 0 replies; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-21 14:07 UTC (permalink / raw)
  To: Andrew Lunn, netdev

...
yes I've just noticed Russell's patch mentioning mvneta,
and found the phylink patches to mvneta in net-next (until then I'd 
been reading the vanilla, where they haven't landed yet). 
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tre
e/drivers/net/ethernet/marvell/mvneta.c

phylink_create() looks clear enough, but I got stuck once I looked at 
phylink_register_sfp(). Which IMO asks the device tree to enumerate 
driver "sfp" or some such. I'm lost again. Thanks for hinting that 
the existing style of the Intel driver and the Linux "device tree" 
don't mix well or readily.

It's sad. Mr. King's code is so obvious and easy to follow (except 
maybe for the indirections through the device tree).

As for Intel software and support... that's a bit of love and hate on 
my part :-) The more I get involved, the more intensive the mix.

On 21 Mar 2018 at 13:58, Andrew Lunn wrote:
> > I'd love to use existing code of the phylib to talk to the SFP
> > PHY's, maybe extend the phylib a bit (with the phy's I have), rather
> > than cobble together something crude and private on my own, inside
> > the igb driver.
> 
> So this is quite a big job, to do it cleanly. You probably need to
> retain the intel code for MDIO/PHY/I2C, but add an option to make use
> of the Linux common MDIO/PHY/I2C infrastructure. Then you need to
> extend PHYLINK with a non device tree way to configure it, and glue
> all the parts together.
> 
> You can make it a bit easier by just throwing away all the intel
> MDIO/PHY/I2C code, replacing it will Linux common code. But i expect
> the Intel maintainers would then reject your changes. There is too
> high a chance of introducing regressions.
>
thanks for that explanation :-) You have saved me some time.
 
Frankly I see no chance of my code getting accepted to upstream - I'm 
critical to my own capabilities here.

int phylink_callback(char* msg)
{
	printk(msg);
}
"Hello there, there's an SGMII SFP plugged into the port that you
have registered earlier, on the mdio-i2c bus you have set up,
we have configured the PHY for you, all you need to do is tuck this
leash up your MAC and tell it to try a handshake."

It would be lovely to add SFP hot-swap support and PHY auto-config to 
the Intel driver, and it would possibly result in quite a voluminous 
crapectomy in the Intel driver, but in my position the effort 
required is clearly over my head, and, as you correctly say, I'm not 
in the position to push this back upstream :-)

I'll see how far I can go, "low hanging fruit /halfway there" style. 
For instance, the "previous-generation" API starting from 
mdiobus_alloc() looks "bounded" in terms of effort.
(Example in drivers/net/ethernet/broadcom/tg3.c)
If I understand this correctly, it should allow me to tap into 
phylib, only I'd have to give up the SFP EEPROM understanding
and PHY hot-swap (available from the phylink with SFP support).

I'll probably become silent now, for a while.
Thanks for all your polite explanations Andrew :-)

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-21 10:47       ` Frantisek Rysanek
@ 2018-03-21 13:08         ` Andrew Lunn
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2018-03-21 13:08 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

> Looking at the i2c dumps, and some past dumps from the igb driver, 
> it's dawning on me on me that the igb driver, without much hacking, 
> would try to read the PHY ID from the DMI/DDM block - a case which 
> the drivers/net/phy/mdio-i2c.c specifically avoids :-)

It avoids if for a very good reason. This driver exports a standard
Linux MDIO bus. The core phylib code will then probe the bus, read the
IDs, find the correct PHY driver and loads it.

It is probably good that you spend some time looking at a driver other
than igb. Picking one i know a little, say the Freescale FEC. It has
functions to perform MDIO read and MDIO write. These are then exported
as an MDIO bus to the linux common code. And there are a few calls to
phy_connect(), phy_start(), phy_stop(). That is how you build a driver
which uses the code in drivers/net/phy. mvneta shows how you can use
phylink. Study these two far a while.

      Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-21 11:50 Frantisek Rysanek
@ 2018-03-21 12:58 ` Andrew Lunn
  2018-03-21 14:07   ` Frantisek Rysanek
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Lunn @ 2018-03-21 12:58 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

> I was also wondering if someone has written any kernel-space support 
> for the SFP's. Sure enough, I've found lots of code by Russell King 
> under drivers/net/phy. I started reading from sfp.c, went on to 
> sfp-bus.c, next the phylink stuff... Answers lots of my questions. 
> Clearly someone has "been there and done that" - I mean how to 
> interpret SFP EEPROM bits and act upon them in the PHY 
> initialization. 

That is all quite new code. It has not spread too far yet. The Marvell
mvneta ethernet driver is using it, and the Clearfog is probably the
first in kernel board to make use of it. A few of us are working on
converting DSA over to using PHYLINK, since we have boards with
Ethernet switches and SFP connected to switch ports.

> There are notes in the phylib drivers that this is "platform" stuff
> - a keyword which speaks to me of stuff hardwired onboard in
> embedded motherboards (is Russell King the father of Linux on ARM
> ?), rather than general-purpose PnP and addon boards.

At the moment, PHYLIB pretty much relies on device tree to glue all
the parts together. There is no support for not using device tree at
the moment. It would need somebody to contribute that code.

The other issue is that the igb driver, like most of the intel
Ethernet drivers, ignore much of the Linux common MDIO/PHY and I2C
infrastructure, and does it all themselves. This is probably because
they share code with the Windoze driver.

> I'd love to use existing code of the phylib to talk to the SFP
> PHY's, maybe extend the phylib a bit (with the phy's I have), rather
> than cobble together something crude and private on my own, inside
> the igb driver.

So this is quite a big job, to do it cleanly. You probably need to
retain the intel code for MDIO/PHY/I2C, but add an option to make use
of the Linux common MDIO/PHY/I2C infrastructure. Then you need to
extend PHYLINK with a non device tree way to configure it, and glue
all the parts together.

You can make it a bit easier by just throwing away all the intel
MDIO/PHY/I2C code, replacing it will Linux common code. But i expect
the Intel maintainers would then reject your changes. There is too
high a chance of introducing regressions.

     Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
@ 2018-03-21 11:50 Frantisek Rysanek
  2018-03-21 12:58 ` Andrew Lunn
  0 siblings, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-21 11:50 UTC (permalink / raw)
  To: Andrew Lunn, netdev

On 21 Mar 2018 at 11:47, Andrew Lunn , netdev@vger.ker wrote:
> Another question is, how to write the driver's initialization 
> sequence, for it to correctly decide if the SFP is SERDES or SGMII or 
> what. I could just follow the config obtained from the i210 EEPROM.
> Alternatively, or somehow combined to that, I could try checking if 
> something responds to me over i2c, and do a quick check for SPD 
> EEPROM. If I find one, do a check for "MII regs over i2c" - at all 
> i2c slave addresses between 0x41..0x59  EXCEPT 0x50/0x51.
> If I find MII-i2c regs, it's clear that the transceiver contains a 
> PHY, and wants to run in SGMII mode - otherwise it's a SERDES thing.
> If nothing is found in i2c mode, and inherited i210 config indicates 
> SGMII, try external MDIO... if that fails, revert to SERDES.
> 

I was also wondering if someone has written any kernel-space support 
for the SFP's. Sure enough, I've found lots of code by Russell King 
under drivers/net/phy. I started reading from sfp.c, went on to 
sfp-bus.c, next the phylink stuff... Answers lots of my questions. 
Clearly someone has "been there and done that" - I mean how to 
interpret SFP EEPROM bits and act upon them in the PHY 
initialization. 
And I keep wondering where to start :-)
If I grep phylink recursively in drivers/net/ethernet, I get no 
hits... Any chance of hooking this up to the igb driver in a clean 
way? There are notes in the phylib drivers that this is "platform" 
stuff - a keyword which speaks to me of stuff hardwired onboard in 
embedded motherboards (is Russell King the father of Linux on ARM ?), 
rather than general-purpose PnP and addon boards. I'd love to use 
existing code of the phylib to talk to the SFP PHY's, maybe extend 
the phylib a bit (with the phy's I have), rather than cobble together 
something crude and private on my own, inside the igb driver. 
If you have any pointers, let me know.

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-20 12:09     ` Andrew Lunn
  2018-03-20 12:23       ` Frantisek Rysanek
@ 2018-03-21 10:47       ` Frantisek Rysanek
  2018-03-21 13:08         ` Andrew Lunn
  1 sibling, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-21 10:47 UTC (permalink / raw)
  To: Andrew Lunn, netdev

Just another follow-up:

With specs on SFP MSA, DDM/DMI and MII in hand, I have determined:
0x50 (a.k.a. 0xA0 in SFP MSA spec) = the module's SPD "EEPROM"
0x51 (a.k.a. 0xA2 in SFP MSA spec) = diagnostics (DMI/DDM)
0x56 = MII management access over i2C

Using eeprog (reading each offset twice to get 16bit words, which 
works for both the SFP's), I've been able to get the MII PHY ID's of 
the chips inside both modules:

SFP#1 has PHY ID == 002060C1 == BCM5461S
SFP#2 has PHY ID == 01410c97 == Marvell MV88E111x series.
    I don't know the precise model of the Marvell chip.
    Could be the mythical MV88E1113.

The SPD EEPROM contents are interesting too.

The module ID == 0 is weird, I would expect 0x03 = SFP,
but then again, the SFP MSA doesn't consider SGMII in the socket at 
all, it appears to only consider SERDES, am I right? So skipping the 
module ID makes some limited sense to me.

I haven't calculated the checksums yet, but multiple fields in there 
are filled in according to the SFP MSA spec.

Interestingly, SFP#1 has "Encoding" (byte 11 / 0x0b) set to 0x05
= "SONET scrambled". But has other fields indicating 100Base-FX.
For 100Base-FX I would expect encoding "4b/5b".
Which is what SFP#2 has encoded in its otherwise sparse EEPROM.

SFP#1 has DMI/DDM implemented. Alarm thresholds seem cranked to the 
limit, but some measured values are returned.

SFP#2 does not have DMI/DDM active, yet it decodes the i2c device 
0x51 (a.k.a. 0xA2) and about three bytes are non-empty... but holding 
nonsensical values (some thresholds).

Looking at the i2c dumps, and some past dumps from the igb driver, 
it's dawning on me on me that the igb driver, without much hacking, 
would try to read the PHY ID from the DMI/DDM block - a case which 
the drivers/net/phy/mdio-i2c.c specifically avoids :-)

My current opinion about the matters is, that I don't really need a 
valid SPD EEPROM to initialize the PHY in the SFP.
The question is, if I can make the i210 properly handshake with the 
PHY on the SGMII payload lane.

Another question is, how to write the driver's initialization 
sequence, for it to correctly decide if the SFP is SERDES or SGMII or 
what. I could just follow the config obtained from the i210 EEPROM.
Alternatively, or somehow combined to that, I could try checking if 
something responds to me over i2c, and do a quick check for SPD 
EEPROM. If I find one, do a check for "MII regs over i2c" - at all 
i2c slave addresses between 0x41..0x59  EXCEPT 0x50/0x51.
If I find MII-i2c regs, it's clear that the transceiver contains a 
PHY, and wants to run in SGMII mode - otherwise it's a SERDES thing.
If nothing is found in i2c mode, and inherited i210 config indicates 
SGMII, try external MDIO... if that fails, revert to SERDES.

And then there's the MII PHY internal config, which can be quite 
proprietary...

And if I write all that, there's noone to re-test this after me, as 
my setup is such a special case :-/

No end of fun.

Unfortunately, some other work is interfering at this very moment...

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-20 12:09     ` Andrew Lunn
@ 2018-03-20 12:23       ` Frantisek Rysanek
  2018-03-21 10:47       ` Frantisek Rysanek
  1 sibling, 0 replies; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-20 12:23 UTC (permalink / raw)
  To: Andrew Lunn, netdev

On 20 Mar 2018 at 13:09, Andrew Lunn wrote:
> > i2cdetect has found three i2c slaves (identical layout in both SFP's) 
> > at addresses 0x50, 0x51 and 0x56.
> > What are they? EEPROM, DDM and "MDIO over i2c" ?
> > The SFP's likely lack a proper SFP MSA data structure.
> 
> 0x50 and 0x51 are EEPROM like. See drivers/net/phy/sfp.c. The standard
> at24 EEPROM driver can also read it. And so should the SFP code in the
> igb driver!
> 
Yes - "should" is the right way to put it.

Looking around, I'm wondering how much general-purpose hardware gets 
sold with an Intel gigabit chip and SFP sockets. Note: sockets for 
actual SFP's, rather than SFP-size transceivers soldered onboard (and 
hardwired in the i210 config EEPROM). It took me quite a while to 
find such a board from DeLock.
I mean to say that I doubt how much actual testing on humans this i2c 
code has enjoyed :-) but admittedly I'm being cheeky here, I haven't 
reviewed that part of the driver.

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-20  9:02   ` Frantisek Rysanek
@ 2018-03-20 12:09     ` Andrew Lunn
  2018-03-20 12:23       ` Frantisek Rysanek
  2018-03-21 10:47       ` Frantisek Rysanek
  0 siblings, 2 replies; 18+ messages in thread
From: Andrew Lunn @ 2018-03-20 12:09 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

> i2cdetect has found three i2c slaves (identical layout in both SFP's) 
> at addresses 0x50, 0x51 and 0x56.
> What are they? EEPROM, DDM and "MDIO over i2c" ?
> The SFP's likely lack a proper SFP MSA data structure.

0x50 and 0x51 are EEPROM like. See drivers/net/phy/sfp.c. The standard
at24 EEPROM driver can also read it. And so should the SFP code in the
igb driver!

> Does this make sense as some sort of proprietary standard 
> (Cisco, if I should take the vendor's label at face value),
> or is this likely some "3rd-party innovation thinko", not worth
> implementing?

See if drivers/net/phy/mdio-i2c.c is useful. I'm just guessing here.

    Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-18 14:40 ` Andrew Lunn
  2018-03-20  9:02   ` Frantisek Rysanek
@ 2018-03-20 12:02   ` Frantisek Rysanek
  1 sibling, 0 replies; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-20 12:02 UTC (permalink / raw)
  To: Andrew Lunn, netdev

I've taken a look inside the two SFP's.
http://support.fccps.cz/download/adv/frr/ptp/inside_sfps.zip

The uglier, bigger and likely older model (my SFP#2) contains two 
PCB's sandwiched, and the key chips are inside the sandwich.
Thus, the photoes don't show much.

The sexier SFP#1 = the one with the Broadcom chip... I believe it's 
what it says on the tin:

- the BCM5461SA is directly interfaced to a laser driver chip (pretty 
much analog, found a datasheet from Maxim)

- the RX direction seems equally simple, I haven't identified the 
chip by the marking, but by pinout it's undoubtedly an RX amplifier 
(they're called transimpedance amps, are they?) and, looking at the 
PCB traces, its output is directly interfaced to the BCM5461SA.

- there's another BGA chip on the board, smaller than the BCM PHY. 
I believe that this is an "SFP MCU". Might be from Maxim or from 
someone completely different :-) Not sure whose trademark the "+" 
sign is in the chip marking.

I've found a *slightly* more promising "data brief" from Broadcom
for the BCM5461S:
http://infiber.ru/assets/files/products/phy/BCM5461S_Product_Brief.pdf
This one mentions 100Base-FX among the interface formats supported.

I don't believe that the SFP maker would pipe copper MLT3 into the 
fiber driver+receiver :-) Note that the block diagram in the Broadcom 
PDF contains other minor errors. God knows what the true 
functionality is.

The SFP#1 PCB still doesn't look fake to me.

Frank

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-18 14:40 ` Andrew Lunn
@ 2018-03-20  9:02   ` Frantisek Rysanek
  2018-03-20 12:09     ` Andrew Lunn
  2018-03-20 12:02   ` Frantisek Rysanek
  1 sibling, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-20  9:02 UTC (permalink / raw)
  To: Andrew Lunn, netdev

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 6415 bytes --]

On 18 Mar 2018 at 15:40, Andrew Lunn wrote:
> > I'm not getting an ACK from the SFP, probably because I've got the 
> > address and offset wrong and because I'd better use indirect access.
> > There's some more work awaiting me...
> 
> Try address 0x50.
> 
> i2detect will probe all addresses for you, if you have a standard
> Linux i2c bus.
> 
Thanks for that pointer, that has helped :-)

Not sure if the HW-driven i2c in the i210 works right or not.
It seems to read some garbage instead of MII Dev ID,
and even if I hack that in as a recognized ID, it then
fails at some later stage of init. I have to get back to this later.
After I got the bit-banging I2c to work (see below), the few values 
that I see coming out of the HW-driven i2c are possibly "obtained 
correctly" too.


I've managed to get far enough in the init to make the netdevice
surface in the OS. 
And, at the end of the process, the bit-banging i2c interface also 
appears as /dev/i2c-8 (in my case - after all the graphics DDC busses 
and whatnot).
And, I've modded the existing bit-banging callbacks in igb_main.c,
supposedly written for the i350. I'm wondering if they've ever worked 
right in the first place... I seem to have confirmed my earlier vague 
impression, that the "set" functions would drive the output hard to 
log.1, instead of letting it "float up" based on the pull up resistor
(go high-Z).

[CODE SNIPPET]

static void igb_set_i2c_data(void *data, int state)
{
   struct igb_adapter *adapter = (struct igb_adapter *)data;
   struct e1000_hw *hw = &adapter->hw;
   s32 i2cctl = rd32(E1000_I2CPARAMS);

   /* 
// original version
   if (state)
      i2cctl |= E1000_I2C_DATA_OUT;
   else
      i2cctl &= ~E1000_I2C_DATA_OUT;

   i2cctl &= ~E1000_I2C_DATA_OE_N;

   i2cctl |= E1000_I2C_CLK_OE_N;
   */

// my replacement
   if (state) {
      i2cctl |= E1000_I2C_DATA_OE_N;  // high Z for SDA
      i2cctl |= E1000_I2C_DATA_OUT;   // redundant, but ahh well
   }
   else {
      i2cctl &= ~E1000_I2C_DATA_OE_N; // SDA output active
      i2cctl &= ~E1000_I2C_DATA_OUT;  // log.0 on SDA output
   }

// this stays the same:
   wr32(E1000_I2CPARAMS, i2cctl);
   wrfl();
}

[/CODE SNIPPET]

Same thing for the SCL pin.
The master must drive the bus using an open collector, rather than a 
full totem - so that the slave can have her say (ACK, return data, 
extend the clock maybe). Not sure if the i210's HW i2c master does 
this right, and if it supports all the needed transaction formats 
etc.

After this mod, the user-space i2c progies started to work on 
/dev/i2c-8. I mean - I'd seen activity on the 'scope earlier,
but it was all failures.

I should probably turn this into a patch, but the same is true about 
the rest of what I'm doing to the driver code, and currently it's not 
nice :-) Once I get to the bottom of it (if I ever do) I'll have to 
start over from scratch = from pristine original IGB code, insert the 
needed mods (observing coding style), comment them properly and 
*then* take a diff...


And I got a little further.
I'm attaching two text files, containing the dumps of i2cdetect and 
eeprog (modified by me *not* to exit on error, just try another 
byte). 

The i2cdetect succeeds even with a simple "read byte" transaction 
(just two bytes on the bus).

The "eeprog" uses an SMbus-style indirect read with an 8bit address.
This consists of two low-level i2c transactions: 
"write byte" followed by a "read byte".
The first transaction sets the offset inside the slave, 
the second transaction reads back actual data.

Again I have two SFP's, both of them "3rd-party Chinese", one sold as 
Huawei-compatible, the other one as Cisco-compatible. Not sure to 
what extent this is true :-)

i2cdetect has found three i2c slaves (identical layout in both SFP's) 
at addresses 0x50, 0x51 and 0x56.
What are they? EEPROM, DDM and "MDIO over i2c" ?
The SFP's likely lack a proper SFP MSA data structure.

The second SFP ("Cisco-compatible") behaves somewhat special at 0x56. 

eeprog just calls the "SMbus read 1 byte from offset at slave" 
iteratively across the "space of offsets".
I.e. every offset gets an independent transaction, 1 byte long.
Now... if I unleash this iteration unto i2c slave 0x56, then every 
other byte (every odd byte = every odd offset) ends up in a 
"transaction error".
I had to hack eeprog to just ignore these errors and print XX instead 
of data in the hex dump.

I went on to investigate further - I tried reading single bytes.
If I start at an even offset, such as 0 or 8, and I read that single 
offset (byte) twice, i.e. two separate and complete SMbus 
transactions, that succeeds, the two values returned are different 
from each other, and I can read another offset without an error.
But, if I read an offset just once, and then try a different offset, 
I get an error on the second offset. And even/odd offsets don't 
really matter - I can read an odd offset just fine, as long as I read 
any/every offset *twice*.

And, it gets more interesting if I look at the 'scope.
I'm attaching some screenshots of the failed transaction.

As already briefly mentioned, the healthy SMbus "read byte" 
transaction consists of two separate i2c sub-transactions:

[START][7bit slave addr][WRITE][ACK][REPST][8bit offset][ACK][STOP]
[START][7bit slave addr][READ][ACK][REPST][8bit data][NAK][STOP]

The error (if I break the rule that I have to read every offset 
twice) looks like this: 

[START][7bit slave addr][WRITE][ACK] [8bit offset][NAK][STOP]
(and the second sub-transaction is not attempted by the master).

= already the first sub-transaction gets NACKed.

This kind of rings a bell, in that the MII PHY registers are 16 bits 
each. Is this a plausible correlation?

This is making me wonder if I should use some other transaction 
format. Read one more byte? There's a transaction called "SMBus read 
word" which does exactly that. 
Except that "read word" wouldn't do, I cannot read another byte after 
a NAK. Same thing with "SMBus read block data". Apparently the
appropriate transaction style is hardwired in the slave, the master
cannot "force" the slave to use a particular transaction style.
Not within that one transaction (maybe somehow "out of band").

Does this make sense as some sort of proprietary standard 
(Cisco, if I should take the vendor's label at face value),
or is this likely some "3rd-party innovation thinko", not worth
implementing?

Frank

[-- Attachment #2: Attachment information. --]
[-- Type: text/plain, Size: 468 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  i2c-detect.txt
     Date:  20 Mar 2018, 6:50
     Size:  1459 bytes.
     Type:  Text

[-- Attachment #3: i2c-detect.txt --]
[-- Type: Application/Octet-stream, Size: 1459 bytes --]


SFP#1 sold as Huawei-compliant

root@debian:/usr/src/eeprog-0.7.6# i2cdetect -a 8 0 0x7f
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-8 using read byte commands.
I will probe address range 0x00-0x7f.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 -- -- -- -- 56 -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


SFP#2 sold as Cisco-compliant

root@debian:/usr/src/eeprog-0.7.6# i2cdetect -a 8 0 0x7f
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-8.
I will probe address range 0x00-0x7f.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 -- -- -- -- 56 -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

[-- Attachment #4: Attachment information. --]
[-- Type: text/plain, Size: 464 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  eeprog.txt
     Date:  20 Mar 2018, 6:49
     Size:  7631 bytes.
     Type:  Text

[-- Attachment #5: eeprog.txt --]
[-- Type: Application/Octet-stream, Size: 7631 bytes --]

EEPROG is using the smbus-style indirect access. 
The -8 arg means "use 8-bit addresses",
otherwise useful with 24c0x...24C16.

EEPROG can also do 16bit addresses for the larger members
of the 24cXX family, but these are likely no use here,
given that the SFP I2c slaves seem to have some data 
in the first 128 B only (corresponding to a 24c01).

######################
SFP#1 Huawei-compliant
######################

root@debian:/usr/src/eeprog-0.7.6# ./eeprog -x -f -8 -r 0:256 /dev/i2c-8 0x50
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
  Bus: /dev/i2c-8, Address: 0x50, Mode: 8bit
  Reading 256 bytes from 0x0

 0000|  00 00 07 00 10 01 20 42   00 0c 00 05 02 00 00 00
 0010|  c8 64 00 00 46 69 62 65   72 53 74 6f 72 65 20 20
 0020|  20 20 20 20 00 00 90 65   53 46 50 2d 47 45 2d 31
 0030|  30 30 46 58 20 20 20 20   41 20 20 20 05 1e 00 ac
 0040|  00 1a 00 00 45 41 31 33   32 35 30 30 30 35 30 37
 0050|  37 33 20 20 31 38 30 33   30 32 20 20 68 90 01 a8
 0060|  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
 0070|  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
 0080|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0090|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00a0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00b0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00c0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00d0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00e0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00f0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff

root@debian:/usr/src/eeprog-0.7.6# ./eeprog -x -f -8 -r 0:256 /dev/i2c-8 0x51
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
  Bus: /dev/i2c-8, Address: 0x51, Mode: 8bit
  Reading 256 bytes from 0x0

 0000|  7f ff 80 00 7f ff 80 00   ff ff 00 00 ff ff 00 00
 0010|  ff ff 00 00 ff ff 00 00   ff ff ff 80 84 ff ff ff
 0020|  ff ff 00 00 ff ff 00 00   00 00 00 00 00 00 00 00
 0030|  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
 0040|  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
 0050|  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
 0060|  3a a0 7d 30 00 00 00 00   00 00 00 00 00 00 00 f8
 0070|  01 00 00 00 01 00 00 00   00 00 00 00 00 00 00 00
 0080|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0090|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00a0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00b0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00c0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00d0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00e0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00f0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff

root@debian:/usr/src/eeprog-0.7.6# ./eeprog -x -f -8 -r 0:256 /dev/i2c-8 0x56
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
  Bus: /dev/i2c-8, Address: 0x56, Mode: 8bit
  Reading 256 bytes from 0x0

 0000|  00 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 0010|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 0020|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 0030|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 0040|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 0050|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 0060|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 0070|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 0080|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 0090|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 00a0|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 00b0|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 00c0|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 00d0|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00
 00e0|  21 79 00 60 01 00 00 20   00 00 00 00 00 00 00 30
 00f0|  00 00 00 00 00 00 00 00   04 05 00 ff 00 00 00 00


#####################
SFP#2 Cisco-compliant
#####################

root@debian:/usr/src/eeprog-0.7.6# ./eeprog -x -f -8 -r 0:256 /dev/i2c-8 0x50
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
  Bus: /dev/i2c-8, Address: 0x50, Mode: 8bit
  Reading 256 bytes from 0x0

 0000|  00 00 07 00 00 00 00 00   00 00 00 02 01 00 0a 00
 0010|  00 00 00 00 4f 45 4d 20   20 20 20 20 20 20 20 20
 0020|  20 20 20 20 00 20 20 20   46 45 2d 31 30 30 4c 58
 0030|  20 20 20 20 20 20 20 20   31 2e 30 20 05 1e 00 bb
 0040|  00 1a 00 00 46 41 39 36   30 39 46 45 4c 30 34 20
 0050|  20 20 20 20 30 39 30 36   31 36 20 20 00 00 00 ca
 0060|  2c 00 08 ae aa 68 43 55   90 d3 69 ac 2b c0 85 a8
 0070|  6b aa ee 00 00 00 00 00   00 00 00 00 a5 4d 36 da
 0080|  31 30 31 30 32 32 2d 4d   33 37 20 20 20 20 20 20
 0090|  32 30 31 30 31 30 32 36   20 20 20 20 20 20 20 20
 00a0|  20 20 20 20 20 20 20 20   20 20 20 20 20 20 20 20
 00b0|  20 20 20 20 20 20 20 20   20 20 20 20 20 20 20 20
 00c0|  20 20 20 20 20 20 20 20   20 20 20 20 20 20 20 20
 00d0|  20 20 20 20 20 20 20 20   20 20 20 20 20 20 20 20
 00e0|  20 20 20 20 20 20 20 20   20 20 20 20 20 20 20 20
 00f0|  76 76 76 76 76 76 76 76   76 76 76 76 76 76 76 76

root@debian:/usr/src/eeprog-0.7.6# ./eeprog -x -f -8 -r 0:256 /dev/i2c-8 0x51
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
  Bus: /dev/i2c-8, Address: 0x51, Mode: 8bit
  Reading 256 bytes from 0x0

 0000|  f7 ff ff ff ff ff ff ff   ff fe ff ff ff ff ff ff
 0010|  ff ff ff ff ff ff ff ff   ff ff ff 80 84 ff ff ff
 0020|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0030|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0040|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0050|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0060|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0070|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0080|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 0090|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00a0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00b0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00c0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00d0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00e0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff
 00f0|  ff ff ff ff ff ff ff ff   ff ff ff ff ff ff ff ff

root@debian:/usr/src/eeprog-0.7.6# ./eeprog -x -f -8 -r 0:256 /dev/i2c-8 0x56
eeprog 0.7.6, a 24Cxx EEPROM reader/writer
Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
  Bus: /dev/i2c-8, Address: 0x56, Mode: 8bit
  Reading 256 bytes from 0x0

 0000|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 0010|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 0020|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 0030|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 0040|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 0050|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 0060|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 0070|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 0080|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 0090|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 00a0|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 00b0|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 00c0|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 00d0|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX
 00e0|  21 XX 01 XX 00 XX 00 XX   00 XX 00 XX 00 XX 00 XX
 00f0|  00 XX 00 XX 00 XX 00 XX   00 XX 80 XX 00 XX 00 XX

[-- Attachment #6: Attachment information. --]
[-- Type: text/plain, Size: 483 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  SFP2_1st_subtrans_bad.png
     Date:  20 Mar 2018, 9:32
     Size:  65532 bytes.
     Type:  Unknown

[-- Attachment #7: SFP2_1st_subtrans_bad.png --]
[-- Type: Application/Octet-stream, Size: 65532 bytes --]

[-- Attachment #8: Attachment information. --]
[-- Type: text/plain, Size: 482 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  SFP2_1st_subtrans_OK.png
     Date:  20 Mar 2018, 9:29
     Size:  63141 bytes.
     Type:  Unknown

[-- Attachment #9: SFP2_1st_subtrans_OK.png --]
[-- Type: Application/Octet-stream, Size: 63141 bytes --]

[-- Attachment #10: Attachment information. --]
[-- Type: text/plain, Size: 482 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  SFP2_whole_trans_bad.png
     Date:  20 Mar 2018, 9:25
     Size:  65050 bytes.
     Type:  Unknown

[-- Attachment #11: SFP2_whole_trans_bad.png --]
[-- Type: Application/Octet-stream, Size: 65050 bytes --]

[-- Attachment #12: Attachment information. --]
[-- Type: text/plain, Size: 481 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  SFP2_whole_trans_OK.png
     Date:  20 Mar 2018, 9:23
     Size:  68852 bytes.
     Type:  Unknown

[-- Attachment #13: SFP2_whole_trans_OK.png --]
[-- Type: Application/Octet-stream, Size: 68852 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
  2018-03-17 22:12 Frantisek Rysanek
@ 2018-03-18 14:40 ` Andrew Lunn
  2018-03-20  9:02   ` Frantisek Rysanek
  2018-03-20 12:02   ` Frantisek Rysanek
  0 siblings, 2 replies; 18+ messages in thread
From: Andrew Lunn @ 2018-03-18 14:40 UTC (permalink / raw)
  To: Frantisek Rysanek; +Cc: netdev

> I'm not getting an ACK from the SFP, probably because I've got the 
> address and offset wrong and because I'd better use indirect access.
> There's some more work awaiting me...

Try address 0x50.

i2detect will probe all addresses for you, if you have a standard
Linux i2c bus.

      Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests?
@ 2018-03-17 22:12 Frantisek Rysanek
  2018-03-18 14:40 ` Andrew Lunn
  0 siblings, 1 reply; 18+ messages in thread
From: Frantisek Rysanek @ 2018-03-17 22:12 UTC (permalink / raw)
  To: Andrew Lunn, netdev

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 1044 bytes --]

> > > Right now I've modded igb_init_i2c() to engage the bit-banging
> > > i2c driver for the i210 too
> > 
> > I don't think that will work. The datasheet for the i210 talks about
> > two registers for I2C/MDIO which are not bit-banging. Only the i350
> > uses bit-banging.
> > 
> From the i210 datasheet, page 477:
> chapter 8.17.9 "SFP I2C Parameters" - reg. I2CPARAMS (0x102C; R/W)
> bit 8 "I2CBB_EN" = I2C bit-bang enable.
> And about 6 more bits for SDA and SCL direction, input and output.
> Looking through existing code of the bit-banging callbacks for i350, 
> their function would seem identical between the i210 and i350.
> I may check the bit definition macros again, if the scope shows 
> nothing.
> 
Sure enough, the I2C port works in bit-banging mode, even without a 
semaphore. Screenshot attached.
I'm not getting an ACK from the SFP, probably because I've got the 
address and offset wrong and because I'd better use indirect access.
There's some more work awaiting me...
God knows if this is going to be any use :-)

Frank


[-- Attachment #2: Attachment information. --]
[-- Type: text/plain, Size: 485 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  osc_some_frame_bitbang.png
     Date:  17 Mar 2018, 17:43
     Size:  54383 bytes.
     Type:  Unknown

[-- Attachment #3: osc_some_frame_bitbang.png --]
[-- Type: Application/Octet-stream, Size: 54383 bytes --]

[-- Attachment #4: Attachment information. --]
[-- Type: text/plain, Size: 480 bytes --]

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  osc_some_frame_HW.png
     Date:  17 Mar 2018, 17:39
     Size:  40613 bytes.
     Type:  Unknown

[-- Attachment #5: osc_some_frame_HW.png --]
[-- Type: Application/Octet-stream, Size: 40613 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-03-21 14:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 16:48 HW question: i210 vs. BCM5461S over SGMII: no response from PHY to MDIO requests? Frantisek Rysanek
2018-03-16 18:42 ` Andrew Lunn
2018-03-16 20:40   ` Frantisek Rysanek
2018-03-16 21:02     ` Andrew Lunn
2018-03-17  7:39       ` Frantisek Rysanek
2018-03-17 14:50         ` Andrew Lunn
2018-03-17 15:20           ` Frantisek Rysanek
2018-03-17 22:12 Frantisek Rysanek
2018-03-18 14:40 ` Andrew Lunn
2018-03-20  9:02   ` Frantisek Rysanek
2018-03-20 12:09     ` Andrew Lunn
2018-03-20 12:23       ` Frantisek Rysanek
2018-03-21 10:47       ` Frantisek Rysanek
2018-03-21 13:08         ` Andrew Lunn
2018-03-20 12:02   ` Frantisek Rysanek
2018-03-21 11:50 Frantisek Rysanek
2018-03-21 12:58 ` Andrew Lunn
2018-03-21 14:07   ` Frantisek Rysanek

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).