Skip to contentSkip to conversation

DP83TD510 Single Pair 10Mbps Ethernet PHY

PATCH In review Dan Murphy 5 participants 13 messages Nov 17, 2020 – Dec 1, 2020

Subsystems (5)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

v4 cover DP83TD510 Single Pair 10Mbps Ethernet PHY

Hello

The DP83TD510 is an Ethernet PHY supporting single pair of twisted wires. The PHY is capable of 10Mbps communication over long distances and exceeds the IEEE 802.3cg 10BASE-T1L single-pair Ethernet specification. The PHY supports various voltage level signalling and can be forced to support a specific voltage or allowed to perfrom auto negotiation on the voltage level. The default for the PHY is auto negotiation but if the PHY is forced to a specific voltage then the LP must also support the same voltage.

Add the 10BASE-T1L linkmodes for ethtool to properly advertise the PHY's capability.

Dan

Dan Murphy (4):
ethtool: Add 10base-T1L link mode entries
dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY
net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

 .../devicetree/bindings/net/ethernet-phy.yaml |   6 +
 .../devicetree/bindings/net/ti,dp83td510.yaml |  64 +++
 drivers/net/phy/Kconfig                       |   6 +
 drivers/net/phy/Makefile                      |   1 +
 drivers/net/phy/dp83td510.c                   | 505 ++++++++++++++++++
 drivers/net/phy/phy-core.c                    |   4 +-
 include/uapi/linux/ethtool.h                  |   2 +
 net/ethtool/common.c                          |   2 +
 net/ethtool/linkmodes.c                       |   2 +
 9 files changed, 591 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yaml
 create mode 100644 drivers/net/phy/dp83td510.c
Signature · 1 line
2.29.2
author
#1 lore raw

PATCH v4 1/4 ethtool: Add 10base-T1L link mode entries

Add entries for the 10base-T1L full and half duplex supported modes.

$ ethtool eth0
        Supported ports: [ TP ]
        Supported link modes:   10baseT1L/Half 10baseT1L/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT1L/Half 10baseT1L/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 10Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: MII
        PHYAD: 1
        Transceiver: external
        Supports Wake-on: gs
        Wake-on: d
        SecureOn password: 00:00:00:00:00:00
        Current message level: 0x00000000 (0)

Link detected: yes

---
 drivers/net/phy/phy-core.c   | 4 +++-
 include/uapi/linux/ethtool.h | 2 ++
 net/ethtool/common.c         | 2 ++
 net/ethtool/linkmodes.c      | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/phy/phy-core.c +3 -1
index 8d333d3084ed..616fae7f0c86 100644
@@ -13,7 +13,7 @@
  */
 const char *phy_speed_to_str(int speed)
 {
-	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 92,
+	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 94,
 		"Enum ethtool_link_mode_bit_indices and phylib are out of sync. "
 		"If a speed or mode has been added please update phy_speed_to_str "
 		"and the PHY settings array.\n");
@@ -175,6 +175,8 @@ static const struct phy_setting settings[] = {
 	/* 10M */
 	PHY_SETTING(     10, FULL,     10baseT_Full		),
 	PHY_SETTING(     10, HALF,     10baseT_Half		),
+	PHY_SETTING(     10, FULL,     10baseT1L_Full		),
+	PHY_SETTING(     10, HALF,     10baseT1L_Half		),
 };
 #undef PHY_SETTING
 
include/uapi/linux/ethtool.h +2 -0
index 9ca87bc73c44..16b6ea7548d3 100644
@@ -1619,6 +1619,8 @@ enum ethtool_link_mode_bit_indices {
 	ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT	 = 89,
 	ETHTOOL_LINK_MODE_100baseFX_Half_BIT		 = 90,
 	ETHTOOL_LINK_MODE_100baseFX_Full_BIT		 = 91,
+	ETHTOOL_LINK_MODE_10baseT1L_Half_BIT		 = 92,
+	ETHTOOL_LINK_MODE_10baseT1L_Full_BIT		 = 93,
 	/* must be last entry */
 	__ETHTOOL_LINK_MODE_MASK_NBITS
 };
