aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bresticker <abrestic@chromium.org>2013-09-25 17:12:51 -0400
committerTomasz Figa <t.figa@samsung.com>2014-01-08 12:02:43 -0500
commit3538a2cf0e04ad69840d74f46f7f8af920d913b5 (patch)
treef01c90bdb68d818038b67d06aee0a86e0c4b0247
parentc08ceea3a9d3276ec464e8b74573b1c58e93db7f (diff)
clk: exynos-audss: add support for Exynos 5420
The AudioSS block on Exynos 5420 has an additional clock gate for the ADMA bus clock. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Acked-by: Mike Turquette <mturquette@linaro.org> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
-rw-r--r--Documentation/devicetree/bindings/clock/clk-exynos-audss.txt7
-rw-r--r--drivers/clk/samsung/clk-exynos-audss.c40
-rw-r--r--include/dt-bindings/clk/exynos-audss-clk.h3
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
49sclk_i2s 7 51sclk_i2s 7
50pcm_bus 8 52pcm_bus 8
51sclk_pcm 9 53sclk_pcm 9
54adma 10 Exynos5420
52 55
53Example 1: An example of a clock controller node using the default input 56Example 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
22enum exynos_audss_clk_type {
23 TYPE_EXYNOS4210,
24 TYPE_EXYNOS5250,
25 TYPE_EXYNOS5420,
26};
27
22static DEFINE_SPINLOCK(lock); 28static DEFINE_SPINLOCK(lock);
23static struct clk **clk_table; 29static struct clk **clk_table;
24static void __iomem *reg_base; 30static 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
68static 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 */
63static int exynos_audss_clk_probe(struct platform_device *pdev) 79static 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
191static 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
197static struct platform_driver exynos_audss_clk_driver = { 223static 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