Skip to content

Commit 4e44a0b

Browse files
committed
Merge tag 'clk-v5.16-samsung' of https://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk into clk-samsung
Pull Samsung clk driver updates from Sylwester Nawrocki: - Initial clock driver for the Exynos850 SoC - Refactoring of the CPU clock code and conversion of Exynos5433 CPU clock driver to the platform driver - A few conversions to devm_platform_ioremap_resource() - Updates of the Samsung Kconfig help text * tag 'clk-v5.16-samsung' of https://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk: clk: samsung: describe drivers in Kconfig clk: samsung: exynos5433: update apollo and atlas clock probing clk: samsung: add support for CPU clocks clk: samsung: Introduce Exynos850 clock driver dt-bindings: clock: Document Exynos850 CMU bindings dt-bindings: clock: Add bindings definitions for Exynos850 CMU clk: samsung: clk-pll: Implement pll0831x PLL type clk: samsung: clk-pll: Implement pll0822x PLL type clk: samsung: s5pv210-audss: Make use of devm_platform_ioremap_resource() clk: samsung: exynos5433: Make use of devm_platform_ioremap_resource() clk: samsung: exynos4412-isp: Make use of devm_platform_ioremap_resource() clk: samsung: exynos-audss: Make use of devm_platform_ioremap_resource()
2 parents 6880fa6 + 9fe667a commit 4e44a0b

File tree

14 files changed

+1478
-94
lines changed

14 files changed

+1478
-94
lines changed
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
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,exynos850-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Samsung Exynos850 SoC clock controller
8+
9+
maintainers:
10+
- Sam Protsenko <[email protected]>
11+
- Chanwoo Choi <[email protected]>
12+
- Krzysztof Kozlowski <[email protected]>
13+
- Sylwester Nawrocki <[email protected]>
14+
- Tomasz Figa <[email protected]>
15+
16+
description: |
17+
Exynos850 clock controller is comprised of several CMU units, generating
18+
clocks for different domains. Those CMU units are modeled as separate device
19+
tree nodes, and might depend on each other. Root clocks in that clock tree are
20+
two external clocks:: OSCCLK (26 MHz) and RTCCLK (32768 Hz). Those external
21+
clocks must be defined as fixed-rate clocks in dts.
22+
23+
CMU_TOP is a top-level CMU, where all base clocks are prepared using PLLs and
24+
dividers; all other leaf clocks (other CMUs) are usually derived from CMU_TOP.
25+
26+
Each clock is assigned an identifier and client nodes can use this identifier
27+
to specify the clock which they consume. All clocks available for usage
28+
in clock consumer nodes are defined as preprocessor macros in
29+
'dt-bindings/clock/exynos850.h' header.
30+
31+
properties:
32+
compatible:
33+
enum:
34+
- samsung,exynos850-cmu-top
35+
- samsung,exynos850-cmu-core
36+
- samsung,exynos850-cmu-dpu
37+
- samsung,exynos850-cmu-hsi
38+
- samsung,exynos850-cmu-peri
39+
40+
clocks:
41+
minItems: 1
42+
maxItems: 5
43+
44+
clock-names:
45+
minItems: 1
46+
maxItems: 5
47+
48+
"#clock-cells":
49+
const: 1
50+
51+
reg:
52+
maxItems: 1
53+
54+
allOf:
55+
- if:
56+
properties:
57+
compatible:
58+
contains:
59+
const: samsung,exynos850-cmu-top
60+
61+
then:
62+
properties:
63+
clocks:
64+
items:
65+
- description: External reference clock (26 MHz)
66+
67+
clock-names:
68+
items:
69+
- const: oscclk
70+
71+
- if:
72+
properties:
73+
compatible:
74+
contains:
75+
const: samsung,exynos850-cmu-core
76+
77+
then:
78+
properties:
79+
clocks:
80+
items:
81+
- description: External reference clock (26 MHz)
82+
- description: CMU_CORE bus clock (from CMU_TOP)
83+
- description: CCI clock (from CMU_TOP)
84+
- description: eMMC clock (from CMU_TOP)
85+
- description: SSS clock (from CMU_TOP)
86+
87+
clock-names:
88+
items:
89+
- const: oscclk
90+
- const: dout_core_bus
91+
- const: dout_core_cci
92+
- const: dout_core_mmc_embd
93+
- const: dout_core_sss
94+
95+
- if:
96+
properties:
97+
compatible:
98+
contains:
99+
const: samsung,exynos850-cmu-dpu
100+
101+
then:
102+
properties:
103+
clocks:
104+
items:
105+
- description: External reference clock (26 MHz)
106+
- description: DPU clock (from CMU_TOP)
107+
108+
clock-names:
109+
items:
110+
- const: oscclk
111+
- const: dout_dpu
112+
113+
- if:
114+
properties:
115+
compatible:
116+
contains:
117+
const: samsung,exynos850-cmu-hsi
118+
119+
then:
120+
properties:
121+
clocks:
122+
items:
123+
- description: External reference clock (26 MHz)
124+
- description: External RTC clock (32768 Hz)
125+
- description: CMU_HSI bus clock (from CMU_TOP)
126+
- description: SD card clock (from CMU_TOP)
127+
- description: "USB 2.0 DRD clock (from CMU_TOP)"
128+
129+
clock-names:
130+
items:
131+
- const: oscclk
132+
- const: rtcclk
133+
- const: dout_hsi_bus
134+
- const: dout_hsi_mmc_card
135+
- const: dout_hsi_usb20drd
136+
137+
- if:
138+
properties:
139+
compatible:
140+
contains:
141+
const: samsung,exynos850-cmu-peri
142+
143+
then:
144+
properties:
145+
clocks:
146+
items:
147+
- description: External reference clock (26 MHz)
148+
- description: CMU_PERI bus clock (from CMU_TOP)
149+
- description: UART clock (from CMU_TOP)
150+
- description: Parent clock for HSI2C and SPI (from CMU_TOP)
151+
152+
clock-names:
153+
items:
154+
- const: oscclk
155+
- const: dout_peri_bus
156+
- const: dout_peri_uart
157+
- const: dout_peri_ip
158+
159+
required:
160+
- compatible
161+
- "#clock-cells"
162+
- clocks
163+
- clock-names
164+
- reg
165+
166+
additionalProperties: false
167+
168+
examples:
169+
# Clock controller node for CMU_PERI
170+
- |
171+
#include <dt-bindings/clock/exynos850.h>
172+
173+
cmu_peri: clock-controller@10030000 {
174+
compatible = "samsung,exynos850-cmu-peri";
175+
reg = <0x10030000 0x8000>;
176+
#clock-cells = <1>;
177+
178+
clocks = <&oscclk>, <&cmu_top CLK_DOUT_PERI_BUS>,
179+
<&cmu_top CLK_DOUT_PERI_UART>,
180+
<&cmu_top CLK_DOUT_PERI_IP>;
181+
clock-names = "oscclk", "dout_peri_bus",
182+
"dout_peri_uart", "dout_peri_ip";
183+
};
184+
185+
...

drivers/clk/samsung/Kconfig

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ config EXYNOS_5420_COMMON_CLK
6767
depends on COMMON_CLK_SAMSUNG
6868
help
6969
Support for the clock controller present on the Samsung
70-
Exynos5420 SoCs. Choose Y here only if you build for this SoC.
70+
Exynos5420/Exynos5422/Exynos5800 SoCs. Choose Y here only if you
71+
build for this SoC.
7172

7273
config EXYNOS_ARM64_COMMON_CLK
7374
bool "Samsung Exynos ARMv8-family clock controller support" if COMPILE_TEST
@@ -79,38 +80,47 @@ config EXYNOS_AUDSS_CLK_CON
7980
default y if ARCH_EXYNOS
8081
help
8182
Support for the Audio Subsystem CLKCON clock controller present
82-
on some Exynos SoC variants. Choose M or Y here if you want to
83-
use audio devices such as I2S, PCM, etc.
83+
on some Samsung Exynos SoC variants. Choose M or Y here if you want
84+
to use audio devices such as I2S, PCM, etc.
8485

8586
config EXYNOS_CLKOUT
8687
tristate "Samsung Exynos clock output driver"
8788
depends on COMMON_CLK_SAMSUNG
8889
default y if ARCH_EXYNOS
8990
help
90-
Support for the clock output (XCLKOUT) present on some of Exynos SoC
91-
variants. Usually the XCLKOUT is used to monitor the status of the
92-
certains clocks from SoC, but it could also be tied to other devices
93-
as an input clock.
91+
Support for the clock output (XCLKOUT) present on some of Samsung
92+
Exynos SoC variants. Usually the XCLKOUT is used to monitor the
93+
status of the certains clocks from SoC, but it could also be tied to
94+
other devices as an input clock.
9495

