Skip to content

Commit ce68962

Browse files
committed
Merge tag 'samsung-clk-6.10-2' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into clk-samsung
Pull Samsung clk driver updates from Krzysztof Kozlowski: - Allow choice of manual or firmware-driven control over PLLs, needed to fully implement CPU clock controllers on Exynos850 - Correct PLL clock IDs on ExynosAutov9 - Propagate certain clock rates to allow setting proper SPI clock rates on Google GS101 - Add HSI0 and HSI2 clock controllers for Google GS101 - Mark certain Google GS101 clocks critical - Convert old S3C64xx clock controller bindings to DT schema * tag 'samsung-clk-6.10-2' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: clk: samsung: gs101: drop unused HSI2 clock parent data clk: samsung: gs101: mark some apm UASC and XIU clocks critical clk: samsung: gs101: add support for cmu_hsi2 clk: samsung: gs101: add support for cmu_hsi0 dt-bindings: clock: google,gs101-clock: add HSI2 clock management unit dt-bindings: clock: google,gs101-clock: add HSI0 clock management unit clk: samsung: gs101: propagate PERIC1 USI SPI clock rate clk: samsung: gs101: propagate PERIC0 USI SPI clock rate clk: samsung: exynosautov9: fix wrong pll clock id value dt-bindings: clock: samsung,s3c6400-clock: convert to DT Schema clk: samsung: exynos850: Add CMU_CPUCL0 and CMU_CPUCL1 clk: samsung: Implement manual PLL control for ARM64 SoCs
2 parents 4cece76 + 7c18b0a commit ce68962

File tree

9 files changed

+1807
-208
lines changed

9 files changed

+1807
-208
lines changed

Documentation/devicetree/bindings/clock/google,gs101-clock.yaml

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ properties:
3030
- google,gs101-cmu-top
3131
- google,gs101-cmu-apm
3232
- google,gs101-cmu-misc
33+
- google,gs101-cmu-hsi0
34+
- google,gs101-cmu-hsi2
3335
- google,gs101-cmu-peric0
3436
- google,gs101-cmu-peric1
3537

3638
clocks:
3739
minItems: 1
38-
maxItems: 3
40+
maxItems: 5
3941

4042
clock-names:
4143
minItems: 1
42-
maxItems: 3
44+
maxItems: 5
4345

4446
"#clock-cells":
4547
const: 1
@@ -72,6 +74,55 @@ allOf:
7274
items:
7375
- const: oscclk
7476

77+
- if:
78+
properties:
79+
compatible:
80+
contains:
81+
const: google,gs101-cmu-hsi0
82+
83+
then:
84+
properties:
85+
clocks:
86+
items:
87+
- description: External reference clock (24.576 MHz)
88+
- description: HSI0 bus clock (from CMU_TOP)
89+
- description: DPGTC (from CMU_TOP)
90+
- description: USB DRD controller clock (from CMU_TOP)
91+
- description: USB Display Port debug clock (from CMU_TOP)
92+
93+
clock-names:
94+
items:
95+
- const: oscclk
96+
- const: bus
97+
- const: dpgtc
98+
- const: usb31drd
99+
- const: usbdpdbg
100+
101+
- if:
102+
properties:
103+
compatible:
104+
contains:
105+
enum:
106+
- google,gs101-cmu-hsi2
107+
108+
then:
109+
properties:
110+
clocks:
111+
items:
112+
- description: External reference clock (24.576 MHz)
113+
- description: High Speed Interface bus clock (from CMU_TOP)
114+
- description: High Speed Interface pcie clock (from CMU_TOP)
115+
- description: High Speed Interface ufs clock (from CMU_TOP)
116+
- description: High Speed Interface mmc clock (from CMU_TOP)
117+
118+
clock-names:
119+
items:
120+
- const: oscclk
121+
- const: bus
122+
- const: pcie
123+
- const: ufs
124+
- const: mmc
125+
75126
- if:
76127
properties:
77128
compatible:
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/samsung,s3c6400-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Samsung S3C6400 SoC clock controller
8+
9+
maintainers:
10+
- Krzysztof Kozlowski <krzk@kernel.org>
11+
12+
description: |
13+
There are several clocks that are generated outside the SoC. It is expected
14+
that they are defined using standard clock bindings with following
15+
clock-output-names and/or provided as clock inputs to this clock controller:
16+
- "fin_pll" - PLL input clock (xtal/extclk) - required,
17+
- "xusbxti" - USB xtal - required,
18+
- "iiscdclk0" - I2S0 codec clock - optional,
19+
- "iiscdclk1" - I2S1 codec clock - optional,
20+
- "iiscdclk2" - I2S2 codec clock - optional,
21+
- "pcmcdclk0" - PCM0 codec clock - optional,
22+
- "pcmcdclk1" - PCM1 codec clock - optional, only S3C6410.
23+
24+
All available clocks are defined as preprocessor macros in
25+
include/dt-bindings/clock/samsung,s3c64xx-clock.h header.
26+
27+
properties:
28+
compatible:
29+
enum:
30+
- samsung,s3c6400-clock
31+
- samsung,s3c6410-clock
32+
33+
reg:
34+
maxItems: 1
35+
36+
clocks:
37+
maxItems: 1
38+
39+
"#clock-cells":
40+
const: 1
41+
42+
required:
43+
- compatible
44+
- reg
45+
- clocks
46+
- "#clock-cells"
47+
48+
additionalProperties: false
49+
50+
examples:
51+
- |
52+
clock-controller@7e00f000 {
53+
compatible = "samsung,s3c6410-clock";
54+
reg = <0x7e00f000 0x1000>;
55+
#clock-cells = <1>;
56+
clocks = <&fin_pll>;
57+
};

Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt

