Skip to content

Commit

Permalink
Merge tag 'v6.12-rockchip-clk1' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/mmind/linux-rockchip into clk-rockchip

Pull Rockchip clk driver updates from Heiko Stübner:

 - Get rid of CLK_NR_CLKS defines in Rockchip DT binding headers
 - New clock controller driver for the rk3576
 - Some fixes for rk3228 and rk3588

* tag 'v6.12-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: fix error for unknown clocks
  clk: rockchip: rk3588: drop unused code
  clk: rockchip: Add clock controller for the RK3576
  clk: rockchip: Add new pll type pll_rk3588_ddr
  dt-bindings: clock, reset: Add support for rk3576
  dt-bindings: clock: rockchip,rk3588-cru: drop unneeded assigned-clocks
  clk: rockchip: rk3588: Fix 32k clock name for pmu_24m_32k_100m_src_p
  dt-bindings: clock: rockchip: remove CLK_NR_CLKS and CLKPMU_NR_CLKS
  clk: rockchip: rk3399: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
  clk: rockchip: rk3368: Drop CLK_NR_CLKS usage
  clk: rockchip: rk3328: Drop CLK_NR_CLKS usage
  clk: rockchip: rk3308: Drop CLK_NR_CLKS usage
  clk: rockchip: rk3288: Drop CLK_NR_CLKS usage
  clk: rockchip: rk3228: Drop CLK_NR_CLKS usage
  clk: rockchip: rk3036: Drop CLK_NR_CLKS usage
  clk: rockchip: px30: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
  clk: rockchip: Set parent rate for DCLK_VOP clock on RK3228
  • Loading branch information
bebarino committed Sep 9, 2024
2 parents 8400291 + 12fd64b commit df947ad
Show file tree
Hide file tree
Showing 28 changed files with 3,794 additions and 78 deletions.
56 changes: 56 additions & 0 deletions Documentation/devicetree/bindings/clock/rockchip,rk3576-cru.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/rockchip,rk3576-cru.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip rk3576 Family Clock and Reset Control Module

maintainers:
- Elaine Zhang <[email protected]>
- Heiko Stuebner <[email protected]>
- Detlev Casanova <[email protected]>

description:
The RK3576 clock controller generates the clock and also implements a reset
controller for SoC peripherals. For example it provides SCLK_UART2 and
PCLK_UART2, as well as SRST_P_UART2 and SRST_S_UART2 for the second UART
module.

properties:
compatible:
const: rockchip,rk3576-cru

reg:
maxItems: 1

"#clock-cells":
const: 1

"#reset-cells":
const: 1

clocks:
maxItems: 2

clock-names:
items:
- const: xin24m
- const: xin32k

required:
- compatible
- reg
- "#clock-cells"
- "#reset-cells"

additionalProperties: false

examples:
- |
clock-controller@27200000 {
compatible = "rockchip,rk3576-cru";
reg = <0xfd7c0000 0x5c000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ properties:
- const: xin24m
- const: xin32k

assigned-clocks: true

assigned-clock-rates: true

rockchip,grf:
$ref: /schemas/types.yaml#/definitions/phandle
description: >
Expand Down
7 changes: 7 additions & 0 deletions drivers/clk/rockchip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ config CLK_RK3568
help
Build the driver for RK3568 Clock Driver.

config CLK_RK3576
bool "Rockchip RK3576 clock controller support"
depends on ARM64 || COMPILE_TEST
default y
help
Build the driver for RK3576 Clock Driver.

config CLK_RK3588
bool "Rockchip RK3588 clock controller support"
depends on ARM64 || COMPILE_TEST
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/rockchip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ obj-$(CONFIG_CLK_RK3328) += clk-rk3328.o
obj-$(CONFIG_CLK_RK3368) += clk-rk3368.o
obj-$(CONFIG_CLK_RK3399) += clk-rk3399.o
obj-$(CONFIG_CLK_RK3568) += clk-rk3568.o
obj-$(CONFIG_CLK_RK3576) += clk-rk3576.o rst-rk3576.o
obj-$(CONFIG_CLK_RK3588) += clk-rk3588.o rst-rk3588.o
6 changes: 5 additions & 1 deletion drivers/clk/rockchip/clk-pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,10 @@ static unsigned long rockchip_rk3588_pll_recalc_rate(struct clk_hw *hw, unsigned
}
rate64 = rate64 >> cur.s;

return (unsigned long)rate64;
if (pll->type == pll_rk3588_ddr)
return (unsigned long)rate64 * 2;
else
return (unsigned long)rate64;
}