9596
# For S3C24XX platforms, select following symbols:
9697
config S3C2410_COMMON_CLK
9798
bool "Samsung S3C2410 clock controller support" if COMPILE_TEST
9899
select COMMON_CLK_SAMSUNG
99100
help
100-
Build the s3c2410 clock driver based on the common clock framework.
101+
Support for the clock controller present on the Samsung
102+
S3C2410/S3C2440/S3C2442 SoCs. Choose Y here only if you build for
103+
this SoC.
101104

102105
config S3C2410_COMMON_DCLK
103106
bool
104107
select COMMON_CLK_SAMSUNG
105108
select REGMAP_MMIO
106109
help
107-
Temporary symbol to build the dclk driver based on the common clock
108-
framework.
110+
Support for the dclk clock controller present on the Samsung
111+
S3C2410/S3C2412/S3C2440/S3C2443 SoCs. Choose Y here only if you build
112+
for this SoC.
109113

110114
config S3C2412_COMMON_CLK
111115
bool "Samsung S3C2412 clock controller support" if COMPILE_TEST
112116
select COMMON_CLK_SAMSUNG
117+
help
118+
Support for the clock controller present on the Samsung S3C2412 SoCs.
119+
Choose Y here only if you build for this SoC.
113120

114121
config S3C2443_COMMON_CLK
115122
bool "Samsung S3C2443 clock controller support" if COMPILE_TEST
116123
select COMMON_CLK_SAMSUNG
124+
help
125+
Support for the clock controller present on the Samsung
126+
S3C2416/S3C2443 SoCs. Choose Y here only if you build for this SoC.

drivers/clk/samsung/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o
1717
obj-$(CONFIG_EXYNOS_AUDSS_CLK_CON) += clk-exynos-audss.o
1818
obj-$(CONFIG_EXYNOS_CLKOUT) += clk-exynos-clkout.o
1919
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7.o
20+
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos850.o
2021
obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
2122
obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o
2223
obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o

drivers/clk/samsung/clk-cpu.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,3 +469,21 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
469469
kfree(cpuclk);
470470
return ret;
471471
}
472+
473+
void __init samsung_clk_register_cpu(struct samsung_clk_provider *ctx,
474+
const struct samsung_cpu_clock *list, unsigned int nr_clk)
475+
{
476+
unsigned int idx;
477+
unsigned int num_cfgs;
478+
struct clk_hw **hws = ctx->clk_data.hws;
479+
480+
for (idx = 0; idx < nr_clk; idx++, list++) {
481+
/* find count of configuration rates in cfg */
482+
for (num_cfgs = 0; list->cfg[num_cfgs].prate != 0; )
483+
num_cfgs++;
484+
485+
exynos_register_cpu_clock(ctx, list->id, list->name, hws[list->parent_id],
486+
hws[list->alt_parent_id], list->offset, list->cfg, num_cfgs,
487+
list->flags);
488+
}
489+
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,14 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
129129
struct clk *pll_ref, *pll_in, *cdclk, *sclk_audio, *sclk_pcm_in;
130130
const struct exynos_audss_clk_drvdata *variant;
131131
struct clk_hw **clk_table;
132-
struct resource *res;
133132
struct device *dev = &pdev->dev;
134133
int i, ret = 0;
135134

136135
variant = of_device_get_match_data(&pdev->dev);
137136
if (!variant)
138137
return -EINVAL;
139138

140-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
141-
reg_base = devm_ioremap_resource(dev, res);
139+
reg_base = devm_platform_ioremap_resource(pdev, 0);
142140
if (IS_ERR(reg_base))
143141
return PTR_ERR(reg_base);
144142

drivers/clk/samsung/clk-exynos4412-isp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ static int __init exynos4x12_isp_clk_probe(struct platform_device *pdev)
110110
struct samsung_clk_provider *ctx;
111111
struct device *dev = &pdev->dev;
112112
struct device_node *np = dev->of_node;
113-
struct resource *res;
114113
void __iomem *reg_base;
115114

116-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
117-
reg_base = devm_ioremap_resource(dev, res);
115+
reg_base = devm_platform_ioremap_resource(pdev, 0);
118116
if (IS_ERR(reg_base))
119117
return PTR_ERR(reg_base);
120118

0 commit comments

Comments
 (0)