clk: imx: pllv3: add disable() support
authorGiulio Benetti <giulio.benetti@benettiengineering.com>
Fri, 10 Jan 2020 14:46:56 +0000 (15:46 +0100)
committerStefano Babic <sbabic@denx.de>
Tue, 14 Jan 2020 21:53:59 +0000 (22:53 +0100)
Add disable() support.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
drivers/clk/imx/clk-pllv3.c

index d8cbe3dd4e761d49c7c9af7433df4a888c15ef5e..9b37cd9cd9d5489f562306257f5f085a39933a98 100644 (file)
@@ -54,9 +54,25 @@ static int clk_pllv3_generic_enable(struct clk *clk)
        return 0;
 }
 
+static int clk_pllv3_generic_disable(struct clk *clk)
+{
+       struct clk_pllv3 *pll = to_clk_pllv3(clk);
+       u32 val;
+
+       val = readl(pll->base);
+       if (pll->powerup_set)
+               val &= ~pll->power_bit;
+       else
+               val |= pll->power_bit;
+       writel(val, pll->base);
+
+       return 0;
+}
+
 static const struct clk_ops clk_pllv3_generic_ops = {
        .get_rate       = clk_pllv3_generic_get_rate,
        .enable         = clk_pllv3_generic_enable,
+       .disable        = clk_pllv3_generic_disable,
 };
 
 struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,