clk: rockchip: rk3218: add rkclk_cpuclk_div_setting

fix up the RK816 setting voltage drop make the system crash.
Before adjusting voltage, increase clk_cpu div and reduce CPU frequency
Only support for RK312x chips.

Change-Id: Id327da9590f7d9d383450e79acd1b309e05cd024
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
This commit is contained in:
shengfei Xu
2017-11-28 14:36:24 +08:00
committed by Tao Huang
parent 2793cfa0d0
commit bf09920b43

View File

@@ -16,6 +16,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/rockchip/cpu.h>
#include <linux/syscore_ops.h>
#include <dt-bindings/clock/rk3128-cru.h>
#include "clk.h"
@@ -587,6 +588,15 @@ static const char *const rk3128_critical_clocks[] __initconst = {
"hclk_vio_niu",
};
static void __iomem *rk312x_reg_base;
void rkclk_cpuclk_div_setting(int div)
{
if (cpu_is_rk312x())
writel_relaxed((0x001f0000 | (div - 1)),
rk312x_reg_base + RK2928_CLKSEL_CON(0));
}
static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
@@ -598,6 +608,7 @@ static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device
return ERR_PTR(-ENOMEM);
}
rk312x_reg_base = reg_base;
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);