@@ -364,6 +364,7 @@ struct bcm2835_cprman {
void __iomem *regs;
spinlock_t regs_lock;
const char *osc_name;
+ int func_code;
struct clk_onecell_data onecell;
struct clk *clks[];
@@ -1222,8 +1223,13 @@ static void bcm2835_pll_off(struct clk_hw *hw)
struct bcm2835_cprman *cprman = pll->cprman;
const struct bcm2835_pll_data *data = pll->data;
+ if (!(cprman_read(cprman, CM_LOCK) & data->lock_mask))
+ pr_warn("%s: PLL still locked from %d\n", __func__, cprman->func_code);
+
cprman_write(cprman, data->cm_ctrl_reg, CM_PLL_ANARST);
cprman_write(cprman, data->a2w_ctrl_reg, A2W_PLL_CTRL_PWRDN);
+
+ cprman->func_code = 1;
}
static int bcm2835_pll_on(struct clk_hw *hw)
@@ -1233,10 +1239,15 @@ static int bcm2835_pll_on(struct clk_hw *hw)
const struct bcm2835_pll_data *data = pll->data;
ktime_t timeout;
+ if (!(cprman_read(cprman, CM_LOCK) & data->lock_mask))
+ pr_warn("%s: PLL still locked from %d\n", __func__, cprman->func_code);
+
/* Take the PLL out of reset. */
cprman_write(cprman, data->cm_ctrl_reg,
cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST);
+ cprman->func_code = 2;
+
/* Wait for the PLL to lock. */
timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
while (!(cprman_read(cprman, CM_LOCK) & data->lock_mask)) {
@@ -1267,6 +1278,8 @@ bcm2835_pll_write_ana(struct bcm2835_cprman *cprman, u32
ana_reg_base, u32 *ana)
*/
for (i = 3; i >= 0; i--)
cprman_write(cprman, ana_reg_base + i * 4, ana[i]);
+
+ cprman->func_code = 3;
}