[RFC/PATCH 00/18] Add Gigabit Ethernet driver support

STALE1762d

Revision rfc of 6 in this series.

79 messages, 4 authors, 2021-10-04 · open the first message on its own page

[RFC/PATCH 00/18] Add Gigabit Ethernet driver support

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:21

The DMAC and EMAC blocks of Gigabit Ethernet IP found on RZ/G2L SoC are
similar to the R-Car Ethernet AVB IP.

The Gigabit Ethernet IP consists of Ethernet controller (E-MAC), Internal
TCP/IP Offload Engine (TOE)  and Dedicated Direct memory access controller
(DMAC).

With a few changes in the driver we can support both IPs.

This patch series aims to add Gigabit ethernet driver support to RZ/G2L SoC.

Please provide your valuable comments.

Ref:-
 * https://lore.kernel.org/linux-renesas-soc/TYCPR01MB59334319695607A2683C1A5E86E59@TYCPR01MB5933.jpnprd01.prod.outlook.com/T/#t


Biju Das (18):
  ravb: Rename "ravb_set_features_rx_csum" function to
    "ravb_set_features_rcar"
  ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"
  ravb: Initialize GbEthernet dmac
  ravb: Enable aligned_tx and tx_counters for RZ/G2L
  ravb: Exclude gPTP feature support for RZ/G2L
  ravb: Add multi_tsrq to struct ravb_hw_info
  ravb: Add magic_pkt to struct ravb_hw_info
  ravb: Add mii_rgmii_selection to struct ravb_hw_info
  ravb: Add half_duplex to struct ravb_hw_info
  ravb: Initialize GbEthernet E-MAC
  ravb: Add rx_2k_buffers to struct ravb_hw_info
  ravb: Add timestamp to struct ravb_hw_info
  ravb: Add rx_ring_free function support for GbEthernet
  ravb: Add rx_ring_format function for GbEthernet
  ravb: Add rx_alloc helper function for GbEthernet
  ravb: Add Packet receive function for Gigabit Ethernet
  ravb: Add carrier_counters to struct ravb_hw_info
  ravb: Add set_feature support for RZ/G2L

 drivers/net/ethernet/renesas/ravb.h      |  91 +++-
 drivers/net/ethernet/renesas/ravb_main.c | 631 ++++++++++++++++++++---
 2 files changed, 630 insertions(+), 92 deletions(-)

-- 
2.17.1

[RFC/PATCH 01/18] ravb: Rename "ravb_set_features_rx_csum" function to "ravb_set_features_rcar"

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:24

Rename "ravb_set_features_rx_csum" function to "ravb_set_features_rcar" and
replace the function pointer "set_rx_csum_feature" with "set_feature".

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Suggested-by: Sergey Shtylyov <redacted>
---
 drivers/net/ethernet/renesas/ravb.h      |  2 +-
 drivers/net/ethernet/renesas/ravb_main.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 47c5377e4f42..7363abae6e59 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -985,7 +985,7 @@ struct ravb_hw_info {
 	void *(*alloc_rx_desc)(struct net_device *ndev, int q);
 	bool (*receive)(struct net_device *ndev, int *quota, int q);
 	void (*set_rate)(struct net_device *ndev);
-	int (*set_rx_csum_feature)(struct net_device *ndev, netdev_features_t features);
+	int (*set_feature)(struct net_device *ndev, netdev_features_t features);
 	void (*dmac_init)(struct net_device *ndev);
 	void (*emac_init)(struct net_device *ndev);
 	const char (*gstrings_stats)[ETH_GSTRING_LEN];
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 0f85f2d97b18..8f2358caef34 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1918,8 +1918,8 @@ static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-static int ravb_set_features_rx_csum(struct net_device *ndev,
-				     netdev_features_t features)
+static int ravb_set_features_rcar(struct net_device *ndev,
+				  netdev_features_t features)
 {
 	netdev_features_t changed = ndev->features ^ features;
 
@@ -1937,7 +1937,7 @@ static int ravb_set_features(struct net_device *ndev,
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
 
-	return info->set_rx_csum_feature(ndev, features);
+	return info->set_feature(ndev, features);
 }
 
 static const struct net_device_ops ravb_netdev_ops = {
@@ -2006,7 +2006,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.alloc_rx_desc = ravb_alloc_rx_desc,
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
-	.set_rx_csum_feature = ravb_set_features_rx_csum,
+	.set_feature = ravb_set_features_rcar,
 	.dmac_init = ravb_rcar_dmac_init,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
@@ -2027,7 +2027,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.alloc_rx_desc = ravb_alloc_rx_desc,
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
-	.set_rx_csum_feature = ravb_set_features_rx_csum,
+	.set_feature = ravb_set_features_rcar,
 	.dmac_init = ravb_rcar_dmac_init,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
-- 
2.17.1

Re: [RFC/PATCH 01/18] ravb: Rename "ravb_set_features_rx_csum" function to "ravb_set_features_rcar"

From: Sergey Shtylyov <hidden>
Date: 2021-09-27 19:54:35

On 9/23/21 5:07 PM, Biju Das wrote:
Rename "ravb_set_features_rx_csum" function to "ravb_set_features_rcar" and
replace the function pointer "set_rx_csum_feature" with "set_feature".

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Suggested-by: Sergey Shtylyov <redacted>
Reviewed-by: Sergey Shtylyov <redacted>

MBR, Sergey

[RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:28

Rename the variable "no_ptp_cfg_active" with "no_gptp" with inverted
checks and "ptp_cfg_active" with "ccc_gac".

There is no functional change.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Suggested-by: Sergey Shtylyov <redacted>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++--
 drivers/net/ethernet/renesas/ravb_main.c | 25 ++++++++++++------------
 2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7363abae6e59..0ce0c13ef8cb 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1000,8 +1000,8 @@ struct ravb_hw_info {
 	unsigned internal_delay:1;	/* AVB-DMAC has internal delays */
 	unsigned tx_counters:1;		/* E-MAC has TX counters */
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
-	unsigned no_ptp_cfg_active:1;	/* AVB-DMAC does not support gPTP active in config mode */
-	unsigned ptp_cfg_active:1;	/* AVB-DMAC has gPTP support active in config mode */
+	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP feature */
+	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 8f2358caef34..2422e74d9b4f 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1274,7 +1274,7 @@ static int ravb_set_ringparam(struct net_device *ndev,
 	if (netif_running(ndev)) {
 		netif_device_detach(ndev);
 		/* Stop PTP Clock driver */
-		if (info->no_ptp_cfg_active)
+		if (!info->no_gptp && !info->ccc_gac)
 			ravb_ptp_stop(ndev);
 		/* Wait for DMA stopping */
 		error = ravb_stop_dma(ndev);
@@ -1306,7 +1306,7 @@ static int ravb_set_ringparam(struct net_device *ndev,
 		ravb_emac_init(ndev);
 
 		/* Initialise PTP Clock driver */
-		if (info->no_ptp_cfg_active)
+		if (!info->no_gptp && !info->ccc_gac)
 			ravb_ptp_init(ndev, priv->pdev);
 
 		netif_device_attach(ndev);
@@ -1446,7 +1446,7 @@ static int ravb_open(struct net_device *ndev)
 	ravb_emac_init(ndev);
 
 	/* Initialise PTP Clock driver */
-	if (info->no_ptp_cfg_active)
+	if (!info->no_gptp && !info->ccc_gac)
 		ravb_ptp_init(ndev, priv->pdev);
 
 	netif_tx_start_all_queues(ndev);
@@ -1460,7 +1460,7 @@ static int ravb_open(struct net_device *ndev)
 
 out_ptp_stop:
 	/* Stop PTP Clock driver */
-	if (info->no_ptp_cfg_active)
+	if (!info->no_gptp && !info->ccc_gac)
 		ravb_ptp_stop(ndev);
 out_free_irq_nc_tx:
 	if (!info->multi_irqs)
@@ -1508,7 +1508,7 @@ static void ravb_tx_timeout_work(struct work_struct *work)
 	netif_tx_stop_all_queues(ndev);
 
 	/* Stop PTP Clock driver */
-	if (info->no_ptp_cfg_active)
+	if (!info->no_gptp && !info->ccc_gac)
 		ravb_ptp_stop(ndev);
 
 	/* Wait for DMA stopping */
@@ -1543,7 +1543,7 @@ static void ravb_tx_timeout_work(struct work_struct *work)
 
 out:
 	/* Initialise PTP Clock driver */
-	if (info->no_ptp_cfg_active)
+	if (!info->no_gptp && !info->ccc_gac)
 		ravb_ptp_init(ndev, priv->pdev);
 
 	netif_tx_start_all_queues(ndev);
@@ -1752,7 +1752,7 @@ static int ravb_close(struct net_device *ndev)
 	ravb_write(ndev, 0, TIC);
 
 	/* Stop PTP Clock driver */
-	if (info->no_ptp_cfg_active)
+	if (!info->no_gptp && !info->ccc_gac)
 		ravb_ptp_stop(ndev);
 
 	/* Set the config mode to stop the AVB-DMAC's processes */
@@ -2018,7 +2018,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.internal_delay = 1,
 	.tx_counters = 1,
 	.multi_irqs = 1,
-	.ptp_cfg_active = 1,
+	.ccc_gac = 1,
 };
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
@@ -2037,7 +2037,6 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
 	.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
 	.aligned_tx = 1,
-	.no_ptp_cfg_active = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
@@ -2080,7 +2079,7 @@ static void ravb_set_config_mode(struct net_device *ndev)
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
 
-	if (info->no_ptp_cfg_active) {
+	if (!info->no_gptp && !info->ccc_gac) {
 		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
 		/* Set CSEL value */
 		ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
@@ -2301,7 +2300,7 @@ static int ravb_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&priv->ts_skb_list);
 
 	/* Initialise PTP Clock driver */
-	if (info->ptp_cfg_active)
+	if (info->ccc_gac)
 		ravb_ptp_init(ndev, pdev);
 
 	/* Debug message level */
@@ -2349,7 +2348,7 @@ static int ravb_probe(struct platform_device *pdev)
 			  priv->desc_bat_dma);
 
 	/* Stop PTP Clock driver */
-	if (info->ptp_cfg_active)
+	if (info->ccc_gac)
 		ravb_ptp_stop(ndev);
 out_disable_refclk:
 	clk_disable_unprepare(priv->refclk);
@@ -2369,7 +2368,7 @@ static int ravb_remove(struct platform_device *pdev)
 	const struct ravb_hw_info *info = priv->info;
 
 	/* Stop PTP Clock driver */
-	if (info->ptp_cfg_active)
+	if (info->ccc_gac)
 		ravb_ptp_stop(ndev);
 
 	clk_disable_unprepare(priv->refclk);
-- 
2.17.1

Re: [RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 16:07:45

On 9/23/21 5:07 PM, Biju Das wrote:
Rename the variable "no_ptp_cfg_active" with "no_gptp" with inverted
checks and "ptp_cfg_active" with "ccc_gac".
   That's not exactly rename, no? At least for the 1st case...
quoted hunk
There is no functional change.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Suggested-by: Sergey Shtylyov <redacted>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++--
 drivers/net/ethernet/renesas/ravb_main.c | 25 ++++++++++++------------
 2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7363abae6e59..0ce0c13ef8cb 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1000,8 +1000,8 @@ struct ravb_hw_info {
 	unsigned internal_delay:1;	/* AVB-DMAC has internal delays */
 	unsigned tx_counters:1;		/* E-MAC has TX counters */
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
-	unsigned no_ptp_cfg_active:1;	/* AVB-DMAC does not support gPTP active in config mode */
-	unsigned ptp_cfg_active:1;	/* AVB-DMAC has gPTP support active in config mode */
+	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP feature */
   Judging on the flag usage (which ensues using logical not in every case), I'd suggest to
invert this flag and call it 'gptp'...

[...]

MBR, Sergey

RE: [RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 16:35:49

Hi Sergei,

Thanks for the feedback.
-----Original Message-----
Subject: Re: [RFC/PATCH 02/18] ravb: Rename the variables
"no_ptp_cfg_active" and "ptp_cfg_active"

On 9/23/21 5:07 PM, Biju Das wrote:
quoted
Rename the variable "no_ptp_cfg_active" with "no_gptp" with inverted
checks and "ptp_cfg_active" with "ccc_gac".
   That's not exactly rename, no? At least for the 1st case...
This is what we agreed as per last discussion[1]. 

https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210825070154.14336-5-biju.das.jz@bp.renesas.com/

quoted
There is no functional change.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Suggested-by: Sergey Shtylyov <redacted>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++--
 drivers/net/ethernet/renesas/ravb_main.c | 25
++++++++++++------------
 2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index 7363abae6e59..0ce0c13ef8cb 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1000,8 +1000,8 @@ struct ravb_hw_info {
 	unsigned internal_delay:1;	/* AVB-DMAC has internal delays */
 	unsigned tx_counters:1;		/* E-MAC has TX counters */
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple
irqs */
quoted
-	unsigned no_ptp_cfg_active:1;	/* AVB-DMAC does not support gPTP
active in config mode */
quoted
-	unsigned ptp_cfg_active:1;	/* AVB-DMAC has gPTP support active in
config mode */
quoted
+	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP
feature */

   Judging on the flag usage (which ensues using logical not in every
case), I'd suggest to invert this flag and call it 'gptp'...
We have the following cases 
Case 1) On R-Car Gen3, gPTP support is active in config mode.
Case 2) On R-Car Gen2, gPTP support is not active in config mode.
Case 3) RZ/G2L does not support the gPTP feature.

And I came up with patches [1] and [2]. Then as per discussion we agreed for gPTP support active in config(ccc_gac) which take care of Case 1, no_gptp which take care of case 3 
And the cases not under 1 and 3 falls to 2.

[1]
https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210825070154.14336-4-biju.das.jz@bp.renesas.com/
[2]
https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210825070154.14336-5-biju.das.jz@bp.renesas.com/

So please clear on your proposals to accomodate the 3 use cases as mentioned below.

Case 1) On R-Car Gen3, gPTP support is active in config mode.
Case 2) On R-Car Gen2, gPTP support is not active in config mode.
Case 3) RZ/G2L does not support the gPTP feature.

Regards,
Biju





[...]

MBR, Sergey

Re: [RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 17:57:58

On 9/23/21 7:35 PM, Biju Das wrote:

[...]
quoted
quoted
Rename the variable "no_ptp_cfg_active" with "no_gptp" with inverted
checks and "ptp_cfg_active" with "ccc_gac".
   That's not exactly rename, no? At least for the 1st case...
This is what we agreed as per last discussion[1]. 

https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210825070154.14336-5-biju.das.jz@bp.renesas.com/
   Sorry, I've changed my mind about 'no_gpgp' after seeing all the checks. I'd like to avoiud the double negations
in those checks -- this should make the code more clear. My 1st idea (just 'gp[tp') turned out to be more practical,
sorry about this going back-and-forth. :-<

[...]

MBR, Sergey

RE: [RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 18:20:51

Hi Sergei,
Subject: Re: [RFC/PATCH 02/18] ravb: Rename the variables
"no_ptp_cfg_active" and "ptp_cfg_active"

On 9/23/21 7:35 PM, Biju Das wrote:

[...]
quoted
quoted
quoted
Rename the variable "no_ptp_cfg_active" with "no_gptp" with inverted
checks and "ptp_cfg_active" with "ccc_gac".
   That's not exactly rename, no? At least for the 1st case...
This is what we agreed as per last discussion[1].

https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
hwork.kernel.org%2Fproject%2Flinux-renesas-soc%2Fpatch%2F2021082507015
4.14336-5-biju.das.jz%40bp.renesas.com%2F&amp;data=04%7C01%7Cbiju.das.
jz%40bp.renesas.com%7Cec41661b87e14f9e810808d97ebbae07%7C53d82571da194
7e49cb4625a166a4a2a%7C0%7C0%7C637680166814248680%7CUnknown%7CTWFpbGZsb
3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
7C1000&amp;sdata=ze0ica0K57exFOSQ9LyMuQ%2FFimvOW4PtH8ETxYJ8o6Y%3D&amp;
reserved=0
   Sorry, I've changed my mind about 'no_gpgp' after seeing all the
checks. I'd like to avoiud the double negations in those checks -- this
should make the code more clear. My 1st idea (just 'gp[tp') turned out to
be more practical, sorry about this going back-and-forth. :-<
So Just to confirm the name to be used are "ccc_gac" and "gptp".

Case 1) On R-Car Gen3, gPTP support is active in config mode. (replace "ptp_cfg_active" with "ccc_gac")
Case 2) On R-Car Gen2, gPTP support is not active in config mode ( replace "no_ptp_cfg_active" with "gptp")
Case 3) RZ/G2L does not support the gPTP feature(if "no_gac" or "gptp" then it falls to case 3).

Regards,
Biju

RE: [RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active"

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 13:34:30

Hi Sergei,
Subject: RE: [RFC/PATCH 02/18] ravb: Rename the variables
"no_ptp_cfg_active" and "ptp_cfg_active"

Hi Sergei,
quoted
Subject: Re: [RFC/PATCH 02/18] ravb: Rename the variables
"no_ptp_cfg_active" and "ptp_cfg_active"

On 9/23/21 7:35 PM, Biju Das wrote:

[...]
quoted
quoted
quoted
Rename the variable "no_ptp_cfg_active" with "no_gptp" with
inverted checks and "ptp_cfg_active" with "ccc_gac".
   That's not exactly rename, no? At least for the 1st case...
This is what we agreed as per last discussion[1].

https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpa
tc
hwork.kernel.org%2Fproject%2Flinux-renesas-soc%2Fpatch%2F20210825070
15
4.14336-5-biju.das.jz%40bp.renesas.com%2F&amp;data=04%7C01%7Cbiju.das.
jz%40bp.renesas.com%7Cec41661b87e14f9e810808d97ebbae07%7C53d82571da1
94
7e49cb4625a166a4a2a%7C0%7C0%7C637680166814248680%7CUnknown%7CTWFpbGZ
sb
3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3
D%
7C1000&amp;sdata=ze0ica0K57exFOSQ9LyMuQ%2FFimvOW4PtH8ETxYJ8o6Y%3D&am
p;
reserved=0
   Sorry, I've changed my mind about 'no_gpgp' after seeing all the
checks. I'd like to avoiud the double negations in those checks --
this should make the code more clear. My 1st idea (just 'gp[tp')
turned out to be more practical, sorry about this going
back-and-forth. :-<
So Just to confirm the name to be used are "ccc_gac" and "gptp".

Case 1) On R-Car Gen3, gPTP support is active in config mode. (replace
"ptp_cfg_active" with "ccc_gac") Case 2) On R-Car Gen2, gPTP support is
not active in config mode ( replace "no_ptp_cfg_active" with "gptp") Case
3) RZ/G2L does not support the gPTP feature(if "no_gac" or "gptp" then it
falls to case 3).
As per the above discussion, I have prepared a new patch.

Regards,
Biju

[RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:31

Initialize GbEthernet dmac found on RZ/G2L SoC.
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar
to be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84 +++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 0ce0c13ef8cb..bee05e6fb815 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -81,6 +81,7 @@ enum ravb_reg {
 	RQC3	= 0x00A0,
 	RQC4	= 0x00A4,
 	RPC	= 0x00B0,
+	RTC	= 0x00B4,	/* RZ/G2L only */
 	UFCW	= 0x00BC,
 	UFCS	= 0x00C0,
 	UFCV0	= 0x00C4,
@@ -156,6 +157,7 @@ enum ravb_reg {
 	TIS	= 0x037C,
 	ISS	= 0x0380,
 	CIE	= 0x0384,	/* R-Car Gen3 only */
+	RIC3	= 0x0388,	/* RZ/G2L only */
 	GCCR	= 0x0390,
 	GMTT	= 0x0394,
 	GPTC	= 0x0398,
@@ -956,6 +958,8 @@ enum RAVB_QUEUE {
 
 #define RX_BUF_SZ	(2048 - ETH_FCS_LEN + sizeof(__sum16))
 
+#define RGETH_RX_BUFF_MAX 8192
+
 struct ravb_tstamp_skb {
 	struct list_head list;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }
 
+static void ravb_rgeth_set_rate(struct net_device *ndev)
+{
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -217,6 +222,11 @@ static int ravb_tx_free(struct net_device *ndev, int q, bool free_txed_only)
 	return free_num;
 }
 
+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -283,6 +293,11 @@ static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }
 
+static void ravb_rx_ring_format_rgeth(struct net_device *ndev, int q)
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -356,6 +371,12 @@ static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }
 
+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev, int q)
+{
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -426,6 +447,11 @@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }
 
+static void ravb_rgeth_emac_init(struct net_device *ndev)
+{
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)
 {
 	/* Receive frame limit set register */
@@ -461,7 +487,32 @@ static void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }
 
-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev)
+{
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
+
+	ravb_write(ndev, TIC_FTE0, TIC);
+}
+
+static void ravb_dmac_init_rcar(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
@@ -579,6 +630,14 @@ static void ravb_rx_csum(struct sk_buff *skb)
 	skb_trim(skb, skb->len - sizeof(__sum16));
 }
 
+/* Packet receive function for Gigabit Ethernet */
+static bool ravb_rgeth_rx(struct net_device *ndev, int *quota, int q)
+{
+	/* Place holder */
+	return true;
+}
+
+/* Packet receive function for Ethernet AVB */
 static bool ravb_rcar_rx(struct net_device *ndev, int *quota, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -1918,6 +1977,13 @@ static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
+static int ravb_set_features_rgeth(struct net_device *ndev,
+				   netdev_features_t features)
+{
+	/* Place holder */
+	return 0;
+}
+
 static int ravb_set_features_rcar(struct net_device *ndev,
 				  netdev_features_t features)
 {
@@ -2007,7 +2073,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
 	.set_feature = ravb_set_features_rcar,
-	.dmac_init = ravb_rcar_dmac_init,
+	.dmac_init = ravb_dmac_init_rcar,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
@@ -2028,7 +2094,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
 	.set_feature = ravb_set_features_rcar,
-	.dmac_init = ravb_rcar_dmac_init,
+	.dmac_init = ravb_dmac_init_rcar,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
@@ -2039,12 +2105,24 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.aligned_tx = 1,
 };
 
+static const struct ravb_hw_info rgeth_hw_info = {
+	.rx_ring_free = ravb_rx_ring_free_rgeth,
+	.rx_ring_format = ravb_rx_ring_format_rgeth,
+	.alloc_rx_desc = ravb_rgeth_alloc_rx_desc,
+	.receive = ravb_rgeth_rx,
+	.set_rate = ravb_rgeth_set_rate,
+	.set_feature = ravb_set_features_rgeth,
+	.dmac_init = ravb_dmac_init_rgeth,
+	.emac_init = ravb_rgeth_emac_init,
+};
+
 static const struct of_device_id ravb_match_table[] = {
 	{ .compatible = "renesas,etheravb-r8a7790", .data = &ravb_gen2_hw_info },
 	{ .compatible = "renesas,etheravb-r8a7794", .data = &ravb_gen2_hw_info },
 	{ .compatible = "renesas,etheravb-rcar-gen2", .data = &ravb_gen2_hw_info },
 	{ .compatible = "renesas,etheravb-r8a7795", .data = &ravb_gen3_hw_info },
 	{ .compatible = "renesas,etheravb-rcar-gen3", .data = &ravb_gen3_hw_info },
+	{ .compatible = "renesas,rzg2l-gbeth", .data = &rgeth_hw_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ravb_match_table);
-- 
2.17.1

Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 17:41:13

On 9/23/21 5:07 PM, Biju Das wrote:
Initialize GbEthernet dmac found on RZ/G2L SoC.
   DMAC (or AVB-DMAC).
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar
to be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84 +++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
[...]
quoted hunk
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }
 
+static void ravb_rgeth_set_rate(struct net_device *ndev)
   What does 'rgeth' stand for? And why not the trailing part of the name, like the other cases? 
quoted hunk
+{
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -217,6 +222,11 @@ static int ravb_tx_free(struct net_device *ndev, int q, bool free_txed_only)
 	return free_num;
 }
 
+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
   rgeth?
quoted hunk
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -283,6 +293,11 @@ static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }
 
+static void ravb_rx_ring_format_rgeth(struct net_device *ndev, int q)
   rgeth?
quoted hunk
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -356,6 +371,12 @@ static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }
 
+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev, int q)
   Again, why rgeth is not in the symbol's tail?
