Skip to contentSkip to conversation

net: mv88e61xx: add configuration for RGMII delay

PATCH New Chris Packham 2 participants 6 messages Jun 25, 2018 – Jun 27, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: mv88e61xx: add configuration for RGMII delay

Some hardware designs connect a CPU MAC directly to the RGMII interface of a mv88e61xx device. On such devices a delay on the RX/TX lines is required, this can either be achieved by adding extra length to the traces on the PCB or by implementing the delay in silicon. This is an implementation of the latter.

---

 drivers/net/phy/Kconfig     |  4 ++++
 drivers/net/phy/mv88e61xx.c | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/net/phy/Kconfig +4 -0
index f5821dfed96d..98cd57eea977 100644
@@ -59,6 +59,10 @@ config MV88E61XX_PHY_PORTS
 config MV88E61XX_FIXED_PORTS
 	hex "Bitmask of PHYless serdes Ports"
 
+config MV88E61XX_RGMII_DELAY
+	bool "Add delay to RGMII outputs"
+	default n
+
 endif # MV88E61XX_SWITCH
 
 config PHYLIB_10G
drivers/net/phy/mv88e61xx.c +26 -0
index ea54a1531053..d258ba1ef0f3 100644
@@ -69,6 +69,7 @@
 #define PORT_REG_CTRL			0x04
 #define PORT_REG_VLAN_MAP		0x06
 #define PORT_REG_VLAN_ID		0x07
+#define PORT_REG_RGMII_TIMING		0x1A
 
 /* Phy registers */
 #define PHY_REG_CTRL1			0x10
@@ -122,6 +123,9 @@
 #define PORT_REG_VLAN_MAP_TABLE_SHIFT	0
 #define PORT_REG_VLAN_MAP_TABLE_WIDTH	11
 
+#define PORT_REG_RGMII_TIMING_RX_DELAY	BIT(10)
+#define PORT_REG_RGMII_TIMING_TX_DELAY	BIT(9)
+
 #define SERDES_REG_CTRL_1_FORCE_LINK	BIT(10)
 
 #define PHY_REG_CTRL1_ENERGY_DET_SHIFT	8
@@ -705,6 +709,24 @@ unforce:
 	return res;
 }
 