net/ethtool/common.c +2 -0
index 24036e3055a1..95f87febc742 100644
@@ -194,6 +194,8 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {
 	__DEFINE_LINK_MODE_NAME(400000, CR4, Full),
 	__DEFINE_LINK_MODE_NAME(100, FX, Half),
 	__DEFINE_LINK_MODE_NAME(100, FX, Full),
+	__DEFINE_LINK_MODE_NAME(10, T1L, Half),
+	__DEFINE_LINK_MODE_NAME(10, T1L, Full),
 };
 static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
 
net/ethtool/linkmodes.c +2 -0
index c5bcb9abc8b9..a8fab6fb1b30 100644
@@ -264,6 +264,8 @@ static const struct link_mode_info link_mode_params[] = {
 	__DEFINE_LINK_MODE_PARAMS(400000, CR4, Full),
 	__DEFINE_LINK_MODE_PARAMS(100, FX, Half),
 	__DEFINE_LINK_MODE_PARAMS(100, FX, Full),
+	__DEFINE_LINK_MODE_PARAMS(10, T1L, Half),
+	__DEFINE_LINK_MODE_PARAMS(10, T1L, Full),
 };
 
 const struct nla_policy ethnl_linkmodes_set_policy[] = {
Signature · 1 line
2.29.2
author
#2 lore raw

PATCH v4 2/4 dt-bindings: net: Add Rx/Tx output configuration for 10base T1L

In reply to Dan Murphy

Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to drive that output is dependent on the PHY's on board power supply. This common feature is applicable to all 10base T1L PHYs so this binding property belongs in a top level ethernet document.

---
 Documentation/devicetree/bindings/net/ethernet-phy.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +6 -0
index 6dd72faebd89..bda1ce51836b 100644
@@ -174,6 +174,12 @@ properties:
       PHY's that have configurable TX internal delays. If this property is
       present then the PHY applies the TX delay.
 
+  max-tx-rx-p2p-microvolt:
+    description: |
+      Configures the Tx/Rx p2p differential output voltage for 10base-T1L PHYs.
+    enum: [ 1100, 2400 ]
+    default: 2400
+
 required:
   - reg
 
Signature · 1 line
2.29.2
author
#6 lore raw

PATCH v4 3/4 dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY

In reply to Dan Murphy

The DP83TD510 is a 10M single twisted pair Ethernet PHY

---
 .../devicetree/bindings/net/ti,dp83td510.yaml | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yaml
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +64 -0
new file mode 100644
index 000000000000..d3c97bb4d820
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/net/ti,dp83td510.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TI DP83TD510 ethernet PHY
+
+allOf:
+  - $ref: "ethernet-controller.yaml#"
+  - $ref: "ethernet-phy.yaml#"
+
+maintainers:
+  - Dan Murphy <[email protected]>
+
+description: |
+  The PHY is an twisted pair 10Mbps Ethernet PHY that support MII, RMII and
+  RGMII interfaces.
+
+  Specifications about the Ethernet PHY can be found at:
+    http://www.ti.com/lit/ds/symlink/dp83td510e.pdf
+
+properties:
+  reg:
+    maxItems: 1
+
+  tx-fifo-depth:
+    description: |
+       Transmitt FIFO depth for RMII mode.  The PHY only exposes 4 nibble
+       depths. The valid nibble depths are 4, 5, 6 and 8.
+    enum: [ 4, 5, 6, 8 ]
+    default: 5
+
+  rx-internal-delay-ps:
+    description: |
+       Setting this property to a non-zero number sets the RX internal delay
+       for the PHY.  The internal delay for the PHY is fixed to 30ns relative
+       to receive data.
+
+  tx-internal-delay-ps:
+    description: |
+       Setting this property to a non-zero number sets the TX internal delay
+       for the PHY.  The internal delay for the PHY has a range of -4 to 4ns
+       relative to transmit data.
+
+unevaluatedProperties: false
+
+required:
+  - reg
+
+examples:
+  - |
+    mdio0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      ethphy0: ethernet-phy@0 {
+        reg = <0>;
+        tx-rx-output-high;
+        tx-fifo-depth = <5>;
+        rx-internal-delay-ps = <1>;
+        tx-internal-delay-ps = <1>;
+      };
+    };
Signature · 1 line
2.29.2
author
#8 lore raw

