Commit 89bf9bb7 authored by Stephen Boyd's avatar Stephen Boyd

Merge tag 'v5.13-rockchip-clocks' of...

Merge tag 'v5.13-rockchip-clocks' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-rockchip

Pull Rockchip clk driver updates from Heiko Stuebner:

 - Support for the clock controller on the new rk3568
 - Some cleanups for rk3399 modularization

* tag 'v5.13-rockchip-clocks' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: drop MODULE_ALIAS from rk3399 clock controller
  clk: rockchip: drop parenthesis from ARM || COMPILE_TEST depends
  clk: rockchip: add clock controller for rk3568
  clk: rockchip: support more core div setting
  dt-binding: clock: Document rockchip, rk3568-cru bindings
  clk: rockchip: add dt-binding header for rk3568
parents a38fd874 40f29839
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/rockchip,rk3568-cru.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROCKCHIP rk3568 Family Clock Control Module Binding
maintainers:
- Elaine Zhang <zhangqing@rock-chips.com>
- Heiko Stuebner <heiko@sntech.de>
description: |
The RK3568 clock controller generates the clock and also implements a
reset controller for SoC peripherals.
(examples: provide SCLK_UART1\PCLK_UART1 and SRST_P_UART1\SRST_S_UART1 for UART module)
Each clock is assigned an identifier and client nodes can use this identifier
to specify the clock which they consume. All available clocks are defined as
preprocessor macros in the dt-bindings/clock/rk3568-cru.h headers and can be
used in device tree sources.
properties:
compatible:
enum:
- rockchip,rk3568-cru
- rockchip,rk3568-pmucru
reg:
maxItems: 1
"#clock-cells":
const: 1
"#reset-cells":
const: 1
required:
- compatible
- reg
- "#clock-cells"
- "#reset-cells"
additionalProperties: false
examples:
# Clock Control Module node:
- |
pmucru: clock-controller@fdd00000 {
compatible = "rockchip,rk3568-pmucru";
reg = <0xfdd00000 0x1000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
- |
cru: clock-controller@fdd20000 {
compatible = "rockchip,rk3568-cru";
reg = <0xfdd20000 0x1000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
...@@ -11,78 +11,85 @@ config COMMON_CLK_ROCKCHIP ...@@ -11,78 +11,85 @@ config COMMON_CLK_ROCKCHIP
if COMMON_CLK_ROCKCHIP if COMMON_CLK_ROCKCHIP
config CLK_PX30 config CLK_PX30
bool "Rockchip PX30 clock controller support" bool "Rockchip PX30 clock controller support"
depends on (ARM64 || COMPILE_TEST) depends on ARM64 || COMPILE_TEST
default y default y
help help
Build the driver for PX30 Clock Driver. Build the driver for PX30 Clock Driver.
config CLK_RV110X config CLK_RV110X
bool "Rockchip RV110x clock controller support" bool "Rockchip RV110x clock controller support"
depends on (ARM || COMPILE_TEST) depends on ARM || COMPILE_TEST
default y default y
help help
Build the driver for RV110x Clock Driver. Build the driver for RV110x Clock Driver.
config CLK_RK3036 config CLK_RK3036
bool "Rockchip RK3036 clock controller support" bool "Rockchip RK3036 clock controller support"
depends on (ARM || COMPILE_TEST) depends on ARM || COMPILE_TEST
default y default y
help help
Build the driver for RK3036 Clock Driver. Build the driver for RK3036 Clock Driver.
config CLK_RK312X config CLK_RK312X
bool "Rockchip RK312x clock controller support" bool "Rockchip RK312x clock controller support"
depends on (ARM || COMPILE_TEST) depends on ARM || COMPILE_TEST
default y default y
help help
Build the driver for RK312x Clock Driver. Build the driver for RK312x Clock Driver.
config CLK_RK3188 config CLK_RK3188
bool "Rockchip RK3188 clock controller support" bool "Rockchip RK3188 clock controller support"
depends on (ARM || COMPILE_TEST) depends on ARM || COMPILE_TEST
default y default y
help help
Build the driver for RK3188 Clock Driver. Build the driver for RK3188 Clock Driver.
config CLK_RK322X config CLK_RK322X
bool "Rockchip RK322x clock controller support" bool "Rockchip RK322x clock controller support"
depends on (ARM || COMPILE_TEST) depends on ARM || COMPILE_TEST
default y default y
help help
Build the driver for RK322x Clock Driver. Build the driver for RK322x Clock Driver.
config CLK_RK3288 config CLK_RK3288
bool "Rockchip RK3288 clock controller support" bool "Rockchip RK3288 clock controller support"
depends on (ARM || COMPILE_TEST) depends on ARM || COMPILE_TEST
default y default y
help help
Build the driver for RK3288 Clock Driver. Build the driver for RK3288 Clock Driver.
config CLK_RK3308 config CLK_RK3308
bool "Rockchip RK3308 clock controller support" bool "Rockchip RK3308 clock controller support"
depends on (ARM64 || COMPILE_TEST) depends on ARM64 || COMPILE_TEST
default y default y
help help
Build the driver for RK3308 Clock Driver. Build the driver for RK3308 Clock Driver.
config CLK_RK3328 config CLK_RK3328
bool "Rockchip RK3328 clock controller support" bool "Rockchip RK3328 clock controller support"
depends on (ARM64 || COMPILE_TEST) depends on ARM64 || COMPILE_TEST
default y default y
help help
Build the driver for RK3328 Clock Driver. Build the driver for RK3328 Clock Driver.
config CLK_RK3368 config CLK_RK3368
bool "Rockchip RK3368 clock controller support" bool "Rockchip RK3368 clock controller support"
depends on (ARM64 || COMPILE_TEST) depends on ARM64 || COMPILE_TEST
default y default y
help help
Build the driver for RK3368 Clock Driver. Build the driver for RK3368 Clock Driver.
config CLK_RK3399 config CLK_RK3399
tristate "Rockchip RK3399 clock controller support" tristate "Rockchip RK3399 clock controller support"
depends on (ARM64 || COMPILE_TEST) depends on ARM64 || COMPILE_TEST
default y default y
help help
Build the driver for RK3399 Clock Driver. Build the driver for RK3399 Clock Driver.
config CLK_RK3568
tristate "Rockchip RK3568 clock controller support"
depends on ARM64 || COMPILE_TEST
default y
help
Build the driver for RK3568 Clock Driver.
endif endif
...@@ -26,3 +26,4 @@ obj-$(CONFIG_CLK_RK3308) += clk-rk3308.o ...@@ -26,3 +26,4 @@ obj-$(CONFIG_CLK_RK3308) += clk-rk3308.o
obj-$(CONFIG_CLK_RK3328) += clk-rk3328.o obj-$(CONFIG_CLK_RK3328) += clk-rk3328.o
obj-$(CONFIG_CLK_RK3368) += clk-rk3368.o obj-$(CONFIG_CLK_RK3368) += clk-rk3368.o
obj-$(CONFIG_CLK_RK3399) += clk-rk3399.o obj-$(CONFIG_CLK_RK3399) += clk-rk3399.o
obj-$(CONFIG_CLK_RK3568) += clk-rk3568.o
...@@ -84,10 +84,10 @@ static unsigned long rockchip_cpuclk_recalc_rate(struct clk_hw *hw, ...@@ -84,10 +84,10 @@ static unsigned long rockchip_cpuclk_recalc_rate(struct clk_hw *hw,
{ {
struct rockchip_cpuclk *cpuclk = to_rockchip_cpuclk_hw(hw); struct rockchip_cpuclk *cpuclk = to_rockchip_cpuclk_hw(hw);
const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data;
u32 clksel0 = readl_relaxed(cpuclk->reg_base + reg_data->core_reg); u32 clksel0 = readl_relaxed(cpuclk->reg_base + reg_data->core_reg[0]);
clksel0 >>= reg_data->div_core_shift; clksel0 >>= reg_data->div_core_shift[0];
clksel0 &= reg_data->div_core_mask; clksel0 &= reg_data->div_core_mask[0];
return parent_rate / (clksel0 + 1); return parent_rate / (clksel0 + 1);
} }
...@@ -120,6 +120,7 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk, ...@@ -120,6 +120,7 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
const struct rockchip_cpuclk_rate_table *rate; const struct rockchip_cpuclk_rate_table *rate;
unsigned long alt_prate, alt_div; unsigned long alt_prate, alt_div;
unsigned long flags; unsigned long flags;
int i = 0;
/* check validity of the new rate */ /* check validity of the new rate */
rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate); rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate);
...@@ -142,10 +143,10 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk, ...@@ -142,10 +143,10 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
if (alt_prate > ndata->old_rate) { if (alt_prate > ndata->old_rate) {
/* calculate dividers */ /* calculate dividers */
alt_div = DIV_ROUND_UP(alt_prate, ndata->old_rate) - 1; alt_div = DIV_ROUND_UP(alt_prate, ndata->old_rate) - 1;
if (alt_div > reg_data->div_core_mask) { if (alt_div > reg_data->div_core_mask[0]) {
pr_warn("%s: limiting alt-divider %lu to %d\n", pr_warn("%s: limiting alt-divider %lu to %d\n",
__func__, alt_div, reg_data->div_core_mask); __func__, alt_div, reg_data->div_core_mask[0]);
alt_div = reg_data->div_core_mask; alt_div = reg_data->div_core_mask[0];
} }
/* /*
...@@ -158,19 +159,17 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk, ...@@ -158,19 +159,17 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
pr_debug("%s: setting div %lu as alt-rate %lu > old-rate %lu\n", pr_debug("%s: setting div %lu as alt-rate %lu > old-rate %lu\n",
__func__, alt_div, alt_prate, ndata->old_rate); __func__, alt_div, alt_prate, ndata->old_rate);
writel(HIWORD_UPDATE(alt_div, reg_data->div_core_mask, for (i = 0; i < reg_data->num_cores; i++) {
reg_data->div_core_shift) | writel(HIWORD_UPDATE(alt_div, reg_data->div_core_mask[i],
HIWORD_UPDATE(reg_data->mux_core_alt, reg_data->div_core_shift[i]),
reg_data->mux_core_mask, cpuclk->reg_base + reg_data->core_reg[i]);
reg_data->mux_core_shift), }
cpuclk->reg_base + reg_data->core_reg); }
} else {
/* select alternate parent */ /* select alternate parent */
writel(HIWORD_UPDATE(reg_data->mux_core_alt, writel(HIWORD_UPDATE(reg_data->mux_core_alt,
reg_data->mux_core_mask, reg_data->mux_core_mask,
reg_data->mux_core_shift), reg_data->mux_core_shift),
cpuclk->reg_base + reg_data->core_reg); cpuclk->reg_base + reg_data->core_reg[0]);
}
spin_unlock_irqrestore(cpuclk->lock, flags); spin_unlock_irqrestore(cpuclk->lock, flags);
return 0; return 0;
...@@ -182,6 +181,7 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk, ...@@ -182,6 +181,7 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk,
const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data;
const struct rockchip_cpuclk_rate_table *rate; const struct rockchip_cpuclk_rate_table *rate;
unsigned long flags; unsigned long flags;
int i = 0;
rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate); rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate);
if (!rate) { if (!rate) {
...@@ -202,12 +202,17 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk, ...@@ -202,12 +202,17 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk,
* primary parent by the extra dividers that were needed for the alt. * primary parent by the extra dividers that were needed for the alt.
*/ */
writel(HIWORD_UPDATE(0, reg_data->div_core_mask, writel(HIWORD_UPDATE(reg_data->mux_core_main,
reg_data->div_core_shift) |
HIWORD_UPDATE(reg_data->mux_core_main,
reg_data->mux_core_mask, reg_data->mux_core_mask,
reg_data->mux_core_shift), reg_data->mux_core_shift),
cpuclk->reg_base + reg_data->core_reg); cpuclk->reg_base + reg_data->core_reg[0]);
/* remove dividers */
for (i = 0; i < reg_data->num_cores; i++) {
writel(HIWORD_UPDATE(0, reg_data->div_core_mask[i],
reg_data->div_core_shift[i]),
cpuclk->reg_base + reg_data->core_reg[i]);
}
if (ndata->old_rate > ndata->new_rate) if (ndata->old_rate > ndata->new_rate)
rockchip_cpuclk_set_dividers(cpuclk, rate); rockchip_cpuclk_set_dividers(cpuclk, rate);
......
...@@ -124,9 +124,10 @@ static struct rockchip_cpuclk_rate_table px30_cpuclk_rates[] __initdata = { ...@@ -124,9 +124,10 @@ static struct rockchip_cpuclk_rate_table px30_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data px30_cpuclk_data = { static const struct rockchip_cpuclk_reg_data px30_cpuclk_data = {
.core_reg = PX30_CLKSEL_CON(0), .core_reg[0] = PX30_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0xf, .div_core_mask[0] = 0xf,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 7, .mux_core_shift = 7,
......
...@@ -102,9 +102,10 @@ static struct rockchip_cpuclk_rate_table rk3036_cpuclk_rates[] __initdata = { ...@@ -102,9 +102,10 @@ static struct rockchip_cpuclk_rate_table rk3036_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3036_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3036_cpuclk_data = {
.core_reg = RK2928_CLKSEL_CON(0), .core_reg[0] = RK2928_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 7, .mux_core_shift = 7,
......
...@@ -117,9 +117,10 @@ static struct rockchip_cpuclk_rate_table rk3128_cpuclk_rates[] __initdata = { ...@@ -117,9 +117,10 @@ static struct rockchip_cpuclk_rate_table rk3128_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3128_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3128_cpuclk_data = {
.core_reg = RK2928_CLKSEL_CON(0), .core_reg[0] = RK2928_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 7, .mux_core_shift = 7,
......
...@@ -145,9 +145,10 @@ static struct rockchip_cpuclk_rate_table rk3066_cpuclk_rates[] __initdata = { ...@@ -145,9 +145,10 @@ static struct rockchip_cpuclk_rate_table rk3066_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3066_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3066_cpuclk_data = {
.core_reg = RK2928_CLKSEL_CON(0), .core_reg[0] = RK2928_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 8, .mux_core_shift = 8,
...@@ -184,9 +185,10 @@ static struct rockchip_cpuclk_rate_table rk3188_cpuclk_rates[] __initdata = { ...@@ -184,9 +185,10 @@ static struct rockchip_cpuclk_rate_table rk3188_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3188_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3188_cpuclk_data = {
.core_reg = RK2928_CLKSEL_CON(0), .core_reg[0] = RK2928_CLKSEL_CON(0),
.div_core_shift = 9, .div_core_shift[0] = 9,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 8, .mux_core_shift = 8,
......
...@@ -119,9 +119,10 @@ static struct rockchip_cpuclk_rate_table rk3228_cpuclk_rates[] __initdata = { ...@@ -119,9 +119,10 @@ static struct rockchip_cpuclk_rate_table rk3228_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3228_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3228_cpuclk_data = {
.core_reg = RK2928_CLKSEL_CON(0), .core_reg[0] = RK2928_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 6, .mux_core_shift = 6,
......
...@@ -179,9 +179,10 @@ static struct rockchip_cpuclk_rate_table rk3288_cpuclk_rates[] __initdata = { ...@@ -179,9 +179,10 @@ static struct rockchip_cpuclk_rate_table rk3288_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3288_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3288_cpuclk_data = {
.core_reg = RK3288_CLKSEL_CON(0), .core_reg[0] = RK3288_CLKSEL_CON(0),
.div_core_shift = 8, .div_core_shift[0] = 8,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 15, .mux_core_shift = 15,
......
...@@ -109,9 +109,10 @@ static struct rockchip_cpuclk_rate_table rk3308_cpuclk_rates[] __initdata = { ...@@ -109,9 +109,10 @@ static struct rockchip_cpuclk_rate_table rk3308_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3308_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3308_cpuclk_data = {
.core_reg = RK3308_CLKSEL_CON(0), .core_reg[0] = RK3308_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0xf, .div_core_mask[0] = 0xf,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 6, .mux_core_shift = 6,
......
...@@ -130,9 +130,10 @@ static struct rockchip_cpuclk_rate_table rk3328_cpuclk_rates[] __initdata = { ...@@ -130,9 +130,10 @@ static struct rockchip_cpuclk_rate_table rk3328_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rk3328_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rk3328_cpuclk_data = {
.core_reg = RK3328_CLKSEL_CON(0), .core_reg[0] = RK3328_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 3, .mux_core_main = 3,
.mux_core_shift = 6, .mux_core_shift = 6,
......
...@@ -154,9 +154,10 @@ static struct clk_div_table div_ddrphy_t[] = { ...@@ -154,9 +154,10 @@ static struct clk_div_table div_ddrphy_t[] = {
#define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK #define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK
static const struct rockchip_cpuclk_reg_data rk3368_cpuclkb_data = { static const struct rockchip_cpuclk_reg_data rk3368_cpuclkb_data = {
.core_reg = RK3368_CLKSEL_CON(0), .core_reg[0] = RK3368_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 7, .mux_core_shift = 7,
...@@ -164,11 +165,12 @@ static const struct rockchip_cpuclk_reg_data rk3368_cpuclkb_data = { ...@@ -164,11 +165,12 @@ static const struct rockchip_cpuclk_reg_data rk3368_cpuclkb_data = {
}; };
static const struct rockchip_cpuclk_reg_data rk3368_cpuclkl_data = { static const struct rockchip_cpuclk_reg_data rk3368_cpuclkl_data = {
.core_reg = RK3368_CLKSEL_CON(2), .core_reg[0] = RK3368_CLKSEL_CON(2),
.div_core_shift = 0, .div_core_shift[0] = 0,
.mux_core_alt = 1, .mux_core_alt = 1,
.num_cores = 1,
.mux_core_main = 0, .mux_core_main = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.mux_core_shift = 7, .mux_core_shift = 7,
.mux_core_mask = 0x1, .mux_core_mask = 0x1,
}; };
......
...@@ -291,9 +291,10 @@ static struct rockchip_clk_branch rk3399_pmuclk_wifi_fracmux __initdata = ...@@ -291,9 +291,10 @@ static struct rockchip_clk_branch rk3399_pmuclk_wifi_fracmux __initdata =
RK3399_PMU_CLKSEL_CON(1), 14, 1, MFLAGS); RK3399_PMU_CLKSEL_CON(1), 14, 1, MFLAGS);
static const struct rockchip_cpuclk_reg_data rk3399_cpuclkl_data = { static const struct rockchip_cpuclk_reg_data rk3399_cpuclkl_data = {
.core_reg = RK3399_CLKSEL_CON(0), .core_reg[0] = RK3399_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 3, .mux_core_alt = 3,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 6, .mux_core_shift = 6,
...@@ -301,9 +302,10 @@ static const struct rockchip_cpuclk_reg_data rk3399_cpuclkl_data = { ...@@ -301,9 +302,10 @@ static const struct rockchip_cpuclk_reg_data rk3399_cpuclkl_data = {
}; };
static const struct rockchip_cpuclk_reg_data rk3399_cpuclkb_data = { static const struct rockchip_cpuclk_reg_data rk3399_cpuclkb_data = {
.core_reg = RK3399_CLKSEL_CON(2), .core_reg[0] = RK3399_CLKSEL_CON(2),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 3, .mux_core_alt = 3,
.mux_core_main = 1, .mux_core_main = 1,
.mux_core_shift = 6, .mux_core_shift = 6,
...@@ -1655,4 +1657,3 @@ builtin_platform_driver_probe(clk_rk3399_driver, clk_rk3399_probe); ...@@ -1655,4 +1657,3 @@ builtin_platform_driver_probe(clk_rk3399_driver, clk_rk3399_probe);
MODULE_DESCRIPTION("Rockchip RK3399 Clock Driver"); MODULE_DESCRIPTION("Rockchip RK3399 Clock Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:clk-rk3399");
This diff is collapsed.
...@@ -106,9 +106,10 @@ static struct rockchip_cpuclk_rate_table rv1108_cpuclk_rates[] __initdata = { ...@@ -106,9 +106,10 @@ static struct rockchip_cpuclk_rate_table rv1108_cpuclk_rates[] __initdata = {
}; };
static const struct rockchip_cpuclk_reg_data rv1108_cpuclk_data = { static const struct rockchip_cpuclk_reg_data rv1108_cpuclk_data = {
.core_reg = RV1108_CLKSEL_CON(0), .core_reg[0] = RV1108_CLKSEL_CON(0),
.div_core_shift = 0, .div_core_shift[0] = 0,
.div_core_mask = 0x1f, .div_core_mask[0] = 0x1f,
.num_cores = 1,
.mux_core_alt = 1, .mux_core_alt = 1,
.mux_core_main = 0, .mux_core_main = 0,
.mux_core_shift = 8, .mux_core_shift = 8,
......
...@@ -188,6 +188,34 @@ struct clk; ...@@ -188,6 +188,34 @@ struct clk;
#define RK3399_PMU_CLKGATE_CON(x) ((x) * 0x4 + 0x100) #define RK3399_PMU_CLKGATE_CON(x) ((x) * 0x4 + 0x100)
#define RK3399_PMU_SOFTRST_CON(x) ((x) * 0x4 + 0x110) #define RK3399_PMU_SOFTRST_CON(x) ((x) * 0x4 + 0x110)
#define RK3568_PLL_CON(x) RK2928_PLL_CON(x)
#define RK3568_MODE_CON0 0xc0
#define RK3568_MISC_CON0 0xc4
#define RK3568_MISC_CON1 0xc8
#define RK3568_MISC_CON2 0xcc
#define RK3568_GLB_CNT_TH 0xd0
#define RK3568_GLB_SRST_FST 0xd4
#define RK3568_GLB_SRST_SND 0xd8
#define RK3568_GLB_RST_CON 0xdc
#define RK3568_GLB_RST_ST 0xe0
#define RK3568_CLKSEL_CON(x) ((x) * 0x4 + 0x100)
#define RK3568_CLKGATE_CON(x) ((x) * 0x4 + 0x300)
#define RK3568_SOFTRST_CON(x) ((x) * 0x4 + 0x400)
#define RK3568_SDMMC0_CON0 0x580
#define RK3568_SDMMC0_CON1 0x584
#define RK3568_SDMMC1_CON0 0x588
#define RK3568_SDMMC1_CON1 0x58c
#define RK3568_SDMMC2_CON0 0x590
#define RK3568_SDMMC2_CON1 0x594
#define RK3568_EMMC_CON0 0x598
#define RK3568_EMMC_CON1 0x59c
#define RK3568_PMU_PLL_CON(x) RK2928_PLL_CON(x)
#define RK3568_PMU_MODE_CON0 0x80
#define RK3568_PMU_CLKSEL_CON(x) ((x) * 0x4 + 0x100)
#define RK3568_PMU_CLKGATE_CON(x) ((x) * 0x4 + 0x180)
#define RK3568_PMU_SOFTRST_CON(x) ((x) * 0x4 + 0x200)
enum rockchip_pll_type { enum rockchip_pll_type {
pll_rk3036, pll_rk3036,
pll_rk3066, pll_rk3066,
...@@ -322,7 +350,8 @@ struct rockchip_cpuclk_clksel { ...@@ -322,7 +350,8 @@ struct rockchip_cpuclk_clksel {
u32 val; u32 val;
}; };
#define ROCKCHIP_CPUCLK_NUM_DIVIDERS 2 #define ROCKCHIP_CPUCLK_NUM_DIVIDERS 5
#define ROCKCHIP_CPUCLK_MAX_CORES 4
struct rockchip_cpuclk_rate_table { struct rockchip_cpuclk_rate_table {
unsigned long prate; unsigned long prate;
struct rockchip_cpuclk_clksel divs[ROCKCHIP_CPUCLK_NUM_DIVIDERS]; struct rockchip_cpuclk_clksel divs[ROCKCHIP_CPUCLK_NUM_DIVIDERS];
...@@ -330,18 +359,19 @@ struct rockchip_cpuclk_rate_table { ...@@ -330,18 +359,19 @@ struct rockchip_cpuclk_rate_table {
/** /**
* struct rockchip_cpuclk_reg_data - register offsets and masks of the cpuclock * struct rockchip_cpuclk_reg_data - register offsets and masks of the cpuclock
* @core_reg: register offset of the core settings register * @core_reg[]: register offset of the cores setting register
* @div_core_shift: core divider offset used to divide the pll value * @div_core_shift[]: cores divider offset used to divide the pll value
* @div_core_mask: core divider mask * @div_core_mask[]: cores divider mask
* @mux_core_alt: mux value to select alternate parent * @num_cores: number of cpu cores
* @mux_core_main: mux value to select main parent of core * @mux_core_main: mux value to select main parent of core
* @mux_core_shift: offset of the core multiplexer * @mux_core_shift: offset of the core multiplexer
* @mux_core_mask: core multiplexer mask * @mux_core_mask: core multiplexer mask
*/ */
struct rockchip_cpuclk_reg_data { struct rockchip_cpuclk_reg_data {
int core_reg; int core_reg[ROCKCHIP_CPUCLK_MAX_CORES];
u8 div_core_shift; u8 div_core_shift[ROCKCHIP_CPUCLK_MAX_CORES];
u32 div_core_mask; u32 div_core_mask[ROCKCHIP_CPUCLK_MAX_CORES];
int num_cores;
u8 mux_core_alt; u8 mux_core_alt;
u8 mux_core_main; u8 mux_core_main;
u8 mux_core_shift; u8 mux_core_shift;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment