Skip to contentSkip to conversation

net: macb: ensure interface is not suspended on at91rm9200

PATCH Applied Alexandre Belloni 4 participants 4 messages Feb 12, 2020 – Feb 17, 2020

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

PATCH 1/1 net: macb: ensure interface is not suspended on at91rm9200

Because of autosuspend, at91ether_start is called with clocks disabled. Ensure that pm_runtime doesn't suspend the interface as soon as it is opened as there is no pm_runtime support is the other relevant parts of the platform support for at91rm9200.

Fixes d54f89af6cc4 ("net: macb: Add pm runtime support")
---
 drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +5 -1
index 4508f0d150da..def94e91883a 100644
@@ -3790,6 +3790,10 @@ static int at91ether_open(struct net_device *dev)
 	u32 ctl;
 	int ret;
 
+	ret = pm_runtime_get_sync(&lp->pdev->dev);
+	if (ret < 0)
+		return ret;
+
 	/* Clear internal statistics */
 	ctl = macb_readl(lp, NCR);
 	macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
@@ -3854,7 +3858,7 @@ static int at91ether_close(struct net_device *dev)
 			  q->rx_buffers, q->rx_buffers_dma);
 	q->rx_buffers = NULL;
 
-	return 0;
+	return pm_runtime_put(&lp->pdev->dev);
 }
 
 /* Transmit packet */
Signature · 1 line
2.24.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alexandre Belloni

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Because of autosuspend, at91ether_start is called with clocks disabled. Ensure that pm_runtime doesn't suspend the interface as soon as it is opened as there is no pm_runtime support is the other relevant parts of the platform support for at91rm9200.

Fixes d54f89af6cc4 ("net: macb: Add pm runtime support")
Quoted 32 lines
---
 drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +5 -2
index 4508f0d150da..def94e91883a 100644
@@ -3790,6 +3790,10 @@ static int at91ether_open(struct net_device *dev)
        u32 ctl;
        int ret;
 
+       ret = pm_runtime_get_sync(&lp->pdev->dev);
+       if (ret < 0)
+               return ret;
+
        /* Clear internal statistics */
        ctl = macb_readl(lp, NCR);
        macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
@@ -3854,7 +3858,7 @@ static int at91ether_close(struct net_device *dev)
                          q->rx_buffers, q->rx_buffers_dma);
        q->rx_buffers = NULL;
 
-       return 0;
+       return pm_runtime_put(&lp->pdev->dev);
 }
 
 /* Transmit packet */
--

2.24.1

Acked-by on v1 1/1
#2 lore raw
In reply to Alexandre Belloni
Quoted 9 lines · Alexandre Belloni

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Because of autosuspend, at91ether_start is called with clocks disabled. Ensure that pm_runtime doesn't suspend the interface as soon as it is opened as there is no pm_runtime support is the other relevant parts of the platform support for at91rm9200.

Fixes d54f89af6cc4 ("net: macb: Add pm runtime support")
Quoted 31 lines
---
  drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +5 -2
index 4508f0d150da..def94e91883a 100644
@@ -3790,6 +3790,10 @@ static int at91ether_open(struct net_device *dev)
         u32 ctl;
         int ret;
 
+       ret = pm_runtime_get_sync(&lp->pdev->dev);
+       if (ret < 0)
+               return ret;
+
         /* Clear internal statistics */
         ctl = macb_readl(lp, NCR);
         macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
@@ -3854,7 +3858,7 @@ static int at91ether_close(struct net_device *dev)
                           q->rx_buffers, q->rx_buffers_dma);
         q->rx_buffers = NULL;
 
-       return 0;
+       return pm_runtime_put(&lp->pdev->dev);
  }
 
  /* Transmit packet */
--

2.24.1

Signature · 1 line
Nicolas Ferre
maintainer Applied
#3 lore raw
In reply to Alexandre Belloni

From: Alexandre Belloni <[email protected]>
Date: Wed, 12 Feb 2020 17:45:38 +0100

Quoted 7 lines

Because of autosuspend, at91ether_start is called with clocks disabled. Ensure that pm_runtime doesn't suspend the interface as soon as it is opened as there is no pm_runtime support is the other relevant parts of the platform support for at91rm9200.

Fixes d54f89af6cc4 ("net: macb: Add pm runtime support")

Applied, thanks.