b532f410f9f52e96765cbe21de3635b8c4461778
[openwrt/staging/wigyori.git] / package / boot / uboot-lantiq / patches / 0112-MIPS-add-board-support-for-Arcadyan-VGV7510KW22.patch
1 --- /dev/null
2 +++ b/board/arcadyan/vgv7510kw22/Makefile
3 @@ -0,0 +1,27 @@
4 +#
5 +# Copyright (C) 2000-2011 Wolfgang Denk, DENX Software Engineering, wd@denx.de
6 +#
7 +# SPDX-License-Identifier: GPL-2.0+
8 +#
9 +
10 +include $(TOPDIR)/config.mk
11 +
12 +LIB = $(obj)lib$(BOARD).o
13 +
14 +COBJS = $(BOARD).o
15 +
16 +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
17 +OBJS := $(addprefix $(obj),$(COBJS))
18 +SOBJS := $(addprefix $(obj),$(SOBJS))
19 +
20 +$(LIB): $(obj).depend $(OBJS) $(SOBJS)
21 + $(call cmd_link_o_target, $(OBJS) $(SOBJS))
22 +
23 +#########################################################################
24 +
25 +# defines $(obj).depend target
26 +include $(SRCTREE)/rules.mk
27 +
28 +sinclude $(obj).depend
29 +
30 +#########################################################################
31 --- /dev/null
32 +++ b/board/arcadyan/vgv7510kw22/vgv7510kw22.c
33 @@ -0,0 +1,98 @@
34 +/*
35 + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
36 + *
37 + * SPDX-License-Identifier: GPL-2.0+
38 + */
39 +
40 +#include <common.h>
41 +#include <asm/gpio.h>
42 +#include <asm/lantiq/eth.h>
43 +#include <asm/lantiq/chipid.h>
44 +#include <asm/lantiq/cpu.h>
45 +#include <asm/arch/gphy.h>
46 +
47 +#if defined(CONFIG_SPL_BUILD)
48 +#define do_gpio_init 1
49 +#define do_pll_init 1
50 +#define do_dcdc_init 0
51 +#elif defined(CONFIG_SYS_BOOT_RAM)
52 +#define do_gpio_init 1
53 +#define do_pll_init 0
54 +#define do_dcdc_init 1
55 +#elif defined(CONFIG_SYS_BOOT_NOR)
56 +#define do_gpio_init 1
57 +#define do_pll_init 1
58 +#define do_dcdc_init 1
59 +#else
60 +#define do_gpio_init 0
61 +#define do_pll_init 0
62 +#define do_dcdc_init 1
63 +#endif
64 +
65 +#define GPIO_POWER_GREEN 14
66 +
67 +static void gpio_init(void)
68 +{
69 + /* Turn on the green power LED */
70 + gpio_direction_output(GPIO_POWER_GREEN, 0);
71 +}
72 +
73 +int board_early_init_f(void)
74 +{
75 + if (do_gpio_init)
76 + gpio_init();
77 +
78 + if (do_pll_init)
79 + ltq_pll_init();
80 +
81 + if (do_dcdc_init)
82 + ltq_dcdc_init(0x7F);
83 +
84 + return 0;
85 +}
86 +
87 +int checkboard(void)
88 +{
89 + puts("Board: " CONFIG_BOARD_NAME "\n");
90 + ltq_chip_print_info();
91 +
92 + return 0;
93 +}
94 +
95 +static const struct ltq_eth_port_config eth_port_config[] = {
96 + /* unused */
97 + { 0, 0x0, LTQ_ETH_PORT_NONE, PHY_INTERFACE_MODE_NONE },
98 + /* unused */
99 + { 1, 0x0, LTQ_ETH_PORT_NONE, PHY_INTERFACE_MODE_NONE },
100 + /* Internal GPHY0 with 10/100 firmware for LAN port 2 */
101 + { 2, 0x11, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
102 + /* Internal GPHY0 with 10/100 firmware for LAN port 1 */
103 + { 3, 0x12, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
104 + /* Internal GPHY1 with 10/100 firmware for LAN port 4 */
105 + { 4, 0x13, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
106 + /* Internal GPHY1 with 10/100 firmware for LAN port 3 */
107 + { 5, 0x14, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
108 +};
109 +
110 +static const struct ltq_eth_board_config eth_board_config = {
111 + .ports = eth_port_config,
112 + .num_ports = ARRAY_SIZE(eth_port_config),
113 +};
114 +
115 +int board_eth_init(bd_t * bis)
116 +{
117 + const enum ltq_gphy_clk clk = LTQ_GPHY_CLK_25MHZ_PLL0;
118 + const ulong fw_addr = 0x80FF0000;
119 +
120 + if (ltq_chip_version_get() == 1)
121 + ltq_gphy_phy22f_a1x_load(fw_addr);
122 + else
123 + ltq_gphy_phy22f_a2x_load(fw_addr);
124 +
125 + ltq_cgu_gphy_clk_src(clk);
126 +
127 + ltq_rcu_gphy_boot(0, fw_addr);
128 + ltq_rcu_gphy_boot(1, fw_addr);
129 +
130 + return ltq_eth_initialize(&eth_board_config);
131 +}
132 --- /dev/null
133 +++ b/board/arcadyan/vgv7510kw22/config.mk
134 @@ -0,0 +1,7 @@
135 +#
136 +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
137 +#
138 +# SPDX-License-Identifier: GPL-2.0+
139 +#
140 +
141 +PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(BOARDDIR)
142 --- /dev/null
143 +++ b/board/arcadyan/vgv7510kw22/ddr_settings.h
144 @@ -0,0 +1,71 @@
145 +/*
146 + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
147 + * Based on code by:
148 + * Daniel Schwierzeck, daniel.schwierzeck@googlemail.com
149 + * and Lantiq Deutschland GmbH
150 + *
151 + * SPDX-License-Identifier: GPL-2.0+
152 + */
153 +
154 +#define MC_CCR00_VALUE 0x101
155 +#define MC_CCR01_VALUE 0x1000100
156 +#define MC_CCR02_VALUE 0x1010000
157 +#define MC_CCR03_VALUE 0x100
158 +#define MC_CCR04_VALUE 0x1000000
159 +#define MC_CCR05_VALUE 0x1000101
160 +#define MC_CCR06_VALUE 0x1000100
161 +#define MC_CCR07_VALUE 0x1010000
162 +#define MC_CCR08_VALUE 0x1000101
163 +#define MC_CCR09_VALUE 0x0
164 +#define MC_CCR10_VALUE 0x2000100
165 +#define MC_CCR11_VALUE 0x2000401
166 +#define MC_CCR12_VALUE 0x30000
167 +#define MC_CCR13_VALUE 0x202
168 +#define MC_CCR14_VALUE 0x7080A0F
169 +#define MC_CCR15_VALUE 0x2040F
170 +#define MC_CCR16_VALUE 0x40000
171 +#define MC_CCR17_VALUE 0x70102
172 +#define MC_CCR18_VALUE 0x4020002
173 +#define MC_CCR19_VALUE 0x30302
174 +#define MC_CCR20_VALUE 0x8000700
175 +#define MC_CCR21_VALUE 0x40F020A
176 +#define MC_CCR22_VALUE 0x0
177 +#define MC_CCR23_VALUE 0xC020000
178 +#define MC_CCR24_VALUE 0x4401B04
179 +#define MC_CCR25_VALUE 0x0
180 +#define MC_CCR26_VALUE 0x0
181 +#define MC_CCR27_VALUE 0x6420000
182 +#define MC_CCR28_VALUE 0x0
183 +#define MC_CCR29_VALUE 0x0
184 +#define MC_CCR30_VALUE 0x798
185 +#define MC_CCR31_VALUE 0x0
186 +#define MC_CCR32_VALUE 0x0
187 +#define MC_CCR33_VALUE 0x650000
188 +#define MC_CCR34_VALUE 0x200C8
189 +#define MC_CCR35_VALUE 0x1D445D
190 +#define MC_CCR36_VALUE 0xC8
191 +#define MC_CCR37_VALUE 0xC351
192 +#define MC_CCR38_VALUE 0x0
193 +#define MC_CCR39_VALUE 0x141F04
194 +#define MC_CCR40_VALUE 0x142704
195 +#define MC_CCR41_VALUE 0x141B42
196 +#define MC_CCR42_VALUE 0x141B42
197 +#define MC_CCR43_VALUE 0x566504
198 +#define MC_CCR44_VALUE 0x566504
199 +#define MC_CCR45_VALUE 0x565F17
200 +#define MC_CCR46_VALUE 0x565F17
201 +#define MC_CCR47_VALUE 0x0
202 +#define MC_CCR48_VALUE 0x0
203 +#define MC_CCR49_VALUE 0x0
204 +#define MC_CCR50_VALUE 0x0
205 +#define MC_CCR51_VALUE 0x0
206 +#define MC_CCR52_VALUE 0x133
207 +#define MC_CCR53_VALUE 0xF3014B27
208 +#define MC_CCR54_VALUE 0xF3014B27
209 +#define MC_CCR55_VALUE 0xF3014B27
210 +#define MC_CCR56_VALUE 0xF3014B27
211 +#define MC_CCR57_VALUE 0x7800301
212 +#define MC_CCR58_VALUE 0x7800301
213 +#define MC_CCR59_VALUE 0x7800301
214 +#define MC_CCR60_VALUE 0x7800301
215 +#define MC_CCR61_VALUE 0x4
216 --- a/boards.cfg
217 +++ b/boards.cfg
218 @@ -531,6 +531,9 @@ Active mips mips32 incai
219 Active mips mips32 incaip - incaip incaip_100MHz incaip:CPU_CLOCK_RATE=100000000 Wolfgang Denk <wd@denx.de>
220 Active mips mips32 incaip - incaip incaip_133MHz incaip:CPU_CLOCK_RATE=133000000 Wolfgang Denk <wd@denx.de>
221 Active mips mips32 incaip - incaip incaip_150MHz incaip:CPU_CLOCK_RATE=150000000 Wolfgang Denk <wd@denx.de>
222 +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_brn vgv7510kw22:SYS_BOOT_BRN Martin Blumenstingl <martin.blumenstingl@googlemail.com>
223 +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_nor vgv7510kw22:SYS_BOOT_NOR Martin Blumenstingl <martin.blumenstingl@googlemail.com>
224 +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_ram vgv7510kw22:SYS_BOOT_RAM Martin Blumenstingl <martin.blumenstingl@googlemail.com>
225 Active mips mips32 vrx200 avm fb3370 fb3370_eva fb3370:SYS_BOOT_EVA Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
226 Active mips mips32 vrx200 avm fb3370 fb3370_ram fb3370:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
227 Active mips mips32 vrx200 avm fb3370 fb3370_sfspl fb3370:SYS_BOOT_SFSPL Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
228 --- /dev/null
229 +++ b/include/configs/vgv7510kw22.h
230 @@ -0,0 +1,59 @@
231 +/*
232 + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
233 + *
234 + * SPDX-License-Identifier: GPL-2.0+
235 + */
236 +
237 +#ifndef __CONFIG_H
238 +#define __CONFIG_H
239 +
240 +#define CONFIG_MACH_TYPE "VGV7510KW22"
241 +#define CONFIG_IDENT_STRING " "CONFIG_MACH_TYPE
242 +#define CONFIG_BOARD_NAME "Arcadyan VGV7510KW22"
243 +
244 +/* Configure SoC */
245 +#define CONFIG_LTQ_SUPPORT_UART /* Enable ASC and UART */
246 +
247 +#define CONFIG_LTQ_SUPPORT_ETHERNET /* Enable ethernet */
248 +
249 +#define CONFIG_LTQ_SUPPORT_NOR_FLASH /* Have a parallel NOR flash */
250 +
251 +#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16 MB */
252 +
253 +#if defined(CONFIG_SYS_BOOT_BRN)
254 +#define CONFIG_SYS_TEXT_BASE 0x80002000
255 +#define CONFIG_SKIP_LOWLEVEL_INIT
256 +#define CONFIG_SYS_DISABLE_CACHE
257 +#define CONFIG_ENV_IS_NOWHERE
258 +#define CONFIG_ENV_OVERWRITE 1
259 +#elif defined(CONFIG_SYS_BOOT_NOR)
260 +#define CONFIG_ENV_IS_IN_FLASH
261 +#define CONFIG_ENV_OVERWRITE
262 +#define CONFIG_ENV_OFFSET (384 * 1024)
263 +#define CONFIG_ENV_SECT_SIZE (128 * 1024)
264 +#else
265 +#define CONFIG_ENV_IS_NOWHERE
266 +#endif
267 +
268 +#define CONFIG_ENV_SIZE (128 * 1024)
269 +
270 +#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
271 +
272 +/* Console */
273 +#define CONFIG_LTQ_ADVANCED_CONSOLE
274 +#define CONFIG_BAUDRATE 115200
275 +#define CONFIG_CONSOLE_ASC 1
276 +#define CONFIG_CONSOLE_DEV "ttyLTQ1"
277 +
278 +/* Pull in default board configs for Lantiq XWAY VRX200 */
279 +#include <asm/lantiq/config.h>
280 +#include <asm/arch/config.h>
281 +
282 +/* Pull in default OpenWrt configs for Lantiq SoC */
283 +#include "openwrt-lantiq-common.h"
284 +
285 +#define CONFIG_EXTRA_ENV_SETTINGS \
286 + CONFIG_ENV_LANTIQ_DEFAULTS \
287 + "kernel_addr=0xB0080000\0"
288 +
289 +#endif /* __CONFIG_H */