diff options
author | John Crispin <blogic@openwrt.org> | 2013-01-19 03:54:24 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-02-16 18:15:17 -0500 |
commit | 740c606e8e79c3e3800afbc32b4e6123da403d6c (patch) | |
tree | d8fad6b56dcdcdfba522011bab2e114d221ba6a3 /arch/mips/lantiq/xway | |
parent | 3d18c17e4f1699c3a4f47d2483c5d4c3ab3a242b (diff) |
MIPS: lantiq: adds static clock for PP32
The Lantiq DSL SoCs have an internal networking processor. Add code to read
the static clock rate.
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/4815/
Diffstat (limited to 'arch/mips/lantiq/xway')
-rw-r--r-- | arch/mips/lantiq/xway/clk.c | 43 | ||||
-rw-r--r-- | arch/mips/lantiq/xway/sysctrl.c | 12 |
2 files changed, 50 insertions, 5 deletions
diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c index 9aa17f79a742..1ab576dc9bd1 100644 --- a/arch/mips/lantiq/xway/clk.c +++ b/arch/mips/lantiq/xway/clk.c | |||
@@ -53,6 +53,29 @@ unsigned long ltq_danube_cpu_hz(void) | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | unsigned long ltq_danube_pp32_hz(void) | ||
57 | { | ||
58 | unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 7) & 3; | ||
59 | unsigned long clk; | ||
60 | |||
61 | switch (clksys) { | ||
62 | case 1: | ||
63 | clk = CLOCK_240M; | ||
64 | break; | ||
65 | case 2: | ||
66 | clk = CLOCK_222M; | ||
67 | break; | ||
68 | case 3: | ||
69 | clk = CLOCK_133M; | ||
70 | break; | ||
71 | default: | ||
72 | clk = CLOCK_266M; | ||
73 | break; | ||
74 | } | ||
75 | |||
76 | return clk; | ||
77 | } | ||
78 | |||
56 | unsigned long ltq_ar9_sys_hz(void) | 79 | unsigned long ltq_ar9_sys_hz(void) |
57 | { | 80 | { |
58 | if (((ltq_cgu_r32(CGU_SYS) >> 3) & 0x3) == 0x2) | 81 | if (((ltq_cgu_r32(CGU_SYS) >> 3) & 0x3) == 0x2) |
@@ -149,3 +172,23 @@ unsigned long ltq_vr9_fpi_hz(void) | |||
149 | 172 | ||
150 | return clk; | 173 | return clk; |
151 | } | 174 | } |
175 | |||
176 | unsigned long ltq_vr9_pp32_hz(void) | ||
177 | { | ||
178 | unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 16) & 3; | ||
179 | unsigned long clk; | ||
180 | |||
181 | switch (clksys) { | ||
182 | case 1: | ||
183 | clk = CLOCK_450M; | ||
184 | break; | ||
185 | case 2: | ||
186 | clk = CLOCK_300M; | ||
187 | break; | ||
188 | default: | ||
189 | clk = CLOCK_500M; | ||
190 | break; | ||
191 | } | ||
192 | |||
193 | return clk; | ||
194 | } | ||
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c index 1aaa726aad47..3390fcd6ee56 100644 --- a/arch/mips/lantiq/xway/sysctrl.c +++ b/arch/mips/lantiq/xway/sysctrl.c | |||
@@ -356,14 +356,16 @@ void __init ltq_soc_init(void) | |||
356 | 356 | ||
357 | if (of_machine_is_compatible("lantiq,ase")) { | 357 | if (of_machine_is_compatible("lantiq,ase")) { |
358 | if (ltq_cgu_r32(CGU_SYS) & (1 << 5)) | 358 | if (ltq_cgu_r32(CGU_SYS) & (1 << 5)) |
359 | clkdev_add_static(CLOCK_266M, CLOCK_133M, CLOCK_133M); | 359 | clkdev_add_static(CLOCK_266M, CLOCK_133M, |
360 | CLOCK_133M, CLOCK_266M); | ||
360 | else | 361 | else |
361 | clkdev_add_static(CLOCK_133M, CLOCK_133M, CLOCK_133M); | 362 | clkdev_add_static(CLOCK_133M, CLOCK_133M, |
363 | CLOCK_133M, CLOCK_133M); | ||
362 | clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY), | 364 | clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY), |
363 | clkdev_add_pmu("1e180000.etop", "ephy", 0, PMU_EPHY); | 365 | clkdev_add_pmu("1e180000.etop", "ephy", 0, PMU_EPHY); |
364 | } else if (of_machine_is_compatible("lantiq,vr9")) { | 366 | } else if (of_machine_is_compatible("lantiq,vr9")) { |
365 | clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(), | 367 | clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(), |
366 | ltq_vr9_fpi_hz()); | 368 | ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz()); |
367 | clkdev_add_pmu("1d900000.pcie", "phy", 1, PMU1_PCIE_PHY); | 369 | clkdev_add_pmu("1d900000.pcie", "phy", 1, PMU1_PCIE_PHY); |
368 | clkdev_add_pmu("1d900000.pcie", "bus", 0, PMU_PCIE_CLK); | 370 | clkdev_add_pmu("1d900000.pcie", "bus", 0, PMU_PCIE_CLK); |
369 | clkdev_add_pmu("1d900000.pcie", "msi", 1, PMU1_PCIE_MSI); | 371 | clkdev_add_pmu("1d900000.pcie", "msi", 1, PMU1_PCIE_MSI); |
@@ -376,10 +378,10 @@ void __init ltq_soc_init(void) | |||
376 | PMU_PPE_QSB | PMU_PPE_TOP); | 378 | PMU_PPE_QSB | PMU_PPE_TOP); |
377 | } else if (of_machine_is_compatible("lantiq,ar9")) { | 379 | } else if (of_machine_is_compatible("lantiq,ar9")) { |
378 | clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(), | 380 | clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(), |
379 | ltq_ar9_fpi_hz()); | 381 | ltq_ar9_fpi_hz(), CLOCK_250M); |
380 | clkdev_add_pmu("1e180000.etop", "switch", 0, PMU_SWITCH); | 382 | clkdev_add_pmu("1e180000.etop", "switch", 0, PMU_SWITCH); |
381 | } else { | 383 | } else { |
382 | clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(), | 384 | clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(), |
383 | ltq_danube_fpi_hz()); | 385 | ltq_danube_fpi_hz(), ltq_danube_pp32_hz()); |
384 | } | 386 | } |
385 | } | 387 | } |