uboot-lantiq: VGV7510KW22 - remove NOR SPL leftovers
[openwrt/openwrt.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,116 @@
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_SYS_BOOT_RAM)
48 +#define do_gpio_init 1
49 +#define do_pll_init 0
50 +#define do_dcdc_init 1
51 +#elif defined(CONFIG_SYS_BOOT_NOR)
52 +#define do_gpio_init 1
53 +#define do_pll_init 1
54 +#define do_dcdc_init 1
55 +#else
56 +#define do_gpio_init 0
57 +#define do_pll_init 0
58 +#define do_dcdc_init 1
59 +#endif
60 +
61 +#define GPIO_POWER_GREEN 14
62 +#define GPIO_POWER_RED 28
63 +
64 +static void gpio_init(void)
65 +{
66 + /* Turn on the green power LED */
67 + gpio_direction_output(GPIO_POWER_GREEN, 0);
68 +
69 + /* Turn off the red power LED */
70 + gpio_direction_output(GPIO_POWER_RED, 1);
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 +void show_boot_progress(int arg)
96 +{
97 + if (!do_gpio_init)
98 + return 0;
99 +
100 + if (arg >= 0) {
101 + /* Success - turn off the red power LED and turn on the green power LED */
102 + gpio_set_value(GPIO_POWER_RED, 1);
103 + gpio_set_value(GPIO_POWER_GREEN, 0);
104 + } else {
105 + /* Failure - turn off green power LED and turn on red power LED */
106 + gpio_set_value(GPIO_POWER_GREEN, 1);
107 + gpio_set_value(GPIO_POWER_RED, 0);
108 + }
109 +
110 + return 0;
111 +}
112 +
113 +static const struct ltq_eth_port_config eth_port_config[] = {
114 + /* unused */
115 + { 0, 0x0, LTQ_ETH_PORT_NONE, PHY_INTERFACE_MODE_NONE },
116 + /* unused */
117 + { 1, 0x0, LTQ_ETH_PORT_NONE, PHY_INTERFACE_MODE_NONE },
118 + /* Internal GPHY0 with 10/100 firmware for LAN port 2 */
119 + { 2, 0x11, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
120 + /* Internal GPHY0 with 10/100 firmware for LAN port 1 */
121 + { 3, 0x12, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
122 + /* Internal GPHY1 with 10/100 firmware for LAN port 4 */
123 + { 4, 0x13, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
124 + /* Internal GPHY1 with 10/100 firmware for LAN port 3 */
125 + { 5, 0x14, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
126 +};
127 +
128 +static const struct ltq_eth_board_config eth_board_config = {
129 + .ports = eth_port_config,
130 + .num_ports = ARRAY_SIZE(eth_port_config),
131 +};
132 +
133 +int board_eth_init(bd_t * bis)
134 +{
135 + const enum ltq_gphy_clk clk = LTQ_GPHY_CLK_25MHZ_PLL0;
136 + const ulong fw_addr = 0x80FF0000;
137 +
138 + if (ltq_chip_version_get() == 1)
139 + ltq_gphy_phy22f_a1x_load(fw_addr);
140 + else
141 + ltq_gphy_phy22f_a2x_load(fw_addr);
142 +
143 + ltq_cgu_gphy_clk_src(clk);
144 +
145 + ltq_rcu_gphy_boot(0, fw_addr);
146 + ltq_rcu_gphy_boot(1, fw_addr);
147 +
148 + return ltq_eth_initialize(&eth_board_config);
149 +}
150 --- /dev/null
151 +++ b/board/arcadyan/vgv7510kw22/config.mk
152 @@ -0,0 +1,7 @@
153 +#
154 +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
155 +#
156 +# SPDX-License-Identifier: GPL-2.0+
157 +#
158 +
159 +PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(BOARDDIR)
160 --- /dev/null
161 +++ b/board/arcadyan/vgv7510kw22/ddr_settings.h
162 @@ -0,0 +1,71 @@
163 +/*
164 + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
165 + * Copyright (C) 2016 Mathias Kresin <dev@kresin.me>
166 + *
167 + * The values have been extracted from original brnboot.
168 + *
169 + * SPDX-License-Identifier: GPL-2.0+
170 + */
171 +
172 +#define MC_CCR00_VALUE 0x101
173 +#define MC_CCR01_VALUE 0x1000100
174 +#define MC_CCR02_VALUE 0x1010000
175 +#define MC_CCR03_VALUE 0x100
176 +#define MC_CCR04_VALUE 0x1000000
177 +#define MC_CCR05_VALUE 0x1000101
178 +#define MC_CCR06_VALUE 0x1000100
179 +#define MC_CCR07_VALUE 0x1010000
180 +#define MC_CCR08_VALUE 0x1000101
181 +#define MC_CCR09_VALUE 0x0
182 +#define MC_CCR10_VALUE 0x2000100
183 +#define MC_CCR11_VALUE 0x2000401
184 +#define MC_CCR12_VALUE 0x30000
185 +#define MC_CCR13_VALUE 0x202
186 +#define MC_CCR14_VALUE 0x7080A0F
187 +#define MC_CCR15_VALUE 0x2040F
188 +#define MC_CCR16_VALUE 0x40000
189 +#define MC_CCR17_VALUE 0x70102
190 +#define MC_CCR18_VALUE 0x4020002
191 +#define MC_CCR19_VALUE 0x30302
192 +#define MC_CCR20_VALUE 0x8000700
193 +#define MC_CCR21_VALUE 0x40F020A
194 +#define MC_CCR22_VALUE 0x0
195 +#define MC_CCR23_VALUE 0xC020000
196 +#define MC_CCR24_VALUE 0x4401B04
197 +#define MC_CCR25_VALUE 0x0
198 +#define MC_CCR26_VALUE 0x0
199 +#define MC_CCR27_VALUE 0x6420000
200 +#define MC_CCR28_VALUE 0x0
201 +#define MC_CCR29_VALUE 0x0
202 +#define MC_CCR30_VALUE 0x798
203 +#define MC_CCR31_VALUE 0x2040F
204 +#define MC_CCR32_VALUE 0x0
205 +#define MC_CCR33_VALUE 0x650000
206 +#define MC_CCR34_VALUE 0x200C8
207 +#define MC_CCR35_VALUE 0x1D445D
208 +#define MC_CCR36_VALUE 0xC8
209 +#define MC_CCR37_VALUE 0xC351
210 +#define MC_CCR38_VALUE 0x0
211 +#define MC_CCR39_VALUE 0x141F04
212 +#define MC_CCR40_VALUE 0x142704
213 +#define MC_CCR41_VALUE 0x141B42
214 +#define MC_CCR42_VALUE 0x141B42
215 +#define MC_CCR43_VALUE 0x566504
216 +#define MC_CCR44_VALUE 0x566504
217 +#define MC_CCR45_VALUE 0x565F17
218 +#define MC_CCR46_VALUE 0x565F17
219 +#define MC_CCR47_VALUE 0x2040F
220 +#define MC_CCR48_VALUE 0x0
221 +#define MC_CCR49_VALUE 0x0
222 +#define MC_CCR50_VALUE 0x0
223 +#define MC_CCR51_VALUE 0x0
224 +#define MC_CCR52_VALUE 0x133
225 +#define MC_CCR53_VALUE 0xF3014B27
226 +#define MC_CCR54_VALUE 0xF3014B27
227 +#define MC_CCR55_VALUE 0xF3014B27
228 +#define MC_CCR56_VALUE 0xF3014B27
229 +#define MC_CCR57_VALUE 0x7800301
230 +#define MC_CCR58_VALUE 0x7800301
231 +#define MC_CCR59_VALUE 0x7800301
232 +#define MC_CCR60_VALUE 0x7800301
233 +#define MC_CCR61_VALUE 0x4
234 --- a/boards.cfg
235 +++ b/boards.cfg
236 @@ -531,6 +531,9 @@ Active mips mips32 incai
237 Active mips mips32 incaip - incaip incaip_100MHz incaip:CPU_CLOCK_RATE=100000000 Wolfgang Denk <wd@denx.de>
238 Active mips mips32 incaip - incaip incaip_133MHz incaip:CPU_CLOCK_RATE=133000000 Wolfgang Denk <wd@denx.de>
239 Active mips mips32 incaip - incaip incaip_150MHz incaip:CPU_CLOCK_RATE=150000000 Wolfgang Denk <wd@denx.de>
240 +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_brn vgv7510kw22:SYS_BOOT_BRN Martin Blumenstingl <martin.blumenstingl@googlemail.com>
241 +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_nor vgv7510kw22:SYS_BOOT_NOR Martin Blumenstingl <martin.blumenstingl@googlemail.com>
242 +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_ram vgv7510kw22:SYS_BOOT_RAM Martin Blumenstingl <martin.blumenstingl@googlemail.com>
243 Active mips mips32 vrx200 avm fb3370 fb3370_eva fb3370:SYS_BOOT_EVA Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
244 Active mips mips32 vrx200 avm fb3370 fb3370_ram fb3370:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
245 Active mips mips32 vrx200 avm fb3370 fb3370_sfspl fb3370:SYS_BOOT_SFSPL Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
246 --- /dev/null
247 +++ b/include/configs/vgv7510kw22.h
248 @@ -0,0 +1,59 @@
249 +/*
250 + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
251 + *
252 + * SPDX-License-Identifier: GPL-2.0+
253 + */
254 +
255 +#ifndef __CONFIG_H
256 +#define __CONFIG_H
257 +
258 +#define CONFIG_MACH_TYPE "VGV7510KW22"
259 +#define CONFIG_IDENT_STRING " "CONFIG_MACH_TYPE
260 +#define CONFIG_BOARD_NAME "Arcadyan VGV7510KW22"
261 +
262 +/* Configure SoC */
263 +#define CONFIG_LTQ_SUPPORT_UART /* Enable ASC and UART */
264 +
265 +#define CONFIG_LTQ_SUPPORT_ETHERNET /* Enable ethernet */
266 +
267 +#define CONFIG_LTQ_SUPPORT_NOR_FLASH /* Have a parallel NOR flash */
268 +
269 +#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16 MB */
270 +
271 +#if defined(CONFIG_SYS_BOOT_BRN)
272 +#define CONFIG_SYS_TEXT_BASE 0x80002000
273 +#define CONFIG_SKIP_LOWLEVEL_INIT
274 +#define CONFIG_SYS_DISABLE_CACHE
275 +#define CONFIG_ENV_IS_NOWHERE
276 +#define CONFIG_ENV_OVERWRITE 1
277 +#elif defined(CONFIG_SYS_BOOT_NOR)
278 +#define CONFIG_ENV_IS_IN_FLASH
279 +#define CONFIG_ENV_OVERWRITE
280 +#define CONFIG_ENV_OFFSET (384 * 1024)
281 +#define CONFIG_ENV_SECT_SIZE (128 * 1024)
282 +#else
283 +#define CONFIG_ENV_IS_NOWHERE
284 +#endif
285 +
286 +#define CONFIG_ENV_SIZE (128 * 1024)
287 +
288 +#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
289 +
290 +/* Console */
291 +#define CONFIG_LTQ_ADVANCED_CONSOLE
292 +#define CONFIG_BAUDRATE 115200
293 +#define CONFIG_CONSOLE_ASC 1
294 +#define CONFIG_CONSOLE_DEV "ttyLTQ1"
295 +
296 +/* Pull in default board configs for Lantiq XWAY VRX200 */
297 +#include <asm/lantiq/config.h>
298 +#include <asm/arch/config.h>
299 +
300 +/* Pull in default OpenWrt configs for Lantiq SoC */
301 +#include "openwrt-lantiq-common.h"
302 +
303 +#define CONFIG_EXTRA_ENV_SETTINGS \
304 + CONFIG_ENV_LANTIQ_DEFAULTS \
305 + "kernel_addr=0xB0080000\0"
306 +
307 +#endif /* __CONFIG_H */