netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] ravb: Add MII support for R-Car V4M
@ 2024-06-24 13:25 Geert Uytterhoeven
  2024-06-24 13:25 ` [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2024-06-24 13:25 UTC (permalink / raw)
  To: Sergey Shtylyov, Paul Barker, Niklas Söderlund,
	Claudiu Beznea, Biju Das, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-renesas-soc, Geert Uytterhoeven

	Hi all,

All EtherAVB instances on R-Car Gen3/Gen4 SoCs support the RGMII
interface.  In addition, the first two EtherAVB instances on R-Car V4M
also support the MII interface, but this is not yet supported by the
driver.  This patch series adds support for MII on R-Car Gen4, after the
customary cleanup.

Changes compared to v1[1]:
  - New patch "ravb: Improve ravb_hw_info instance order",
  - Add Reviewed-by,
  - Rename ravb_emac_init_rcar_apsr() to ravb_emac_init_rcar_gen4(),
  - Restrict MII support to R-Car Gen4 by adding a new ravb_hw_info
    instance.

The corresponding pin control support is available in [2].

Compile-tested only, as all AVB interfaces on the Gray Hawk Single
development board are connected to RGMII PHYs.
No regressions on R-Car V4H.

Thanks for your comments!

[1] "[PATCH/RFC] net: ravb: Add MII support for R-Car V4M"
    https://lore.kernel.org/f0ef3e00aec461beb33869ab69ccb44a23d78f51.1718378166.git.geert+renesas@glider.be

[2] "[PATCH/RFC] pinctrl: renesas: r8a779h0: Add AVB MII pins and groups"
    https://lore.kernel.org/4a0a12227f2145ef53b18bc08f45b19dcd745fc6.1718378739.git.geert+renesas@glider.be/

Geert Uytterhoeven (2):
  ravb: Improve ravb_hw_info instance order
  ravb: Add MII support for R-Car V4M

 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 45 +++++++++++++++++++++---
 2 files changed, 41 insertions(+), 5 deletions(-)

-- 
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order
  2024-06-24 13:25 [PATCH net-next v2 0/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
@ 2024-06-24 13:25 ` Geert Uytterhoeven
  2024-06-24 15:42   ` Niklas Söderlund
  2024-06-24 20:11   ` Sergey Shtylyov
  2024-06-24 13:25 ` [PATCH net-next v2 2/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
  2024-06-26  0:10 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
  2 siblings, 2 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2024-06-24 13:25 UTC (permalink / raw)
  To: Sergey Shtylyov, Paul Barker, Niklas Söderlund,
	Claudiu Beznea, Biju Das, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-renesas-soc, Geert Uytterhoeven

Move ravb_gen2_hw_info before ravb_gen3_hw_info to match
ravb_match_table[] order.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - New.
---
 drivers/net/ethernet/renesas/ravb_main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index c1546b916e4ef581..974e0bb9da1947f2 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2652,7 +2652,7 @@ static int ravb_mdio_release(struct ravb_private *priv)
 	return 0;
 }
 
-static const struct ravb_hw_info ravb_gen3_hw_info = {
+static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
 	.set_feature = ravb_set_features_rcar,
@@ -2668,16 +2668,13 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.rx_buffer_size = SZ_2K +
 			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
 	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
-	.internal_delay = 1,
-	.tx_counters = 1,
-	.multi_irqs = 1,
-	.irq_en_dis = 1,
-	.ccc_gac = 1,
+	.aligned_tx = 1,
+	.gptp = 1,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
 
-static const struct ravb_hw_info ravb_gen2_hw_info = {
+static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
 	.set_feature = ravb_set_features_rcar,
@@ -2693,8 +2690,11 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.rx_buffer_size = SZ_2K +
 			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
 	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
-	.aligned_tx = 1,
-	.gptp = 1,
+	.internal_delay = 1,
+	.tx_counters = 1,
+	.multi_irqs = 1,
+	.irq_en_dis = 1,
+	.ccc_gac = 1,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
-- 
2.34.1


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

* [PATCH net-next v2 2/2] ravb: Add MII support for R-Car V4M
  2024-06-24 13:25 [PATCH net-next v2 0/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
  2024-06-24 13:25 ` [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order Geert Uytterhoeven
@ 2024-06-24 13:25 ` Geert Uytterhoeven
  2024-06-24 20:29   ` Sergey Shtylyov
  2024-06-26  0:10 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2024-06-24 13:25 UTC (permalink / raw)
  To: Sergey Shtylyov, Paul Barker, Niklas Söderlund,
	Claudiu Beznea, Biju Das, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-renesas-soc, Geert Uytterhoeven

All EtherAVB instances on R-Car Gen3/Gen4 SoCs support the RGMII
interface.  In addition, the first two EtherAVB instances on R-Car V4M
also support the MII interface, but this is not yet supported by the
driver.

Add support for MII on R-Car Gen4 by adding an R-Car Gen4-specific EMAC
initialization function that selects the MII clock instead of the RGMII
clock when the PHY interface is MII.  Note that all implementations of
EtherAVB on R-Car Gen4 SoCs have the APSR register, but only MII-capable
instances are documented to have the MIISELECT bit, which has a
documented value of zero when reserved.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
v2:
  - Add Reviewed-by,
  - Rename ravb_emac_init_rcar_apsr() to ravb_emac_init_rcar_gen4(),
  - Restrict MII support to R-Car Gen4 by adding a new ravb_hw_info
    instance.
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 37 +++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 6b2444d31fcc3093..9893c91af1050fa1 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -258,6 +258,7 @@ enum APSR_BIT {
 	APSR_CMSW	= 0x00000010,
 	APSR_RDM	= 0x00002000,
 	APSR_TDM	= 0x00004000,
+	APSR_MIISELECT	= 0x01000000,	/* R-Car V4M only */
 };
 
 /* RCR */
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 974e0bb9da1947f2..6605e4f4af538106 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -579,6 +579,16 @@ static void ravb_emac_init_rcar(struct net_device *ndev)
 	ravb_write(ndev, ECSIPR_ICDIP | ECSIPR_MPDIP | ECSIPR_LCHNGIP, ECSIPR);
 }
 
+static void ravb_emac_init_rcar_gen4(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	bool mii = priv->phy_interface == PHY_INTERFACE_MODE_MII;
+
+	ravb_modify(ndev, APSR, APSR_MIISELECT, mii ? APSR_MIISELECT : 0);
+
+	ravb_emac_init_rcar(ndev);
+}
+
 /* E-MAC init function */
 static void ravb_emac_init(struct net_device *ndev)
 {
@@ -2699,6 +2709,31 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.magic_pkt = 1,
 };
 
+static const struct ravb_hw_info ravb_gen4_hw_info = {
+	.receive = ravb_rx_rcar,
+	.set_rate = ravb_set_rate_rcar,
+	.set_feature = ravb_set_features_rcar,
+	.dmac_init = ravb_dmac_init_rcar,
+	.emac_init = ravb_emac_init_rcar_gen4,
+	.gstrings_stats = ravb_gstrings_stats,
+	.gstrings_size = sizeof(ravb_gstrings_stats),
+	.net_hw_features = NETIF_F_RXCSUM,
+	.net_features = NETIF_F_RXCSUM,
+	.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
+	.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+	.rx_max_frame_size = SZ_2K,
+	.rx_buffer_size = SZ_2K +
+			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
+	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
+	.internal_delay = 1,
+	.tx_counters = 1,
+	.multi_irqs = 1,
+	.irq_en_dis = 1,
+	.ccc_gac = 1,
+	.nc_queues = 1,
+	.magic_pkt = 1,
+};
+
 static const struct ravb_hw_info ravb_rzv2m_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
@@ -2751,7 +2786,7 @@ static const struct of_device_id ravb_match_table[] = {
 	{ .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,etheravb-rcar-gen4", .data = &ravb_gen3_hw_info },
+	{ .compatible = "renesas,etheravb-rcar-gen4", .data = &ravb_gen4_hw_info },
 	{ .compatible = "renesas,etheravb-rzv2m", .data = &ravb_rzv2m_hw_info },
 	{ .compatible = "renesas,rzg2l-gbeth", .data = &gbeth_hw_info },
 	{ }
-- 
2.34.1


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

* Re: [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order
  2024-06-24 13:25 ` [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order Geert Uytterhoeven
@ 2024-06-24 15:42   ` Niklas Söderlund
  2024-06-24 20:11   ` Sergey Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Niklas Söderlund @ 2024-06-24 15:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Sergey Shtylyov, Paul Barker, Claudiu Beznea, Biju Das,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-renesas-soc

Hi Geert,

Thanks for your work.

On 2024-06-24 15:25:24 +0200, Geert Uytterhoeven wrote:
> Move ravb_gen2_hw_info before ravb_gen3_hw_info to match
> ravb_match_table[] order.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> v2:
>   - New.
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index c1546b916e4ef581..974e0bb9da1947f2 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2652,7 +2652,7 @@ static int ravb_mdio_release(struct ravb_private *priv)
>  	return 0;
>  }
>  
> -static const struct ravb_hw_info ravb_gen3_hw_info = {
> +static const struct ravb_hw_info ravb_gen2_hw_info = {
>  	.receive = ravb_rx_rcar,
>  	.set_rate = ravb_set_rate_rcar,
>  	.set_feature = ravb_set_features_rcar,
> @@ -2668,16 +2668,13 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
>  	.rx_buffer_size = SZ_2K +
>  			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
>  	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
> -	.internal_delay = 1,
> -	.tx_counters = 1,
> -	.multi_irqs = 1,
> -	.irq_en_dis = 1,
> -	.ccc_gac = 1,
> +	.aligned_tx = 1,
> +	.gptp = 1,
>  	.nc_queues = 1,
>  	.magic_pkt = 1,
>  };
>  
> -static const struct ravb_hw_info ravb_gen2_hw_info = {
> +static const struct ravb_hw_info ravb_gen3_hw_info = {
>  	.receive = ravb_rx_rcar,
>  	.set_rate = ravb_set_rate_rcar,
>  	.set_feature = ravb_set_features_rcar,
> @@ -2693,8 +2690,11 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
>  	.rx_buffer_size = SZ_2K +
>  			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
>  	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
> -	.aligned_tx = 1,
> -	.gptp = 1,
> +	.internal_delay = 1,
> +	.tx_counters = 1,
> +	.multi_irqs = 1,
> +	.irq_en_dis = 1,
> +	.ccc_gac = 1,
>  	.nc_queues = 1,
>  	.magic_pkt = 1,
>  };
> -- 
> 2.34.1
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order
  2024-06-24 13:25 ` [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order Geert Uytterhoeven
  2024-06-24 15:42   ` Niklas Söderlund
@ 2024-06-24 20:11   ` Sergey Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2024-06-24 20:11 UTC (permalink / raw)
  To: Geert Uytterhoeven, Paul Barker, Niklas Söderlund,
	Claudiu Beznea, Biju Das, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-renesas-soc

On 6/24/24 4:25 PM, Geert Uytterhoeven wrote:

> Move ravb_gen2_hw_info before ravb_gen3_hw_info to match
> ravb_match_table[] order.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey

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

* Re: [PATCH net-next v2 2/2] ravb: Add MII support for R-Car V4M
  2024-06-24 13:25 ` [PATCH net-next v2 2/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
@ 2024-06-24 20:29   ` Sergey Shtylyov
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2024-06-24 20:29 UTC (permalink / raw)
  To: Geert Uytterhoeven, Paul Barker, Niklas Söderlund,
	Claudiu Beznea, Biju Das, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-renesas-soc

On 6/24/24 4:25 PM, Geert Uytterhoeven wrote:

> All EtherAVB instances on R-Car Gen3/Gen4 SoCs support the RGMII
> interface.  In addition, the first two EtherAVB instances on R-Car V4M
> also support the MII interface, but this is not yet supported by the
> driver.
> 
> Add support for MII on R-Car Gen4 by adding an R-Car Gen4-specific EMAC
> initialization function that selects the MII clock instead of the RGMII
> clock when the PHY interface is MII.  Note that all implementations of
> EtherAVB on R-Car Gen4 SoCs have the APSR register, but only MII-capable
> instances are documented to have the MIISELECT bit, which has a
> documented value of zero when reserved.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey

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

* Re: [PATCH net-next v2 0/2] ravb: Add MII support for R-Car V4M
  2024-06-24 13:25 [PATCH net-next v2 0/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
  2024-06-24 13:25 ` [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order Geert Uytterhoeven
  2024-06-24 13:25 ` [PATCH net-next v2 2/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
@ 2024-06-26  0:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-26  0:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: s.shtylyov, paul.barker.ct, niklas.soderlund+renesas,
	claudiu.beznea.uj, biju.das.jz, davem, edumazet, kuba, pabeni,
	netdev, linux-renesas-soc

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 24 Jun 2024 15:25:23 +0200 you wrote:
> Hi all,
> 
> All EtherAVB instances on R-Car Gen3/Gen4 SoCs support the RGMII
> interface.  In addition, the first two EtherAVB instances on R-Car V4M
> also support the MII interface, but this is not yet supported by the
> driver.  This patch series adds support for MII on R-Car Gen4, after the
> customary cleanup.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] ravb: Improve ravb_hw_info instance order
    https://git.kernel.org/netdev/net-next/c/8d653d26ffc7
  - [net-next,v2,2/2] ravb: Add MII support for R-Car V4M
    https://git.kernel.org/netdev/net-next/c/6e0713cc8206

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-06-26  0:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 13:25 [PATCH net-next v2 0/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
2024-06-24 13:25 ` [PATCH net-next v2 1/2] ravb: Improve ravb_hw_info instance order Geert Uytterhoeven
2024-06-24 15:42   ` Niklas Söderlund
2024-06-24 20:11   ` Sergey Shtylyov
2024-06-24 13:25 ` [PATCH net-next v2 2/2] ravb: Add MII support for R-Car V4M Geert Uytterhoeven
2024-06-24 20:29   ` Sergey Shtylyov
2024-06-26  0:10 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).