[net-next,v3,11/19] net: ravb: Move DBAT configuration to the driver's ndo_open API

Message ID 20240105082339.1468817-12-claudiu.beznea.uj@bp.renesas.com
State New
Headers
Series net: ravb: Add suspend to RAM and runtime PM support for RZ/G3S |

Commit Message

claudiu beznea Jan. 5, 2024, 8:23 a.m. UTC
  From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

DBAT setup was done in the driver's probe API. As some IP variants switch
to reset mode (and thus registers content is lost) when setting clocks
(due to module standby functionality) to be able to implement runtime PM
move the DBAT configuration in the driver's ndo_open API.

This commit prepares the code for the addition of runtime PM.

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v3:
- collected tags

Changes in v2:
- none; this patch is new


 drivers/net/ethernet/renesas/ravb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Sergey Shtylyov Jan. 6, 2024, 8:34 p.m. UTC | #1
On 1/5/24 11:23 AM, Claudiu wrote:

> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> DBAT setup was done in the driver's probe API. As some IP variants switch
> to reset mode (and thus registers content is lost) when setting clocks
> (due to module standby functionality) to be able to implement runtime PM
> move the DBAT configuration in the driver's ndo_open API.
> 
> This commit prepares the code for the addition of runtime PM.
> 
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
[...]

> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 946abd7606ca..dbc26c3e95ec 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1826,6 +1826,7 @@ static int ravb_open(struct net_device *ndev)
>  		napi_enable(&priv->napi[RAVB_NC]);
>  
>  	ravb_set_delay_mode(ndev);
> +	ravb_write(ndev, priv->desc_bat_dma, DBAT);

   Please do consider moving this to ravb_dmac_init(), at least in
the future...

>  
>  	/* Device init */
>  	error = ravb_dmac_init(ndev);

MBR, Sergey
  

Patch

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 946abd7606ca..dbc26c3e95ec 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1826,6 +1826,7 @@  static int ravb_open(struct net_device *ndev)
 		napi_enable(&priv->napi[RAVB_NC]);
 
 	ravb_set_delay_mode(ndev);
+	ravb_write(ndev, priv->desc_bat_dma, DBAT);
 
 	/* Device init */
 	error = ravb_dmac_init(ndev);
@@ -2769,7 +2770,6 @@  static int ravb_probe(struct platform_device *pdev)
 	}
 	for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++)
 		priv->desc_bat[q].die_dt = DT_EOS;
-	ravb_write(ndev, priv->desc_bat_dma, DBAT);
 
 	/* Initialise HW timestamp list */
 	INIT_LIST_HEAD(&priv->ts_skb_list);