Lines changed: 0 additions & 76 deletions
This file was deleted.

drivers/clk/samsung/clk-exynos-arm64.c

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,17 @@
1717

1818
#include "clk-exynos-arm64.h"
1919

20+
/* PLL register bits */
21+
#define PLL_CON1_MANUAL BIT(1)
22+
2023
/* Gate register bits */
2124
#define GATE_MANUAL BIT(20)
2225
#define GATE_ENABLE_HWACG BIT(28)
2326

27+
/* PLL_CONx_PLL register offsets range */
28+
#define PLL_CON_OFF_START 0x100
29+
#define PLL_CON_OFF_END 0x600
30+
2431
/* Gate register offsets range */
2532
#define GATE_OFF_START 0x2000
2633
#define GATE_OFF_END 0x2fff
@@ -38,17 +45,36 @@ struct exynos_arm64_cmu_data {
3845
struct samsung_clk_provider *ctx;
3946
};
4047

48+
/* Check if the register offset is a GATE register */
49+
static bool is_gate_reg(unsigned long off)
50+
{
51+
return off >= GATE_OFF_START && off <= GATE_OFF_END;
52+
}
53+
54+
/* Check if the register offset is a PLL_CONx register */
55+
static bool is_pll_conx_reg(unsigned long off)
56+
{
57+
return off >= PLL_CON_OFF_START && off <= PLL_CON_OFF_END;
58+
}
59+
60+
/* Check if the register offset is a PLL_CON1 register */
61+
static bool is_pll_con1_reg(unsigned long off)
62+
{
63+
return is_pll_conx_reg(off) && (off & 0xf) == 0x4 && !(off & 0x10);
64+
}
65+
4166
/**
4267
* exynos_arm64_init_clocks - Set clocks initial configuration
43-
* @np: CMU device tree node with "reg" property (CMU addr)
44-
* @reg_offs: Register offsets array for clocks to init
45-
* @reg_offs_len: Number of register offsets in reg_offs array
68+
* @np: CMU device tree node with "reg" property (CMU addr)
69+
* @cmu: CMU data
4670
*
47-
* Set manual control mode for all gate clocks.
71+
* Set manual control mode for all gate and PLL clocks.
4872
*/
4973
static void __init exynos_arm64_init_clocks(struct device_node *np,
50-
const unsigned long *reg_offs, size_t reg_offs_len)
74+
const struct samsung_cmu_info *cmu)
5175
{
76+
const unsigned long *reg_offs = cmu->clk_regs;
77+
size_t reg_offs_len = cmu->nr_clk_regs;
5278
void __iomem *reg_base;
5379
size_t i;
5480

@@ -60,14 +86,14 @@ static void __init exynos_arm64_init_clocks(struct device_node *np,
6086
void __iomem *reg = reg_base + reg_offs[i];
6187
u32 val;
6288

63-
/* Modify only gate clock registers */
64-
if (reg_offs[i] < GATE_OFF_START || reg_offs[i] > GATE_OFF_END)
65-
continue;
66-
67-
val = readl(reg);
68-
val |= GATE_MANUAL;
69-
val &= ~GATE_ENABLE_HWACG;
70-
writel(val, reg);
89+
if (cmu->manual_plls && is_pll_con1_reg(reg_offs[i])) {
90+
writel(PLL_CON1_MANUAL, reg);
91+
} else if (is_gate_reg(reg_offs[i])) {
92+
val = readl(reg);
93+
val |= GATE_MANUAL;
94+
val &= ~GATE_ENABLE_HWACG;
95+
writel(val, reg);
96+
}
7197
}
7298

7399
iounmap(reg_base);
@@ -177,7 +203,7 @@ void __init exynos_arm64_register_cmu(struct device *dev,
177203
pr_err("%s: could not enable bus clock %s; err = %d\n",
178204
__func__, cmu->clk_name, err);
179205

180-
exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs);
206+
exynos_arm64_init_clocks(np, cmu);
181207
samsung_cmu_register_one(np, cmu);
182208
}
183209

@@ -224,7 +250,7 @@ int __init exynos_arm64_register_cmu_pm(struct platform_device *pdev,
224250
__func__, cmu->clk_name, ret);
225251

226252
if (set_manual)
227-
exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs);
253+
exynos_arm64_init_clocks(np, cmu);
228254

229255
reg_base = devm_platform_ioremap_resource(pdev, 0);
230256
if (IS_ERR(reg_base))

0 commit comments

Comments
 (0)