[PATCH v2 3/8] net: macb: add function to disable all macb clocks

Florian Fainelli f.fainelli at gmail.com
Tue Dec 8 19:29:30 EST 2020


On 12/7/20 4:15 AM, Claudiu Beznea wrote:
> Add function to disable all macb clocks.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea at microchip.com>
> Suggested-by: Andrew Lunn <andrew at lunn.ch>
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 62 ++++++++++++++++----------------
>  1 file changed, 32 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index b23e986ac6dc..6b8e1109dfd3 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -3694,6 +3694,16 @@ static void macb_probe_queues(void __iomem *mem,
>  	*num_queues = hweight32(*queue_mask);
>  }
>  
> +static void macb_clks_disable(struct clk *pclk, struct clk *hclk, struct clk *tx_clk,
> +			      struct clk *rx_clk, struct clk *tsu_clk)
> +{
> +	clk_disable_unprepare(tx_clk);
> +	clk_disable_unprepare(hclk);
> +	clk_disable_unprepare(pclk);
> +	clk_disable_unprepare(rx_clk);
> +	clk_disable_unprepare(tsu_clk);

Looks like you should consider using the CLK bulk API:
clk_bulk_disable_unprepare() and friends.
-- 
Florian



More information about the linux-riscv mailing list