Skip to contentSkip to conversation

ravb: Duplex handling update V3

PATCH In review Magnus Damm 2 participants 4 messages Nov 21, 2018 – Nov 24, 2018

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

v3 cover ravb: Duplex handling update V3

ravb: Duplex handling update V3

[PATCH v3 01/02] ravb: Do not announce HDX as supported [PATCH v3 02/02] ravb: Clean up duplex handling

This series is V3 of duplex handling improvements for the Ethernet-AVB driver.

Previous versions of this series have been posted to linux-renesas-soc as RFC so V3 is the first actual version to make it to netdev.

Based on the latest data sheet for R-Car Gen3 [1] and R-Car Gen2 [2] the following information is part of the EthernetAVB-IF overview page:

Transfer speed: Supports transfer at 100 and 1000 Mbps
Mode: Full-duplex mode

It seems that the driver implementation is not matching the information provided in the friendly data sheet, and on top of this during run-time when changing PHY configuration of the link partner the Ethernet-AVB PHY seems to want to announce unsupported modes.

[1] R-Car Series, 3rd Generation Rev.1.00 (Apr 2018)
[2] R-Car Series, 2nd Generation Rev.2.00 (Feb 2016)

Changes since V2:
- Updated patch 1/2 to make use of phy_remove_link_mode()
- Added Reviewed-by from Sergei - thanks!

Changes since V1:
- Updated patches to reflect input from Sergei and Geert - thanks!

Fixes c156633f1353 ("Renesas Ethernet AVB driver proper")

---

Applies on top of next-20181121

 drivers/net/ethernet/renesas/ravb.h      |    1 -
 drivers/net/ethernet/renesas/ravb_main.c |   23 +++++------------------
 2 files changed, 5 insertions(+), 19 deletions(-)
#1 lore raw

PATCH v3 1/2 ravb: Do not announce HDX as supported

From: Magnus Damm <[email protected]>

According to the data sheet the Ethernet-AVB hardware in R-Car Gen3 and R-Car Gen2 SoCs do not support half duplex operation. So update the driver to mark 100Mbit and 1Gbps HDX as unsupported.

Fixes c156633f1353 ("Renesas Ethernet AVB driver proper")

---

Slightly reworked since V2 to make use of phy_remove_link_mode(). In case Sergei wants to opt-out from the Reviewed-by tag for V2 let us know.

Applies on top of next-20181121

 drivers/net/ethernet/renesas/ravb_main.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/renesas/ravb_main.c +4 -0
@@ -1088,6 +1088,10 @@ static int ravb_phy_init(struct net_devi
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Pause_BIT);
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT);
 
+	/* Half Duplex is not supported */
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
+
 	phy_attached_info(phydev);
 
 	return 0;
#2 lore raw

PATCH v3 2/2 ravb: Clean up duplex handling

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Since only full-duplex operation is supported by the hardware, remove duplex handling code and keep the register setting of ECMR.DM fixed at 1.

This updates the driver implementation to follow the data sheet text "This bit should always be set to 1."

Fixes c156633f1353 ("Renesas Ethernet AVB driver proper")

---

Applies on top of next-20181121

 drivers/net/ethernet/renesas/ravb.h      |    1 -
 drivers/net/ethernet/renesas/ravb_main.c |   19 +------------------
 2 files changed, 1 insertion(+), 19 deletions(-)
drivers/net/ethernet/renesas/ravb.h +0 -1
@@ -1032,7 +1032,6 @@ struct ravb_private {
 	phy_interface_t phy_interface;
 	int msg_enable;
 	int speed;
-	int duplex;
 	int emac_irq;
 	enum ravb_chip_id chip_id;
 	int rx_irqs[NUM_RX_QUEUE];
drivers/net/ethernet/renesas/ravb_main.c +1 -18
@@ -82,13 +82,6 @@ static int ravb_config(struct net_device
 	return error;
 }
 
-static void ravb_set_duplex(struct net_device *ndev)
-{
-	struct ravb_private *priv = netdev_priv(ndev);
-
-	ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex ? ECMR_DM : 0);
-}
-
 static void ravb_set_rate(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -406,13 +399,11 @@ error:
 /* E-MAC init function */
 static void ravb_emac_init(struct net_device *ndev)
 {
-	struct ravb_private *priv = netdev_priv(ndev);
-
 	/* Receive frame limit set register */
 	ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
 
 	/* EMAC Mode: PAUSE prohibition; Duplex; RX Checksum; TX; RX */
-	ravb_write(ndev, ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) |
+	ravb_write(ndev, ECMR_ZPF | ECMR_DM |
 		   (ndev->features & NETIF_F_RXCSUM ? ECMR_RCSC : 0) |
 		   ECMR_TE | ECMR_RE, ECMR);
 
@@ -995,12 +986,6 @@ static void ravb_adjust_link(struct net_
 		ravb_rcv_snd_disable(ndev);
 
 	if (phydev->link) {
-		if (phydev->duplex != priv->duplex) {
-			new_state = true;
-			priv->duplex = phydev->duplex;
-			ravb_set_duplex(ndev);
-		}
-
 		if (phydev->speed != priv->speed) {
 			new_state = true;
 			priv->speed = phydev->speed;
@@ -1015,7 +1000,6 @@ static void ravb_adjust_link(struct net_
 		new_state = true;
 		priv->link = 0;
 		priv->speed = 0;
-		priv->duplex = -1;
 	}
 
 	/* Enable TX and RX right over here, if E-MAC change is ignored */
@@ -1045,7 +1029,6 @@ static int ravb_phy_init(struct net_devi
 
 	priv->link = 0;
 	priv->speed = 0;
-	priv->duplex = -1;
 
 	/* Try connecting to PHY */
 	pn = of_parse_phandle(np, "phy-handle", 0);
maintainer
#3 lore raw
In reply to Magnus Damm

From: Magnus Damm <[email protected]>
Date: Wed, 21 Nov 2018 20:21:08 +0900

Quoted 4 lines

ravb: Duplex handling update V3

[PATCH v3 01/02] ravb: Do not announce HDX as supported [PATCH v3 02/02] ravb: Clean up duplex handling

Series applied to net-next.