diff mbox series

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

Message ID 20210923140813.13541-4-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Add Gigabit Ethernet driver support | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count fail Series longer than 15 patches
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 178 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Biju Das Sept. 23, 2021, 2:07 p.m. UTC
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(-)

Comments

Sergey Shtylyov Sept. 23, 2021, 5:41 p.m. UTC | #1
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(-)

[...]
> 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? 

> +{
> +	/* 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?

> +{
> +	/* 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?

> +{
> +	/* 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?

> +{
> +	/* 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...

> +{
> +	/* 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?

[...]
> @@ -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
Biju Das Sept. 23, 2021, 6:42 p.m. UTC | #2
Hi Sergei,

> Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> 
> On 9/23/21 5:07 PM, Biju Das wrote:
> 
> > 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.

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

> 
> > +{
> > +	/* 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? 

Are you ok with this function name right? Since based on previous comment
to trailing part.

> 
> > +{
> > +	/* 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.

> 
> > +{
> > +	/* 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.
> 
> > +{
> > +	/* 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.
> 
> > +{
> > +	/* 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.

> 
> [...]
> > @@ -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...

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
Sergey Shtylyov Sept. 23, 2021, 7:07 p.m. UTC | #3
On 9/23/21 5:07 PM, Biju Das wrote:

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

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

>  	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
Biju Das Sept. 23, 2021, 7:22 p.m. UTC | #4
HI Sergei,

> Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> 
> On 9/23/21 5:07 PM, Biju Das wrote:
> 
> > 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...
> 
> >  	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...
> 
> >  	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?

Rcar gen3 has separate initialization routine, This part is RZ/G2L specific, the buffer size is different.

> 
> > +
> > +	/* 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
Biju Das Sept. 23, 2021, 7:29 p.m. UTC | #5
Hi Sergey,

> Subject: RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> 
> HI Sergei,
> 
> > Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> >
> > On 9/23/21 5:07 PM, Biju Das wrote:
> >
> > > 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.

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

> >
> > >  	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?
> 
> Rcar gen3 has separate initialization routine, This part is RZ/G2L
> specific, the buffer size is different.
> 
> >
> > > +
> > > +	/* 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
Biju Das Sept. 26, 2021, 1:38 p.m. UTC | #6
Hi Sergei,

> Subject: RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> 
> Hi Sergey,
> 
> > Subject: RE: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> >
> > HI Sergei,
> >
> > > Subject: Re: [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac
> > >
> > > On 9/23/21 5:07 PM, Biju Das wrote:
> > >
> > > > 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.
> 
> > >
> > > >  	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.

> 
> > >
> > > >  	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?
> >
> > Rcar gen3 has separate initialization routine, This part is RZ/G2L
> > specific, the buffer size is different.
> >
> > >
> > > > +
> > > > +	/* 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
diff mbox series

Patch

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);