1 From 780a64cd52209fad15c7133f950b2b2d6b9b59e2 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sat, 27 Aug 2011 21:44:32 +0200
4 Subject: [PATCH 23/24] MIPS: lantiq: adds basic vr9 support
7 .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 2 +
8 arch/mips/lantiq/Kconfig | 9 ++
9 arch/mips/lantiq/Platform | 1 +
10 arch/mips/lantiq/machtypes.h | 3 +
11 arch/mips/lantiq/xway/Kconfig | 12 +++
12 arch/mips/lantiq/xway/Makefile | 2 +
13 arch/mips/lantiq/xway/clk-vr9.c | 78 ++++++++++++++++++++
14 arch/mips/lantiq/xway/mach-fritz.c | 74 +++++++++++++++++++
15 arch/mips/lantiq/xway/prom-vr9.c | 55 ++++++++++++++
16 arch/mips/pci/Makefile | 2 +-
17 10 files changed, 237 insertions(+), 1 deletions(-)
18 create mode 100644 arch/mips/lantiq/xway/clk-vr9.c
19 create mode 100644 arch/mips/lantiq/xway/mach-fritz.c
20 create mode 100644 arch/mips/lantiq/xway/prom-vr9.c
22 Index: linux-3.0.3/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
23 ===================================================================
24 --- linux-3.0.3.orig/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 2011-10-04 20:05:48.000000000 +0200
25 +++ linux-3.0.3/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 2011-10-04 20:05:54.234312800 +0200
27 #define SOC_ID_ARX188 0x16C
28 #define SOC_ID_ARX168 0x16D
29 #define SOC_ID_ARX182 0x16F
30 +#define SOC_ID_VRX288 0x1C0
33 #define SOC_TYPE_DANUBE 0x01
37 #define LTQ_ETOP_BASE_ADDR 0x1E180000
38 +#define LTQ_ETOP_BASE_ADDR_VR9 0x1E200000
39 #define LTQ_ETOP_SIZE 0x40000
41 /* GBIT - gigabit switch */
42 Index: linux-3.0.3/arch/mips/lantiq/Kconfig
43 ===================================================================
44 --- linux-3.0.3.orig/arch/mips/lantiq/Kconfig 2011-10-04 20:03:54.000000000 +0200
45 +++ linux-3.0.3/arch/mips/lantiq/Kconfig 2011-10-04 20:05:54.238312800 +0200
61 + select SOC_TYPE_XWAY
68 Index: linux-3.0.3/arch/mips/lantiq/Platform
69 ===================================================================
70 --- linux-3.0.3.orig/arch/mips/lantiq/Platform 2011-10-04 20:03:54.000000000 +0200
71 +++ linux-3.0.3/arch/mips/lantiq/Platform 2011-10-04 20:05:54.238312800 +0200
73 cflags-$(CONFIG_LANTIQ) += -I$(srctree)/arch/mips/include/asm/mach-lantiq
74 load-$(CONFIG_LANTIQ) = 0xffffffff80002000
75 cflags-$(CONFIG_SOC_TYPE_XWAY) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/xway
76 +cflags-$(CONFIG_SOC_TYPE_VR9) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/xway
77 cflags-$(CONFIG_SOC_FALCON) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/falcon
78 Index: linux-3.0.3/arch/mips/lantiq/machtypes.h
79 ===================================================================
80 --- linux-3.0.3.orig/arch/mips/lantiq/machtypes.h 2011-10-04 20:03:54.000000000 +0200
81 +++ linux-3.0.3/arch/mips/lantiq/machtypes.h 2011-10-04 20:05:54.238312800 +0200
83 LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
84 LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
85 LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
88 + LANTIQ_MACH_FRITZ3370, /* FRITZ!BOX 3370 vdsl cpe */
92 Index: linux-3.0.3/arch/mips/lantiq/xway/Kconfig
93 ===================================================================
94 --- linux-3.0.3.orig/arch/mips/lantiq/xway/Kconfig 2011-08-17 19:57:16.000000000 +0200
95 +++ linux-3.0.3/arch/mips/lantiq/xway/Kconfig 2011-10-04 20:05:54.238312800 +0200
105 +config LANTIQ_MACH_FRITZ3370
106 + bool "Fritz!Box 3370"
112 Index: linux-3.0.3/arch/mips/lantiq/xway/Makefile
113 ===================================================================
114 --- linux-3.0.3.orig/arch/mips/lantiq/xway/Makefile 2011-10-04 20:05:50.000000000 +0200
115 +++ linux-3.0.3/arch/mips/lantiq/xway/Makefile 2011-10-04 20:05:54.238312800 +0200
118 obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o
119 obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o
120 +obj-$(CONFIG_SOC_VR9) += clk-vr9.o prom-vr9.o
122 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
123 obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
124 +obj-$(CONFIG_LANTIQ_MACH_FRITZ3370) += mach-fritz.o
125 Index: linux-3.0.3/arch/mips/lantiq/xway/clk-vr9.c
126 ===================================================================
127 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
128 +++ linux-3.0.3/arch/mips/lantiq/xway/clk-vr9.c 2011-10-04 20:05:54.238312800 +0200
131 + * This program is free software; you can redistribute it and/or modify it
132 + * under the terms of the GNU General Public License version 2 as published
133 + * by the Free Software Foundation.
135 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
138 +#include <linux/io.h>
139 +#include <linux/module.h>
140 +#include <linux/init.h>
141 +#include <linux/clk.h>
143 +#include <asm/time.h>
144 +#include <asm/irq.h>
145 +#include <asm/div64.h>
147 +#include <lantiq_soc.h>
149 +#define CLOCK_62_5M 62500000
150 +#define CLOCK_83_5M 83500000
151 +#define CLOCK_125M 125000000
152 +#define CLOCK_200M 200000000
153 +#define CLOCK_250M 250000000
154 +#define CLOCK_300M 300000000
155 +#define CLOCK_98_304M 98304000
156 +#define CLOCK_150M 150000000
157 +#define CLOCK_196_608M 196608000
158 +#define CLOCK_600M 600000000
159 +#define CLOCK_500M 500000000
160 +#define CLOCK_393M 393215332
161 +#define CLOCK_166M 166666666
163 +#define LTQ_CGU_SYS 0x0c
164 +#define LTQ_CGU_IF_CLK 0x24
166 +unsigned int ltq_get_cpu_hz(void)
169 + CLOCK_600M, CLOCK_500M, CLOCK_393M, CLOCK_333M, CLOCK_125M,
170 + CLOCK_125M, CLOCK_196_608M, CLOCK_166M, CLOCK_125M, CLOCK_125M };
171 + int val = (ltq_cgu_r32(LTQ_CGU_SYS) >> 4) & 0xf;
174 + panic("bad cpu speed\n");
176 + panic("missing workaround\n");
177 + //cgu_get_pll1_fosc(); //CLOCK_393M;
180 +EXPORT_SYMBOL(ltq_get_cpu_hz);
182 +unsigned int ltq_get_fpi_hz(void)
185 + CLOCK_62_5M, CLOCK_62_5M, CLOCK_83_5M, CLOCK_125M, CLOCK_125M,
186 + CLOCK_125M, CLOCK_167M, CLOCK_200M, CLOCK_250M, CLOCK_300M,
187 + CLOCK_62_5M, CLOCK_98_304M, CLOCK_150M, CLOCK_196_608M };
188 + int val = ((ltq_cgu_r32(LTQ_CGU_IF_CLK) >> 25) & 0xf);
191 + panic("bad fpi speed\n");
195 +EXPORT_SYMBOL(ltq_get_fpi_hz);
197 +unsigned int ltq_get_io_region_clock(void)
199 + return ltq_get_fpi_hz() / 2;
201 +EXPORT_SYMBOL(ltq_get_io_region_clock);
203 +unsigned int ltq_get_fpi_bus_clock(int fpi)
205 + return ltq_get_fpi_hz();
207 +EXPORT_SYMBOL(ltq_get_fpi_bus_clock);
208 Index: linux-3.0.3/arch/mips/lantiq/xway/prom-vr9.c
209 ===================================================================
210 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
211 +++ linux-3.0.3/arch/mips/lantiq/xway/prom-vr9.c 2011-10-04 20:05:54.238312800 +0200
214 + * This program is free software; you can redistribute it and/or modify it
215 + * under the terms of the GNU General Public License version 2 as published
216 + * by the Free Software Foundation.
218 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
221 +#include <linux/module.h>
222 +#include <linux/clk.h>
223 +#include <asm/bootinfo.h>
224 +#include <asm/time.h>
226 +#include <lantiq_soc.h>
228 +#include "devices.h"
229 +#include "../prom.h"
231 +#define SOC_VRX288 "VRX288"
233 +#define PART_SHIFT 12
234 +#define PART_MASK 0x0FFFFFFF
235 +#define REV_SHIFT 28
236 +#define REV_MASK 0xF0000000
238 +void __init ltq_soc_detect(struct ltq_soc_info *i)
240 + i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT;
241 + i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT;
242 + sprintf(i->rev_type, "1.%d", i->rev);
243 + switch (i->partnum) {
244 + case SOC_ID_VRX288:
245 + i->name = SOC_VRX288;
246 + i->type = SOC_TYPE_VR9;
253 + printk("%08X\n", i->partnum);
256 +void __init ltq_soc_setup(void)
259 + reg = IFX_REG_R32(IFX_XBAR_ALWAYS_LAST);
260 + reg &= ~ IFX_XBAR_FPI_BURST_EN;
261 + IFX_REG_W32(reg, IFX_XBAR_ALWAYS_LAST);
264 + ltq_register_asc(1);
265 + ltq_register_gpio();
266 + ltq_register_wdt();
268 Index: linux-3.0.3/arch/mips/pci/Makefile
269 ===================================================================
270 --- linux-3.0.3.orig/arch/mips/pci/Makefile 2011-08-17 19:57:16.000000000 +0200
271 +++ linux-3.0.3/arch/mips/pci/Makefile 2011-10-04 20:05:54.238312800 +0200
273 obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o
274 obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o
275 obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o
276 -obj-$(CONFIG_SOC_XWAY) += pci-lantiq.o ops-lantiq.o
277 +obj-$(CONFIG_LANTIQ) += pci-lantiq.o ops-lantiq.o
278 obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
279 obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
280 obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o