PATCH v4 4/4 net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

In reply to Dan Murphy

The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.

The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.

---

v4 - Considerable rework of the code after secondary test setup was created. This version also uses the handle_interrupt call back and reduces the configuration arrays as it was determined that 80% of the array was the same.

 drivers/net/phy/Kconfig     |   6 +
 drivers/net/phy/Makefile    |   1 +
 drivers/net/phy/dp83td510.c | 505 ++++++++++++++++++++++++++++++++++++
 3 files changed, 512 insertions(+)
 create mode 100644 drivers/net/phy/dp83td510.c
drivers/net/phy/Kconfig +6 -0
index 698bea312adc..017252e1504c 100644
@@ -302,6 +302,12 @@ config DP83869_PHY
 	  Currently supports the DP83869 PHY.  This PHY supports copper and
 	  fiber connections.
 
+config DP83TD510_PHY
+	tristate "Texas Instruments DP83TD510 10M Single Pair Ethernet PHY"
+	help
+	  Support for the DP83TD510 Ethernet PHY. This PHY supports a 10M single
+	  pair Ethernet connection.
+
 config VITESSE_PHY
 	tristate "Vitesse PHYs"
 	help
drivers/net/phy/Makefile +1 -0
index a13e402074cf..bf62ce211eb4 100644
@@ -56,6 +56,7 @@ obj-$(CONFIG_DP83848_PHY)	+= dp83848.o
 obj-$(CONFIG_DP83867_PHY)	+= dp83867.o
 obj-$(CONFIG_DP83869_PHY)	+= dp83869.o
 obj-$(CONFIG_DP83TC811_PHY)	+= dp83tc811.o
+obj-$(CONFIG_DP83TD510_PHY)	+= dp83td510.o
 obj-$(CONFIG_FIXED_PHY)		+= fixed_phy.o
 obj-$(CONFIG_ICPLUS_PHY)	+= icplus.o
 obj-$(CONFIG_INTEL_XWAY_PHY)	+= intel-xway.o
drivers/net/phy/dp83td510.c new file +505 -0

505 lines not on this page · raw message

Signature · 1 line
2.29.2
maintainer
#3 lore raw

