[PATCH 2/9] can: rcar_canfd: Add Runtime PM support

Biju Das biju.das.jz at bp.renesas.com
Fri Nov 6 00:29:52 PST 2026


Hi Geert,

> -----Original Message-----
> From: linux-arm-kernel <linux-arm-kernel-bounces at lists.infradead.org> On Behalf Of Geert Uytterhoeven
> Sent: 29 October 2026 13:11
> Subject: [PATCH 2/9] can: rcar_canfd: Add Runtime PM support
> 
> On R-Car X5H, the CAN-FD module is part of a power domain.  This means Runtime PM must be used to make
> sure the domain is powered when needed.
> The CAN-FD module is part of a Clock Domain on all supported SoCs.
> Hence remove explicit management of the functional clock, as this is handled automatically by Runtime
> PM.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>

Reviewed-by: Biju Das <biju.das.jz at bp.renesas.com>

Cheers,
Biju
> ---
>  drivers/net/can/rcar/rcar_canfd.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> index 4d805df5ff9e8933..74d9ffd2790587b9 100644
> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
> @@ -37,6 +37,7 @@
>  #include <linux/of.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/reset.h>
>  #include <linux/types.h>
> 
> @@ -2004,9 +2005,9 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
>  	int err;
> 
>  	/* Enable peripheral clock for register access */
> -	err = clk_prepare_enable(gpriv->clkp);
> +	err = pm_runtime_resume_and_get(dev);
>  	if (err) {
> -		dev_err(dev, "failed to enable peripheral clock: %pe\n",
> +		dev_err(dev, "pm_runtime_resume_and_get() failed: %pe\n",
>  			ERR_PTR(err));
>  		return err;
>  	}
> @@ -2016,7 +2017,7 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
>  	if (err) {
>  		dev_err(dev,
>  			"failed to enable RAM clock, error %d\n", err);
> -		goto fail_clk;
> +		goto fail_rpm;
>  	}
> 
>  	err = reset_control_reset(gpriv->rstc1);
> @@ -2074,8 +2075,8 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
>  	reset_control_assert(gpriv->rstc1);
>  fail_ram_clk:
>  	clk_disable_unprepare(gpriv->clk_ram);
> -fail_clk:
> -	clk_disable_unprepare(gpriv->clkp);
> +fail_rpm:
> +	pm_runtime_put(dev);
>  	return err;
>  }
> 
> @@ -2093,7 +2094,7 @@ static void rcar_canfd_global_deinit(struct rcar_canfd_global *gpriv, bool full)
>  	reset_control_assert(gpriv->rstc2);
>  	reset_control_assert(gpriv->rstc1);
>  	clk_disable_unprepare(gpriv->clk_ram);
> -	clk_disable_unprepare(gpriv->clkp);
> +	pm_runtime_put(&gpriv->pdev->dev);
>  }
> 
>  static int rcar_canfd_probe(struct platform_device *pdev) @@ -2254,6 +2255,10 @@ static int
> rcar_canfd_probe(struct platform_device *pdev)
>  		}
>  	}
> 
> +	err = devm_pm_runtime_enable(dev);
> +	if (err)
> +		goto fail_dev;
> +
>  	err = rcar_canfd_global_init(gpriv);
>  	if (err)
>  		goto fail_mode;
> --
> 2.43.0
> 




More information about the linux-arm-kernel mailing list