1 From 27c4128ab1835a2aff1a0ce6413bb21cfa614d93 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 21 Feb 2012 09:48:11 +0100
4 Subject: [PATCH 36/70] MIPS: lantiq: add vr9 support
6 VR9 is a VDSL SoC made by Lantiq. It is very similar to the AR9.
7 This patch adds the clkdev init code and SoC detection for the VR9.
9 Signed-off-by: John Crispin <blogic@openwrt.org>
10 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
12 .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 3 +
13 arch/mips/lantiq/xway/clk.c | 83 ++++++++++++++++++++
14 arch/mips/lantiq/xway/prom.c | 6 ++
15 arch/mips/lantiq/xway/sysctrl.c | 12 +++-
16 4 files changed, 103 insertions(+), 1 deletions(-)
18 diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
19 index e9d2dd4..5d11eb7 100644
20 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
21 +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
23 #define SOC_ID_ARX188 0x16C
24 #define SOC_ID_ARX168 0x16D
25 #define SOC_ID_ARX182 0x16F
26 +#define SOC_ID_VRX288 0x1C0 /* VRX288 v1.1 */
27 +#define SOC_ID_VRX268 0x1C2 /* VRX268 v1.1 */
28 +#define SOC_ID_GRX288 0x1C9 /* GRX288 v1.1 */
31 #define SOC_TYPE_DANUBE 0x01
32 diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c
33 index f3b50fc..3635c9f 100644
34 --- a/arch/mips/lantiq/xway/clk.c
35 +++ b/arch/mips/lantiq/xway/clk.c
36 @@ -225,3 +225,86 @@ unsigned long ltq_danube_fpi_hz(void)
37 return ddr_clock >> 1;
41 +unsigned long ltq_vr9_cpu_hz(void)
43 + unsigned int cpu_sel;
46 + cpu_sel = (ltq_cgu_r32(LTQ_CGU_SYS_VR9) >> 4) & 0xf;
63 + clk = CLOCK_196_608M;
81 +unsigned long ltq_vr9_fpi_hz(void)
83 + unsigned int ocp_sel, cpu_clk;
86 + cpu_clk = ltq_vr9_cpu_hz();
87 + ocp_sel = ltq_cgu_r32(LTQ_CGU_SYS_VR9) & 0x3;
100 + clk = (cpu_clk * 2) / 5;
114 +unsigned long ltq_vr9_io_region_clock(void)
116 + return ltq_vr9_fpi_hz();
119 +unsigned long ltq_vr9_fpi_bus_clock(int fpi)
121 + return ltq_vr9_fpi_hz();
123 diff --git a/arch/mips/lantiq/xway/prom.c b/arch/mips/lantiq/xway/prom.c
124 index 0929acb..b6f56b7 100644
125 --- a/arch/mips/lantiq/xway/prom.c
126 +++ b/arch/mips/lantiq/xway/prom.c
127 @@ -60,6 +60,12 @@ void __init ltq_soc_detect(struct ltq_soc_info *i)
131 + case SOC_ID_VRX268:
132 + case SOC_ID_VRX288:
134 + i->type = SOC_TYPE_VR9;
140 diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
141 index c5782b5..38f02f9 100644
142 --- a/arch/mips/lantiq/xway/sysctrl.c
143 +++ b/arch/mips/lantiq/xway/sysctrl.c
144 @@ -147,7 +147,8 @@ void __init ltq_soc_init(void)
145 clkdev_add_pmu("ltq_dma", NULL, 0, PMU_DMA);
146 clkdev_add_pmu("ltq_stp", NULL, 0, PMU_STP);
147 clkdev_add_pmu("ltq_spi", NULL, 0, PMU_SPI);
148 - clkdev_add_pmu("ltq_etop", NULL, 0, PMU_PPE);
150 + clkdev_add_pmu("ltq_etop", NULL, 0, PMU_PPE);
152 if (ltq_cgu_r32(LTQ_CGU_SYS) & (1 << 5))
153 clkdev_add_static(CLOCK_266M, CLOCK_133M, CLOCK_133M);
154 @@ -155,6 +156,15 @@ void __init ltq_soc_init(void)
155 clkdev_add_static(CLOCK_133M, CLOCK_133M, CLOCK_133M);
156 clkdev_add_cgu("ltq_etop", "ephycgu", CGU_EPHY),
157 clkdev_add_pmu("ltq_etop", "ephy", 0, PMU_EPHY);
158 + } else if (ltq_is_vr9()) {
159 + clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
160 + ltq_vr9_io_region_clock());
161 + clkdev_add_pmu("ltq_pcie", "phy", 1, PMU1_PCIE_PHY);
162 + clkdev_add_pmu("ltq_pcie", "bus", 0, PMU_PCIE_CLK);
163 + clkdev_add_pmu("ltq_pcie", "msi", 1, PMU1_PCIE_MSI);
164 + clkdev_add_pmu("ltq_pcie", "pdi", 1, PMU1_PCIE_PDI);
165 + clkdev_add_pmu("ltq_pcie", "ctl", 1, PMU1_PCIE_CTL);
166 + clkdev_add_pmu("ltq_pcie", "ahb", 0, PMU_AHBM | PMU_AHBS);
168 clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
169 ltq_danube_io_region_clock());