Re: [PATCH net-next v4 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L

In reply to Dan Murphy
Quoted 2 lines · Dan Murphy

Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to

ability

Quoted 14 lines

drive that output is dependent on the PHY's on board power supply. This common feature is applicable to all 10base T1L PHYs so this binding property belongs in a top level ethernet document.

---
 Documentation/devicetree/bindings/net/ethernet-phy.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
index 6dd72faebd89..bda1ce51836b 100644

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 179

Quoted 6 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +3 -0
@@ -174,6 +174,12 @@ properties:
       PHY's that have configurable TX internal delays. If this property is
       present then the PHY applies the TX delay.
 
+  max-tx-rx-p2p-microvolt:
+    description: |
+      Configures the Tx/Rx p2p differential output voltage for 10base-T1L PHYs.

Does it configure, or does it limit? I _think_ this is a negotiation parameter, so the PHY might decide to do 1100mV if the link peer is near by even when max-tx-rx-p2p-microvolt has the higher value.

Andrew

author
#4 lore raw

Re: [PATCH net-next v4 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L

Andrew

Quoted 4 lines · Andrew Lunn
Quoted 2 lines · Dan Murphy

Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to

ability

Ack

Quoted 18 lines
Quoted 18 lines

drive that output is dependent on the PHY's on board power supply. This common feature is applicable to all 10base T1L PHYs so this binding property belongs in a top level ethernet document.

---
  Documentation/devicetree/bindings/net/ethernet-phy.yaml | 6 ++++++
  1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
index 6dd72faebd89..bda1ce51836b 100644
@@ -174,6 +174,12 @@ properties:
        PHY's that have configurable TX internal delays. If this property is
        present then the PHY applies the TX delay.
 
Quoted 6 lines

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 179

Quoted 3 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +3 -0
+  max-tx-rx-p2p-microvolt:
+    description: |
+      Configures the Tx/Rx p2p differential output voltage for 10base-T1L PHYs.

Does it configure, or does it limit? I _think_ this is a negotiation parameter, so the PHY might decide to do 1100mV if the link peer is near by even when max-tx-rx-p2p-microvolt has the higher value.

For this device we can configure or force it to only work at 1.1v p2p otherwise 2.4 is the default.

But each LP's have to be configured for the same voltage. unless auto negotiation is on then it negotiates the voltage.

Dan

Quoted 2 lines

Andrew

#9 lore raw

Re: [PATCH net-next v4 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

In reply to Dan Murphy
Quoted 21 lines · Dan Murphy

The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.

The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.

---

v4 - Considerable rework of the code after secondary test setup was created. This version also uses the handle_interrupt call back and reduces the configuration arrays as it was determined that 80% of the array was the same.

 drivers/net/phy/Kconfig     |   6 +
 drivers/net/phy/Makefile    |   1 +
 drivers/net/phy/dp83td510.c | 505 ++++++++++++++++++++++++++++++++++++
 3 files changed, 512 insertions(+)
 create mode 100644 drivers/net/phy/dp83td510.c

[snip]

Quoted 17 lines
drivers/net/phy/dp83td510.c new file +17 -0
+static int dp83td510_ack_interrupt(struct phy_device *phydev)
+{
+	int ret;
+
+	ret = phy_read(phydev, DP83TD510_INT_REG1);
+	if (ret < 0)
+		return ret;
+
+	ret = phy_read(phydev, DP83TD510_INT_REG2);
+	if (ret < 0)
+		return ret;
+
+	phy_trigger_machine(phydev);
+
+	return 0;
+}
+

drivers/net/phy/dp83td510.c line 155

Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10 -0
+static irqreturn_t dp83td510_handle_interrupt(struct phy_device *phydev)
+{
+	int ret;
+
+	ret = dp83td510_ack_interrupt(phydev);
+	if (ret)
+		return IRQ_NONE;
+
+	return IRQ_HANDLED;
+}

From what I can see in the datasheet, the INT_REG1 and INT_REG2 are used for both interrupt configuration and interrupt status.

If this is the case, the state machine should only be triggered if the interrupt was triggered (eg DP83TD510_INT1_LINK is set), not if _any_ bit from the register is set. This is broken since anytime you have interrupts enabled, the lower half of the register will be non-zero since that contains you interrupt enabled bits.

The .handle_interrupt() should look something like:

	ret = phy_read(phydev, DP83TD510_INT_REG1);
	if (ret < 0)
		return ret;
	
	if (!(ret & (DP83TD510_INT1_ESD | DP83TD510_INT1_LINK | DP83TD510_INT1_RHF)))
		return IRQ_NONE;

	ret = phy_read(phydev, DP83TD510_INT_REG2);
	if (ret < 0)
		return ret;
	
	if (!(ret & (DP83TD510_INT2_POR | DP83TD510_INT2_POL | DP83TD510_INT2_PAGE)))
		return IRQ_NONE;

	phy_trigger_machine(phydev);

	return IRQ_HANDLED;
Quoted 16 lines
drivers/net/phy/dp83td510.c new file +16 -0
+
+static int dp83td510_config_intr(struct phy_device *phydev)
+{
+	int int_status;
+	int gen_cfg_val;
+	int ret;
+
+	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+		int_status = phy_read(phydev, DP83TD510_INT_REG1);
+		if (int_status < 0)
+			return int_status;
+
+		int_status = (DP83TD510_INT1_ESD_EN | DP83TD510_INT1_LINK_EN |
+			      DP83TD510_INT1_RHF_EN);
+
+		ret = phy_write(phydev, DP83TD510_INT_REG1, int_status);

drivers/net/phy/dp83td510.c line 181

Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10 -0
+		if (ret)
+			return ret;
+
+		int_status = phy_read(phydev, DP83TD510_INT_REG2);
+		if (int_status < 0)
+			return int_status;
+
+		int_status = (DP83TD510_INT2_POR | DP83TD510_INT2_POL |
+				DP83TD510_INT2_PAGE);
+

Shouldn't you use DP83TD510_INT2_POR_EN, DP83TD510_INT2_POL_EN etc here? It seems that you are setting up the bits corresponding with the interrupt status and not the interrupt enable.

Ioana

#10 lore raw

Re: [PATCH net-next v4 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

In reply to Dan Murphy
I love your patch! Yet something to improve:

Hi Dan,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Dan-Murphy/DP83TD510-Single-Pair-10Mbps-Ethernet-PHY/20201118-041918
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 72308ecbf33b145641aba61071be31a85ebfd92c
config: arm-randconfig-m031-20201118 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/ec556cedbd640ecfa25713eadf48e5b7ee74fda3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dan-Murphy/DP83TD510-Single-Pair-10Mbps-Ethernet-PHY/20201118-041918 git checkout ec556cedbd640ecfa25713eadf48e5b7ee74fda3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/net/phy/dp83td510.c: In function 'dp83869_of_init':

>> drivers/net/phy/dp83td510.c:450:2: error: 'dp83td510' undeclared (first use in this function)
     450 |  dp83td510->hi_diff_output = DP83TD510_2_4V_P2P
         |  ^~~~~~~~~
   drivers/net/phy/dp83td510.c:450:2: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/phy/dp83td510.c:451:2: error: expected ';' before 'dp83td510'
     451 |  dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_5_B_NIB
         |  ^~~~~~~~~
   drivers/net/phy/dp83td510.c:453:1: error: no return statement in function returning non-void [-Werror=return-type]
     453 | }
         | ^
   drivers/net/phy/dp83td510.c: In function 'dp83td510_probe':
>> drivers/net/phy/dp83td510.c:468:8: error: implicit declaration of function 'dp83td510_of_init'; did you mean 'dp83td510_config_init'? [-Werror=implicit-function-declaration]
     468 |  ret = dp83td510_of_init(phydev);
         |        ^~~~~~~~~~~~~~~~~
         |        dp83td510_config_init
   At top level:
   drivers/net/phy/dp83td510.c:448:12: warning: 'dp83869_of_init' defined but not used [-Wunused-function]
     448 | static int dp83869_of_init(struct phy_device *phydev)
         |            ^~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/dp83td510 +450 drivers/net/phy/dp83td510.c

390
391 #if IS_ENABLED(CONFIG_OF_MDIO)
392 static int dp83td510_of_init(struct phy_device *phydev)
393 {
394 struct dp83td510_private *dp83td510 = phydev->priv;
395 struct device *dev = &phydev->mdio.dev;
396 struct device_node *of_node = dev->of_node;
397 s32 rx_int_delay;
398 s32 tx_int_delay;
399 int ret;
400
401 if (!of_node)
402 return -ENODEV;
403
404 ret = of_property_read_u32(phydev->mdio.dev.of_node,
405 "max-tx-rx-p2p-microvolt",
406 &dp83td510->hi_diff_output);
407 if (ret)
408 dp83td510->hi_diff_output = DP83TD510_2_4V_P2P;
409
410 if (dp83td510->hi_diff_output != DP83TD510_2_4V_P2P &&
411 dp83td510->hi_diff_output != DP83TD510_1_1V_P2P)
412 return -EINVAL;
413
414 if (of_property_read_u32(phydev->mdio.dev.of_node, "tx-fifo-depth",
415 &dp83td510->tx_fifo_depth))
416 dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_5_B_NIB;
417
418 switch (dp83td510->tx_fifo_depth) {
419 case 4:
420 dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_4_B_NIB;
421 break;
422 case 6:
423 dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_6_B_NIB;
424 break;
425 case 8:
426 dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_8_B_NIB;
427 break;
428 case 5:
429 default:
430 dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_5_B_NIB;
431 }
432
433 rx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, true);
434 if (rx_int_delay <= 0)
435 dp83td510->rgmii_delay = DP83TD510_RX_CLK_SHIFT;
436 else
437 dp83td510->rgmii_delay = 0;
438
439 tx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, false);
440 if (tx_int_delay <= 0)
441 dp83td510->rgmii_delay |= DP83TD510_TX_CLK_SHIFT;
442 else
443 dp83td510->rgmii_delay &= ~DP83TD510_TX_CLK_SHIFT;
444
445 return 0;
446 }
447 #else
448 static int dp83869_of_init(struct phy_device *phydev)
449 {

 > 450		dp83td510->hi_diff_output = DP83TD510_2_4V_P2P
 > 451		dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_5_B_NIB
   452		return 0;
   453	}
   454	#endif /* CONFIG_OF_MDIO */
   455	
   456	static int dp83td510_probe(struct phy_device *phydev)
   457	{
   458		struct dp83td510_private *dp83td510;
   459		int ret;
   460	
   461		dp83td510 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83td510),
   462					 GFP_KERNEL);
   463		if (!dp83td510)
   464			return -ENOMEM;
   465	
   466		phydev->priv = dp83td510;
   467	
 > 468		ret = dp83td510_of_init(phydev);

469 if (ret)
470 return ret;
471
472 return dp83td510_config_init(phydev);
473 }
474

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#11 lore raw

