All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC v2 00/02] ravb: Duplex handling update V2
@ 2018-08-20 14:59 Magnus Damm
  2018-08-20 14:59 ` [PATCH/RFC v2 01/02] ravb: Do not announce HDX as supported Magnus Damm
  2018-08-20 14:59 ` [PATCH/RFC v2 02/02] ravb: Clean up duplex handling Magnus Damm
  0 siblings, 2 replies; 4+ messages in thread
From: Magnus Damm @ 2018-08-20 14:59 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

ravb: Duplex handling update V2

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

This series is V2 of prototype-level code to update the Ethernet-AVB
driver to improve duplex handling.

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 V1:
- Updated patches to reflect input from Sergei and Geert - thanks!

Getting closer to be suitable for upstream merge?

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 Written on top of next-20180820

 drivers/net/ethernet/renesas/ravb.h      |    1 -
 drivers/net/ethernet/renesas/ravb_main.c |   24 ++++--------------------
 2 files changed, 4 insertions(+), 21 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH/RFC v2 01/02] ravb: Do not announce HDX as supported
  2018-08-20 14:59 [PATCH/RFC v2 00/02] ravb: Duplex handling update V2 Magnus Damm
@ 2018-08-20 14:59 ` Magnus Damm
  2018-08-20 14:59 ` [PATCH/RFC v2 02/02] ravb: Clean up duplex handling Magnus Damm
  1 sibling, 0 replies; 4+ messages in thread
From: Magnus Damm @ 2018-08-20 14:59 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

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.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---

 Written on top of next-20180820

 drivers/net/ethernet/renesas/ravb_main.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- 0001/drivers/net/ethernet/renesas/ravb_main.c
+++ work/drivers/net/ethernet/renesas/ravb_main.c	2018-08-20 23:42:46.670859449 +0900
@@ -1076,8 +1076,9 @@ static int ravb_phy_init(struct net_devi
 		netdev_info(ndev, "limited PHY to 100Mbit/s\n");
 	}
 
-	/* 10BASE is not supported */
-	phydev->supported &= ~PHY_10BT_FEATURES;
+	/* Neither 10BASE nor half duplex are supported */
+	phydev->supported &= ~(PHY_10BT_FEATURES | SUPPORTED_100baseT_Half |
+			       SUPPORTED_1000baseT_Half);
 
 	phy_attached_info(phydev);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH/RFC v2 02/02] ravb: Clean up duplex handling
  2018-08-20 14:59 [PATCH/RFC v2 00/02] ravb: Duplex handling update V2 Magnus Damm
  2018-08-20 14:59 ` [PATCH/RFC v2 01/02] ravb: Do not announce HDX as supported Magnus Damm
@ 2018-08-20 14:59 ` Magnus Damm
  2018-08-20 15:30   ` Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Magnus Damm @ 2018-08-20 14:59 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

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."

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
---

 Written on top of next-20180820

 drivers/net/ethernet/renesas/ravb.h      |    1 -
 drivers/net/ethernet/renesas/ravb_main.c |   19 +------------------
 2 files changed, 1 insertion(+), 19 deletions(-)

--- 0001/drivers/net/ethernet/renesas/ravb.h
+++ work/drivers/net/ethernet/renesas/ravb.h	2018-08-20 23:45:02.203442052 +0900
@@ -1027,7 +1027,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];
--- 0002/drivers/net/ethernet/renesas/ravb_main.c
+++ work/drivers/net/ethernet/renesas/ravb_main.c	2018-08-20 23:48:17.840945347 +0900
@@ -85,13 +85,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);
@@ -401,13 +394,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);
 
@@ -989,12 +980,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;
@@ -1009,7 +994,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 */
@@ -1039,7 +1023,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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC v2 02/02] ravb: Clean up duplex handling
  2018-08-20 14:59 ` [PATCH/RFC v2 02/02] ravb: Clean up duplex handling Magnus Damm
@ 2018-08-20 15:30   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2018-08-20 15:30 UTC (permalink / raw)
  To: Magnus Damm, linux-renesas-soc

On 08/20/2018 05:59 PM, Magnus Damm wrote:

> From: Magnus Damm <damm+renesas@opensource.se>
> 
> 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."
> 
> Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")

  Fixes: tag should precede sign-off.

[...]

   You missed to add this from the previous review:

Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

   The net.git repo is always open, so you can post these patches to netdev
already...

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-20 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 14:59 [PATCH/RFC v2 00/02] ravb: Duplex handling update V2 Magnus Damm
2018-08-20 14:59 ` [PATCH/RFC v2 01/02] ravb: Do not announce HDX as supported Magnus Damm
2018-08-20 14:59 ` [PATCH/RFC v2 02/02] ravb: Clean up duplex handling Magnus Damm
2018-08-20 15:30   ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.