]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/clk/meson/clk-pll.c
Merge branches 'clk-debugfs-danger', 'clk-basic-hw', 'clk-renesas', 'clk-amlogic...
[linux.git] / drivers / clk / meson / clk-pll.c
index ddb1e563473953007288b5585359fe991e9fbffe..b17a13e9337c40eb0fe677d6b283f91178ce01f9 100644 (file)
@@ -77,6 +77,15 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw,
        unsigned int m, n, frac;
 
        n = meson_parm_read(clk->map, &pll->n);
+
+       /*
+        * On some HW, N is set to zero on init. This value is invalid as
+        * it would result in a division by zero. The rate can't be
+        * calculated in this case
+        */
+       if (n == 0)
+               return 0;
+
        m = meson_parm_read(clk->map, &pll->m);
 
        frac = MESON_PARM_APPLICABLE(&pll->frac) ?
@@ -277,7 +286,7 @@ static int meson_clk_pll_wait_lock(struct clk_hw *hw)
        return -ETIMEDOUT;
 }
 
-static void meson_clk_pll_init(struct clk_hw *hw)
+static int meson_clk_pll_init(struct clk_hw *hw)
 {
        struct clk_regmap *clk = to_clk_regmap(hw);
        struct meson_clk_pll_data *pll = meson_clk_pll_data(clk);
@@ -288,6 +297,8 @@ static void meson_clk_pll_init(struct clk_hw *hw)
                                       pll->init_count);
                meson_parm_write(clk->map, &pll->rst, 0);
        }
+
+       return 0;
 }
 
 static int meson_clk_pll_is_enabled(struct clk_hw *hw)