static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
Expand Down Expand Up @@ -1167,6 +1170,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
break;
case pll_rk3588:
case pll_rk3588_core:
case pll_rk3588_ddr:
if (!pll->rate_table)
init.ops = &rockchip_rk3588_pll_clk_norate_ops;
else
Expand Down
10 changes: 8 additions & 2 deletions drivers/clk/rockchip/clk-px30.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ static const char *const px30_cru_critical_clocks[] __initconst = {
static void __init px30_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -1010,7 +1011,9 @@ static void __init px30_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(px30_clk_branches,
ARRAY_SIZE(px30_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down Expand Up @@ -1043,6 +1046,7 @@ CLK_OF_DECLARE(px30_cru, "rockchip,px30-cru", px30_clk_init);
static void __init px30_pmu_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clkpmu_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -1051,7 +1055,9 @@ static void __init px30_pmu_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
clkpmu_nr_clks = rockchip_clk_find_max_clk_id(px30_clk_pmu_branches,
ARRAY_SIZE(px30_clk_pmu_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clkpmu_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip pmu clk init failed\n", __func__);
return;
Expand Down
5 changes: 4 additions & 1 deletion drivers/clk/rockchip/clk-rk3036.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ static const char *const rk3036_critical_clocks[] __initconst = {
static void __init rk3036_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;
struct clk *clk;

Expand All @@ -452,7 +453,9 @@ static void __init rk3036_clk_init(struct device_node *np)
writel_relaxed(HIWORD_UPDATE(0x2, 0x3, 10),
reg_base + RK2928_CLKSEL_CON(13));

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3036_clk_branches,
ARRAY_SIZE(rk3036_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down
7 changes: 5 additions & 2 deletions drivers/clk/rockchip/clk-rk3228.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
RK2928_CLKSEL_CON(29), 0, 3, DFLAGS),
DIV(0, "sclk_vop_pre", "sclk_vop_src", 0,
RK2928_CLKSEL_CON(27), 8, 8, DFLAGS),
MUX(DCLK_VOP, "dclk_vop", mux_dclk_vop_p, 0,
MUX(DCLK_VOP, "dclk_vop", mux_dclk_vop_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
RK2928_CLKSEL_CON(27), 1, 1, MFLAGS),

FACTOR(0, "xin12m", "xin24m", 0, 1, 2),
Expand Down Expand Up @@ -683,6 +683,7 @@ static const char *const rk3228_critical_clocks[] __initconst = {
static void __init rk3228_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -691,7 +692,9 @@ static void __init rk3228_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3228_clk_branches,
ARRAY_SIZE(rk3228_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down
5 changes: 4 additions & 1 deletion drivers/clk/rockchip/clk-rk3288.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,14 +932,17 @@ static void __init rk3288_common_init(struct device_node *np,
enum rk3288_variant soc)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;

rk3288_cru_base = of_iomap(np, 0);
if (!rk3288_cru_base) {
pr_err("%s: could not map cru region\n", __func__);
return;
}

ctx = rockchip_clk_init(np, rk3288_cru_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3288_clk_branches,
ARRAY_SIZE(rk3288_clk_branches)) + 1;
ctx = rockchip_clk_init(np, rk3288_cru_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(rk3288_cru_base);
Expand Down
5 changes: 4 additions & 1 deletion drivers/clk/rockchip/clk-rk3308.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ static const char *const rk3308_critical_clocks[] __initconst = {
static void __init rk3308_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -925,7 +926,9 @@ static void __init rk3308_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3308_clk_branches,
ARRAY_SIZE(rk3308_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down
5 changes: 4 additions & 1 deletion drivers/clk/rockchip/clk-rk3328.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ static const char *const rk3328_critical_clocks[] __initconst = {
static void __init rk3328_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -889,7 +890,9 @@ static void __init rk3328_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3328_clk_branches,
ARRAY_SIZE(rk3328_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down
5 changes: 4 additions & 1 deletion drivers/clk/rockchip/clk-rk3368.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ static const char *const rk3368_critical_clocks[] __initconst = {
static void __init rk3368_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -874,7 +875,9 @@ static void __init rk3368_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3368_clk_branches,
ARRAY_SIZE(rk3368_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down
10 changes: 8 additions & 2 deletions drivers/clk/rockchip/clk-rk3399.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,7 @@ static const char *const rk3399_pmucru_critical_clocks[] __initconst = {
static void __init rk3399_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clk_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -1539,7 +1540,9 @@ static void __init rk3399_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3399_clk_branches,
ARRAY_SIZE(rk3399_clk_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
iounmap(reg_base);
Expand Down Expand Up @@ -1577,6 +1580,7 @@ CLK_OF_DECLARE(rk3399_cru, "rockchip,rk3399-cru", rk3399_clk_init);
static void __init rk3399_pmu_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
unsigned long clkpmu_nr_clks;
void __iomem *reg_base;

reg_base = of_iomap(np, 0);
Expand All @@ -1585,7 +1589,9 @@ static void __init rk3399_pmu_clk_init(struct device_node *np)
return;
}

ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
clkpmu_nr_clks = rockchip_clk_find_max_clk_id(rk3399_clk_pmu_branches,
ARRAY_SIZE(rk3399_clk_pmu_branches)) + 1;
ctx = rockchip_clk_init(np, reg_base, clkpmu_nr_clks);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip pmu clk init failed\n", __func__);
iounmap(reg_base);
Expand Down
Loading

0 comments on commit df947ad

Please sign in to comment.