+static int mv88e61xx_rgmii_timing_cfg(struct phy_device *phydev)
+{
+#ifdef CONFIG_MV88E61XX_RGMII_DELAY
+	int val;
+
+	val = mv88e61xx_port_read(phydev, 6, PORT_REG_RGMII_TIMING);
+	if (val < 0)
+		return val;
+
+	val |= PORT_REG_RGMII_TIMING_RX_DELAY |
+	       PORT_REG_RGMII_TIMING_TX_DELAY;
+
+	return mv88e61xx_port_write(phydev, 6, PORT_REG_RGMII_TIMING, val);
+#else
+	return 0;
+#endif
+}
+
 static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 {
 	int val;
@@ -774,6 +796,10 @@ static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
 				return val;
 		}
 	} else {
+		val = mv88e61xx_rgmii_timing_cfg(phydev);
+		if (val < 0)
+			return val;
+
 		val = mv88e61xx_fixed_port_setup(phydev,
 						 CONFIG_MV88E61XX_CPU_PORT);
 		if (val < 0)
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 ARM: kirkwood: add SBx81LIFXCAT board

This is a series of line cards for Allied Telesis's SBx8100 chassis switch. The CPU block is common to the SBx81GP24 and SBx81GT24 cards cards collectively referred to as SBx81LIFXCAT in u-boot.

---

 arch/arm/dts/kirkwood-atl-sbx81lifxcat.dts    | 145 ++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig                |   4 +
 board/alliedtelesis/SBx81LIFXCAT/Kconfig      |  12 ++
 board/alliedtelesis/SBx81LIFXCAT/MAINTAINERS  |   7 +
 board/alliedtelesis/SBx81LIFXCAT/Makefile     |   7 +
 board/alliedtelesis/SBx81LIFXCAT/kwbimage.cfg |  49 ++++++
 .../alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c | 134 ++++++++++++++++
 configs/SBx81LIFXCAT_defconfig                |  44 ++++++
 include/configs/SBx81LIFXCAT.h                | 114 ++++++++++++++
 9 files changed, 516 insertions(+)
 create mode 100644 arch/arm/dts/kirkwood-atl-sbx81lifxcat.dts
 create mode 100644 board/alliedtelesis/SBx81LIFXCAT/Kconfig
 create mode 100644 board/alliedtelesis/SBx81LIFXCAT/MAINTAINERS
 create mode 100644 board/alliedtelesis/SBx81LIFXCAT/Makefile
 create mode 100644 board/alliedtelesis/SBx81LIFXCAT/kwbimage.cfg
 create mode 100644 board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c
 create mode 100644 configs/SBx81LIFXCAT_defconfig
 create mode 100644 include/configs/SBx81LIFXCAT.h
arch/arm/dts/kirkwood-atl-sbx81lifxcat.dts new file +145 -0
new file mode 100644
index 000000000000..c23444993623
@@ -0,0 +1,145 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-98dx4122.dtsi"
+
+/ {
+	model = "Allied Telesis SBx81LIFXCAT Board";
+	compatible = "atl,SBx8LIFXCAT", "marvell,kirkwood-98DX4122",
+		     "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x08000000>; /* 128 MB */
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+		stdout-path = &uart0;
+	};
+
+	aliases {
+		ethernet0 = &eth0;
+		i2c0 = &i2c0;
+		spi0 = &spi0;
+	};
+
+	dsa {
+		compatible = "marvell,dsa";
+		#address-cells = <2>;
+		#size-cells = <0>;
+		dsa,ethernet = <&eth0>;
+		dsa,mii-bus = <&mdio>;
+		status = "okay";
+
+		switch at 0 {
+			#address-cells =  <1>;
+			#size-cells = <0>;
+			reg = <1 0>;
+
+			port at 0 {
+				reg = <0>;
+				label = "internal0";
+			};
+			port at 1 {
+				reg = <1>;
+				label = "internal1";
+			};
+			port at 8 {
+				reg = <8>;
+				label = "internal8";
+				phy-mode = "rgmii-id";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+			port at 9 {
+				reg = <9>;
+				label = "internal9";
+				phy-mode = "rgmii-id";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+			port at 10 {
+				reg = <10>;
+				label = "cpu";
+			};
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		ledn {
+			label = "status:ledn";
+			gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+		};
+
+		ledp {
+			label = "status:ledp";
+			gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	flash at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "st,m25p128", "jedec,spi-nor", "spi-flash";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+		mode = <0>;
+
+		partition at u-boot {
+			reg = <0x00000000 0x00c00000>;
+			label = "u-boot";
+		};
+		partition at u-boot-env {
+			reg = <0x00c00000 0x00040000>;
+			label = "u-boot-env";
+		};
+		partition at unused {
+			reg = <0x00100000 0x00f00000>;
+			label = "unused";
+		};
+	};
+};
+
+&i2c0 {
+	status = "okay";
+
+	eeprom at 52 {
+		compatible = "atmel,24c04";
+		reg = <0x52>;
+	};
+
+	gpio3: gpio at 76 {
+		#gpio-cells = <2>;
+		compatible = "nxp,pca9539";
+		reg = <0x76>;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&mdio {
+	status = "okay";
+};
+
+&eth0 {
+	status = "okay";
+
+	ethernet0-port at 0 {
+		speed = <1000>;
+		duplex = <1>;
+	};
+};
arch/arm/mach-kirkwood/Kconfig +4 -0
index 5a5a63cea719..3b860c4f55fe 100644
@@ -62,6 +62,9 @@ config TARGET_NSA310S
 config TARGET_SBx81LIFKW
 	bool "Allied Telesis SBx81GS24/SBx81GT40/SBx81XS6/SBx81XS16"
 
+config TARGET_SBx81LIFXCAT
+	bool "Allied Telesis SBx81GP24/SBx81GT24"
+
 endchoice
 
 config SYS_SOC
@@ -85,5 +88,6 @@ source "board/Seagate/goflexhome/Kconfig"
 source "board/Seagate/nas220/Kconfig"
 source "board/zyxel/nsa310s/Kconfig"
 source "board/alliedtelesis/SBx81LIFKW/Kconfig"
+source "board/alliedtelesis/SBx81LIFXCAT/Kconfig"
 
 endif
board/alliedtelesis/SBx81LIFXCAT/Kconfig new file +12 -0
new file mode 100644
index 000000000000..524c2900892e
@@ -0,0 +1,12 @@
+if TARGET_SBx81LIFXCAT
+
+config SYS_BOARD
+       default "SBx81LIFXCAT"
+
+config SYS_VENDOR
+       default "alliedtelesis"
+
+config SYS_CONFIG_NAME
+       default "SBx81LIFXCAT"
+
+endif
board/alliedtelesis/SBx81LIFXCAT/MAINTAINERS new file +7 -0
new file mode 100644
index 000000000000..6b722ded250e
@@ -0,0 +1,7 @@
+SBx81LIFXCAT BOARD
+M:	Chris Packham <[email protected]>
+S:	Maintained
+F:	board/alliedtelesis/SBx81LIFXCAT/
+F:	include/configs/SBx81LIFXCAT
+F:	configs/SBx81LIFXCAT_defconfig
+F:	arch/arm/dts/kirkwood-atl-sbx81lifxcat.dts
board/alliedtelesis/SBx81LIFXCAT/Makefile new file +7 -0
new file mode 100644
index 000000000000..f21c8ef9d6ee
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2010, 2018
+# Allied Telesis <www.alliedtelesis.com>
+#
+
+obj-y	+= sbx81lifxcat.o
board/alliedtelesis/SBx81LIFXCAT/kwbimage.cfg new file +49 -0

49 lines not on this page · raw message

board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c new file +134 -0

134 lines not on this page · raw message

configs/SBx81LIFXCAT_defconfig new file +44 -0

44 lines not on this page · raw message

include/configs/SBx81LIFXCAT.h new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.18.0
#2 lore raw

PATCH 1/2 net: mv88e61xx: add configuration for RGMII delay

In reply to Chris Packham
Quoted 18 lines · Chris Packham

Some hardware designs connect a CPU MAC directly to the RGMII interface of a mv88e61xx device. On such devices a delay on the RX/TX lines is required, this can either be achieved by adding extra length to the traces on the PCB or by implementing the delay in silicon. This is an implementation of the latter.

---

 drivers/net/phy/Kconfig     |  4 ++++
 drivers/net/phy/mv88e61xx.c | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/net/phy/Kconfig +0 -0
index f5821dfed96d..98cd57eea977 100644

drivers/net/phy/Kconfig config MV88E61XX_PHY_PORTS · line 64

Quoted 6 lines
drivers/net/phy/Kconfig +3 -0
@@ -59,6 +59,10 @@ config MV88E61XX_PHY_PORTS
 config MV88E61XX_FIXED_PORTS
        hex "Bitmask of PHYless serdes Ports"
 
+config MV88E61XX_RGMII_DELAY
+       bool "Add delay to RGMII outputs"
+       default n

Not sure why you would need this line. default n is implied, no?

Quoted 27 lines
drivers/net/phy/Kconfig +1 -0
+
 endif # MV88E61XX_SWITCH
 
 config PHYLIB_10G
drivers/net/phy/mv88e61xx.c +4 -0
index ea54a1531053..d258ba1ef0f3 100644
@@ -69,6 +69,7 @@
 #define PORT_REG_CTRL                  0x04
 #define PORT_REG_VLAN_MAP              0x06
 #define PORT_REG_VLAN_ID               0x07
+#define PORT_REG_RGMII_TIMING          0x1A
 
 /* Phy registers */
 #define PHY_REG_CTRL1                  0x10
@@ -122,6 +123,9 @@
 #define PORT_REG_VLAN_MAP_TABLE_SHIFT  0
 #define PORT_REG_VLAN_MAP_TABLE_WIDTH  11
 
+#define PORT_REG_RGMII_TIMING_RX_DELAY BIT(10)
+#define PORT_REG_RGMII_TIMING_TX_DELAY BIT(9)
+
 #define SERDES_REG_CTRL_1_FORCE_LINK   BIT(10)
 
 #define PHY_REG_CTRL1_ENERGY_DET_SHIFT 8

drivers/net/phy/mv88e61xx.c unforce: · line 714

Quoted 6 lines
drivers/net/phy/mv88e61xx.c +3 -0
@@ -705,6 +709,24 @@ unforce:
        return res;
 }
 
+static int mv88e61xx_rgmii_timing_cfg(struct phy_device *phydev)
+{
+#ifdef CONFIG_MV88E61XX_RGMII_DELAY

It seems like this would be more appropriate as a device tree property rather than a board config.

Quoted 36 lines
drivers/net/phy/mv88e61xx.c +19 -1
+       int val;
+
+       val = mv88e61xx_port_read(phydev, 6, PORT_REG_RGMII_TIMING);
+       if (val < 0)
+               return val;
+
+       val |= PORT_REG_RGMII_TIMING_RX_DELAY |
+              PORT_REG_RGMII_TIMING_TX_DELAY;
+
+       return mv88e61xx_port_write(phydev, 6, PORT_REG_RGMII_TIMING, val);
+#else
+       return 0;
+#endif
+}
+
 static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 {
        int val;
@@ -774,6 +796,10 @@ static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
                                return val;
                }
        } else {
+               val = mv88e61xx_rgmii_timing_cfg(phydev);
+               if (val < 0)
+                       return val;
+
                val = mv88e61xx_fixed_port_setup(phydev,
                                                 CONFIG_MV88E61XX_CPU_PORT);
                if (val < 0)
--

2.18.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH 1/2 net: mv88e61xx: add configuration for RGMII delay

Quoted 23 lines · Joe Hershberger
Quoted 21 lines · Chris Packham

Some hardware designs connect a CPU MAC directly to the RGMII interface of a mv88e61xx device. On such devices a delay on the RX/TX lines is required, this can either be achieved by adding extra length to the traces on the PCB or by implementing the delay in silicon. This is an implementation of the latter.

---

 drivers/net/phy/Kconfig     |  4 ++++
 drivers/net/phy/mv88e61xx.c | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/net/phy/Kconfig +0 -0
index f5821dfed96d..98cd57eea977 100644
@@ -59,6 +59,10 @@ config MV88E61XX_PHY_PORTS
 config MV88E61XX_FIXED_PORTS
        hex "Bitmask of PHYless serdes Ports"
 
Quoted 6 lines

drivers/net/phy/Kconfig config MV88E61XX_PHY_PORTS · line 64

Quoted 3 lines
drivers/net/phy/Kconfig +3 -0
+config MV88E61XX_RGMII_DELAY
+       bool "Add delay to RGMII outputs"
+       default n

Not sure why you would need this line. default n is implied, no?

I'll remove it in v2.

Quoted 30 lines
Quoted 30 lines
drivers/net/phy/Kconfig +1 -0
+
 endif # MV88E61XX_SWITCH
 
 config PHYLIB_10G
drivers/net/phy/mv88e61xx.c +4 -0
index ea54a1531053..d258ba1ef0f3 100644
@@ -69,6 +69,7 @@
 #define PORT_REG_CTRL                  0x04
 #define PORT_REG_VLAN_MAP              0x06
 #define PORT_REG_VLAN_ID               0x07
+#define PORT_REG_RGMII_TIMING          0x1A
 
 /* Phy registers */
 #define PHY_REG_CTRL1                  0x10
@@ -122,6 +123,9 @@
 #define PORT_REG_VLAN_MAP_TABLE_SHIFT  0
 #define PORT_REG_VLAN_MAP_TABLE_WIDTH  11
 
+#define PORT_REG_RGMII_TIMING_RX_DELAY BIT(10)
+#define PORT_REG_RGMII_TIMING_TX_DELAY BIT(9)
+
 #define SERDES_REG_CTRL_1_FORCE_LINK   BIT(10)
 
 #define PHY_REG_CTRL1_ENERGY_DET_SHIFT 8
@@ -705,6 +709,24 @@ unforce:
        return res;
 }
 
Quoted 7 lines

drivers/net/phy/mv88e61xx.c unforce: · line 714

Quoted 3 lines
drivers/net/phy/mv88e61xx.c +3 -0
+static int mv88e61xx_rgmii_timing_cfg(struct phy_device *phydev)
+{
+#ifdef CONFIG_MV88E61XX_RGMII_DELAY

It seems like this would be more appropriate as a device tree property rather than a board config.

Yes, as would the assignment of ports. It would make sense to follow the dsa bindings used by Linux which would be a fairly significant piece of work.

Quoted 36 lines
Quoted 36 lines
drivers/net/phy/mv88e61xx.c +19 -1
+       int val;
+
+       val = mv88e61xx_port_read(phydev, 6, PORT_REG_RGMII_TIMING);
+       if (val < 0)
+               return val;
+
+       val |= PORT_REG_RGMII_TIMING_RX_DELAY |
+              PORT_REG_RGMII_TIMING_TX_DELAY;
+
+       return mv88e61xx_port_write(phydev, 6, PORT_REG_RGMII_TIMING, val);
+#else
+       return 0;
+#endif
+}
+
 static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 {
        int val;
@@ -774,6 +796,10 @@ static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
                                return val;
                }
        } else {
+               val = mv88e61xx_rgmii_timing_cfg(phydev);
+               if (val < 0)
+                       return val;
+
                val = mv88e61xx_fixed_port_setup(phydev,
                                                 CONFIG_MV88E61XX_CPU_PORT);
                if (val < 0)
--

2.18.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

PATCH 1/2 net: mv88e61xx: add configuration for RGMII delay

Quoted 71 lines · Chris Packham
Quoted 23 lines · Joe Hershberger
Quoted 21 lines · Chris Packham

Some hardware designs connect a CPU MAC directly to the RGMII interface of a mv88e61xx device. On such devices a delay on the RX/TX lines is required, this can either be achieved by adding extra length to the traces on the PCB or by implementing the delay in silicon. This is an implementation of the latter.

---

 drivers/net/phy/Kconfig     |  4 ++++
 drivers/net/phy/mv88e61xx.c | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/net/phy/Kconfig +0 -0
index f5821dfed96d..98cd57eea977 100644
@@ -59,6 +59,10 @@ config MV88E61XX_PHY_PORTS
 config MV88E61XX_FIXED_PORTS
        hex "Bitmask of PHYless serdes Ports"
 
Quoted 6 lines

drivers/net/phy/Kconfig config MV88E61XX_PHY_PORTS · line 64

Quoted 3 lines
drivers/net/phy/Kconfig +3 -0
+config MV88E61XX_RGMII_DELAY
+       bool "Add delay to RGMII outputs"
+       default n

Not sure why you would need this line. default n is implied, no?

I'll remove it in v2.

Quoted 30 lines
Quoted 30 lines
drivers/net/phy/Kconfig +1 -0
+
 endif # MV88E61XX_SWITCH
 
 config PHYLIB_10G
drivers/net/phy/mv88e61xx.c +4 -0
index ea54a1531053..d258ba1ef0f3 100644
@@ -69,6 +69,7 @@
 #define PORT_REG_CTRL                  0x04
 #define PORT_REG_VLAN_MAP              0x06
 #define PORT_REG_VLAN_ID               0x07
+#define PORT_REG_RGMII_TIMING          0x1A
 
 /* Phy registers */
 #define PHY_REG_CTRL1                  0x10
@@ -122,6 +123,9 @@
 #define PORT_REG_VLAN_MAP_TABLE_SHIFT  0
 #define PORT_REG_VLAN_MAP_TABLE_WIDTH  11
 
+#define PORT_REG_RGMII_TIMING_RX_DELAY BIT(10)
+#define PORT_REG_RGMII_TIMING_TX_DELAY BIT(9)
+
 #define SERDES_REG_CTRL_1_FORCE_LINK   BIT(10)
 
 #define PHY_REG_CTRL1_ENERGY_DET_SHIFT 8
@@ -705,6 +709,24 @@ unforce:
        return res;
 }
 
Quoted 7 lines

drivers/net/phy/mv88e61xx.c unforce: · line 714

Quoted 3 lines
drivers/net/phy/mv88e61xx.c +3 -0
+static int mv88e61xx_rgmii_timing_cfg(struct phy_device *phydev)
+{
+#ifdef CONFIG_MV88E61XX_RGMII_DELAY

It seems like this would be more appropriate as a device tree property rather than a board config.

Quoted 3 lines

Yes, as would the assignment of ports. It would make sense to follow the dsa bindings used by Linux which would be a fairly significant piece of work.

By that do you mean too much work?

Quoted 41 lines
Quoted 33 lines
Quoted 33 lines
drivers/net/phy/mv88e61xx.c +19 -1
+       int val;
+
+       val = mv88e61xx_port_read(phydev, 6, PORT_REG_RGMII_TIMING);
+       if (val < 0)
+               return val;
+
+       val |= PORT_REG_RGMII_TIMING_RX_DELAY |
+              PORT_REG_RGMII_TIMING_TX_DELAY;
+
+       return mv88e61xx_port_write(phydev, 6, PORT_REG_RGMII_TIMING, val);
+#else
+       return 0;
+#endif
+}
+
 static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 {
        int val;
@@ -774,6 +796,10 @@ static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
                                return val;
                }
        } else {
+               val = mv88e61xx_rgmii_timing_cfg(phydev);
+               if (val < 0)
+                       return val;
+
                val = mv88e61xx_fixed_port_setup(phydev,
                                                 CONFIG_MV88E61XX_CPU_PORT);
                if (val < 0)
--

2.18.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#5 lore raw

PATCH 1/2 net: mv88e61xx: add configuration for RGMII delay

Quoted 73 lines · Joe Hershberger
Quoted 71 lines · Chris Packham
Quoted 23 lines · Joe Hershberger
Quoted 21 lines · Chris Packham

Some hardware designs connect a CPU MAC directly to the RGMII interface of a mv88e61xx device. On such devices a delay on the RX/TX lines is required, this can either be achieved by adding extra length to the traces on the PCB or by implementing the delay in silicon. This is an implementation of the latter.

---

 drivers/net/phy/Kconfig     |  4 ++++
 drivers/net/phy/mv88e61xx.c | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/net/phy/Kconfig +0 -0
index f5821dfed96d..98cd57eea977 100644
@@ -59,6 +59,10 @@ config MV88E61XX_PHY_PORTS
 config MV88E61XX_FIXED_PORTS
        hex "Bitmask of PHYless serdes Ports"
 
Quoted 6 lines

drivers/net/phy/Kconfig config MV88E61XX_PHY_PORTS · line 64

Quoted 3 lines
drivers/net/phy/Kconfig +3 -0
+config MV88E61XX_RGMII_DELAY
+       bool "Add delay to RGMII outputs"
+       default n

Not sure why you would need this line. default n is implied, no?

I'll remove it in v2.

Quoted 37 lines
Quoted 27 lines
drivers/net/phy/Kconfig +1 -0
+
 endif # MV88E61XX_SWITCH
 
 config PHYLIB_10G
drivers/net/phy/mv88e61xx.c +4 -0
index ea54a1531053..d258ba1ef0f3 100644
@@ -69,6 +69,7 @@
 #define PORT_REG_CTRL                  0x04
 #define PORT_REG_VLAN_MAP              0x06
 #define PORT_REG_VLAN_ID               0x07
+#define PORT_REG_RGMII_TIMING          0x1A
 
 /* Phy registers */
 #define PHY_REG_CTRL1                  0x10
@@ -122,6 +123,9 @@
 #define PORT_REG_VLAN_MAP_TABLE_SHIFT  0
 #define PORT_REG_VLAN_MAP_TABLE_WIDTH  11
 
+#define PORT_REG_RGMII_TIMING_RX_DELAY BIT(10)
+#define PORT_REG_RGMII_TIMING_TX_DELAY BIT(9)
+
 #define SERDES_REG_CTRL_1_FORCE_LINK   BIT(10)
 
 #define PHY_REG_CTRL1_ENERGY_DET_SHIFT 8

drivers/net/phy/mv88e61xx.c unforce: · line 714

Quoted 6 lines
drivers/net/phy/mv88e61xx.c +3 -0
@@ -705,6 +709,24 @@ unforce:
        return res;
 }
 
+static int mv88e61xx_rgmii_timing_cfg(struct phy_device *phydev)
+{
+#ifdef CONFIG_MV88E61XX_RGMII_DELAY

It seems like this would be more appropriate as a device tree property rather than a board config.

Quoted 6 lines
Quoted 3 lines

Yes, as would the assignment of ports. It would make sense to follow the dsa bindings used by Linux which would be a fairly significant piece of work.

By that do you mean too much work?

Certainly more work than I have time for u-boot hacking. I can add it to my "someday" list.

One pre-requisite for the full dsa switch binding would be the mdio bus uclass (added Ken to the Cc list). We could come up with some u-boot specific device tree bindings which would be easier to implement at the cost of the device trees deviating from Linux.

Quoted 41 lines
Quoted 41 lines
Quoted 33 lines
Quoted 33 lines
drivers/net/phy/mv88e61xx.c +19 -1
+       int val;
+
+       val = mv88e61xx_port_read(phydev, 6, PORT_REG_RGMII_TIMING);
+       if (val < 0)
+               return val;
+
+       val |= PORT_REG_RGMII_TIMING_RX_DELAY |
+              PORT_REG_RGMII_TIMING_TX_DELAY;
+
+       return mv88e61xx_port_write(phydev, 6, PORT_REG_RGMII_TIMING, val);
+#else
+       return 0;
+#endif
+}
+
 static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 {
        int val;
@@ -774,6 +796,10 @@ static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
                                return val;
                }
        } else {
+               val = mv88e61xx_rgmii_timing_cfg(phydev);
+               if (val < 0)
+                       return val;
+
                val = mv88e61xx_fixed_port_setup(phydev,
                                                 CONFIG_MV88E61XX_CPU_PORT);
                if (val < 0)
--

2.18.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot