Skip to contentSkip to conversation

net: ethernet: ravb: Suspend and resume the transmission flow

net-next Applied Niklas Söderlund 3 participants 6 messages Apr 1 – Apr 12

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

From: Yoshihiro Shimoda <[email protected]>

The current driver does not follow the latest datasheet and does not suspend the flow when stopping DMA and resume it when starting. Update the driver to do so.

[Niklas: Rebase from BSP and reword commit message]
---
 drivers/net/ethernet/renesas/ravb_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ethernet/renesas/ravb_main.c +9 -0
index 2c725824b348..1dbfadb2a881 100644
@@ -694,6 +694,9 @@ static int ravb_dmac_init(struct net_device *ndev)
 	const struct ravb_hw_info *info = priv->info;
 	int error;
 
+	/* Clear transmission suspension */
+	ravb_modify(ndev, CCC, CCC_DTSR, 0);
+
 	/* Set CONFIG mode */
 	error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
 	if (error)
@@ -1103,6 +1106,12 @@ static int ravb_stop_dma(struct net_device *ndev)
 	if (error)
 		return error;
 
+	/* Request for transmission suspension */
+	ravb_modify(ndev, CCC, CCC_DTSR, CCC_DTSR);
+	error = ravb_wait(ndev, CSR, CSR_DTS, CSR_DTS);
+	if (error)
+		netdev_err(ndev, "failed to stop AXI BUS\n");
+
 	/* Stop AVB-DMAC process */
 	return ravb_set_opmode(ndev, CCC_OPC_CONFIG);
 }
Signature · 1 line
2.53.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Wed, 1 Apr 2026 20:36:08 +0200 you wrote:

From: Yoshihiro Shimoda <[email protected]>

The current driver does not follow the latest datasheet and does not suspend the flow when stopping DMA and resume it when starting. Update the driver to do so.

[Niklas: Rebase from BSP and reword commit message]

[...]

Here is the summary with links:
- [net-next] net: ethernet: ravb: Suspend and resume the transmission flow

    https://git.kernel.org/netdev/net-next/c/353d8e7989b6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#2 lore raw
In reply to Niklas Söderlund

Hi Niklas, Shimoda-san,

Quoted 10 lines · Niklas Söderlund

From: Yoshihiro Shimoda <[email protected]>

The current driver does not follow the latest datasheet and does not suspend the flow when stopping DMA and resume it when starting. Update the driver to do so.

[Niklas: Rebase from BSP and reword commit message]

Thanks for your patch, which is now commit 353d8e7989b6babe ("net:
ethernet: ravb: Suspend and resume the transmission flow") in linux-next/master net-next.

Quoted 13 lines
drivers/net/ethernet/renesas/ravb_main.c +3 -0
@@ -694,6 +694,9 @@ static int ravb_dmac_init(struct net_device *ndev)
        const struct ravb_hw_info *info = priv->info;
        int error;
 
+       /* Clear transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, 0);
+
        /* Set CONFIG mode */
        error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
        if (error)

drivers/net/ethernet/renesas/ravb_main.c static int ravb_stop_dma(struct net_device *ndev) · line 1113

Quoted 8 lines
drivers/net/ethernet/renesas/ravb_main.c +5 -0
@@ -1103,6 +1106,12 @@ static int ravb_stop_dma(struct net_device *ndev)
        if (error)
                return error;
 
+       /* Request for transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, CCC_DTSR);
+       error = ravb_wait(ndev, CSR, CSR_DTS, CSR_DTS);
+       if (error)
+               netdev_err(ndev, "failed to stop AXI BUS\n");

This error message is printed during resume from s2idle or s2ram on e.g. Salvator-XS and Gray Hawk Single. Ethernet (nfsroot) still works fine, though.

drivers/net/ethernet/renesas/ravb_main.c static int ravb_stop_dma(struct net_device *ndev) · line 1117

Quoted 4 lines
drivers/net/ethernet/renesas/ravb_main.c +1 -0
+
        /* Stop AVB-DMAC process */
        return ravb_set_opmode(ndev, CCC_OPC_CONFIG);
 }

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#3 lore raw

Hi Geert,

Thanks for your report.

Quoted 35 lines · Geert Uytterhoeven

Hi Niklas, Shimoda-san,

Quoted 10 lines · Niklas Söderlund

From: Yoshihiro Shimoda <[email protected]>

The current driver does not follow the latest datasheet and does not suspend the flow when stopping DMA and resume it when starting. Update the driver to do so.

[Niklas: Rebase from BSP and reword commit message]

Thanks for your patch, which is now commit 353d8e7989b6babe ("net:
ethernet: ravb: Suspend and resume the transmission flow") in linux-next/master net-next.

Quoted 16 lines
drivers/net/ethernet/renesas/ravb_main.c +3 -0
@@ -694,6 +694,9 @@ static int ravb_dmac_init(struct net_device *ndev)
        const struct ravb_hw_info *info = priv->info;
        int error;
 
+       /* Clear transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, 0);
+
        /* Set CONFIG mode */
        error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
        if (error)
@@ -1103,6 +1106,12 @@ static int ravb_stop_dma(struct net_device *ndev)
        if (error)
                return error;
 
Quoted 9 lines

drivers/net/ethernet/renesas/ravb_main.c static int ravb_stop_dma(struct net_device *ndev) · line 1113

Quoted 5 lines
drivers/net/ethernet/renesas/ravb_main.c +5 -0
+       /* Request for transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, CCC_DTSR);
+       error = ravb_wait(ndev, CSR, CSR_DTS, CSR_DTS);
+       if (error)
+               netdev_err(ndev, "failed to stop AXI BUS\n");

This error message is printed during resume from s2idle or s2ram on e.g. Salvator-XS and Gray Hawk Single. Ethernet (nfsroot) still works fine, though.

I was not able to reproduce this on M3N (r8a77965-salvator-xs.dts) nor Sparrow Hawk (r8a779g3-sparrow-hawk.dts). I'm using the following to test, is your test-case different?

  # echo enabled > /sys/class/tty/ttySC0/power/wakeup
  # echo s2idle > /sys/power/mem_sleep
  # echo 0 > /sys/module/printk/parameters/console_suspend
  # echo mem > /sys/power/state

Console log from M3N (console wakeup)

[  149.278623] Freezing user space processes
[  149.287951] Freezing user space processes completed (elapsed 0.005 seconds)
[  149.295439] OOM killer disabled.
[  149.298796] Freezing remaining freezable tasks
[  149.305367] Freezing remaining freezable tasks completed (elapsed 0.002 seconds)
[  149.364876] ravb e6800000.ethernet end0: Link is Down
[  149.701951] usb usb2: root hub lost power or was reset
[  149.708295] usb usb1: root hub lost power or was reset
[  149.793871] usb usb3: root hub lost power or was reset
[  149.799174] usb usb4: root hub lost power or was reset
[  149.931707] Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00: attached PHY driver (mii_bus:phy_addr=e6800000.ethernet-ffffffff:00, irq=170)
[  150.008695] OOM killer enabled.
[  150.012003] Restarting tasks: Starting
[  150.020596] Restarting tasks: Done
[  150.024234] random: crng reseeded on system resumption
[  150.036191] PM: suspend exit
[  150.235966] ata1: link resume succeeded after 1 retries
[  150.344391] ata1: SATA link down (SStatus 0 SControl 300)
[  156.499184] ravb e6800000.ethernet end0: Link is Up - 1Gbps/Full - flow control off

Console log from V4H (console wakeup)

[   64.982935] Filesystems sync: 0.000 seconds
[   64.992414] Freezing user space processes
[   64.996111] Freezing user space processes completed (elapsed 0.002 seconds)
[   64.997280] OOM killer disabled.
[   64.997711] Freezing remaining freezable tasks
[   65.000580] Freezing remaining freezable tasks completed (elapsed 0.002 seconds)
[   65.012959] ravb e6800000.ethernet end0: Link is Down
[   65.167569] Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00: attached PHY driver (mii_bus:phy_addr=e6800000.ethernet-ffffffff:00, irq=108)
[   65.190614] OOM killer enabled.
[   65.191058] Restarting tasks: Starting
[   65.195133] Restarting tasks: Done
[   65.195743] random: crng reseeded on system resumption
[   65.201052] PM: suspend exit
[   71.305027] ravb e6800000.ethernet end0: Link is Up - 1Gbps/Full - flow control off
Quoted 16 lines

drivers/net/ethernet/renesas/ravb_main.c static int ravb_stop_dma(struct net_device *ndev) · line 1117

Quoted 5 lines
drivers/net/ethernet/renesas/ravb_main.c +1 -0
+
        /* Stop AVB-DMAC process */
        return ravb_set_opmode(ndev, CCC_OPC_CONFIG);
 }

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
Signature · 2 lines
Kind Regards,
Niklas Söderlund
#4 lore raw

Hi Niklas,

Quoted 44 lines · Niklas Söderlund
Quoted 33 lines · Geert Uytterhoeven
Quoted 10 lines · Niklas Söderlund

From: Yoshihiro Shimoda <[email protected]>

The current driver does not follow the latest datasheet and does not suspend the flow when stopping DMA and resume it when starting. Update the driver to do so.

[Niklas: Rebase from BSP and reword commit message]

Thanks for your patch, which is now commit 353d8e7989b6babe ("net:
ethernet: ravb: Suspend and resume the transmission flow") in linux-next/master net-next.

Quoted 16 lines
drivers/net/ethernet/renesas/ravb_main.c +3 -0
@@ -694,6 +694,9 @@ static int ravb_dmac_init(struct net_device *ndev)
        const struct ravb_hw_info *info = priv->info;
        int error;
 
+       /* Clear transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, 0);
+
        /* Set CONFIG mode */
        error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
        if (error)
@@ -1103,6 +1106,12 @@ static int ravb_stop_dma(struct net_device *ndev)
        if (error)
                return error;
 
Quoted 9 lines

drivers/net/ethernet/renesas/ravb_main.c static int ravb_stop_dma(struct net_device *ndev) · line 1113

Quoted 5 lines
drivers/net/ethernet/renesas/ravb_main.c +5 -0
+       /* Request for transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, CCC_DTSR);
+       error = ravb_wait(ndev, CSR, CSR_DTS, CSR_DTS);
+       if (error)
+               netdev_err(ndev, "failed to stop AXI BUS\n");

This error message is printed during resume from s2idle or s2ram on e.g. Salvator-XS and Gray Hawk Single. Ethernet (nfsroot) still works fine, though.

Quoted 8 lines

I was not able to reproduce this on M3N (r8a77965-salvator-xs.dts) nor Sparrow Hawk (r8a779g3-sparrow-hawk.dts). I'm using the following to test, is your test-case different?

  # echo enabled > /sys/class/tty/ttySC0/power/wakeup
  # echo s2idle > /sys/power/mem_sleep
  # echo 0 > /sys/module/printk/parameters/console_suspend
  # echo mem > /sys/power/state

Looks good. Major difference seems to be that I use either Wake-on-LAN or gpio-keys wake-up, and I always have WoL enabled for ravb.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#5 lore raw

Hi Geert,

Quoted 52 lines · Geert Uytterhoeven

Hi Niklas,

Quoted 48 lines · Niklas Söderlund
Quoted 33 lines · Geert Uytterhoeven
Quoted 10 lines · Niklas Söderlund

From: Yoshihiro Shimoda <[email protected]>

The current driver does not follow the latest datasheet and does not suspend the flow when stopping DMA and resume it when starting. Update the driver to do so.

[Niklas: Rebase from BSP and reword commit message]

Thanks for your patch, which is now commit 353d8e7989b6babe ("net:
ethernet: ravb: Suspend and resume the transmission flow") in linux-next/master net-next.

Quoted 16 lines
drivers/net/ethernet/renesas/ravb_main.c +3 -0
@@ -694,6 +694,9 @@ static int ravb_dmac_init(struct net_device *ndev)
        const struct ravb_hw_info *info = priv->info;
        int error;
 
+       /* Clear transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, 0);
+
        /* Set CONFIG mode */
        error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
        if (error)
@@ -1103,6 +1106,12 @@ static int ravb_stop_dma(struct net_device *ndev)
        if (error)
                return error;
 
Quoted 9 lines

drivers/net/ethernet/renesas/ravb_main.c static int ravb_stop_dma(struct net_device *ndev) · line 1113

Quoted 5 lines
drivers/net/ethernet/renesas/ravb_main.c +5 -0
+       /* Request for transmission suspension */
+       ravb_modify(ndev, CCC, CCC_DTSR, CCC_DTSR);
+       error = ravb_wait(ndev, CSR, CSR_DTS, CSR_DTS);
+       if (error)
+               netdev_err(ndev, "failed to stop AXI BUS\n");

This error message is printed during resume from s2idle or s2ram on e.g. Salvator-XS and Gray Hawk Single. Ethernet (nfsroot) still works fine, though.

I was not able to reproduce this on M3N (r8a77965-salvator-xs.dts) nor Sparrow Hawk (r8a779g3-sparrow-hawk.dts). I'm using the following to test, is your test-case different?

Quoted 7 lines
Quoted 4 lines
  # echo enabled > /sys/class/tty/ttySC0/power/wakeup
  # echo s2idle > /sys/power/mem_sleep
  # echo 0 > /sys/module/printk/parameters/console_suspend
  # echo mem > /sys/power/state

Looks good. Major difference seems to be that I use either Wake-on-LAN or gpio-keys wake-up, and I always have WoL enabled for ravb.

WoL was indeed the key.

Having iperf3 blasting traffic to the target made no difference and access to URAM is allowed to be suspended and no warning was triggered, however just enabling WoL and no traffic.

    # ethtool -s end0 wol g

And URAM access will not be suspended and reported active when checking DTS in CSR register and this warning will be printed. I will send a patch to ignore the check if WoL is enabled (when net-next open), but still keep the request to stop URAM access. Nice catch!

Quoted 11 lines

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
Signature · 2 lines
Kind Regards,
Niklas Söderlund