quoted hunk
+{
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -426,6 +447,11 @@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }
 
+static void ravb_rgeth_emac_init(struct net_device *ndev)
   Same here...
quoted hunk
+{
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)
 {
 	/* Receive frame limit set register */
@@ -461,7 +487,32 @@ static void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }
 
-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev)
+{
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
+
+	ravb_write(ndev, TIC_FTE0, TIC);
+}
   Ah, so 'rgeth' stands for GbEthernet... why not 'gbeth' then?

[...]
quoted hunk
@@ -579,6 +630,14 @@ static void ravb_rx_csum(struct sk_buff *skb)
 	skb_trim(skb, skb->len - sizeof(__sum16));
 }
 
+/* Packet receive function for Gigabit Ethernet */
+static bool ravb_rgeth_rx(struct net_device *ndev, int *quota, int q)
+{
+	/* Place holder */
+	return true;
+}
+
+/* Packet receive function for Ethernet AVB */
 static bool ravb_rcar_rx(struct net_device *ndev, int *quota, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -1918,6 +1977,13 @@ static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
+static int ravb_set_features_rgeth(struct net_device *ndev,
+				   netdev_features_t features)
+{
+	/* Place holder */
+	return 0;
+}
+
 static int ravb_set_features_rcar(struct net_device *ndev,
 				  netdev_features_t features)
 {
@@ -2007,7 +2073,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
 	.set_feature = ravb_set_features_rcar,
-	.dmac_init = ravb_rcar_dmac_init,
+	.dmac_init = ravb_dmac_init_rcar,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
@@ -2028,7 +2094,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
 	.set_feature = ravb_set_features_rcar,
-	.dmac_init = ravb_rcar_dmac_init,
+	.dmac_init = ravb_dmac_init_rcar,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
@@ -2039,12 +2105,24 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.aligned_tx = 1,
 };
 
+static const struct ravb_hw_info rgeth_hw_info = {
+	.rx_ring_free = ravb_rx_ring_free_rgeth,
+	.rx_ring_format = ravb_rx_ring_format_rgeth,
+	.alloc_rx_desc = ravb_rgeth_alloc_rx_desc,
+	.receive = ravb_rgeth_rx,
+	.set_rate = ravb_rgeth_set_rate,
+	.set_feature = ravb_set_features_rgeth,
+	.dmac_init = ravb_dmac_init_rgeth,
+	.emac_init = ravb_rgeth_emac_init,
+};
+>  static const struct of_device_id ravb_match_table[] = {
 	{ .compatible = "renesas,etheravb-r8a7790", .data = &ravb_gen2_hw_info },
 	{ .compatible = "renesas,etheravb-r8a7794", .data = &ravb_gen2_hw_info },
 	{ .compatible = "renesas,etheravb-rcar-gen2", .data = &ravb_gen2_hw_info },
 	{ .compatible = "renesas,etheravb-r8a7795", .data = &ravb_gen3_hw_info },
 	{ .compatible = "renesas,etheravb-rcar-gen3", .data = &ravb_gen3_hw_info },
+	{ .compatible = "renesas,rzg2l-gbeth", .data = &rgeth_hw_info },
    Mhm, I thought this parch should come lst of the series, without any placeholders...

[...]

MBR, Sergey

RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 18:42:06

Hi Sergei,
Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

On 9/23/21 5:07 PM, Biju Das wrote:
quoted
Initialize GbEthernet dmac found on RZ/G2L SoC.
   DMAC (or AVB-DMAC).
OK will change it to DMAC. AVB-DMAC is not applicable for GbEthernet.
quoted
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar to
be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84
+++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }

+static void ravb_rgeth_set_rate(struct net_device *ndev)
   What does 'rgeth' stand for? And why not the trailing part of the name,
like the other cases?
'rgeth' stands for Renesas Gigabit Ethernet like 'ravb' renesas AVB.
OK it can be moved to trailing part.
quoted
+{
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -217,6 +222,11 @@
static int ravb_tx_free(struct net_device *ndev, int q, bool
free_txed_only)
quoted
 	return free_num;
 }

+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
   rgeth? 
Are you ok with this function name right? Since based on previous comment
to trailing part.
quoted
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -283,6 +293,11 @@
static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }

+static void ravb_rx_ring_format_rgeth(struct net_device *ndev, int q)
   rgeth?
Are you ok with this function name right? Since based on previous comment
to trailing part.
quoted
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -356,6 +371,12 @@
static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }

+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev, int q)
   Again, why rgeth is not in the symbol's tail?
Ok will move to the tail.
quoted
+{
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -426,6 +447,11 @@
static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }

+static void ravb_rgeth_emac_init(struct net_device *ndev)
   Same here...
OK will move to the tail.
quoted
+{
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)  {
 	/* Receive frame limit set register */ @@ -461,7 +487,32 @@ static
void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }

-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev) {
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
+
+	ravb_write(ndev, TIC_FTE0, TIC);
+}
   Ah, so 'rgeth' stands for GbEthernet... why not 'gbeth' then?
'rgeth" is Renesas Gigabit ethernet. If needed I can change it to 'gbeth' if there is no 
Objection from others.
[...]
quoted
@@ -579,6 +630,14 @@ static void ravb_rx_csum(struct sk_buff *skb)
 	skb_trim(skb, skb->len - sizeof(__sum16));  }

+/* Packet receive function for Gigabit Ethernet */ static bool
+ravb_rgeth_rx(struct net_device *ndev, int *quota, int q) {
+	/* Place holder */
+	return true;
+}
+
+/* Packet receive function for Ethernet AVB */
 static bool ravb_rcar_rx(struct net_device *ndev, int *quota, int q)
{
 	struct ravb_private *priv = netdev_priv(ndev); @@ -1918,6 +1977,13
@@ static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
 	spin_unlock_irqrestore(&priv->lock, flags);  }

