提交 30042312 编写于 作者: E Eric Anholt 提交者: Zheng Zengkai

clk: bcm2835: Add support for setting leaf clock rates while running.

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

As long as you wait for !BUSY, you can do glitch-free updates of clock
rate while the clock is running.
Signed-off-by: NEric Anholt <eric@anholt.net>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 88360524
...@@ -1115,15 +1115,19 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, ...@@ -1115,15 +1115,19 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw,
spin_lock(&cprman->regs_lock); spin_lock(&cprman->regs_lock);
/* ctl = cprman_read(cprman, data->ctl_reg);
* Setting up frac support
* /* If the clock is running, we have to pause clock generation while
* In principle it is recommended to stop/start the clock first, * updating the control and div regs. This is glitchless (no clock
* but as we set CLK_SET_RATE_GATE during registration of the * signals generated faster than the rate) but each reg access is two
* clock this requirement should be take care of by the * OSC cycles so the clock will slow down for a moment.
* clk-framework.
*/ */
ctl = cprman_read(cprman, data->ctl_reg) & ~CM_FRAC; if (ctl & CM_ENABLE) {
cprman_write(cprman, data->ctl_reg, ctl & ~CM_ENABLE);
bcm2835_clock_wait_busy(clock);
}
ctl &= ~CM_FRAC;
ctl |= (div & CM_DIV_FRAC_MASK) ? CM_FRAC : 0; ctl |= (div & CM_DIV_FRAC_MASK) ? CM_FRAC : 0;
cprman_write(cprman, data->ctl_reg, ctl); cprman_write(cprman, data->ctl_reg, ctl);
...@@ -1499,7 +1503,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, ...@@ -1499,7 +1503,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
init.ops = &bcm2835_vpu_clock_clk_ops; init.ops = &bcm2835_vpu_clock_clk_ops;
} else { } else {
init.ops = &bcm2835_clock_clk_ops; init.ops = &bcm2835_clock_clk_ops;
init.flags |= CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; init.flags |= CLK_SET_PARENT_GATE;
/* If the clock wasn't actually enabled at boot, it's not /* If the clock wasn't actually enabled at boot, it's not
* critical. * critical.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册