SolidRun Clearfog SFP support
cover SolidRun Clearfog SFP support
Now that mvneta supports SFP, we can add the necessary DT changes to Clearfog to support the SFP cages. This series consists of two patches:
1. Increase the I2C bus speed with the GPIO expander to 400kHz, as there are bus timing issues that this works around - and as we poll the expander, we need the bus to be reliable.
2. Add the SFP entry to the clearfog DTS. This includes the maximum power level specification, which is not yet reviewed or merged but has been sent via netdev for net-next. I'll follow up when the binding has been acked by Rob.
arch/arm/boot/dts/armada-388-clearfog.dtsi | 52 ++++++++---------------------- 1 file changed, 14 insertions(+), 38 deletions(-)
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
PATCH 1/2 ARM: dts: armada388-clearfog: increase speed of i2c0 to 400kHz
All the devices on I2C0 support fast mode, so increase the bus speed to match. The Armada 388 is known to have a timing issue when in standard mode, which we believe causes the ficticious device at 0x64 to appear.
--- arch/arm/boot/dts/armada-388-clearfog.dtsi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/arm/boot/dts/armada-388-clearfog.dtsi +2 -5
@@ -143,8 +143,7 @@ }; &i2c0 { - /* Is there anything on this? */ - clock-frequency = <100000>; + clock-frequency = <400000>; pinctrl-0 = <&i2c0_pins>; pinctrl-names = "default"; status = "okay";
@@ -239,13 +238,11 @@ }; }; - /* The MCP3021 is 100kHz clock only */ + /* The MCP3021 supports standard and fast modes */ mikrobus_adc: mcp3021 at 4c { compatible = "microchip,mcp3021"; reg = <0x4c>; }; - - /* Also something at 0x64 */ }; &i2c1 {
Signature · 1 line
2.7.4
PATCH 1/2 ARM: dts: armada388-clearfog: increase speed of i2c0 to 400kHz
Hi Russell,
Quoted 2 lines · Russell King
All the devices on I2C0 support fast mode, so increase the bus speed to match.
I agree with this part. I didn't pay attention to it in the initial submission but now I've checked it, and indeed according to the datasheet the MCP3021 support "standard (100 kHz) and Fast (400 kHz) I2C Compatible modes"
Quoted 3 lines
The Armada 388 is known to have a timing issue when in standard mode, which we believe causes the ficticious device at
0x64to appear.
This errata "FE-8471889 I2C Repeated Start is not supported in standard mode (up to 100K)" was supposed to be fixed with the commit c1d15b68aab8 ("i2c: mv64xxx: Fix timing issue on Armada XP (errata FE-8471889)"). And it was used on the Armada 38x SoCs since fbffee74986c ("ARM: dts: Fix I2C repeated start issue on Armada-38x") in 4.14.
So I think that now even at 100kHz the ficticious device should not appear any more. If it is still the case then there might be an issue with the fix in the 2c driver.
Gregory
Quoted 38 lines
Signed-off-by Russell King <[email protected]>--- arch/arm/boot/dts/armada-388-clearfog.dtsi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/arm/boot/dts/armada-388-clearfog.dtsi +2
-5@@ -143,8 +143,7 @@ }; &i2c0 { - /* Is there anything on this? */ - clock-frequency = <100000>; + clock-frequency = <400000>; pinctrl-0 = <&i2c0_pins>; pinctrl-names = "default"; status = "okay";@@ -239,13 +238,11 @@ }; }; - /* The MCP3021 is 100kHz clock only */ + /* The MCP3021 supports standard and fast modes */ mikrobus_adc: mcp3021 at 4c { compatible = "microchip,mcp3021"; reg = <0x4c>; }; - - /* Also something at 0x64 */ }; &i2c1 {Signature · 1 line
2.7.4
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
PATCH 1/2 ARM: dts: armada388-clearfog: increase speed of i2c0 to 400kHz
Quoted 16 lines · Gregory CLEMENT
Hi Russell,
Quoted 2 lines · Russell King
All the devices on I2C0 support fast mode, so increase the bus speed to match.
I agree with this part. I didn't pay attention to it in the initial submission but now I've checked it, and indeed according to the datasheet the MCP3021 support "standard (100 kHz) and Fast (400 kHz) I2C Compatible modes"
Quoted 3 lines
The Armada 388 is known to have a timing issue when in standard mode, which we believe causes the ficticious device at
0x64to appear.
Quoted 5 lines
This errata "FE-8471889 I2C Repeated Start is not supported in standard mode (up to 100K)" was supposed to be fixed with the commit
c1d15b68aab8("i2c: mv64xxx: Fix timing issue on Armada XP (errata FE-8471889)"). And it was used on the Armada 38x SoCs sincefbffee74986c("ARM: dts: Fix I2C repeated start issue on Armada-38x") in 4.14.
The commit pre-dates 4.14, and the commit message was correct at the time it was committed (Nov 29 2016). I don't know whether its still the case that the ficticious device still appears, but increasing the bus speed is still a sensible thing to do if the devices all support it.
Quoted 49 lines
So I think that now even at 100kHz the ficticious device should not appear any more. If it is still the case then there might be an issue with the fix in the 2c driver.
Gregory
Quoted 38 lines
Signed-off-by Russell King <[email protected]>--- arch/arm/boot/dts/armada-388-clearfog.dtsi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/arm/boot/dts/armada-388-clearfog.dtsi +2
-5@@ -143,8 +143,7 @@ }; &i2c0 { - /* Is there anything on this? */ - clock-frequency = <100000>; + clock-frequency = <400000>; pinctrl-0 = <&i2c0_pins>; pinctrl-names = "default"; status = "okay";@@ -239,13 +238,11 @@ }; }; - /* The MCP3021 is 100kHz clock only */ + /* The MCP3021 supports standard and fast modes */ mikrobus_adc: mcp3021 at 4c { compatible = "microchip,mcp3021"; reg = <0x4c>; }; - - /* Also something at 0x64 */ }; &i2c1 {Signature · 1 line
2.7.4Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
PATCH 1/2 ARM: dts: armada388-clearfog: increase speed of i2c0 to 400kHz
Hi Russell King,
Quoted 23 lines · Russell King - ARM Linux
Quoted 16 lines · Gregory CLEMENT
Hi Russell,
Quoted 2 lines · Russell King
All the devices on I2C0 support fast mode, so increase the bus speed to match.
I agree with this part. I didn't pay attention to it in the initial submission but now I've checked it, and indeed according to the datasheet the MCP3021 support "standard (100 kHz) and Fast (400 kHz) I2C Compatible modes"
Quoted 3 lines
The Armada 388 is known to have a timing issue when in standard mode, which we believe causes the ficticious device at
0x64to appear.Quoted 5 lines
This errata "FE-8471889 I2C Repeated Start is not supported in standard mode (up to 100K)" was supposed to be fixed with the commit
c1d15b68aab8("i2c: mv64xxx: Fix timing issue on Armada XP (errata FE-8471889)"). And it was used on the Armada 38x SoCs sincefbffee74986c("ARM: dts: Fix I2C repeated start issue on Armada-38x") in 4.14.
Quoted 4 lines
The commit pre-dates 4.14, and the commit message was correct at the time it was committed (Nov 29 2016). I don't know whether its still the case that the ficticious device still appears, but increasing the bus speed is still a sensible thing to do if the devices all support it.
I agree to apply it. I was concerned by the fact that the i2c fix might not work. I've just tested it and by using the "marvell,mv78230-a0-i2c" there was no more ficticious device at 100KHz, so I am happy with it.
In order to make know that now the Standard mode is working on Armada 38x, I will just add a the following comment to your commit log:
[gregory.clement at bootlin.com: Note that since the commit fbffee74986c ("ARM: dts: Fix I2C repeated start issue on Armada-38x") in 4.14, the timing issue is managed for the Armada 38x SoCs.]
Thanks,
Gregory
Quoted 55 lines
Quoted 50 lines
So I think that now even at 100kHz the ficticious device should not appear any more. If it is still the case then there might be an issue with the fix in the 2c driver.
Gregory
Quoted 38 lines
Signed-off-by Russell King <[email protected]>--- arch/arm/boot/dts/armada-388-clearfog.dtsi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/arm/boot/dts/armada-388-clearfog.dtsi +2
-5@@ -143,8 +143,7 @@ }; &i2c0 { - /* Is there anything on this? */ - clock-frequency = <100000>; + clock-frequency = <400000>; pinctrl-0 = <&i2c0_pins>; pinctrl-names = "default"; status = "okay";@@ -239,13 +238,11 @@ }; }; - /* The MCP3021 is 100kHz clock only */ + /* The MCP3021 supports standard and fast modes */ mikrobus_adc: mcp3021 at 4c { compatible = "microchip,mcp3021"; reg = <0x4c>; }; - - /* Also something at 0x64 */ }; &i2c1 {Signature · 1 line
2.7.4Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.comSignature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
In reply to Russell King - ARM LinuxAdd SFP module support for Clearfog using the SFP phylink support.
--- arch/arm/boot/dts/armada-388-clearfog.dtsi | 45 ++++++++---------------------- 1 file changed, 12 insertions(+), 33 deletions(-)
arch/arm/boot/dts/armada-388-clearfog.dtsi +12 -33
@@ -117,6 +117,16 @@ }; }; }; + + sfp: sfp { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&expander0 12 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&expander0 15 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&expander0 14 GPIO_ACTIVE_HIGH>; + tx-fault-gpio = <&expander0 13 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <2000>; + }; }; ð1 {
@@ -133,13 +143,10 @@ bm,pool-long = <3>; bm,pool-short = <1>; buffer-manager = <&bm>; + managed = "in-band-status"; phy-mode = "sgmii"; + sfp = <&sfp>; status = "okay"; - - fixed-link { - speed = <1000>; - full-duplex; - }; }; &i2c0 {
@@ -208,34 +215,6 @@ output-low; line-name = "m.2 devslp"; }; - sfp_los { - /* SFP loss of signal */ - gpio-hog; - gpios = <12 GPIO_ACTIVE_HIGH>; - input; - line-name = "sfp-los"; - }; - sfp_tx_fault { - /* SFP laser fault */ - gpio-hog; - gpios = <13 GPIO_ACTIVE_HIGH>; - input; - line-name = "sfp-tx-fault"; - }; - sfp_tx_disable { - /* SFP transmit disable */ - gpio-hog; - gpios = <14 GPIO_ACTIVE_HIGH>; - output-low; - line-name = "sfp-tx-disable"; - }; - sfp_mod_def0 { - /* SFP module present */ - gpio-hog; - gpios = <15 GPIO_ACTIVE_LOW>; - input; - line-name = "sfp-mod-def0"; - }; }; /* The MCP3021 supports standard and fast modes */
Signature · 1 line
2.7.4
PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
Quoted 3 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Signed-off-by Russell King <[email protected]>
Using a RoboFiber SFP module, connected to a media converter. Link up/down detected.
Andrew
PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
Quoted 9 lines · Andrew Lunn
Quoted 3 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Signed-off-by Russell King <[email protected]>Tested-by Andrew Lunn <[email protected]>Using a RoboFiber SFP module, connected to a media converter. Link up/down detected.
ethtool -m should also work.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
Quoted 4 lines · Russell King - ARM Linux
Quoted 3 lines · Andrew Lunn
Quoted 2 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Russell King <[email protected]>Tested-by Andrew Lunn <[email protected]>Using a RoboFiber SFP module, connected to a media converter. Link up/down detected.
ethtool -m should also work.
Yes, it does. Sorry, should of said that.
root at clearfog:~# ethtool -m eth1
Identifier : 0x03 (SFP)
Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID)
Connector : 0x07 (LC)
Transceiver codes : 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00
Transceiver type : Ethernet: 1000BASE-SX
Encoding : 0x01 (8B/10B)
BR, Nominal : 1300MBd
Rate identifier : 0x00 (unspecified)
Length (SMF,km) : 0km
Length (SMF) : 0m
Length (50um) : 550m
Length (62.5um) : 270m
Length (Copper) : 0m
Length (OM3) : 0m
Laser wavelength : 850nm
Vendor name : OEM
Vendor OUI : 20:20:20
Vendor PN : SFP-7000-85
Vendor rev : 11.0
Optical diagnostics support : Yes
Laser bias current : 45.512 mA
Laser output power : 0.2861 mW / -5.43 dBm
Receiver signal average optical power : 0.2749 mW / -5.61 dBm
Module temperature : 25.72 degrees C / 78.29 degrees F
Module voltage : 3.2856 V...
Andrew
PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
In reply to Russell KingHi Russell,
Quoted 3 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Signed-off-by Russell King <[email protected]>
Tested on Clearfog base with kernel version 4.16-rc3. The SFP module is 1G copper Linktel LX1801CNR.
ethtool output:
Identifier : 0x03 (SFP) Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID) Connector : 0x00 (unknown or unspecified) Transceiver codes : 0x00 0x00 0x00 0x08 0x00 0x00 0x00 0x00 Transceiver type : Ethernet: 1000BASE-T Encoding : 0x01 (8B/10B) BR, Nominal : 1300MBd Rate identifier : 0x00 (unspecified) Length (SMF,km) : 0km Length (SMF) : 0m Length (50um) : 0m Length (62.5um) : 0m Length (Copper) : 100m Length (OM3) : 0m Laser wavelength : 0nm Vendor name : LINKTEL Vendor OUI : 00:00:00 Vendor PN : LX1801CNR Vendor rev : 1.0 Option values : 0x00 0x10 Option : TX_DISABLE implemented BR margin, max : 0% BR margin, min : 0% Vendor SN : 1172623927 Date code : 170628
Thanks,
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
Quoted 11 lines · Baruch Siach
Hi Russell,
Quoted 3 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Signed-off-by Russell King <[email protected]>Tested-by Baruch Siach <[email protected]>Tested on Clearfog base with kernel version 4.16-rc3. The SFP module is 1G copper Linktel LX1801CNR.
Thanks for testing.
Please also send the "ethtool -m eth2 raw on > foo.bin" output as well so I can build a database of module EEPROMs, which allows me to validate the SFP parsing code against. Alternatively, please send the "hex on" if you think that's more convenient.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
Hi Russell,
Quoted 11 lines · Russell King - ARM Linux
Quoted 9 lines · Baruch Siach
Quoted 3 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Signed-off-by Russell King <[email protected]>Tested-by Baruch Siach <[email protected]>Tested on Clearfog base with kernel version 4.16-rc3. The SFP module is 1G copper Linktel LX1801CNR.
Quoted 6 lines
Thanks for testing.
Please also send the "ethtool -m eth2 raw on > foo.bin" output as well so I can build a database of module EEPROMs, which allows me to validate the SFP parsing code against. Alternatively, please send the "hex on" if you think that's more convenient.
Here are both. Binary file md5sum: 3635c7ceff2127d4d6bf04339b657440
Offset Values
------ ------0x0000: 03 04 00 00 00 00 08 00 00 00 00 01 0d 00 00 000x0010: 00 00 64 00 4c 49 4e 4b 54 45 4c 20 20 20 20 200x0020: 20 20 20 20 00 00 00 00 4c 58 31 38 30 31 43 4e0x0030: 52 20 20 20 20 20 20 20 31 2e 30 20 00 00 00 940x0040: 00 10 00 00 31 31 37 32 36 32 33 39 32 37 20 200x0050: 20 20 20 20 31 37 30 36 32 38 20 20 00 00 00 500x0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x0090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x00a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x00b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x00c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x00d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x00e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff0x00f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
baruch
Signature · 10 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sfp.bin
Type: application/octet-stream
Size: 256 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180304/77a629b6/attachment.bin>PATCH 2/2 ARM: dts: armada388-clearfog: add SFP module support
In reply to Russell KingHi Russell,
Quoted 3 lines · Russell King
Add SFP module support for Clearfog using the SFP phylink support.
Signed-off-by Russell King <[email protected]>
Applied on mvebu/dt with the tested-by flags
Thanks,
Gregory
Quoted 79 lines
--- arch/arm/boot/dts/armada-388-clearfog.dtsi | 45 ++++++++---------------------- 1 file changed, 12 insertions(+), 33 deletions(-)arch/arm/boot/dts/armada-388-clearfog.dtsi +12
-33@@ -117,6 +117,16 @@ }; }; }; + + sfp: sfp { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&expander0 12 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&expander0 15 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&expander0 14 GPIO_ACTIVE_HIGH>; + tx-fault-gpio = <&expander0 13 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <2000>; + }; }; ð1 {@@ -133,13 +143,10 @@ bm,pool-long = <3>; bm,pool-short = <1>; buffer-manager = <&bm>; + managed = "in-band-status"; phy-mode = "sgmii"; + sfp = <&sfp>; status = "okay"; - - fixed-link { - speed = <1000>; - full-duplex; - }; }; &i2c0 {@@ -208,34 +215,6 @@ output-low; line-name = "m.2 devslp"; }; - sfp_los { - /* SFP loss of signal */ - gpio-hog; - gpios = <12 GPIO_ACTIVE_HIGH>; - input; - line-name = "sfp-los"; - }; - sfp_tx_fault { - /* SFP laser fault */ - gpio-hog; - gpios = <13 GPIO_ACTIVE_HIGH>; - input; - line-name = "sfp-tx-fault"; - }; - sfp_tx_disable { - /* SFP transmit disable */ - gpio-hog; - gpios = <14 GPIO_ACTIVE_HIGH>; - output-low; - line-name = "sfp-tx-disable"; - }; - sfp_mod_def0 { - /* SFP module present */ - gpio-hog; - gpios = <15 GPIO_ACTIVE_LOW>; - input; - line-name = "sfp-mod-def0"; - }; }; /* The MCP3021 supports standard and fast modes */Signature · 1 line
2.7.4
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com