+static int ravb_set_features_rgeth(struct net_device *ndev,
+				   netdev_features_t features)
+{
+	/* Place holder */
+	return 0;
+}
+
 static int ravb_set_features_rcar(struct net_device *ndev,
 				  netdev_features_t features)
 {
@@ -2007,7 +2073,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info
= {
quoted
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
 	.set_feature = ravb_set_features_rcar,
-	.dmac_init = ravb_rcar_dmac_init,
+	.dmac_init = ravb_dmac_init_rcar,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats), @@ -2028,7 +2094,7 @@
static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
 	.set_feature = ravb_set_features_rcar,
-	.dmac_init = ravb_rcar_dmac_init,
+	.dmac_init = ravb_dmac_init_rcar,
 	.emac_init = ravb_rcar_emac_init,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats), @@ -2039,12 +2105,24
@@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.aligned_tx = 1,
 };

+static const struct ravb_hw_info rgeth_hw_info = {
+	.rx_ring_free = ravb_rx_ring_free_rgeth,
+	.rx_ring_format = ravb_rx_ring_format_rgeth,
+	.alloc_rx_desc = ravb_rgeth_alloc_rx_desc,
+	.receive = ravb_rgeth_rx,
+	.set_rate = ravb_rgeth_set_rate,
+	.set_feature = ravb_set_features_rgeth,
+	.dmac_init = ravb_dmac_init_rgeth,
+	.emac_init = ravb_rgeth_emac_init,
+};
+>  static const struct of_device_id ravb_match_table[] = {
 	{ .compatible = "renesas,etheravb-r8a7790", .data =
&ravb_gen2_hw_info },
quoted
 	{ .compatible = "renesas,etheravb-r8a7794", .data =
&ravb_gen2_hw_info },
quoted
 	{ .compatible = "renesas,etheravb-rcar-gen2", .data =
&ravb_gen2_hw_info },
quoted
 	{ .compatible = "renesas,etheravb-r8a7795", .data =
&ravb_gen3_hw_info },
quoted
 	{ .compatible = "renesas,etheravb-rcar-gen3", .data =
&ravb_gen3_hw_info },
+	{ .compatible = "renesas,rzg2l-gbeth", .data = &rgeth_hw_info },
    Mhm, I thought this parch should come lst of the series, without any
placeholders...
It is OK. 

Like you commented on https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210923140813.13541-5-biju.das.jz@bp.renesas.com/, why there is a patch required for this feature bits?

Cheers,
Biju
[...]

MBR, Sergey

Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 19:07:29

On 9/23/21 5:07 PM, Biju Das wrote:
quoted hunk
Initialize GbEthernet dmac found on RZ/G2L SoC.
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar
to be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84 +++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 0ce0c13ef8cb..bee05e6fb815 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -81,6 +81,7 @@ enum ravb_reg {
 	RQC3	= 0x00A0,
 	RQC4	= 0x00A4,
 	RPC	= 0x00B0,
+	RTC	= 0x00B4,	/* RZ/G2L only */
   My gen3 manual says the regiuster exists there...
quoted hunk
 	UFCW	= 0x00BC,
 	UFCS	= 0x00C0,
 	UFCV0	= 0x00C4,
@@ -156,6 +157,7 @@ enum ravb_reg {
 	TIS	= 0x037C,
 	ISS	= 0x0380,
 	CIE	= 0x0384,	/* R-Car Gen3 only */
+	RIC3	= 0x0388,	/* RZ/G2L only */
   Again, this register (along with RIS3) exists on gen3...
quoted hunk
 	GCCR	= 0x0390,
 	GMTT	= 0x0394,
 	GPTC	= 0x0398,
@@ -956,6 +958,8 @@ enum RAVB_QUEUE {
 
 #define RX_BUF_SZ	(2048 - ETH_FCS_LEN + sizeof(__sum16))
 
+#define RGETH_RX_BUFF_MAX 8192
+
 struct ravb_tstamp_skb {
 	struct list_head list;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }
 
+static void ravb_rgeth_set_rate(struct net_device *ndev)
+{
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -217,6 +222,11 @@ static int ravb_tx_free(struct net_device *ndev, int q, bool free_txed_only)
 	return free_num;
 }
 
+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -283,6 +293,11 @@ static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }
 
+static void ravb_rx_ring_format_rgeth(struct net_device *ndev, int q)
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -356,6 +371,12 @@ static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }
 
+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev, int q)
+{
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -426,6 +447,11 @@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }
 
+static void ravb_rgeth_emac_init(struct net_device *ndev)
+{
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)
 {
 	/* Receive frame limit set register */
@@ -461,7 +487,32 @@ static void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }
 
-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev)
+{
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
   Should be init'ed on gen3 as well?
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
   Should be init'ed on gen3 as well? Matter of a separate patch, I can do it prolly...

[...]

MBR, Sergey

RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 19:23:05

HI Sergei,
Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

On 9/23/21 5:07 PM, Biju Das wrote:
quoted
Initialize GbEthernet dmac found on RZ/G2L SoC.
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar to
be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84
+++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index 0ce0c13ef8cb..bee05e6fb815 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -81,6 +81,7 @@ enum ravb_reg {
 	RQC3	= 0x00A0,
 	RQC4	= 0x00A4,
 	RPC	= 0x00B0,
+	RTC	= 0x00B4,	/* RZ/G2L only */
   My gen3 manual says the regiuster exists there...
quoted
 	UFCW	= 0x00BC,
 	UFCS	= 0x00C0,
 	UFCV0	= 0x00C4,
@@ -156,6 +157,7 @@ enum ravb_reg {
 	TIS	= 0x037C,
 	ISS	= 0x0380,
 	CIE	= 0x0384,	/* R-Car Gen3 only */
+	RIC3	= 0x0388,	/* RZ/G2L only */
   Again, this register (along with RIS3) exists on gen3...
quoted
 	GCCR	= 0x0390,
 	GMTT	= 0x0394,
 	GPTC	= 0x0398,
@@ -956,6 +958,8 @@ enum RAVB_QUEUE {

 #define RX_BUF_SZ	(2048 - ETH_FCS_LEN + sizeof(__sum16))

+#define RGETH_RX_BUFF_MAX 8192
+
 struct ravb_tstamp_skb {
 	struct list_head list;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }

+static void ravb_rgeth_set_rate(struct net_device *ndev) {
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -217,6 +222,11 @@
static int ravb_tx_free(struct net_device *ndev, int q, bool
free_txed_only)
quoted
 	return free_num;
 }

+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q) {
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -283,6 +293,11 @@
static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }

+static void ravb_rx_ring_format_rgeth(struct net_device *ndev, int q)
+{
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -356,6 +371,12 @@
static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }

+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev, int q)
+{
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -426,6 +447,11 @@
static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }

+static void ravb_rgeth_emac_init(struct net_device *ndev) {
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)  {
 	/* Receive frame limit set register */ @@ -461,7 +487,32 @@ static
void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }

-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev) {
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
   Should be init'ed on gen3 as well?
Rcar gen3 has separate initialization routine, This part is RZ/G2L specific, the buffer size is different.
quoted
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
   Should be init'ed on gen3 as well? Matter of a separate patch, I can do
it prolly...
OK. May be after completing RZ/G2L, I can investigate on gen3 stuff or If you have R-Car board and confirm this change 
Won't break anything on R-Car gen3, you can submit the patch.

Regards,
Biju

[...]

MBR, Sergey

RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 19:29:08

Hi Sergey,
Subject: RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

HI Sergei,
quoted
Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

On 9/23/21 5:07 PM, Biju Das wrote:
quoted
Initialize GbEthernet dmac found on RZ/G2L SoC.
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar
to be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84
+++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index 0ce0c13ef8cb..bee05e6fb815 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -81,6 +81,7 @@ enum ravb_reg {
 	RQC3	= 0x00A0,
 	RQC4	= 0x00A4,
 	RPC	= 0x00B0,
+	RTC	= 0x00B4,	/* RZ/G2L only */
   My gen3 manual says the regiuster exists there...
The existing driver is not using it. Since manual says there is RTC, I will document for Gen3 as well.
quoted
quoted
 	UFCW	= 0x00BC,
 	UFCS	= 0x00C0,
 	UFCV0	= 0x00C4,
@@ -156,6 +157,7 @@ enum ravb_reg {
 	TIS	= 0x037C,
 	ISS	= 0x0380,
 	CIE	= 0x0384,	/* R-Car Gen3 only */
+	RIC3	= 0x0388,	/* RZ/G2L only */
   Again, this register (along with RIS3) exists on gen3...
RIS3 is not used by R-Car or RZ/G2L hence it not documented.
But RIC3 is used by RZ/G2L. As per gen3 hw manual it is present, so I will update the comment.
quoted
quoted
 	GCCR	= 0x0390,
 	GMTT	= 0x0394,
 	GPTC	= 0x0398,
@@ -956,6 +958,8 @@ enum RAVB_QUEUE {

 #define RX_BUF_SZ	(2048 - ETH_FCS_LEN + sizeof(__sum16))

+#define RGETH_RX_BUFF_MAX 8192
+
 struct ravb_tstamp_skb {
 	struct list_head list;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }

+static void ravb_rgeth_set_rate(struct net_device *ndev) {
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -217,6 +222,11
@@ static int ravb_tx_free(struct net_device *ndev, int q, bool
free_txed_only)
quoted
 	return free_num;
 }

+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q) {
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -283,6 +293,11
@@ static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }

+static void ravb_rx_ring_format_rgeth(struct net_device *ndev, int
+q) {
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -356,6 +371,12
@@ static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }

+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev, int
+q) {
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -426,6 +447,11
@@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }

+static void ravb_rgeth_emac_init(struct net_device *ndev) {
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)  {
 	/* Receive frame limit set register */ @@ -461,7 +487,32 @@ static
void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }

-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev) {
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
   Should be init'ed on gen3 as well?
Rcar gen3 has separate initialization routine, This part is RZ/G2L
specific, the buffer size is different.
quoted
quoted
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
   Should be init'ed on gen3 as well? Matter of a separate patch, I
can do it prolly...
OK. May be after completing RZ/G2L, I can investigate on gen3 stuff or If
you have R-Car board and confirm this change Won't break anything on R-Car
gen3, you can submit the patch.

Regards,
Biju

quoted
[...]

MBR, Sergey

RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 13:38:14

Hi Sergei,
Subject: RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

Hi Sergey,
quoted
Subject: RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

HI Sergei,
quoted
Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac

On 9/23/21 5:07 PM, Biju Das wrote:
quoted
Initialize GbEthernet dmac found on RZ/G2L SoC.
This patch also renames ravb_rcar_dmac_init to ravb_dmac_init_rcar
to be consistent with the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  4 ++
 drivers/net/ethernet/renesas/ravb_main.c | 84
+++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index 0ce0c13ef8cb..bee05e6fb815 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -81,6 +81,7 @@ enum ravb_reg {
 	RQC3	= 0x00A0,
 	RQC4	= 0x00A4,
 	RPC	= 0x00B0,
+	RTC	= 0x00B4,	/* RZ/G2L only */
   My gen3 manual says the regiuster exists there...
The existing driver is not using it. Since manual says there is RTC, I
will document for Gen3 as well.
quoted
quoted
quoted
 	UFCW	= 0x00BC,
 	UFCS	= 0x00C0,
 	UFCV0	= 0x00C4,
@@ -156,6 +157,7 @@ enum ravb_reg {
 	TIS	= 0x037C,
 	ISS	= 0x0380,
 	CIE	= 0x0384,	/* R-Car Gen3 only */
+	RIC3	= 0x0388,	/* RZ/G2L only */
   Again, this register (along with RIS3) exists on gen3...
RIS3 is not used by R-Car or RZ/G2L hence it not documented.
But RIC3 is used by RZ/G2L. As per gen3 hw manual it is present, so I will
update the comment.
I am dropping RIC3 for RZ/G2L as default value  is 0 and code is initializing with 0
Which is not needed.
quoted
quoted
quoted
 	GCCR	= 0x0390,
 	GMTT	= 0x0394,
 	GPTC	= 0x0398,
@@ -956,6 +958,8 @@ enum RAVB_QUEUE {

 #define RX_BUF_SZ	(2048 - ETH_FCS_LEN + sizeof(__sum16))

+#define RGETH_RX_BUFF_MAX 8192
+
 struct ravb_tstamp_skb {
 	struct list_head list;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 2422e74d9b4f..54c4d31a6950 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,6 +83,11 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }

+static void ravb_rgeth_set_rate(struct net_device *ndev) {
+	/* Place holder */
+}
+
 static void ravb_set_rate(struct net_device *ndev)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -217,6
+222,11
quoted
quoted
quoted
@@ static int ravb_tx_free(struct net_device *ndev, int q, bool
free_txed_only)
quoted
 	return free_num;
 }

+static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
{
quoted
quoted
quoted
+	/* Place holder */
+}
+
 static void ravb_rx_ring_free(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -283,6
+293,11
quoted
quoted
quoted
@@ static void ravb_ring_free(struct net_device *ndev, int q)
 	priv->tx_skb[q] = NULL;
 }

+static void ravb_rx_ring_format_rgeth(struct net_device *ndev,
+int
+q) {
+	/* Place holder */
+}
+
 static void ravb_rx_ring_format(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -356,6
+371,12
quoted
quoted
quoted
@@ static void ravb_ring_format(struct net_device *ndev, int q)
 	desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
 }

+static void *ravb_rgeth_alloc_rx_desc(struct net_device *ndev,
+int
+q) {
+	/* Place holder */
+	return NULL;
+}
+
 static void *ravb_alloc_rx_desc(struct net_device *ndev, int q)  {
 	struct ravb_private *priv = netdev_priv(ndev); @@ -426,6
+447,11
quoted
quoted
quoted
@@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }

+static void ravb_rgeth_emac_init(struct net_device *ndev) {
+	/* Place holder */
+}
+
 static void ravb_rcar_emac_init(struct net_device *ndev)  {
 	/* Receive frame limit set register */ @@ -461,7 +487,32 @@
static void ravb_emac_init(struct net_device *ndev)
 	info->emac_init(ndev);
 }

-static void ravb_rcar_dmac_init(struct net_device *ndev)
+static void ravb_dmac_init_rgeth(struct net_device *ndev) {
+	/* Set AVB RX */
+	ravb_write(ndev, 0x60000000, RCR);
+
+	/* Set Max Frame Length (RTC) */
+	ravb_write(ndev, 0x7ffc0000 | RGETH_RX_BUFF_MAX, RTC);
   Should be init'ed on gen3 as well?
Rcar gen3 has separate initialization routine, This part is RZ/G2L
specific, the buffer size is different.
quoted
quoted
+
+	/* Set FIFO size */
+	ravb_write(ndev, 0x00222200, TGC);
+
+	ravb_write(ndev, 0, TCCR);
+
+	/* Frame receive */
+	ravb_write(ndev, RIC0_FRE0, RIC0);
+	/* Disable FIFO full warning */
+	ravb_write(ndev, 0x0, RIC1);
+	/* Receive FIFO full error, descriptor empty */
+	ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
+
+	ravb_write(ndev, 0x0, RIC3);
   Should be init'ed on gen3 as well? Matter of a separate patch, I
can do it prolly...
OK. May be after completing RZ/G2L, I can investigate on gen3 stuff or
If you have R-Car board and confirm this change Won't break anything
on R-Car gen3, you can submit the patch.
As mentioned above I am dropping this initialization for RIC3, as per H/W manual
Reset value of RIC3 is 0.

Regards,
Biju

[RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:35

RZ/G2L need 4byte address alignment like R-Car Gen2 and
it has tx_counters like R-Car Gen3. This patch enable
these features for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bee05e6fb815..bb92469d770e 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -195,7 +195,7 @@ enum ravb_reg {
 	GECMR	= 0x05b0,
 	MAHR	= 0x05c0,
 	MALR	= 0x05c8,
-	TROCR	= 0x0700,	/* R-Car Gen3 only */
+	TROCR	= 0x0700,	/* R-Car Gen3 and RZ/G2L only */
 	CEFCR	= 0x0740,
 	FRECR	= 0x0748,
 	TSFRCR	= 0x0750,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 54c4d31a6950..d38fc33a8e93 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2114,6 +2114,8 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.set_feature = ravb_set_features_rgeth,
 	.dmac_init = ravb_dmac_init_rgeth,
 	.emac_init = ravb_rgeth_emac_init,
+	.aligned_tx = 1,
+	.tx_counters = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
-- 
2.17.1

Re: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for RZ/G2L

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 18:06:03

On 9/23/21 5:07 PM, Biju Das wrote:

   Somehow this patch haven't reached my OMP email -- I got it only thru
 the linux-renesas-soc list... :-/
quoted hunk
RZ/G2L need 4byte address alignment like R-Car Gen2 and
it has tx_counters like R-Car Gen3. This patch enable
these features for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bee05e6fb815..bb92469d770e 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -195,7 +195,7 @@ enum ravb_reg {
 	GECMR	= 0x05b0,
 	MAHR	= 0x05c0,
 	MALR	= 0x05c8,
-	TROCR	= 0x0700,	/* R-Car Gen3 only */
+	TROCR	= 0x0700,	/* R-Car Gen3 and RZ/G2L only */
 	CEFCR	= 0x0740,
 	FRECR	= 0x0748,
 	TSFRCR	= 0x0750,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 54c4d31a6950..d38fc33a8e93 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2114,6 +2114,8 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.set_feature = ravb_set_features_rgeth,
 	.dmac_init = ravb_dmac_init_rgeth,
 	.emac_init = ravb_rgeth_emac_init,
+	.aligned_tx = 1,
+	.tx_counters = 1,
   Mhm, I don't see a connection between those 2 (other than they're both for RX). And anyway, this prolly
should be a part of the previous patch...

[...]

MBR, Sergey

Re: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for RZ/G2L

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 18:10:42

On 9/23/21 9:05 PM, Sergey Shtylyov wrote:
   Somehow this patch haven't reached my OMP email -- I got it only thru
 the linux-renesas-soc list... :-/
quoted
RZ/G2L need 4byte address alignment like R-Car Gen2 and
it has tx_counters like R-Car Gen3. This patch enable
these features for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 54c4d31a6950..d38fc33a8e93 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2114,6 +2114,8 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.set_feature = ravb_set_features_rgeth,
 	.dmac_init = ravb_dmac_init_rgeth,
 	.emac_init = ravb_rgeth_emac_init,
+	.aligned_tx = 1,
+	.tx_counters = 1,
   Mhm, I don't see a connection between those 2 (other than they're both for RX). And anyway, this prolly
  TX, of/c. :-)
should be a part of the previous patch...

[...]
MBR, Sergey

RE: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 18:14:02

Hi Sergei,

Thanks for the review.
Subject: Re: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for
RZ/G2L

On 9/23/21 5:07 PM, Biju Das wrote:

   Somehow this patch haven't reached my OMP email -- I got it only thru
the linux-renesas-soc list... :-/
quoted
RZ/G2L need 4byte address alignment like R-Car Gen2 and it has
tx_counters like R-Car Gen3. This patch enable these features for
RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index bee05e6fb815..bb92469d770e 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -195,7 +195,7 @@ enum ravb_reg {
 	GECMR	= 0x05b0,
 	MAHR	= 0x05c0,
 	MALR	= 0x05c8,
-	TROCR	= 0x0700,	/* R-Car Gen3 only */
+	TROCR	= 0x0700,	/* R-Car Gen3 and RZ/G2L only */
 	CEFCR	= 0x0740,
 	FRECR	= 0x0748,
 	TSFRCR	= 0x0750,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 54c4d31a6950..d38fc33a8e93 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2114,6 +2114,8 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.set_feature = ravb_set_features_rgeth,
 	.dmac_init = ravb_dmac_init_rgeth,
 	.emac_init = ravb_rgeth_emac_init,
+	.aligned_tx = 1,
+	.tx_counters = 1,
   Mhm, I don't see a connection between those 2 (other than they're both
for RX). And anyway, this prolly should be a part of the previous patch...
There was a discussion to make smaller patches. If there is no objection, on
the next revision I will add this as part of previous patch.

Regards,
Biju

RE: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 13:40:55

Hi Sergei,
Subject: RE: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for
RZ/G2L

Hi Sergei,

Thanks for the review.
quoted
Subject: Re: [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters
for RZ/G2L

On 9/23/21 5:07 PM, Biju Das wrote:

   Somehow this patch haven't reached my OMP email -- I got it only
thru the linux-renesas-soc list... :-/
quoted
RZ/G2L need 4byte address alignment like R-Car Gen2 and it has
tx_counters like R-Car Gen3. This patch enable these features for
RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index bee05e6fb815..bb92469d770e 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -195,7 +195,7 @@ enum ravb_reg {
 	GECMR	= 0x05b0,
 	MAHR	= 0x05c0,
 	MALR	= 0x05c8,
-	TROCR	= 0x0700,	/* R-Car Gen3 only */
+	TROCR	= 0x0700,	/* R-Car Gen3 and RZ/G2L only */
 	CEFCR	= 0x0740,
 	FRECR	= 0x0748,
 	TSFRCR	= 0x0750,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 54c4d31a6950..d38fc33a8e93 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2114,6 +2114,8 @@ static const struct ravb_hw_info rgeth_hw_info =
{
quoted
quoted
 	.set_feature = ravb_set_features_rgeth,
 	.dmac_init = ravb_dmac_init_rgeth,
 	.emac_init = ravb_rgeth_emac_init,
+	.aligned_tx = 1,
+	.tx_counters = 1,
   Mhm, I don't see a connection between those 2 (other than they're
both for RX). And anyway, this prolly should be a part of the previous
patch...

There was a discussion to make smaller patches. If there is no objection,
on the next revision I will add this as part of previous patch.
Thanks, As discussed, I have merged this with previous patch, as it is trivial change.

Regards,
Biju

[RFC/PATCH 05/18] ravb: Exclude gPTP feature support for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:39

R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L by enabling
no_gptp feature bit.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 46 ++++++++++++++----------
 1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d38fc33a8e93..8663d83507a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -918,6 +918,7 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id)
 {
 	struct net_device *ndev = dev_id;
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	irqreturn_t result = IRQ_NONE;
 	u32 iss;
 
@@ -953,7 +954,7 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id)
 	}
 
 	/* gPTP interrupt status summary */
-	if (iss & ISS_CGIS) {
+	if (!info->no_gptp && (iss & ISS_CGIS)) {
 		ravb_ptp_interrupt(ndev);
 		result = IRQ_HANDLED;
 	}
@@ -1378,6 +1379,7 @@ static int ravb_get_ts_info(struct net_device *ndev,
 			    struct ethtool_ts_info *info)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *hw_info = priv->info;
 
 	info->so_timestamping =
 		SOF_TIMESTAMPING_TX_SOFTWARE |
@@ -1391,7 +1393,8 @@ static int ravb_get_ts_info(struct net_device *ndev,
 		(1 << HWTSTAMP_FILTER_NONE) |
 		(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
 		(1 << HWTSTAMP_FILTER_ALL);
-	info->phc_index = ptp_clock_index(priv->ptp.clock);
+	if (!hw_info->no_gptp)
+		info->phc_index = ptp_clock_index(priv->ptp.clock);
 
 	return 0;
 }
@@ -2116,6 +2119,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.emac_init = ravb_rgeth_emac_init,
 	.aligned_tx = 1,
 	.tx_counters = 1,
+	.no_gptp = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
@@ -2159,13 +2163,15 @@ static void ravb_set_config_mode(struct net_device *ndev)
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
 
-	if (!info->no_gptp && !info->ccc_gac) {
+	if (info->no_gptp) {
 		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
-		/* Set CSEL value */
-		ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
-	} else {
+	} else if (info->ccc_gac) {
 		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG |
 			    CCC_GAC | CCC_CSEL_HPB);
+	} else {
+		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
+		/* Set CSEL value */
+		ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
 	}
 }
 
@@ -2348,13 +2354,15 @@ static int ravb_probe(struct platform_device *pdev)
 	/* Set AVB config mode */
 	ravb_set_config_mode(ndev);
 
-	/* Set GTI value */
-	error = ravb_set_gti(ndev);
-	if (error)
-		goto out_disable_refclk;
+	if (!info->no_gptp) {
+		/* Set GTI value */
+		error = ravb_set_gti(ndev);
+		if (error)
+			goto out_disable_refclk;
 
-	/* Request GTI loading */
-	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
+		/* Request GTI loading */
+		ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
+	}
 
 	if (info->internal_delay) {
 		ravb_parse_delay_mode(np, ndev);
@@ -2547,13 +2555,15 @@ static int __maybe_unused ravb_resume(struct device *dev)
 	/* Set AVB config mode */
 	ravb_set_config_mode(ndev);
 
-	/* Set GTI value */
-	ret = ravb_set_gti(ndev);
-	if (ret)
-		return ret;
+	if (!info->no_gptp) {
+		/* Set GTI value */
+		ret = ravb_set_gti(ndev);
+		if (ret)
+			return ret;
 
-	/* Request GTI loading */
-	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
+		/* Request GTI loading */
+		ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
+	}
 
 	if (info->internal_delay)
 		ravb_set_delay_mode(ndev);
-- 
2.17.1

Re: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for RZ/G2L

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 19:00:18

On 9/23/21 5:08 PM, Biju Das wrote:
quoted hunk
R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L by enabling
no_gptp feature bit.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 46 ++++++++++++++----------
 1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d38fc33a8e93..8663d83507a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted hunk
@@ -953,7 +954,7 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id)
 	}
 
 	/* gPTP interrupt status summary */
-	if (iss & ISS_CGIS) {
   Isn't this bit always 0 on RZ/G2L?
quoted hunk
+	if (!info->no_gptp && (iss & ISS_CGIS)) {
 		ravb_ptp_interrupt(ndev);
 		result = IRQ_HANDLED;
 	}
@@ -1378,6 +1379,7 @@ static int ravb_get_ts_info(struct net_device *ndev,
 			    struct ethtool_ts_info *info)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *hw_info = priv->info;
 
 	info->so_timestamping =
 		SOF_TIMESTAMPING_TX_SOFTWARE |
@@ -1391,7 +1393,8 @@ static int ravb_get_ts_info(struct net_device *ndev,
 		(1 << HWTSTAMP_FILTER_NONE) |
 		(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
 		(1 << HWTSTAMP_FILTER_ALL);
-	info->phc_index = ptp_clock_index(priv->ptp.clock);
+	if (!hw_info->no_gptp)
+		info->phc_index = ptp_clock_index(priv->ptp.clock);
 
 	return 0;
 }
@@ -2116,6 +2119,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.emac_init = ravb_rgeth_emac_init,
 	.aligned_tx = 1,
 	.tx_counters = 1,
+	.no_gptp = 1,
   Mhm, I definitely don't like the way you "extend" the GbEthernet info structure. All the applicable flags
should be set in the last patch of the series, not amidst of it.

[...]

MBR, Sergey

RE: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 19:13:35

Hi Sergei,

Thanks for the review.
-----Original Message-----
From: Sergey Shtylyov <redacted>
Sent: 23 September 2021 20:00
To: Biju Das <biju.das.jz@bp.renesas.com>; David S. Miller
[off-list ref]; Jakub Kicinski [off-list ref]
Cc: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>;
Andrew Lunn [off-list ref]; Sergei Shtylyov [off-list ref];
Geert Uytterhoeven [off-list ref]; Adam Ford
[off-list ref]; Yoshihiro Shimoda
[off-list ref]; netdev@vger.kernel.org; linux-renesas-
soc@vger.kernel.org; Chris Paterson [off-list ref]; Biju
Das [off-list ref]
Subject: Re: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for
RZ/G2L

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L by enabling no_gptp
feature bit.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 46
++++++++++++++----------
 1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index d38fc33a8e93..8663d83507a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -953,7 +954,7 @@ static irqreturn_t ravb_interrupt(int irq, void
*dev_id)
quoted
 	}

 	/* gPTP interrupt status summary */
-	if (iss & ISS_CGIS) {
   Isn't this bit always 0 on RZ/G2L?
This CGIM bit(BIT13) which is present on R-Car Gen3 is not present in RZ/G2L. As per the HW manual
BIT13 is reserved bit and read is always 0.
quoted
+	if (!info->no_gptp && (iss & ISS_CGIS)) {
 		ravb_ptp_interrupt(ndev);
 		result = IRQ_HANDLED;
 	}
@@ -1378,6 +1379,7 @@ static int ravb_get_ts_info(struct net_device
*ndev,
quoted
 			    struct ethtool_ts_info *info)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *hw_info = priv->info;

 	info->so_timestamping =
 		SOF_TIMESTAMPING_TX_SOFTWARE |
@@ -1391,7 +1393,8 @@ static int ravb_get_ts_info(struct net_device
*ndev,
quoted
 		(1 << HWTSTAMP_FILTER_NONE) |
 		(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
 		(1 << HWTSTAMP_FILTER_ALL);
-	info->phc_index = ptp_clock_index(priv->ptp.clock);
+	if (!hw_info->no_gptp)
+		info->phc_index = ptp_clock_index(priv->ptp.clock);

 	return 0;
 }
@@ -2116,6 +2119,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.emac_init = ravb_rgeth_emac_init,
 	.aligned_tx = 1,
 	.tx_counters = 1,
+	.no_gptp = 1,
   Mhm, I definitely don't like the way you "extend" the GbEthernet info
structure. All the applicable flags should be set in the last patch of the
series, not amidst of it.
According to me, It is clearer with smaller patches like, what we have done with previous 2 patch sets for factorisation.
Please correct me, if any one have different opinion.

Regards,
Biju
[...]

MBR, Sergey

Re: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for RZ/G2L

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 19:41:45

On 9/23/21 10:13 PM, Biju Das wrote:

[...]
quoted
quoted
R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L by enabling no_gptp
feature bit.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 46
++++++++++++++----------
 1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index d38fc33a8e93..8663d83507a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -953,7 +954,7 @@ static irqreturn_t ravb_interrupt(int irq, void
*dev_id)
quoted
 	}

 	/* gPTP interrupt status summary */
-	if (iss & ISS_CGIS) {
   Isn't this bit always 0 on RZ/G2L?
This CGIM bit(BIT13) which is present on R-Car Gen3 is not present in RZ/G2L. As per the HW manual
BIT13 is reserved bit and read is always 0.
quoted
quoted
+	if (!info->no_gptp && (iss & ISS_CGIS)) {
   Then extending this check doesn't seem necessary?
quoted
quoted
 		ravb_ptp_interrupt(ndev);
 		result = IRQ_HANDLED;
 	}
[...]
quoted
quoted
@@ -2116,6 +2119,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.emac_init = ravb_rgeth_emac_init,
 	.aligned_tx = 1,
 	.tx_counters = 1,
+	.no_gptp = 1,
   Mhm, I definitely don't like the way you "extend" the GbEthernet info
structure. All the applicable flags should be set in the last patch of the
series, not amidst of it.
According to me, It is clearer with smaller patches like, what we have done with previous 2 patch sets for factorisation.
Please correct me, if any one have different opinion.
   I'm afraid you'd get a partly functioning device with the RZ/G2 info introduced amidst of the series
and then the necessary flags/values added to it. This should definitely be avoided.
Regards,
Biju
MBR, Sergey

RE: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 19:45:34

Hi Sergei,
Subject: Re: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for
RZ/G2L

On 9/23/21 10:13 PM, Biju Das wrote:

[...]
quoted
quoted
quoted
R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L by enabling
no_gptp feature bit.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 46
++++++++++++++----------
 1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index d38fc33a8e93..8663d83507a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -953,7 +954,7 @@ static irqreturn_t ravb_interrupt(int irq, void
*dev_id)
quoted
 	}

 	/* gPTP interrupt status summary */
-	if (iss & ISS_CGIS) {
   Isn't this bit always 0 on RZ/G2L?
This CGIM bit(BIT13) which is present on R-Car Gen3 is not present in
RZ/G2L. As per the HW manual
BIT13 is reserved bit and read is always 0.
quoted
quoted
+	if (!info->no_gptp && (iss & ISS_CGIS)) {
   Then extending this check doesn't seem necessary?
quoted
quoted
quoted
 		ravb_ptp_interrupt(ndev);
 		result = IRQ_HANDLED;
 	}
[...]
quoted
quoted
quoted
@@ -2116,6 +2119,7 @@ static const struct ravb_hw_info rgeth_hw_info =
{
quoted
quoted
quoted
 	.emac_init = ravb_rgeth_emac_init,
 	.aligned_tx = 1,
 	.tx_counters = 1,
+	.no_gptp = 1,
   Mhm, I definitely don't like the way you "extend" the GbEthernet
info structure. All the applicable flags should be set in the last
patch of the series, not amidst of it.
According to me, It is clearer with smaller patches like, what we have
done with previous 2 patch sets for factorisation.
quoted
Please correct me, if any one have different opinion.
   I'm afraid you'd get a partly functioning device with the RZ/G2 info
introduced amidst of the series and then the necessary flags/values added
to it. This should definitely be avoided.
It is ok, It is understood, After replacing all  the place holders only we get full functionality.
That is the reason place holders added in first patch, so that we can fill each function at later stage
By smaller patcher. Same case for feature bits.

Regards,
Biju

RE: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for RZ/G2L

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 13:48:48

Hi Sergei,
Subject: RE: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for
RZ/G2L

Hi Sergei,
quoted
Subject: Re: [RFC/PATCH 05/18] ravb: Exclude gPTP feature support for
RZ/G2L

On 9/23/21 10:13 PM, Biju Das wrote:

[...]
quoted
quoted
quoted
R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L by enabling
no_gptp feature bit.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 46
++++++++++++++----------
 1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index d38fc33a8e93..8663d83507a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -953,7 +954,7 @@ static irqreturn_t ravb_interrupt(int irq,
void
*dev_id)
quoted
 	}

 	/* gPTP interrupt status summary */
-	if (iss & ISS_CGIS) {
   Isn't this bit always 0 on RZ/G2L?
This CGIM bit(BIT13) which is present on R-Car Gen3 is not present
in RZ/G2L. As per the HW manual
BIT13 is reserved bit and read is always 0.
quoted
quoted
quoted
quoted
+	if (!info->no_gptp && (iss & ISS_CGIS)) {
   Then extending this check doesn't seem necessary?
I have dropped this check in new version.
quoted
quoted
quoted
quoted
 		ravb_ptp_interrupt(ndev);
 		result = IRQ_HANDLED;
 	}
[...]
quoted
quoted
quoted
@@ -2116,6 +2119,7 @@ static const struct ravb_hw_info
rgeth_hw_info =
{
quoted
quoted
quoted
 	.emac_init = ravb_rgeth_emac_init,
 	.aligned_tx = 1,
 	.tx_counters = 1,
+	.no_gptp = 1,
   Mhm, I definitely don't like the way you "extend" the GbEthernet
info structure. All the applicable flags should be set in the last
patch of the series, not amidst of it.
According to me, It is clearer with smaller patches like, what we
have
done with previous 2 patch sets for factorisation.
quoted
Please correct me, if any one have different opinion.
   I'm afraid you'd get a partly functioning device with the RZ/G2
info introduced amidst of the series and then the necessary
flags/values added to it. This should definitely be avoided.
It is ok, It is understood, After replacing all  the place holders only we
get full functionality.
That is the reason place holders added in first patch, so that we can fill
each function at later stage By smaller patcher. Same case for feature
bits.
OK, the new patch excluded gPTP support for RZ/G2L and Also as per your suggestion,dropped timestamp feature bit and merged that code in this patch.

Regards,
Biju

[RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:44

R-Car AVB-DMAC has 4 Transmit start Request queues, whereas
RZ/G2L has only 1 Transmit start Request queue(Best Effort)

Add a multi_tsrq hw feature bit to struct ravb_hw_info to enable
this only for R-Car. This will allow us to add single TSRQ support for
RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bb92469d770e..c043ee555be4 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1006,6 +1006,7 @@ struct ravb_hw_info {
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
 	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP feature */
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
+	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 8663d83507a0..d37d73f6d984 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -776,11 +776,17 @@ static void ravb_rcv_snd_enable(struct net_device *ndev)
 /* function for waiting dma process finished */
 static int ravb_stop_dma(struct net_device *ndev)
 {
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	int error;
 
 	/* Wait for stopping the hardware TX process */
-	error = ravb_wait(ndev, TCCR,
-			  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, 0);
+	if (info->multi_tsrq)
+		error = ravb_wait(ndev, TCCR,
+				  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, 0);
+	else
+		error = ravb_wait(ndev, TCCR, TCCR_TSRQ0, 0);
+
 	if (error)
 		return error;
 
@@ -2088,6 +2094,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.tx_counters = 1,
 	.multi_irqs = 1,
 	.ccc_gac = 1,
+	.multi_tsrq = 1,
 };
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
@@ -2106,6 +2113,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
 	.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
 	.aligned_tx = 1,
+	.multi_tsrq = 1,
 };
 
 static const struct ravb_hw_info rgeth_hw_info = {
-- 
2.17.1

Re: [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 20:19:58

On 9/23/21 5:08 PM, Biju Das wrote:
quoted hunk
R-Car AVB-DMAC has 4 Transmit start Request queues, whereas
RZ/G2L has only 1 Transmit start Request queue(Best Effort)

Add a multi_tsrq hw feature bit to struct ravb_hw_info to enable
this only for R-Car. This will allow us to add single TSRQ support for
RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bb92469d770e..c043ee555be4 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1006,6 +1006,7 @@ struct ravb_hw_info {
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
 	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP feature */
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
+	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
   Maybe 'single_tx_q' instead?
quoted hunk
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 8663d83507a0..d37d73f6d984 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -776,11 +776,17 @@ static void ravb_rcv_snd_enable(struct net_device *ndev)
 /* function for waiting dma process finished */
 static int ravb_stop_dma(struct net_device *ndev)
 {
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	int error;
 
 	/* Wait for stopping the hardware TX process */
-	error = ravb_wait(ndev, TCCR,
-			  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, 0);
+	if (info->multi_tsrq)
+		error = ravb_wait(ndev, TCCR,
+				  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, 0);
+	else
+		error = ravb_wait(ndev, TCCR, TCCR_TSRQ0, 0);
   Aren't the TSRQ1/2/3 bits reserved on RZ/G2L? If so, this new flag adds a little value, I think... unless
you plan to use this flag further in the series?

MBR, Sergei

RE: [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-24 06:21:32

Hi Sergei,

Thanks for the feedback.
Subject: Re: [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
R-Car AVB-DMAC has 4 Transmit start Request queues, whereas RZ/G2L has
only 1 Transmit start Request queue(Best Effort)

Add a multi_tsrq hw feature bit to struct ravb_hw_info to enable this
only for R-Car. This will allow us to add single TSRQ support for
RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index bb92469d770e..c043ee555be4 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1006,6 +1006,7 @@ struct ravb_hw_info {
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple
irqs */
quoted
 	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP
feature */
quoted
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in
config mode */
quoted
+	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
   Maybe 'single_tx_q' instead? 
Since it is called transmit start request queue, it is better to be named as single_tsrq
to match with hardware manual and I will update the comment with "GbEthernet DMAC has single TSRQ"
Please let me know are you ok with it. Other wise I would like to use existing name.
quoted
 };

 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 8663d83507a0..d37d73f6d984 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -776,11 +776,17 @@ static void ravb_rcv_snd_enable(struct
net_device *ndev)
 /* function for waiting dma process finished */  static int
ravb_stop_dma(struct net_device *ndev)  {
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	int error;

 	/* Wait for stopping the hardware TX process */
-	error = ravb_wait(ndev, TCCR,
-			  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, 0);
+	if (info->multi_tsrq)
+		error = ravb_wait(ndev, TCCR,
+				  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 |
TCCR_TSRQ3, 0);
quoted
+	else
+		error = ravb_wait(ndev, TCCR, TCCR_TSRQ0, 0);
   Aren't the TSRQ1/2/3 bits reserved on RZ/G2L? If so, this new flag adds
a little value, I think... unless you plan to use this flag further in the
series?
It will be confusing for RZ/G2L users. HW manual does not describes TSRQ1/2/3
and we are writing undocumented registers which is reserved.

Tomorrow it can happen that this reserved bits(90% it will not happen) will be used for describing something else.

It is unsafe to use reserved bits. Are you agreeing with this?

Regards,
Biju
MBR, Sergei

RE: [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 13:55:06

Hi Sergei,
Subject: RE: [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info

Hi Sergei,

Thanks for the feedback.
quoted
Subject: Re: [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
R-Car AVB-DMAC has 4 Transmit start Request queues, whereas RZ/G2L
has only 1 Transmit start Request queue(Best Effort)

Add a multi_tsrq hw feature bit to struct ravb_hw_info to enable
this only for R-Car. This will allow us to add single TSRQ support
for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index bb92469d770e..c043ee555be4 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1006,6 +1006,7 @@ struct ravb_hw_info {
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple
irqs */
quoted
 	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP
feature */
quoted
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in
config mode */
quoted
+	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
   Maybe 'single_tx_q' instead?
Since it is called transmit start request queue, it is better to be named
as single_tsrq to match with hardware manual and I will update the comment
with "GbEthernet DMAC has single TSRQ"
Please let me know are you ok with it. Other wise I would like to use
existing name.
On the next revision as you proposed for [1],
I will use a u32 tsrq, instead of bit, there by we can avoid a check.

https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210923140813.13541-12-biju.das.jz@bp.renesas.com/
quoted
quoted
 };

 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 8663d83507a0..d37d73f6d984 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -776,11 +776,17 @@ static void ravb_rcv_snd_enable(struct
net_device *ndev)
 /* function for waiting dma process finished */  static int
ravb_stop_dma(struct net_device *ndev)  {
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	int error;

 	/* Wait for stopping the hardware TX process */
-	error = ravb_wait(ndev, TCCR,
-			  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, 0);
+	if (info->multi_tsrq)
+		error = ravb_wait(ndev, TCCR,
+				  TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 |
TCCR_TSRQ3, 0);
quoted
+	else
+		error = ravb_wait(ndev, TCCR, TCCR_TSRQ0, 0);
   Aren't the TSRQ1/2/3 bits reserved on RZ/G2L? If so, this new flag
adds a little value, I think... unless you plan to use this flag
further in the series?
It will be confusing for RZ/G2L users. HW manual does not describes
TSRQ1/2/3 and we are writing undocumented registers which is reserved.

Tomorrow it can happen that this reserved bits(90% it will not happen)
will be used for describing something else.

It is unsafe to use reserved bits. Are you agreeing with this?
As per the above discussion, we can replace the above check as you proposed for [1]

error = ravb_wait(ndev, TCCR, info->tsrq, 0);

[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210923140813.13541-12-biju.das.jz@bp.renesas.com/

regards,
Biju

[RFC/PATCH 07/18] ravb: Add magic_pkt to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:45

E-MAC on R-Car supports magic packet detection, whereas RZ/G2L
do not support this feature. Add magic_pkt to struct ravb_hw_info
and enable this feature only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index c043ee555be4..bce480fadb91 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1007,6 +1007,7 @@ struct ravb_hw_info {
 	unsigned no_gptp:1;		/* AVB-DMAC does not support gPTP feature */
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
+	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d37d73f6d984..529364d8f7fb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -811,12 +811,13 @@ static int ravb_stop_dma(struct net_device *ndev)
 static void ravb_emac_interrupt_unlocked(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	u32 ecsr, psr;
 
 	ecsr = ravb_read(ndev, ECSR);
 	ravb_write(ndev, ecsr, ECSR);	/* clear interrupt */
 
-	if (ecsr & ECSR_MPD)
+	if (info->magic_pkt && (ecsr & ECSR_MPD))
 		pm_wakeup_event(&priv->pdev->dev, 0);
 	if (ecsr & ECSR_ICD)
 		ndev->stats.tx_carrier_errors++;
@@ -1416,8 +1417,9 @@ static void ravb_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 static int ravb_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 
-	if (wol->wolopts & ~WAKE_MAGIC)
+	if (!info->magic_pkt || (wol->wolopts & ~WAKE_MAGIC))
 		return -EOPNOTSUPP;
 
 	priv->wol_enabled = !!(wol->wolopts & WAKE_MAGIC);
@@ -2095,6 +2097,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.multi_irqs = 1,
 	.ccc_gac = 1,
 	.multi_tsrq = 1,
+	.magic_pkt = 1,
 };
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
@@ -2114,6 +2117,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
 	.aligned_tx = 1,
 	.multi_tsrq = 1,
+	.magic_pkt = 1,
 };
 
 static const struct ravb_hw_info rgeth_hw_info = {
-- 
2.17.1

Re: [RFC/PATCH 07/18] ravb: Add magic_pkt to struct ravb_hw_info

From: Sergey Shtylyov <hidden>
Date: 2021-09-23 20:42:26

On 9/23/21 5:08 PM, Biju Das wrote:
E-MAC on R-Car supports magic packet detection, whereas RZ/G2L
do not support this feature. Add magic_pkt to struct ravb_hw_info
and enable this feature only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]
quoted hunk
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d37d73f6d984..529364d8f7fb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -811,12 +811,13 @@ static int ravb_stop_dma(struct net_device *ndev)
 static void ravb_emac_interrupt_unlocked(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	u32 ecsr, psr;
 
 	ecsr = ravb_read(ndev, ECSR);
 	ravb_write(ndev, ecsr, ECSR);	/* clear interrupt */
 
-	if (ecsr & ECSR_MPD)
+	if (info->magic_pkt && (ecsr & ECSR_MPD))
   I think masking the MPD interrupt would be enough.
quoted hunk
 		pm_wakeup_event(&priv->pdev->dev, 0);
 	if (ecsr & ECSR_ICD)
 		ndev->stats.tx_carrier_errors++;
@@ -1416,8 +1417,9 @@ static void ravb_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
   Didn't you miss ravb_get_wol() -- it needs a change as well...
 static int ravb_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 
-	if (wol->wolopts & ~WAKE_MAGIC)
+	if (!info->magic_pkt || (wol->wolopts & ~WAKE_MAGIC))
 		return -EOPNOTSUPP;
 
 	priv->wol_enabled = !!(wol->wolopts & WAKE_MAGIC);
[...]

MBR, Sergey

RE: [RFC/PATCH 07/18] ravb: Add magic_pkt to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-24 06:24:39

Hi Sergei,

Thanks for the feedback.
Subject: Re: [RFC/PATCH 07/18] ravb: Add magic_pkt to struct ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
E-MAC on R-Car supports magic packet detection, whereas RZ/G2L do not
support this feature. Add magic_pkt to struct ravb_hw_info and enable
this feature only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index d37d73f6d984..529364d8f7fb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -811,12 +811,13 @@ static int ravb_stop_dma(struct net_device
*ndev)  static void ravb_emac_interrupt_unlocked(struct net_device
*ndev)  {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	u32 ecsr, psr;

 	ecsr = ravb_read(ndev, ECSR);
 	ravb_write(ndev, ecsr, ECSR);	/* clear interrupt */

-	if (ecsr & ECSR_MPD)
+	if (info->magic_pkt && (ecsr & ECSR_MPD))
   I think masking the MPD interrupt would be enough.
Agreed.
quoted
 		pm_wakeup_event(&priv->pdev->dev, 0);
 	if (ecsr & ECSR_ICD)
 		ndev->stats.tx_carrier_errors++;
@@ -1416,8 +1417,9 @@ static void ravb_get_wol(struct net_device
*ndev, struct ethtool_wolinfo *wol)
   Didn't you miss ravb_get_wol() -- it needs a change as well...
I don't think it is required. Framework is taking care of this. Please see the output from target.

root@smarc-rzg2l:~# ethtool -s eth0 wol g
netlink error: Operation not supported
root@smarc-rzg2l:~#


Regards,
Biju
quoted
 static int ravb_set_wol(struct net_device *ndev, struct
ethtool_wolinfo *wol)  {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;

-	if (wol->wolopts & ~WAKE_MAGIC)
+	if (!info->magic_pkt || (wol->wolopts & ~WAKE_MAGIC))
 		return -EOPNOTSUPP;

 	priv->wol_enabled = !!(wol->wolopts & WAKE_MAGIC);
[...]

MBR, Sergey

RE: [RFC/PATCH 07/18] ravb: Add magic_pkt to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 13:57:07

Hi Sergei,
Subject: RE: [RFC/PATCH 07/18] ravb: Add magic_pkt to struct ravb_hw_info

Hi Sergei,

Thanks for the feedback.
quoted
Subject: Re: [RFC/PATCH 07/18] ravb: Add magic_pkt to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
E-MAC on R-Car supports magic packet detection, whereas RZ/G2L do
not support this feature. Add magic_pkt to struct ravb_hw_info and
enable this feature only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index d37d73f6d984..529364d8f7fb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -811,12 +811,13 @@ static int ravb_stop_dma(struct net_device
*ndev)  static void ravb_emac_interrupt_unlocked(struct net_device
*ndev)  {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	u32 ecsr, psr;

 	ecsr = ravb_read(ndev, ECSR);
 	ravb_write(ndev, ecsr, ECSR);	/* clear interrupt */

-	if (ecsr & ECSR_MPD)
+	if (info->magic_pkt && (ecsr & ECSR_MPD))
   I think masking the MPD interrupt would be enough.
Agreed.
quoted
quoted
 		pm_wakeup_event(&priv->pdev->dev, 0);
 	if (ecsr & ECSR_ICD)
 		ndev->stats.tx_carrier_errors++;
@@ -1416,8 +1417,9 @@ static void ravb_get_wol(struct net_device
*ndev, struct ethtool_wolinfo *wol)
   Didn't you miss ravb_get_wol() -- it needs a change as well...
I don't think it is required. Framework is taking care of this. Please see
the output from target.

root@smarc-rzg2l:~# ethtool -s eth0 wol g netlink error: Operation not
supported root@smarc-rzg2l:~#
quoted
quoted
 static int ravb_set_wol(struct net_device *ndev, struct
ethtool_wolinfo *wol)  {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;

-	if (wol->wolopts & ~WAKE_MAGIC)
+	if (!info->magic_pkt || (wol->wolopts & ~WAKE_MAGIC))
 		return -EOPNOTSUPP;

 	priv->wol_enabled = !!(wol->wolopts & WAKE_MAGIC);
[...]
As discussed, the new patch removes info->magic_pkt from interrupt routine.

Regards,
Biju

[RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:48

E-MAC on RZ/G2L supports MII/RGMII selection. Add a
mii_rgmii_selection feature bit to struct ravb_hw_info
to support this for RZ/G2L.
Currently only selecting RGMII is supported.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 17 +++++++++++++++++
 drivers/net/ethernet/renesas/ravb_main.c |  6 ++++++
 2 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bce480fadb91..dfaf3121da44 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -189,6 +189,8 @@ enum ravb_reg {
 	PIR	= 0x0520,
 	PSR	= 0x0528,
 	PIPR	= 0x052c,
+	CXR31	= 0x0530,	/* Documented for RZ/G2L only */
+	CXR35	= 0x0540,	/* Documented for RZ/G2L only */
 	MPR	= 0x0558,
 	PFTCR	= 0x055c,
 	PFRCR	= 0x0560,
@@ -951,6 +953,20 @@ enum RAVB_QUEUE {
 	RAVB_NC,	/* Network Control Queue */
 };
 
+enum CXR31_BIT {
+	CXR31_SEL_LINK0	= 0x00000001,
+	CXR31_SEL_LINK1	= 0x00000008,
+};
+
+enum CXR35_BIT {
+	CXR35_SEL_MODIN	= 0x00000100,
+};
+
+enum CSR0_BIT {
+	CSR0_TPE	= 0x00000010,
+	CSR0_RPE	= 0x00000020,
+};
+
 #define DBAT_ENTRY_NUM	22
 #define RX_QUEUE_OFFSET	4
 #define NUM_RX_QUEUE	2
@@ -1008,6 +1024,7 @@ struct ravb_hw_info {
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
+	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 529364d8f7fb..5d18681582b9 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1128,6 +1128,7 @@ static int ravb_phy_init(struct net_device *ndev)
 {
 	struct device_node *np = ndev->dev.parent->of_node;
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	struct phy_device *phydev;
 	struct device_node *pn;
 	phy_interface_t iface;
@@ -1173,6 +1174,10 @@ static int ravb_phy_init(struct net_device *ndev)
 		netdev_info(ndev, "limited PHY to 100Mbit/s\n");
 	}
 
+	if (info->mii_rgmii_selection &&
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID)
+		ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN, CXR35);
+
 	/* 10BASE, Pause and Asym Pause is not supported */
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
@@ -2132,6 +2137,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.aligned_tx = 1,
 	.tx_counters = 1,
 	.no_gptp = 1,
+	.mii_rgmii_selection = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
-- 
2.17.1

Re: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct ravb_hw_info

From: Sergey Shtylyov <hidden>
Date: 2021-09-24 19:49:13

On 9/23/21 5:08 PM, Biju Das wrote:
quoted hunk
E-MAC on RZ/G2L supports MII/RGMII selection. Add a
mii_rgmii_selection feature bit to struct ravb_hw_info
to support this for RZ/G2L.
Currently only selecting RGMII is supported.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 17 +++++++++++++++++
 drivers/net/ethernet/renesas/ravb_main.c |  6 ++++++
 2 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bce480fadb91..dfaf3121da44 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
[...]
quoted hunk
@@ -951,6 +953,20 @@ enum RAVB_QUEUE {
 	RAVB_NC,	/* Network Control Queue */
 };
 
+enum CXR31_BIT {
+	CXR31_SEL_LINK0	= 0x00000001,
+	CXR31_SEL_LINK1	= 0x00000008,
+};
+
+enum CXR35_BIT {
+	CXR35_SEL_MODIN	= 0x00000100,
+};
+
+enum CSR0_BIT {
+	CSR0_TPE	= 0x00000010,
+	CSR0_RPE	= 0x00000020,
+};
   I don't see those used? What is CSR0?

[...]
quoted hunk
@@ -1008,6 +1024,7 @@ struct ravb_hw_info {
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
+	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
   Perhaps just 'mii_rgmii_sel'?

[...]
quoted hunk
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 529364d8f7fb..5d18681582b9 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted hunk
@@ -1173,6 +1174,10 @@ static int ravb_phy_init(struct net_device *ndev)
 		netdev_info(ndev, "limited PHY to 100Mbit/s\n");
 	}
 
+	if (info->mii_rgmii_selection &&
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID)
   Not MII?
+		ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN, CXR35);
   We have ravb_mnodify() for that...
quoted hunk
+
 	/* 10BASE, Pause and Asym Pause is not supported */
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
@@ -2132,6 +2137,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.aligned_tx = 1,
 	.tx_counters = 1,
 	.no_gptp = 1,
+	.mii_rgmii_selection = 1,
   I don't see where we handle MII?

[...]

MBR, Sergey

RE: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-25 06:23:46

Hi Sergei,

Thanks for the feedback.
Subject: Re: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
E-MAC on RZ/G2L supports MII/RGMII selection. Add a
mii_rgmii_selection feature bit to struct ravb_hw_info to support this
for RZ/G2L.
Currently only selecting RGMII is supported.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 17 +++++++++++++++++
 drivers/net/ethernet/renesas/ravb_main.c |  6 ++++++
 2 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index bce480fadb91..dfaf3121da44 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
[...]
quoted
@@ -951,6 +953,20 @@ enum RAVB_QUEUE {
 	RAVB_NC,	/* Network Control Queue */
 };

+enum CXR31_BIT {
+	CXR31_SEL_LINK0	= 0x00000001,
+	CXR31_SEL_LINK1	= 0x00000008,
+};
+
+enum CXR35_BIT {
+	CXR35_SEL_MODIN	= 0x00000100,
+};
+
+enum CSR0_BIT {
+	CSR0_TPE	= 0x00000010,
+	CSR0_RPE	= 0x00000020,
+};
   I don't see those used? What is CSR0?
OK, This has to be part of later patch for emac_init. CSR is checksum operating mode register in TOE.
[...]
quoted
@@ -1008,6 +1024,7 @@ struct ravb_hw_info {
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in
config mode */
quoted
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet
detection */
quoted
+	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii
selection */

   Perhaps just 'mii_rgmii_sel'?
OK.
[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 529364d8f7fb..5d18681582b9 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -1173,6 +1174,10 @@ static int ravb_phy_init(struct net_device *ndev)
 		netdev_info(ndev, "limited PHY to 100Mbit/s\n");
 	}

+	if (info->mii_rgmii_selection &&
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID)
   Not MII?
Currently only RGMII supported, see the commit message.
quoted
+		ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN,
CXR35);

   We have ravb_mnodify() for that...
quoted
+
 	/* 10BASE, Pause and Asym Pause is not supported */
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
@@ -2132,6 +2137,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.aligned_tx = 1,
 	.tx_counters = 1,
 	.no_gptp = 1,
+	.mii_rgmii_selection = 1,
   I don't see where we handle MII?
See the commit message. "Currently only selecting RGMII is supported."
We have a plan to support this at later.

Regards,
Biju
[...]

MBR, Sergey

RE: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 15:50:01

Hi Sergei,
Subject: RE: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct
ravb_hw_info

Hi Sergei,

Thanks for the feedback.
quoted
Subject: Re: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
E-MAC on RZ/G2L supports MII/RGMII selection. Add a
mii_rgmii_selection feature bit to struct ravb_hw_info to support
this for RZ/G2L.
Currently only selecting RGMII is supported.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 17 +++++++++++++++++
 drivers/net/ethernet/renesas/ravb_main.c |  6 ++++++
 2 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index bce480fadb91..dfaf3121da44 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
[...]
quoted
@@ -951,6 +953,20 @@ enum RAVB_QUEUE {
 	RAVB_NC,	/* Network Control Queue */
 };

+enum CXR31_BIT {
+	CXR31_SEL_LINK0	= 0x00000001,
+	CXR31_SEL_LINK1	= 0x00000008,
+};
+
+enum CXR35_BIT {
+	CXR35_SEL_MODIN	= 0x00000100,
+};
+
+enum CSR0_BIT {
+	CSR0_TPE	= 0x00000010,
+	CSR0_RPE	= 0x00000020,
+};
   I don't see those used? What is CSR0?
OK, This has to be part of later patch for emac_init. CSR is checksum
operating mode register in TOE.
quoted
[...]
quoted
@@ -1008,6 +1024,7 @@ struct ravb_hw_info {
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in
config mode */
quoted
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet
detection */
quoted
+	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii
selection */

   Perhaps just 'mii_rgmii_sel'?
OK.
quoted
[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 529364d8f7fb..5d18681582b9 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -1173,6 +1174,10 @@ static int ravb_phy_init(struct net_device
*ndev)
quoted
quoted
 		netdev_info(ndev, "limited PHY to 100Mbit/s\n");
 	}

+	if (info->mii_rgmii_selection &&
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID)
   Not MII?
Currently only RGMII supported, see the commit message.
quoted
quoted
+		ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN,
CXR35);

   We have ravb_mnodify() for that...
quoted
+
 	/* 10BASE, Pause and Asym Pause is not supported */
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
@@ -2132,6 +2137,7 @@ static const struct ravb_hw_info rgeth_hw_info =
{
quoted
quoted
 	.aligned_tx = 1,
 	.tx_counters = 1,
 	.no_gptp = 1,
+	.mii_rgmii_selection = 1,
   I don't see where we handle MII?
See the commit message. "Currently only selecting RGMII is supported."
We have a plan to support this at later.
I have prepared a patch with "mii_rgmii_sel", will send next revision soon.

Regards,
Biju

[RFC/PATCH 09/18] ravb: Add half_duplex to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:54

RZ/G2L supports half duplex mode.
Add a half_duplex hw feature bit to struct ravb_hw_info for
supporting half duplex mode for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  3 ++
 drivers/net/ethernet/renesas/ravb_main.c | 40 +++++++++++++++++++-----
 2 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index dfaf3121da44..7f68f9b8349c 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1025,6 +1025,7 @@ struct ravb_hw_info {
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
+	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
 };
 
 struct ravb_private {
@@ -1079,6 +1080,8 @@ struct ravb_private {
 	unsigned rgmii_override:1;	/* Deprecated rgmii-*id behavior */
 	unsigned int num_tx_desc;	/* TX descriptors per packet */
 
+	int duplex;
+
 	const struct ravb_hw_info *info;
 	struct reset_control *rstc;
 };
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 5d18681582b9..04bff44b7660 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi, int budget)
 	return budget - quota;
 }
 
+static void ravb_set_duplex_rgeth(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	u32 ecmr = ravb_read(ndev, ECMR);
+
+	if (priv->duplex > 0)	/* Full */
+		ecmr |=  ECMR_DM;
+	else			/* Half */
+		ecmr &= ~ECMR_DM;
+	ravb_write(ndev, ecmr, ECMR);
+}
+
 /* PHY state control function */
 static void ravb_adjust_link(struct net_device *ndev)
 {
@@ -1092,6 +1104,12 @@ static void ravb_adjust_link(struct net_device *ndev)
 		ravb_rcv_snd_disable(ndev);
 
 	if (phydev->link) {
+		if (info->half_duplex && phydev->duplex != priv->duplex) {
+			new_state = true;
+			priv->duplex = phydev->duplex;
+			ravb_set_duplex_rgeth(ndev);
+		}
+
 		if (phydev->speed != priv->speed) {
 			new_state = true;
 			priv->speed = phydev->speed;
@@ -1106,6 +1124,8 @@ static void ravb_adjust_link(struct net_device *ndev)
 		new_state = true;
 		priv->link = 0;
 		priv->speed = 0;
+		if (info->half_duplex)
+			priv->duplex = -1;
 	}
 
 	/* Enable TX and RX right over here, if E-MAC change is ignored */
@@ -1136,6 +1156,7 @@ static int ravb_phy_init(struct net_device *ndev)
 
 	priv->link = 0;
 	priv->speed = 0;
+	priv->duplex = -1;
 
 	/* Try connecting to PHY */
 	pn = of_parse_phandle(np, "phy-handle", 0);
@@ -1178,15 +1199,17 @@ static int ravb_phy_init(struct net_device *ndev)
 	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID)
 		ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN, CXR35);
 
-	/* 10BASE, Pause and Asym Pause is not supported */
-	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
-	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
-	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Pause_BIT);
-	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT);
+	if (!info->half_duplex) {
+		/* 10BASE, Pause and Asym Pause is not supported */
+		phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
+		phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
+		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);
+		/* 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);
 
@@ -2138,6 +2161,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.tx_counters = 1,
 	.no_gptp = 1,
 	.mii_rgmii_selection = 1,
+	.half_duplex = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
-- 
2.17.1

Re: [RFC/PATCH 09/18] ravb: Add half_duplex to struct ravb_hw_info

From: Sergey Shtylyov <hidden>
Date: 2021-09-24 20:07:40

On 9/23/21 5:08 PM, Biju Das wrote:
RZ/G2L supports half duplex mode.
Add a half_duplex hw feature bit to struct ravb_hw_info for
supporting half duplex mode for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]

Reviewed-by: Sergey Shtylyov <redacted>

   Just a little bit of change needed...

[...]
quoted hunk
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 5d18681582b9..04bff44b7660 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi, int budget)
 	return budget - quota;
 }
 
+static void ravb_set_duplex_rgeth(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	u32 ecmr = ravb_read(ndev, ECMR);
+
+	if (priv->duplex > 0)	/* Full */
+		ecmr |=  ECMR_DM;
+	else			/* Half */
+		ecmr &= ~ECMR_DM;
+	ravb_write(ndev, ecmr, ECMR);
   I think we should do that like sh_eth.c:

	ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex > 0 ? ECMR_DM : 0);

[...]

MBR, Sergey

RE: [RFC/PATCH 09/18] ravb: Add half_duplex to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-25 06:37:11

Hi Sergei,

Thanks for the feedback.
Subject: Re: [RFC/PATCH 09/18] ravb: Add half_duplex to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
RZ/G2L supports half duplex mode.
Add a half_duplex hw feature bit to struct ravb_hw_info for supporting
half duplex mode for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]

Reviewed-by: Sergey Shtylyov <redacted>

   Just a little bit of change needed...

[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 5d18681582b9..04bff44b7660 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi,
int budget)
quoted
 	return budget - quota;
 }

+static void ravb_set_duplex_rgeth(struct net_device *ndev) {
+	struct ravb_private *priv = netdev_priv(ndev);
+	u32 ecmr = ravb_read(ndev, ECMR);
+
+	if (priv->duplex > 0)	/* Full */
+		ecmr |=  ECMR_DM;
+	else			/* Half */
+		ecmr &= ~ECMR_DM;
+	ravb_write(ndev, ecmr, ECMR);
   I think we should do that like sh_eth.c:

	ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex > 0 ? ECMR_DM : 0);
OK. Will do

Regards,
Biju
[...]

MBR, Sergey

RE: [RFC/PATCH 09/18] ravb: Add half_duplex to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 15:51:44

Hi Sergei,
Subject: Re: [RFC/PATCH 09/18] ravb: Add half_duplex to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
RZ/G2L supports half duplex mode.
Add a half_duplex hw feature bit to struct ravb_hw_info for supporting
half duplex mode for RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[...]

Reviewed-by: Sergey Shtylyov <redacted>

   Just a little bit of change needed...

[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 5d18681582b9..04bff44b7660 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi,
int budget)
quoted
 	return budget - quota;
 }

+static void ravb_set_duplex_rgeth(struct net_device *ndev) {
+	struct ravb_private *priv = netdev_priv(ndev);
+	u32 ecmr = ravb_read(ndev, ECMR);
+
+	if (priv->duplex > 0)	/* Full */
+		ecmr |=  ECMR_DM;
+	else			/* Half */
+		ecmr &= ~ECMR_DM;
+	ravb_write(ndev, ecmr, ECMR);
   I think we should do that like sh_eth.c:

	ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex > 0 ? ECMR_DM : 0);
I have prepared a patch with this changes and also renamed the function "ravb_set_duplex_rgeth" to " ravb_set_duplex_gbeth"
As you suggested.

Regards,
Biju

[RFC/PATCH 10/18] ravb: Initialize GbEthernet E-MAC

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:08:58

Initialize GbEthernet E-MAC found on RZ/G2L SoC.
This patch also renames ravb_set_rate to ravb_set_rate_rcar and
ravb_rcar_emac_init to ravb_emac_init_rcar to be consistent with
the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 15 ++++--
 drivers/net/ethernet/renesas/ravb_main.c | 64 +++++++++++++++++++-----
 2 files changed, 62 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7f68f9b8349c..7532cb51d7b8 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -204,6 +204,7 @@ enum ravb_reg {
 	TLFRCR	= 0x0758,
 	RFCR	= 0x0760,
 	MAFCR	= 0x0778,
+	CSR0     = 0x0800,	/* Documented for RZ/G2L only */
 };
 
 
@@ -814,10 +815,11 @@ enum ECMR_BIT {
 	ECMR_TXF	= 0x00010000,	/* Documented for R-Car Gen3 only */
 	ECMR_RXF	= 0x00020000,
 	ECMR_PFR	= 0x00040000,
-	ECMR_ZPF	= 0x00080000,	/* Documented for R-Car Gen3 only */
+	ECMR_ZPF	= 0x00080000,	/* Documented for R-Car Gen3 and RZ/G2L */
 	ECMR_RZPF	= 0x00100000,
 	ECMR_DPAD	= 0x00200000,
 	ECMR_RCSC	= 0x00800000,
+	ECMR_RCPT	= 0x02000000,	/* Documented for RZ/G2L only */
 	ECMR_TRCCM	= 0x04000000,
 };
 
@@ -827,6 +829,7 @@ enum ECSR_BIT {
 	ECSR_MPD	= 0x00000002,
 	ECSR_LCHNG	= 0x00000004,
 	ECSR_PHYI	= 0x00000008,
+	ECSR_PFRI	= 0x00000010,
 };
 
 /* ECSIPR */
@@ -861,9 +864,13 @@ enum MPR_BIT {
 
 /* GECMR */
 enum GECMR_BIT {
-	GECMR_SPEED	= 0x00000001,
-	GECMR_SPEED_100	= 0x00000000,
-	GECMR_SPEED_1000 = 0x00000001,
+	GECMR_SPEED		= 0x00000001,
+	GECMR_SPEED_100		= 0x00000000,
+	GECMR_SPEED_1000	= 0x00000001,
+	RGETH_GECMR_SPEED	= 0x00000030,
+	RGETH_GECMR_SPEED_10	= 0x00000000,
+	RGETH_GECMR_SPEED_100	= 0x00000010,
+	RGETH_GECMR_SPEED_1000	= 0x00000020,
 };
 
 /* The Ethernet AVB descriptor definitions. */
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 04bff44b7660..7f06adbd00e1 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -83,12 +83,24 @@ static int ravb_config(struct net_device *ndev)
 	return error;
 }
 
-static void ravb_rgeth_set_rate(struct net_device *ndev)
+static void ravb_set_rate_rgeth(struct net_device *ndev)
 {
-	/* Place holder */
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	switch (priv->speed) {
+	case 10:                /* 10BASE */
+		ravb_write(ndev, RGETH_GECMR_SPEED_10, GECMR);
+		break;
+	case 100:               /* 100BASE */
+		ravb_write(ndev, RGETH_GECMR_SPEED_100, GECMR);
+		break;
+	case 1000:              /* 1000BASE */
+		ravb_write(ndev, RGETH_GECMR_SPEED_1000, GECMR);
+		break;
+	}
 }
 
-static void ravb_set_rate(struct net_device *ndev)
+static void ravb_set_rate_rcar(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 
@@ -447,12 +459,38 @@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }
 
-static void ravb_rgeth_emac_init(struct net_device *ndev)
+static void ravb_emac_init_rgeth(struct net_device *ndev)
 {
-	/* Place holder */
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	/* Receive frame limit set register */
+	ravb_write(ndev, RGETH_RX_BUFF_MAX + ETH_FCS_LEN, RFLR);
+
+	/* PAUSE prohibition */
+	ravb_write(ndev, ECMR_ZPF | ((priv->duplex > 0) ? ECMR_DM : 0) |
+			 ECMR_TE | ECMR_RE | ECMR_RCPT |
+			 ECMR_TXF | ECMR_RXF | ECMR_PRM, ECMR);
+
+	ravb_set_rate_rgeth(ndev);
+
+	/* Set MAC address */
+	ravb_write(ndev,
+		   (ndev->dev_addr[0] << 24) | (ndev->dev_addr[1] << 16) |
+		   (ndev->dev_addr[2] << 8)  | (ndev->dev_addr[3]), MAHR);
+	ravb_write(ndev, (ndev->dev_addr[4] << 8)  | (ndev->dev_addr[5]), MALR);
+
+	/* E-MAC status register clear */
+	ravb_write(ndev, ECSR_ICD | ECSR_LCHNG | ECSR_PFRI, ECSR);
+	ravb_write(ndev, CSR0_TPE | CSR0_RPE, CSR0);
+
+	/* E-MAC interrupt enable register */
+	ravb_write(ndev, ECSIPR_ICDIP, ECSIPR);
+
+	ravb_write(ndev, ravb_read(ndev, CXR31) & ~CXR31_SEL_LINK1, CXR31);
+	ravb_write(ndev, ravb_read(ndev, CXR31) | CXR31_SEL_LINK0, CXR31);
 }
 
-static void ravb_rcar_emac_init(struct net_device *ndev)
+static void ravb_emac_init_rcar(struct net_device *ndev)
 {
 	/* Receive frame limit set register */
 	ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
@@ -462,7 +500,7 @@ static void ravb_rcar_emac_init(struct net_device *ndev)
 		   (ndev->features & NETIF_F_RXCSUM ? ECMR_RCSC : 0) |
 		   ECMR_TE | ECMR_RE, ECMR);
 
-	ravb_set_rate(ndev);
+	ravb_set_rate_rcar(ndev);
 
 	/* Set MAC address */
 	ravb_write(ndev,
@@ -2110,10 +2148,10 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.rx_ring_format = ravb_rx_ring_format,
 	.alloc_rx_desc = ravb_alloc_rx_desc,
 	.receive = ravb_rcar_rx,
-	.set_rate = ravb_set_rate,
+	.set_rate = ravb_set_rate_rcar,
 	.set_feature = ravb_set_features_rcar,
 	.dmac_init = ravb_dmac_init_rcar,
-	.emac_init = ravb_rcar_emac_init,
+	.emac_init = ravb_emac_init_rcar,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
 	.net_hw_features = NETIF_F_RXCSUM,
@@ -2133,10 +2171,10 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.rx_ring_format = ravb_rx_ring_format,
 	.alloc_rx_desc = ravb_alloc_rx_desc,
 	.receive = ravb_rcar_rx,
-	.set_rate = ravb_set_rate,
+	.set_rate = ravb_set_rate_rcar,
 	.set_feature = ravb_set_features_rcar,
 	.dmac_init = ravb_dmac_init_rcar,
-	.emac_init = ravb_rcar_emac_init,
+	.emac_init = ravb_emac_init_rcar,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
 	.net_hw_features = NETIF_F_RXCSUM,
@@ -2153,10 +2191,10 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.rx_ring_format = ravb_rx_ring_format_rgeth,
 	.alloc_rx_desc = ravb_rgeth_alloc_rx_desc,
 	.receive = ravb_rgeth_rx,
-	.set_rate = ravb_rgeth_set_rate,
+	.set_rate = ravb_set_rate_rgeth,
 	.set_feature = ravb_set_features_rgeth,
 	.dmac_init = ravb_dmac_init_rgeth,
-	.emac_init = ravb_rgeth_emac_init,
+	.emac_init = ravb_emac_init_rgeth,
 	.aligned_tx = 1,
 	.tx_counters = 1,
 	.no_gptp = 1,
-- 
2.17.1

Re: [RFC/PATCH 10/18] ravb: Initialize GbEthernet E-MAC

From: Sergey Shtylyov <hidden>
Date: 2021-09-24 20:44:18

On 9/23/21 5:08 PM, Biju Das wrote:
quoted hunk
Initialize GbEthernet E-MAC found on RZ/G2L SoC.
This patch also renames ravb_set_rate to ravb_set_rate_rcar and
ravb_rcar_emac_init to ravb_emac_init_rcar to be consistent with
the naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 15 ++++--
 drivers/net/ethernet/renesas/ravb_main.c | 64 +++++++++++++++++++-----
 2 files changed, 62 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7f68f9b8349c..7532cb51d7b8 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -204,6 +204,7 @@ enum ravb_reg {
 	TLFRCR	= 0x0758,
 	RFCR	= 0x0760,
 	MAFCR	= 0x0778,
+	CSR0     = 0x0800,	/* Documented for RZ/G2L only */
   Ah, the CSR0 bit *enum* belongs here! :-) 

[...]
quoted hunk
@@ -827,6 +829,7 @@ enum ECSR_BIT {
 	ECSR_MPD	= 0x00000002,
 	ECSR_LCHNG	= 0x00000004,
 	ECSR_PHYI	= 0x00000008,
+	ECSR_PFRI	= 0x00000010,
   It's not documented on gen2, perhaps it just doesn't exist there...

[...]
quoted hunk
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 04bff44b7660..7f06adbd00e1 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted hunk
@@ -447,12 +459,38 @@ static int ravb_ring_init(struct net_device *ndev, int q)
 	return -ENOMEM;
 }
 
-static void ravb_rgeth_emac_init(struct net_device *ndev)
+static void ravb_emac_init_rgeth(struct net_device *ndev)
 {
-	/* Place holder */
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	/* Receive frame limit set register */
+	ravb_write(ndev, RGETH_RX_BUFF_MAX + ETH_FCS_LEN, RFLR);
+
+	/* PAUSE prohibition */
+	ravb_write(ndev, ECMR_ZPF | ((priv->duplex > 0) ? ECMR_DM : 0) |
+			 ECMR_TE | ECMR_RE | ECMR_RCPT |
+			 ECMR_TXF | ECMR_RXF | ECMR_PRM, ECMR);
+
+	ravb_set_rate_rgeth(ndev);
+
+	/* Set MAC address */
+	ravb_write(ndev,
+		   (ndev->dev_addr[0] << 24) | (ndev->dev_addr[1] << 16) |
+		   (ndev->dev_addr[2] << 8)  | (ndev->dev_addr[3]), MAHR);
+	ravb_write(ndev, (ndev->dev_addr[4] << 8)  | (ndev->dev_addr[5]), MALR);
+
+	/* E-MAC status register clear */
+	ravb_write(ndev, ECSR_ICD | ECSR_LCHNG | ECSR_PFRI, ECSR);
+	ravb_write(ndev, CSR0_TPE | CSR0_RPE, CSR0);
+
+	/* E-MAC interrupt enable register */
+	ravb_write(ndev, ECSIPR_ICDIP, ECSIPR);
+
+	ravb_write(ndev, ravb_read(ndev, CXR31) & ~CXR31_SEL_LINK1, CXR31);
+	ravb_write(ndev, ravb_read(ndev, CXR31) | CXR31_SEL_LINK0, CXR31);
   We have ravb_modify() for that, it'll help to avoid the double read/write...

[...]

MBR, Sergey

RE: [RFC/PATCH 10/18] ravb: Initialize GbEthernet E-MAC

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-25 06:39:03

Hi Sergei,

Thanks for the feedback.
Subject: Re: [RFC/PATCH 10/18] ravb: Initialize GbEthernet E-MAC

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
Initialize GbEthernet E-MAC found on RZ/G2L SoC.
This patch also renames ravb_set_rate to ravb_set_rate_rcar and
ravb_rcar_emac_init to ravb_emac_init_rcar to be consistent with the
naming convention used in sh_eth driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 15 ++++--
 drivers/net/ethernet/renesas/ravb_main.c | 64
+++++++++++++++++++-----
 2 files changed, 62 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index 7f68f9b8349c..7532cb51d7b8 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -204,6 +204,7 @@ enum ravb_reg {
 	TLFRCR	= 0x0758,
 	RFCR	= 0x0760,
 	MAFCR	= 0x0778,
+	CSR0     = 0x0800,	/* Documented for RZ/G2L only */
   Ah, the CSR0 bit *enum* belongs here! :-)
Yes, will move enum bits from previous patch
[...]
quoted
@@ -827,6 +829,7 @@ enum ECSR_BIT {
 	ECSR_MPD	= 0x00000002,
 	ECSR_LCHNG	= 0x00000004,
 	ECSR_PHYI	= 0x00000008,
+	ECSR_PFRI	= 0x00000010,
   It's not documented on gen2, perhaps it just doesn't exist there...

[...]
quoted
diff --git a/drivers/net/ethernet/renesas/ravb_main.c
b/drivers/net/ethernet/renesas/ravb_main.c
index 04bff44b7660..7f06adbd00e1 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
quoted
@@ -447,12 +459,38 @@ static int ravb_ring_init(struct net_device *ndev,
int q)
quoted
 	return -ENOMEM;
 }

-static void ravb_rgeth_emac_init(struct net_device *ndev)
+static void ravb_emac_init_rgeth(struct net_device *ndev)
 {
-	/* Place holder */
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	/* Receive frame limit set register */
+	ravb_write(ndev, RGETH_RX_BUFF_MAX + ETH_FCS_LEN, RFLR);
+
+	/* PAUSE prohibition */
+	ravb_write(ndev, ECMR_ZPF | ((priv->duplex > 0) ? ECMR_DM : 0) |
+			 ECMR_TE | ECMR_RE | ECMR_RCPT |
+			 ECMR_TXF | ECMR_RXF | ECMR_PRM, ECMR);
+
+	ravb_set_rate_rgeth(ndev);
+
+	/* Set MAC address */
+	ravb_write(ndev,
+		   (ndev->dev_addr[0] << 24) | (ndev->dev_addr[1] << 16) |
+		   (ndev->dev_addr[2] << 8)  | (ndev->dev_addr[3]), MAHR);
+	ravb_write(ndev, (ndev->dev_addr[4] << 8)  | (ndev->dev_addr[5]),
+MALR);
+
+	/* E-MAC status register clear */
+	ravb_write(ndev, ECSR_ICD | ECSR_LCHNG | ECSR_PFRI, ECSR);
+	ravb_write(ndev, CSR0_TPE | CSR0_RPE, CSR0);
+
+	/* E-MAC interrupt enable register */
+	ravb_write(ndev, ECSIPR_ICDIP, ECSIPR);
+
+	ravb_write(ndev, ravb_read(ndev, CXR31) & ~CXR31_SEL_LINK1, CXR31);
+	ravb_write(ndev, ravb_read(ndev, CXR31) | CXR31_SEL_LINK0, CXR31);
   We have ravb_modify() for that, it'll help to avoid the double
read/write...
OK

Regards,
Biju
[...]

MBR, Sergey

[RFC/PATCH 11/18] ravb: Add rx_2k_buffers to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:09:01

R-Car AVB-DMAC has Maximum 2K size on RZ buffer.
We need to Allow for changing the MTU within the
limit of the maximum size of a descriptor (2048 bytes).

Add a rx_2k_buffers hw feature bit to struct ravb_hw_info
to add this constraint only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7532cb51d7b8..ab4909244276 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1033,6 +1033,7 @@ struct ravb_hw_info {
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
+	unsigned rx_2k_buffers:1;	/* AVB-DMAC has Max 2K buf size on RX */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 7f06adbd00e1..9c0d35f4b221 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2164,6 +2164,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.ccc_gac = 1,
 	.multi_tsrq = 1,
 	.magic_pkt = 1,
+	.rx_2k_buffers = 1,
 };
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
@@ -2184,6 +2185,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.aligned_tx = 1,
 	.multi_tsrq = 1,
 	.magic_pkt = 1,
+	.rx_2k_buffers = 1,
 };
 
 static const struct ravb_hw_info rgeth_hw_info = {
@@ -2417,8 +2419,10 @@ static int ravb_probe(struct platform_device *pdev)
 	}
 	clk_prepare_enable(priv->refclk);
 
-	ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
-	ndev->min_mtu = ETH_MIN_MTU;
+	if (info->rx_2k_buffers) {
+		ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
+		ndev->min_mtu = ETH_MIN_MTU;
+	}
 
 	/* FIXME: R-Car Gen2 has 4byte alignment restriction for tx buffer
 	 * Use two descriptor to handle such situation. First descriptor to
-- 
2.17.1

Re: [RFC/PATCH 11/18] ravb: Add rx_2k_buffers to struct ravb_hw_info

From: Sergey Shtylyov <hidden>
Date: 2021-09-24 19:35:49

On 9/23/21 5:08 PM, Biju Das wrote:
quoted hunk
R-Car AVB-DMAC has Maximum 2K size on RZ buffer.
We need to Allow for changing the MTU within the
limit of the maximum size of a descriptor (2048 bytes).

Add a rx_2k_buffers hw feature bit to struct ravb_hw_info
to add this constraint only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7532cb51d7b8..ab4909244276 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1033,6 +1033,7 @@ struct ravb_hw_info {
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
+	unsigned rx_2k_buffers:1;	/* AVB-DMAC has Max 2K buf size on RX */
   It seems more flexible to specify the buffer size, not just a bit like this...

[...]

MBR, Sergey

RE: [RFC/PATCH 11/18] ravb: Add rx_2k_buffers to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-26 15:48:17

Hi Sergei,
Subject: Re: [RFC/PATCH 11/18] ravb: Add rx_2k_buffers to struct
ravb_hw_info

On 9/23/21 5:08 PM, Biju Das wrote:
quoted
R-Car AVB-DMAC has Maximum 2K size on RZ buffer.
We need to Allow for changing the MTU within the limit of the maximum
size of a descriptor (2048 bytes).

Add a rx_2k_buffers hw feature bit to struct ravb_hw_info to add this
constraint only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h
b/drivers/net/ethernet/renesas/ravb.h
index 7532cb51d7b8..ab4909244276 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1033,6 +1033,7 @@ struct ravb_hw_info {
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet
detection */
quoted
 	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii
selection */
quoted
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
+	unsigned rx_2k_buffers:1;	/* AVB-DMAC has Max 2K buf size on RX
*/

   It seems more flexible to specify the buffer size, not just a bit like
this...
Agreed, will use rx_max_buf_size variable on the next version.

Regards,
Biju

[RFC/PATCH 12/18] ravb: Add timestamp to struct ravb_hw_info

From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-09-23 14:09:04

R-Car AVB-DMAC supports timestamp feature.
Add a timestamp hw feature bit to struct ravb_hw_info
to add this feature only for R-Car.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  2 +
 drivers/net/ethernet/renesas/ravb_main.c | 68 +++++++++++++++---------
 2 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index ab4909244276..2505de5d4a28 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1034,6 +1034,7 @@ struct ravb_hw_info {
 	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
 	unsigned rx_2k_buffers:1;	/* AVB-DMAC has Max 2K buf size on RX */
+	unsigned timestamp:1;		/* AVB-DMAC has timestamp */
 };
 
 struct ravb_private {
@@ -1089,6 +1090,7 @@ struct ravb_private {
 	unsigned int num_tx_desc;	/* TX descriptors per packet */
 
 	int duplex;
+	struct ravb_rx_desc *rgeth_rx_ring[NUM_RX_QUEUE];
 
 	const struct ravb_hw_info *info;
 	struct reset_control *rstc;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9c0d35f4b221..2c375002ebcb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -949,11 +949,14 @@ static bool ravb_queue_interrupt(struct net_device *ndev, int q)
 
 static bool ravb_timestamp_interrupt(struct net_device *ndev)
 {
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	u32 tis = ravb_read(ndev, TIS);
 
 	if (tis & TIS_TFUF) {
 		ravb_write(ndev, ~(TIS_TFUF | TIS_RESERVED), TIS);
-		ravb_get_tx_tstamp(ndev);
+		if (info->timestamp)
+			ravb_get_tx_tstamp(ndev);
 		return true;
 	}
 	return false;
@@ -1071,16 +1074,24 @@ static int ravb_poll(struct napi_struct *napi, int budget)
 	struct net_device *ndev = napi->dev;
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
+	struct ravb_rx_desc *desc;
 	unsigned long flags;
 	int q = napi - priv->napi;
 	int mask = BIT(q);
 	int quota = budget;
+	unsigned int entry;
 
+	if (!info->timestamp) {
+		entry = priv->cur_rx[q] % priv->num_rx_ring[q];
+		desc = &priv->rgeth_rx_ring[q][entry];
+	}
 	/* Processing RX Descriptor Ring */
 	/* Clear RX interrupt */
 	ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
-	if (ravb_rx(ndev, &quota, q))
-		goto out;
+	if (info->timestamp || desc->die_dt != DT_FEMPTY) {
+		if (ravb_rx(ndev, &quota, q))
+			goto out;
+	}
 
 	/* Processing TX Descriptor Ring */
 	spin_lock_irqsave(&priv->lock, flags);
@@ -1689,6 +1700,7 @@ static void ravb_tx_timeout_work(struct work_struct *work)
 static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	unsigned int num_tx_desc = priv->num_tx_desc;
 	u16 q = skb_get_queue_mapping(skb);
 	struct ravb_tstamp_skb *ts_skb;
@@ -1765,28 +1777,30 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	desc->dptr = cpu_to_le32(dma_addr);
 
 	/* TX timestamp required */
-	if (q == RAVB_NC) {
-		ts_skb = kmalloc(sizeof(*ts_skb), GFP_ATOMIC);
-		if (!ts_skb) {
-			if (num_tx_desc > 1) {
-				desc--;
-				dma_unmap_single(ndev->dev.parent, dma_addr,
-						 len, DMA_TO_DEVICE);
+	if (info->timestamp) {
+		if (q == RAVB_NC) {
+			ts_skb = kmalloc(sizeof(*ts_skb), GFP_ATOMIC);
+			if (!ts_skb) {
+				if (num_tx_desc > 1) {
+					desc--;
+					dma_unmap_single(ndev->dev.parent, dma_addr,
+							 len, DMA_TO_DEVICE);
+				}
+				goto unmap;
 			}
-			goto unmap;
+			ts_skb->skb = skb_get(skb);
+			ts_skb->tag = priv->ts_skb_tag++;
+			priv->ts_skb_tag &= 0x3ff;
+			list_add_tail(&ts_skb->list, &priv->ts_skb_list);
+
+			/* TAG and timestamp required flag */
+			skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
+			desc->tagh_tsr = (ts_skb->tag >> 4) | TX_TSR;
+			desc->ds_tagl |= cpu_to_le16(ts_skb->tag << 12);
 		}
-		ts_skb->skb = skb_get(skb);
-		ts_skb->tag = priv->ts_skb_tag++;
-		priv->ts_skb_tag &= 0x3ff;
-		list_add_tail(&ts_skb->list, &priv->ts_skb_list);
 
-		/* TAG and timestamp required flag */
-		skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
-		desc->tagh_tsr = (ts_skb->tag >> 4) | TX_TSR;
-		desc->ds_tagl |= cpu_to_le16(ts_skb->tag << 12);
+		skb_tx_timestamp(skb);
 	}
-
-	skb_tx_timestamp(skb);
 	/* Descriptor type must be set after all the above writes */
 	dma_wmb();
 	if (num_tx_desc > 1) {
@@ -1897,10 +1911,12 @@ static int ravb_close(struct net_device *ndev)
 			   "device will be stopped after h/w processes are done.\n");
 
 	/* Clear the timestamp list */
-	list_for_each_entry_safe(ts_skb, ts_skb2, &priv->ts_skb_list, list) {
-		list_del(&ts_skb->list);
-		kfree_skb(ts_skb->skb);
-		kfree(ts_skb);
+	if (info->timestamp) {
+		list_for_each_entry_safe(ts_skb, ts_skb2, &priv->ts_skb_list, list) {
+			list_del(&ts_skb->list);
+			kfree_skb(ts_skb->skb);
+			kfree(ts_skb);
+		}
 	}
 
 	/* PHY disconnect */
@@ -2165,6 +2181,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.multi_tsrq = 1,
 	.magic_pkt = 1,
 	.rx_2k_buffers = 1,
+	.timestamp = 1,
 };
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
@@ -2186,6 +2203,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.multi_tsrq = 1,
 	.magic_pkt = 1,
 	.rx_2k_buffers = 1,
+	.timestamp = 1,
 };
 
 static const struct ravb_hw_info rgeth_hw_info = {
-- 
2.17.1

29 further messages

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help