Re: [PATCH net-next v4 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

In reply to Dan Murphy

drivers/net/phy/dp83td510.c line 361

Quoted 11 lines
drivers/net/phy/dp83td510.c new file +10 -0
+static int dp83td510_config_init(struct phy_device *phydev)
+{
+	struct dp83td510_private *dp83td510 = phydev->priv;
+	int ret = 0;
+
+	if (phy_interface_is_rgmii(phydev)) {
 
+		if (dp83td510->rgmii_delay) {
+			ret = phy_set_bits_mmd(phydev, DP83TD510_DEVADDR,
+					       DP83TD510_MAC_CFG_1,
+					       dp83td510->rgmii_delay);

Just to be safe, you should always write rgmii_delay, even if it is zero. We have had too many bugs with RGMII delays which cause bad backwards compatibility problems, so i would prefer to do a write which might be unneeded, that find a bug here in a few years time.

drivers/net/phy/dp83td510.c line 370

Quoted 9 lines
drivers/net/phy/dp83td510.c new file +9 -0
+			if (ret)
+				return ret;
+		}
+	}
+
+	if (phydev->interface == PHY_INTERFACE_MODE_RMII) {
+		ret = phy_modify(phydev, DP83TD510_GEN_CFG,
+				 DP83TD510_FIFO_DEPTH_MASK,
+				 dp83td510->tx_fifo_depth);

So there is no need to set the FIFO depth for the other three RGMII modes? Or should this also be phy_interface_is_rgmii(phydev)?

drivers/net/phy/dp83td510.c line 396

Quoted 6 lines
drivers/net/phy/dp83td510.c new file +6 -0
+#if IS_ENABLED(CONFIG_OF_MDIO)
+static int dp83td510_of_init(struct phy_device *phydev)
+{
+	struct dp83td510_private *dp83td510 = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	struct device_node *of_node = dev->of_node;

You need to move this assignment to later in order to keep with reverse christmas tree.

drivers/net/phy/dp83td510.c line 451

Quoted 5 lines
drivers/net/phy/dp83td510.c new file +5 -0
+#else
+static int dp83869_of_init(struct phy_device *phydev)
+{
+	dp83td510->hi_diff_output = DP83TD510_2_4V_P2P
+	dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_5_B_NIB

You don't have DT, so there is no fine control, but you still need to do the basic 2ns delay as indicated by the phydev->interface value. So i think you still need to set dp83td510->rgmii_delay depending on which RGMII mode is requested.

Andrew

author
#12 lore raw

Re: [PATCH net-next v4 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

Andrew

Quoted 6 lines · Andrew Lunn
Quoted 6 lines
drivers/net/phy/dp83td510.c new file +6 -0
+static int dp83td510_config_init(struct phy_device *phydev)
+{
+	struct dp83td510_private *dp83td510 = phydev->priv;
+	int ret = 0;
+
+	if (phy_interface_is_rgmii(phydev)) {
Quoted 8 lines

drivers/net/phy/dp83td510.c line 361

Quoted 4 lines
drivers/net/phy/dp83td510.c new file +4 -0
+		if (dp83td510->rgmii_delay) {
+			ret = phy_set_bits_mmd(phydev, DP83TD510_DEVADDR,
+					       DP83TD510_MAC_CFG_1,
+					       dp83td510->rgmii_delay);

Just to be safe, you should always write rgmii_delay, even if it is zero. We have had too many bugs with RGMII delays which cause bad backwards compatibility problems, so i would prefer to do a write which might be unneeded, that find a bug here in a few years time.

OK.

Quoted 12 lines

drivers/net/phy/dp83td510.c line 370

Quoted 10 lines
drivers/net/phy/dp83td510.c new file +9 -0
+			if (ret)
+				return ret;
+		}
+	}
+
+	if (phydev->interface == PHY_INTERFACE_MODE_RMII) {
+		ret = phy_modify(phydev, DP83TD510_GEN_CFG,
+				 DP83TD510_FIFO_DEPTH_MASK,
+				 dp83td510->tx_fifo_depth);

So there is no need to set the FIFO depth for the other three RGMII modes? Or should this also be phy_interface_is_rgmii(phydev)?

According to the data sheet the FIFO depth is for RMII.

"Fifo depth for RMII Tx fifo"

But I will ask the HW team for clarification.

Quoted 9 lines

drivers/net/phy/dp83td510.c line 396

Quoted 7 lines
drivers/net/phy/dp83td510.c new file +6 -0
+#if IS_ENABLED(CONFIG_OF_MDIO)
+static int dp83td510_of_init(struct phy_device *phydev)
+{
+	struct dp83td510_private *dp83td510 = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	struct device_node *of_node = dev->of_node;

You need to move this assignment to later in order to keep with reverse christmas tree.

Well this is only used once so I will just remove the of_node declaration

Quoted 10 lines

drivers/net/phy/dp83td510.c line 451

Quoted 6 lines
drivers/net/phy/dp83td510.c new file +5 -0
+#else
+static int dp83869_of_init(struct phy_device *phydev)
+{
+	dp83td510->hi_diff_output = DP83TD510_2_4V_P2P
+	dp83td510->tx_fifo_depth = DP83TD510_FIFO_DEPTH_5_B_NIB

You don't have DT, so there is no fine control, but you still need to do the basic 2ns delay as indicated by the phydev->interface value. So i think you still need to set dp83td510->rgmii_delay depending on which RGMII mode is requested.

The RGMII delay is fixed in the PHY.  The user can either turn it on or off. The default is 'off' which is 0.

I can explicitly set the rgmii_delay to 0 in non-OF cases.

Dan

maintainer
#5 lore raw

Re: [PATCH net-next v4 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L

In reply to Dan Murphy
Quoted 2 lines · Dan Murphy

Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to

1.1V?

Quoted 14 lines

drive that output is dependent on the PHY's on board power supply. This common feature is applicable to all 10base T1L PHYs so this binding property belongs in a top level ethernet document.

---
 Documentation/devicetree/bindings/net/ethernet-phy.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
index 6dd72faebd89..bda1ce51836b 100644

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 178

Quoted 5 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +2 -0
@@ -174,6 +174,12 @@ properties:
       PHY's that have configurable TX internal delays. If this property is
       present then the PHY applies the TX delay.
 
+  max-tx-rx-p2p-microvolt:
+    description: |

Don't need '|' if no formatting.

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 181

Quoted 3 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +3 -0
+      Configures the Tx/Rx p2p differential output voltage for 10base-T1L PHYs.
+    enum: [ 1100, 2400 ]
+    default: 2400

Aren't you off by 1000?

Quoted 7 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +1 -0
+
 required:
   - reg
 
Signature · 1 line
2.29.2
maintainer
#7 lore raw

Re: [PATCH net-next v4 3/4] dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY

In reply to Dan Murphy
Quoted 43 lines · Dan Murphy

The DP83TD510 is a 10M single twisted pair Ethernet PHY

---
 .../devicetree/bindings/net/ti,dp83td510.yaml | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yaml
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +29 -0
new file mode 100644
index 000000000000..d3c97bb4d820
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/net/ti,dp83td510.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TI DP83TD510 ethernet PHY
+
+allOf:
+  - $ref: "ethernet-controller.yaml#"
+  - $ref: "ethernet-phy.yaml#"
+
+maintainers:
+  - Dan Murphy <[email protected]>
+
+description: |
+  The PHY is an twisted pair 10Mbps Ethernet PHY that support MII, RMII and
+  RGMII interfaces.
+
+  Specifications about the Ethernet PHY can be found at:
+    http://www.ti.com/lit/ds/symlink/dp83td510e.pdf
+
+properties:
+  reg:
+    maxItems: 1
+
+  tx-fifo-depth:
+    description: |

Documentation/devicetree/bindings/net/ti,dp83td510.yaml line 39

Quoted 10 lines
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +10 -0
+       Transmitt FIFO depth for RMII mode.  The PHY only exposes 4 nibble
+       depths. The valid nibble depths are 4, 5, 6 and 8.
+    enum: [ 4, 5, 6, 8 ]
+    default: 5
+
+  rx-internal-delay-ps:
+    description: |
+       Setting this property to a non-zero number sets the RX internal delay
+       for the PHY.  The internal delay for the PHY is fixed to 30ns relative
+       to receive data.

I'm confused. The delay is 30ns +/- whatever is set here?

Documentation/devicetree/bindings/net/ti,dp83td510.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +6 -0
+
+  tx-internal-delay-ps:
+    description: |
+       Setting this property to a non-zero number sets the TX internal delay
+       for the PHY.  The internal delay for the PHY has a range of -4 to 4ns
+       relative to transmit data.

Sounds like constraints?

We do have a problem handling negative values though. Addressing in dtc was rejected, so we'll need to fixup the schema with unsigned values. But here it should just be negative values.

Quoted 22 lines
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +19 -0
+
+unevaluatedProperties: false
+
+required:
+  - reg
+
+examples:
+  - |
+    mdio0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      ethphy0: ethernet-phy@0 {
+        reg = <0>;
+        tx-rx-output-high;
+        tx-fifo-depth = <5>;
+        rx-internal-delay-ps = <1>;
+        tx-internal-delay-ps = <1>;
+      };
+    };
Signature · 1 line
2.29.2