diff mbox

[2/2] ARM: dts: armada388-clearfog: add SFP module support

Message ID E1eqhha-0004l3-Rd@rmk-PC.armlinux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Russell King Feb. 27, 2018, 4:02 p.m. UTC
Add SFP module support for Clearfog using the SFP phylink support.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/boot/dts/armada-388-clearfog.dtsi | 45 ++++++++----------------------
 1 file changed, 12 insertions(+), 33 deletions(-)

Comments

Andrew Lunn March 2, 2018, 9:56 p.m. UTC | #1
On Tue, Feb 27, 2018 at 04:02:02PM +0000, Russell King wrote:
> Add SFP module support for Clearfog using the SFP phylink support.
> 
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Tested-by: Andrew Lunn <andrew@lunn.ch>

Using a RoboFiber SFP module, connected to a media converter. Link
up/down detected.

    Andrew
Russell King (Oracle) March 2, 2018, 10:02 p.m. UTC | #2
On Fri, Mar 02, 2018 at 10:56:14PM +0100, Andrew Lunn wrote:
> On Tue, Feb 27, 2018 at 04:02:02PM +0000, Russell King wrote:
> > Add SFP module support for Clearfog using the SFP phylink support.
> > 
> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> Tested-by: Andrew Lunn <andrew@lunn.ch>
> 
> Using a RoboFiber SFP module, connected to a media converter. Link
> up/down detected.

ethtool -m should also work.
Andrew Lunn March 2, 2018, 10:04 p.m. UTC | #3
On Fri, Mar 02, 2018 at 10:02:15PM +0000, Russell King - ARM Linux wrote:
> On Fri, Mar 02, 2018 at 10:56:14PM +0100, Andrew Lunn wrote:
> > On Tue, Feb 27, 2018 at 04:02:02PM +0000, Russell King wrote:
> > > Add SFP module support for Clearfog using the SFP phylink support.
> > > 
> > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> > 
> > Tested-by: Andrew Lunn <andrew@lunn.ch>
> > 
> > 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@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
Baruch Siach March 4, 2018, 12:13 p.m. UTC | #4
Hi Russell,

On Tue, Feb 27, 2018 at 04:02:02PM +0000, Russell King wrote:
> Add SFP module support for Clearfog using the SFP phylink support.
> 
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Tested-by: Baruch Siach <baruch@tkos.co.il>

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
Russell King (Oracle) March 4, 2018, 12:49 p.m. UTC | #5
On Sun, Mar 04, 2018 at 02:13:24PM +0200, Baruch Siach wrote:
> Hi Russell,
> 
> On Tue, Feb 27, 2018 at 04:02:02PM +0000, Russell King wrote:
> > Add SFP module support for Clearfog using the SFP phylink support.
> > 
> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> Tested-by: Baruch Siach <baruch@tkos.co.il>
> 
> 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.
Baruch Siach March 4, 2018, 1:19 p.m. UTC | #6
Hi Russell,

On Sun, Mar 04, 2018 at 12:49:06PM +0000, Russell King - ARM Linux wrote:
> On Sun, Mar 04, 2018 at 02:13:24PM +0200, Baruch Siach wrote:
> > On Tue, Feb 27, 2018 at 04:02:02PM +0000, Russell King wrote:
> > > Add SFP module support for Clearfog using the SFP phylink support.
> > > 
> > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> > 
> > Tested-by: Baruch Siach <baruch@tkos.co.il>
> > 
> > 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.

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 00 
0x0010:		00 00 64 00 4c 49 4e 4b 54 45 4c 20 20 20 20 20 
0x0020:		20 20 20 20 00 00 00 00 4c 58 31 38 30 31 43 4e 
0x0030:		52 20 20 20 20 20 20 20 31 2e 30 20 00 00 00 94 
0x0040:		00 10 00 00 31 31 37 32 36 32 33 39 32 37 20 20 
0x0050:		20 20 20 20 31 37 30 36 32 38 20 20 00 00 00 50 
0x0060:		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0070:		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0080:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x0090:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00a0:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00b0:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00c0:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00d0:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00e0:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00f0:		ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 

baruch
Gregory CLEMENT March 19, 2018, 9:41 p.m. UTC | #7
Hi Russell,
 
 On mar., févr. 27 2018, Russell King <rmk+kernel@arm.linux.org.uk> wrote:

> Add SFP module support for Clearfog using the SFP phylink support.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>


Applied on mvebu/dt with the tested-by flags

Thanks,

Gregory

> ---
>  arch/arm/boot/dts/armada-388-clearfog.dtsi | 45 ++++++++----------------------
>  1 file changed, 12 insertions(+), 33 deletions(-)
>
> diff --git a/arch/arm/boot/dts/armada-388-clearfog.dtsi b/arch/arm/boot/dts/armada-388-clearfog.dtsi
> index 0e3b1f140e6d..a44bf20ab7f8 100644
> --- a/arch/arm/boot/dts/armada-388-clearfog.dtsi
> +++ b/arch/arm/boot/dts/armada-388-clearfog.dtsi
> @@ -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>;
> +	};
>  };
>  
>  &eth1 {
> @@ -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 */
> -- 
> 2.7.4
>
diff mbox

Patch

diff --git a/arch/arm/boot/dts/armada-388-clearfog.dtsi b/arch/arm/boot/dts/armada-388-clearfog.dtsi
index 0e3b1f140e6d..a44bf20ab7f8 100644
--- a/arch/arm/boot/dts/armada-388-clearfog.dtsi
+++ b/arch/arm/boot/dts/armada-388-clearfog.dtsi
@@ -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>;
+	};
 };
 
 &eth1 {
@@ -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 */