diff options
-rw-r--r-- | Documentation/devicetree/bindings/clock/clk-exynos-audss.txt | 7 | ||||
-rw-r--r-- | drivers/clk/samsung/clk-exynos-audss.c | 40 | ||||
-rw-r--r-- | include/dt-bindings/clk/exynos-audss-clk.h | 3 |
3 files changed, 40 insertions, 10 deletions
diff --git a/Documentation/devicetree/bindings/clock/clk-exynos-audss.txt b/Documentation/devicetree/bindings/clock/clk-exynos-audss.txt index 85b9e28078c8..180e8835569e 100644 --- a/Documentation/devicetree/bindings/clock/clk-exynos-audss.txt +++ b/Documentation/devicetree/bindings/clock/clk-exynos-audss.txt | |||
@@ -8,8 +8,10 @@ Required Properties: | |||
8 | 8 | ||
9 | - compatible: should be one of the following: | 9 | - compatible: should be one of the following: |
10 | - "samsung,exynos4210-audss-clock" - controller compatible with all Exynos4 SoCs. | 10 | - "samsung,exynos4210-audss-clock" - controller compatible with all Exynos4 SoCs. |
11 | - "samsung,exynos5250-audss-clock" - controller compatible with all Exynos5 SoCs. | 11 | - "samsung,exynos5250-audss-clock" - controller compatible with Exynos5250 |
12 | 12 | SoCs. | |
13 | - "samsung,exynos5420-audss-clock" - controller compatible with Exynos5420 | ||
14 | SoCs. | ||
13 | - reg: physical base address and length of the controller's register set. | 15 | - reg: physical base address and length of the controller's register set. |
14 | 16 | ||
15 | - #clock-cells: should be 1. | 17 | - #clock-cells: should be 1. |
@@ -49,6 +51,7 @@ i2s_bus 6 | |||
49 | sclk_i2s 7 | 51 | sclk_i2s 7 |
50 | pcm_bus 8 | 52 | pcm_bus 8 |
51 | sclk_pcm 9 | 53 | sclk_pcm 9 |
54 | adma 10 Exynos5420 | ||
52 | 55 | ||
53 | Example 1: An example of a clock controller node using the default input | 56 | Example 1: An example of a clock controller node using the default input |
54 | clock names is listed below. | 57 | clock names is listed below. |
diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c index 19a0d874931e..884187fbfe00 100644 --- a/drivers/clk/samsung/clk-exynos-audss.c +++ b/drivers/clk/samsung/clk-exynos-audss.c | |||
@@ -19,6 +19,12 @@ | |||
19 | 19 | ||
20 | #include <dt-bindings/clk/exynos-audss-clk.h> | 20 | #include <dt-bindings/clk/exynos-audss-clk.h> |
21 | 21 | ||
22 | enum exynos_audss_clk_type { | ||
23 | TYPE_EXYNOS4210, | ||
24 | TYPE_EXYNOS5250, | ||
25 | TYPE_EXYNOS5420, | ||
26 | }; | ||
27 | |||
22 | static DEFINE_SPINLOCK(lock); | 28 | static DEFINE_SPINLOCK(lock); |
23 | static struct clk **clk_table; | 29 | static struct clk **clk_table; |
24 | static void __iomem *reg_base; | 30 | static void __iomem *reg_base; |
@@ -59,6 +65,16 @@ static struct syscore_ops exynos_audss_clk_syscore_ops = { | |||
59 | }; | 65 | }; |
60 | #endif /* CONFIG_PM_SLEEP */ | 66 | #endif /* CONFIG_PM_SLEEP */ |
61 | 67 | ||
68 | static const struct of_device_id exynos_audss_clk_of_match[] = { | ||
69 | { .compatible = "samsung,exynos4210-audss-clock", | ||
70 | .data = (void *)TYPE_EXYNOS4210, }, | ||
71 | { .compatible = "samsung,exynos5250-audss-clock", | ||
72 | .data = (void *)TYPE_EXYNOS5250, }, | ||
73 | { .compatible = "samsung,exynos5420-audss-clock", | ||
74 | .data = (void *)TYPE_EXYNOS5420, }, | ||
75 | {}, | ||
76 | }; | ||
77 | |||
62 | /* register exynos_audss clocks */ | 78 | /* register exynos_audss clocks */ |
63 | static int exynos_audss_clk_probe(struct platform_device *pdev) | 79 | static int exynos_audss_clk_probe(struct platform_device *pdev) |
64 | { | 80 | { |
@@ -68,6 +84,13 @@ static int exynos_audss_clk_probe(struct platform_device *pdev) | |||
68 | const char *mout_i2s_p[] = {"mout_audss", "cdclk0", "sclk_audio0"}; | 84 | const char *mout_i2s_p[] = {"mout_audss", "cdclk0", "sclk_audio0"}; |
69 | const char *sclk_pcm_p = "sclk_pcm0"; | 85 | const char *sclk_pcm_p = "sclk_pcm0"; |
70 | struct clk *pll_ref, *pll_in, *cdclk, *sclk_audio, *sclk_pcm_in; | 86 | struct clk *pll_ref, *pll_in, *cdclk, *sclk_audio, *sclk_pcm_in; |
87 | const struct of_device_id *match; | ||
88 | enum exynos_audss_clk_type variant; | ||
89 | |||
90 | match = of_match_node(exynos_audss_clk_of_match, pdev->dev.of_node); | ||
91 | if (!match) | ||
92 | return -EINVAL; | ||
93 | variant = (enum exynos_audss_clk_type)match->data; | ||
71 | 94 | ||
72 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 95 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
73 | reg_base = devm_ioremap_resource(&pdev->dev, res); | 96 | reg_base = devm_ioremap_resource(&pdev->dev, res); |
@@ -83,7 +106,10 @@ static int exynos_audss_clk_probe(struct platform_device *pdev) | |||
83 | return -ENOMEM; | 106 | return -ENOMEM; |
84 | 107 | ||
85 | clk_data.clks = clk_table; | 108 | clk_data.clks = clk_table; |
86 | clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS; | 109 | if (variant == TYPE_EXYNOS5420) |
110 | clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS; | ||
111 | else | ||
112 | clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS - 1; | ||
87 | 113 | ||
88 | pll_ref = devm_clk_get(&pdev->dev, "pll_ref"); | 114 | pll_ref = devm_clk_get(&pdev->dev, "pll_ref"); |
89 | pll_in = devm_clk_get(&pdev->dev, "pll_in"); | 115 | pll_in = devm_clk_get(&pdev->dev, "pll_in"); |
@@ -142,6 +168,12 @@ static int exynos_audss_clk_probe(struct platform_device *pdev) | |||
142 | sclk_pcm_p, CLK_SET_RATE_PARENT, | 168 | sclk_pcm_p, CLK_SET_RATE_PARENT, |
143 | reg_base + ASS_CLK_GATE, 5, 0, &lock); | 169 | reg_base + ASS_CLK_GATE, 5, 0, &lock); |
144 | 170 | ||
171 | if (variant == TYPE_EXYNOS5420) { | ||
172 | clk_table[EXYNOS_ADMA] = clk_register_gate(NULL, "adma", | ||
173 | "dout_srp", CLK_SET_RATE_PARENT, | ||
174 | reg_base + ASS_CLK_GATE, 9, 0, &lock); | ||
175 | } | ||
176 | |||
145 | for (i = 0; i < clk_data.clk_num; i++) { | 177 | for (i = 0; i < clk_data.clk_num; i++) { |
146 | if (IS_ERR(clk_table[i])) { | 178 | if (IS_ERR(clk_table[i])) { |
147 | dev_err(&pdev->dev, "failed to register clock %d\n", i); | 179 | dev_err(&pdev->dev, "failed to register clock %d\n", i); |
@@ -188,12 +220,6 @@ static int exynos_audss_clk_remove(struct platform_device *pdev) | |||
188 | return 0; | 220 | return 0; |
189 | } | 221 | } |
190 | 222 | ||
191 | static const struct of_device_id exynos_audss_clk_of_match[] = { | ||
192 | { .compatible = "samsung,exynos4210-audss-clock", }, | ||
193 | { .compatible = "samsung,exynos5250-audss-clock", }, | ||
194 | {}, | ||
195 | }; | ||
196 | |||
197 | static struct platform_driver exynos_audss_clk_driver = { | 223 | static struct platform_driver exynos_audss_clk_driver = { |
198 | .driver = { | 224 | .driver = { |
199 | .name = "exynos-audss-clk", | 225 | .name = "exynos-audss-clk", |
diff --git a/include/dt-bindings/clk/exynos-audss-clk.h b/include/dt-bindings/clk/exynos-audss-clk.h index 8279f427c60f..0ae6f5a75d2a 100644 --- a/include/dt-bindings/clk/exynos-audss-clk.h +++ b/include/dt-bindings/clk/exynos-audss-clk.h | |||
@@ -19,7 +19,8 @@ | |||
19 | #define EXYNOS_SCLK_I2S 7 | 19 | #define EXYNOS_SCLK_I2S 7 |
20 | #define EXYNOS_PCM_BUS 8 | 20 | #define EXYNOS_PCM_BUS 8 |
21 | #define EXYNOS_SCLK_PCM 9 | 21 | #define EXYNOS_SCLK_PCM 9 |
22 | #define EXYNOS_ADMA 10 | ||
22 | 23 | ||
23 | #define EXYNOS_AUDSS_MAX_CLKS 10 | 24 | #define EXYNOS_AUDSS_MAX_CLKS 11 |
24 | 25 | ||
25 | #endif | 26 | #endif |