packages: uboot-mxs: override instead of appending u-boot make flags
[openwrt/staging/wigyori.git] / package / boot / uboot-mxs / patches / 001-add-i2se-duckbill.patch
1 From 25de6430219d3f3698d709c10358fbea17b24cf1 Mon Sep 17 00:00:00 2001
2 From: Michael Heimpold <mhei@heimpold.de>
3 Date: Fri, 21 Apr 2017 11:08:19 +0200
4 Subject: [PATCH] arm: mxs: add support for I2SE's Duckbill boards
5
6 The Duckbill devices are small, pen-drive sized boards based on
7 NXP's i.MX28 SoC. While the initial variants (Duckbill series) were
8 equipped with a micro SD card slot only, the latest generation
9 (Duckbill 2 series) have an additional internal eMMC onboard.
10
11 Both device generations consists of four "family members":
12
13 - Duckbill/Duckbill 2: generic board, intended to be used as
14 baseboard for custom designs and/or as development board
15
16 - Duckbill EnOcean/Duckbill 2 EnOcean: come with an EnOcean
17 daugther board equipped with the popular TCM310 module
18
19 - Duckbill 485/Duckbill 2 485: as the name implies, these
20 devices are intended to be used as Ethernet - RS485 converters
21
22 - Duckbill SPI/Duckbill 2 SPI: not sold separately, but used
23 in I2SE's development kits for Green PHY HomePlug Powerline
24 communication
25
26 Signed-off-by: Michael Heimpold <mhei@heimpold.de>
27 Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
28 ---
29 arch/arm/Kconfig | 9 +-
30 board/i2se/duckbill/Kconfig | 15 +++
31 board/i2se/duckbill/MAINTAINERS | 6 ++
32 board/i2se/duckbill/Makefile | 12 +++
33 board/i2se/duckbill/duckbill.c | 181 ++++++++++++++++++++++++++++++++++++
34 board/i2se/duckbill/iomux.c | 157 +++++++++++++++++++++++++++++++
35 configs/duckbill_defconfig | 31 +++++++
36 include/configs/duckbill.h | 199 ++++++++++++++++++++++++++++++++++++++++
37 8 files changed, 609 insertions(+), 1 deletion(-)
38 create mode 100644 board/i2se/duckbill/Kconfig
39 create mode 100644 board/i2se/duckbill/MAINTAINERS
40 create mode 100644 board/i2se/duckbill/Makefile
41 create mode 100644 board/i2se/duckbill/duckbill.c
42 create mode 100644 board/i2se/duckbill/iomux.c
43 create mode 100644 configs/duckbill_defconfig
44 create mode 100644 include/configs/duckbill.h
45
46 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
47 index 30e71b2..b77e778 100644
48 --- a/arch/arm/Kconfig
49 +++ b/arch/arm/Kconfig
50 @@ -373,6 +373,12 @@ config TARGET_MX28EVK
51 select SUPPORT_SPL
52 select BOARD_EARLY_INIT_F
53
54 +config TARGET_DUCKBILL
55 + bool "Support duckbill"
56 + select CPU_ARM926EJS
57 + select SUPPORT_SPL
58 + select BOARD_EARLY_INIT_F
59 +
60 config TARGET_MX23_OLINUXINO
61 bool "Support mx23_olinuxino"
62 select CPU_ARM926EJS
63 @@ -1250,6 +1256,7 @@ source "board/gumstix/pepper/Kconfig"
64 source "board/h2200/Kconfig"
65 source "board/hisilicon/hikey/Kconfig"
66 source "board/hisilicon/poplar/Kconfig"
67 +source "board/i2se/duckbill/Kconfig"
68 source "board/imx31_phycore/Kconfig"
69 source "board/isee/igep003x/Kconfig"
70 source "board/olimex/mx23_olinuxino/Kconfig"
71 @@ -1279,7 +1286,7 @@ source "arch/arm/Kconfig.debug"
72 endmenu
73
74 config SPL_LDSCRIPT
75 - default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if TARGET_APX4DEVKIT || TARGET_BG0900 || TARGET_M28EVK || TARGET_MX23_OLINUXINO || TARGET_MX23EVK || TARGET_MX28EVK || TARGET_SANSA_FUZE_PLUS || TARGET_SC_SPS_1 || TARGET_TS4600 || TARGET_XFI3
76 + default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if TARGET_APX4DEVKIT || TARGET_BG0900 || TARGET_M28EVK || TARGET_MX23_OLINUXINO || TARGET_MX23EVK || TARGET_MX28EVK || TARGET_DUCKBILL || TARGET_SANSA_FUZE_PLUS || TARGET_SC_SPS_1 || TARGET_TS4600 || TARGET_XFI3
77 default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
78 default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
79
80 diff --git a/board/i2se/duckbill/Kconfig b/board/i2se/duckbill/Kconfig
81 new file mode 100644
82 index 0000000..98c1e46
83 --- /dev/null
84 +++ b/board/i2se/duckbill/Kconfig
85 @@ -0,0 +1,15 @@
86 +if TARGET_DUCKBILL
87 +
88 +config SYS_BOARD
89 + default "duckbill"
90 +
91 +config SYS_VENDOR
92 + default "i2se"
93 +
94 +config SYS_SOC
95 + default "mxs"
96 +
97 +config SYS_CONFIG_NAME
98 + default "duckbill"
99 +
100 +endif
101 diff --git a/board/i2se/duckbill/MAINTAINERS b/board/i2se/duckbill/MAINTAINERS
102 new file mode 100644
103 index 0000000..5496baa
104 --- /dev/null
105 +++ b/board/i2se/duckbill/MAINTAINERS
106 @@ -0,0 +1,6 @@
107 +I2SE DUCKBILL BOARD
108 +M: Michael Heimpold <mhei@heimpold.de>
109 +S: Maintained
110 +F: board/i2se/duckbill/
111 +F: include/configs/duckbill.h
112 +F: configs/duckbill_defconfig
113 diff --git a/board/i2se/duckbill/Makefile b/board/i2se/duckbill/Makefile
114 new file mode 100644
115 index 0000000..66baec4
116 --- /dev/null
117 +++ b/board/i2se/duckbill/Makefile
118 @@ -0,0 +1,12 @@
119 +#
120 +# (C) Copyright 2014-2017
121 +# Michael Heimpold, mhei@heimpold.de.
122 +#
123 +# SPDX-License-Identifier: GPL-2.0+
124 +#
125 +
126 +ifndef CONFIG_SPL_BUILD
127 +obj-y := duckbill.o
128 +else
129 +obj-y := iomux.o
130 +endif
131 diff --git a/board/i2se/duckbill/duckbill.c b/board/i2se/duckbill/duckbill.c
132 new file mode 100644
133 index 0000000..caeb903
134 --- /dev/null
135 +++ b/board/i2se/duckbill/duckbill.c
136 @@ -0,0 +1,181 @@
137 +/*
138 + * I2SE Duckbill board
139 + *
140 + * (C) Copyright 2014-2017 Michael Heimpold <mhei@heimpold.de>
141 + *
142 + * SPDX-License-Identifier: GPL-2.0+
143 + */
144 +
145 +#include <common.h>
146 +#include <asm/gpio.h>
147 +#include <asm/io.h>
148 +#include <asm/arch/imx-regs.h>
149 +#include <asm/arch/iomux-mx28.h>
150 +#include <asm/arch/clock.h>
151 +#include <asm/arch/sys_proto.h>
152 +#include <asm/setup.h>
153 +#include <fdt_support.h>
154 +#include <linux/mii.h>
155 +#include <miiphy.h>
156 +#include <netdev.h>
157 +#include <errno.h>
158 +#include <fuse.h>
159 +
160 +DECLARE_GLOBAL_DATA_PTR;
161 +
162 +static u32 system_rev;
163 +static u32 serialno;
164 +
165 +/*
166 + * Functions
167 + */
168 +int board_early_init_f(void)
169 +{
170 + /* IO0 clock at 480MHz */
171 + mxs_set_ioclk(MXC_IOCLK0, 480000);
172 + /* IO1 clock at 480MHz */
173 + mxs_set_ioclk(MXC_IOCLK1, 480000);
174 +
175 + /* SSP0 clock at 96MHz */
176 + mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
177 +
178 + return 0;
179 +}
180 +
181 +int dram_init(void)
182 +{
183 + return mxs_dram_init();
184 +}
185 +
186 +int board_init(void)
187 +{
188 + /* Adress of boot parameters */
189 + gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
190 +
191 + return 0;
192 +}
193 +
194 +#ifdef CONFIG_CMD_MMC
195 +int board_mmc_init(bd_t *bis)
196 +{
197 + return mxsmmc_initialize(bis, 0, NULL, NULL);
198 +}
199 +#endif
200 +
201 +#ifdef CONFIG_CMD_NET
202 +int board_eth_init(bd_t *bis)
203 +{
204 + unsigned int reset_gpio;
205 + int ret;
206 +
207 + ret = cpu_eth_init(bis);
208 +
209 + if (system_rev == 1)
210 + reset_gpio = MX28_PAD_SSP0_DATA7__GPIO_2_7;
211 + else
212 + reset_gpio = MX28_PAD_GPMI_ALE__GPIO_0_26;
213 +
214 + /* Reset PHY */
215 + gpio_direction_output(reset_gpio, 0);
216 + udelay(200);
217 + gpio_set_value(reset_gpio, 1);
218 +
219 + /* give PHY some time to get out of the reset */
220 + udelay(10000);
221 +
222 + ret = fecmxc_initialize(bis);
223 + if (ret) {
224 + puts("FEC MXS: Unable to init FEC\n");
225 + return ret;
226 + }
227 +
228 + return ret;
229 +}
230 +
231 +void mx28_adjust_mac(int dev_id, unsigned char *mac)
232 +{
233 + mac[0] = 0x00;
234 + mac[1] = 0x01;
235 + mac[2] = 0x87;
236 +}
237 +#endif
238 +
239 +#ifdef CONFIG_OF_BOARD_SETUP
240 +int ft_board_setup(void *blob, bd_t *bd)
241 +{
242 + uint8_t enetaddr[6];
243 + u32 mac = 0;
244 +
245 + enetaddr[0] = 0x00;
246 + enetaddr[1] = 0x01;
247 + enetaddr[2] = 0x87;
248 +
249 +#ifdef CONFIG_MXS_OCOTP
250 + /* only Duckbill SPI has a MAC for the QCA7k */
251 + fuse_read(0, 1, &mac);
252 +#endif
253 +
254 + if (mac != 0) {
255 + enetaddr[3] = (mac >> 16) & 0xff;
256 + enetaddr[4] = (mac >> 8) & 0xff;
257 + enetaddr[5] = mac & 0xff;
258 +
259 + fdt_find_and_setprop(blob,
260 + "/apb@80000000/apbh@80000000/ssp@80014000/ethernet@0",
261 + "local-mac-address", enetaddr, 6, 1);
262 + }
263 +
264 + return 0;
265 +}
266 +#endif
267 +
268 +#ifdef CONFIG_REVISION_TAG
269 +u32 get_board_rev(void)
270 +{
271 + return system_rev;
272 +}
273 +#endif
274 +
275 +#ifdef CONFIG_SERIAL_TAG
276 +void get_board_serial(struct tag_serialnr *serialnr)
277 +{
278 + serialnr->low = serialno;
279 + serialnr->high = 0;
280 +}
281 +#endif
282 +
283 +int misc_init_r(void)
284 +{
285 + unsigned int led_red_gpio;
286 + char *s;
287 +
288 + /* Board revision detection */
289 + gpio_direction_input(MX28_PAD_LCD_D17__GPIO_1_17);
290 +
291 + /* MX28_PAD_LCD_D17__GPIO_1_17: v1 = pull-down, v2 = pull-up */
292 + system_rev =
293 + gpio_get_value(MX28_PAD_LCD_D17__GPIO_1_17);
294 + system_rev += 1;
295 +
296 + /* enable red LED to indicate a running bootloader */
297 + if (system_rev == 1)
298 + led_red_gpio = MX28_PAD_AUART1_RX__GPIO_3_4;
299 + else
300 + led_red_gpio = MX28_PAD_SAIF0_LRCLK__GPIO_3_21;
301 + gpio_direction_output(led_red_gpio, 1);
302 +
303 + if (system_rev == 1)
304 + puts("Board: I2SE Duckbill\n");
305 + else
306 + puts("Board: I2SE Duckbill 2\n");
307 +
308 + serialno = env_get_ulong("serial#", 10, 0);
309 + s = env_get("serial#");
310 + if (s && s[0]) {
311 + puts("Serial: ");
312 + puts(s);
313 + putc('\n');
314 + }
315 +
316 + return 0;
317 +}
318 diff --git a/board/i2se/duckbill/iomux.c b/board/i2se/duckbill/iomux.c
319 new file mode 100644
320 index 0000000..b3c4d92
321 --- /dev/null
322 +++ b/board/i2se/duckbill/iomux.c
323 @@ -0,0 +1,157 @@
324 +/*
325 + * I2SE Duckbill IOMUX setup
326 + *
327 + * Copyright (C) 2013-2017 Michael Heimpold <mhei@heimpold.de>
328 + *
329 + * SPDX-License-Identifier: GPL-2.0+
330 + */
331 +
332 +#include <common.h>
333 +#include <config.h>
334 +#include <asm/io.h>
335 +#include <asm/gpio.h>
336 +#include <asm/arch/iomux-mx28.h>
337 +#include <asm/arch/imx-regs.h>
338 +#include <asm/arch/sys_proto.h>
339 +
340 +#define MUX_CONFIG_SSP0 (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)
341 +#define MUX_CONFIG_ENET (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)
342 +#define MUX_CONFIG_EMI (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL)
343 +
344 +/* For all revisions */
345 +const iomux_cfg_t iomux_setup[] = {
346 + /* DUART */
347 + MX28_PAD_PWM0__DUART_RX,
348 + MX28_PAD_PWM1__DUART_TX,
349 +
350 + /* eMMC (v2) or SD card (v1) */
351 + MX28_PAD_SSP0_DATA0__SSP0_D0 | MUX_CONFIG_SSP0,
352 + MX28_PAD_SSP0_DATA1__SSP0_D1 | MUX_CONFIG_SSP0,
353 + MX28_PAD_SSP0_DATA2__SSP0_D2 | MUX_CONFIG_SSP0,
354 + MX28_PAD_SSP0_DATA3__SSP0_D3 | MUX_CONFIG_SSP0,
355 + MX28_PAD_SSP0_CMD__SSP0_CMD | MUX_CONFIG_SSP0,
356 + MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT |
357 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
358 + MX28_PAD_SSP0_SCK__SSP0_SCK |
359 + (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
360 +
361 + /* Ethernet */
362 + MX28_PAD_ENET0_MDC__ENET0_MDC | MUX_CONFIG_ENET,
363 + MX28_PAD_ENET0_MDIO__ENET0_MDIO | MUX_CONFIG_ENET,
364 + MX28_PAD_ENET0_RX_EN__ENET0_RX_EN | MUX_CONFIG_ENET,
365 + MX28_PAD_ENET0_TX_EN__ENET0_TX_EN | MUX_CONFIG_ENET,
366 + MX28_PAD_ENET0_RXD0__ENET0_RXD0 | MUX_CONFIG_ENET,
367 + MX28_PAD_ENET0_RXD1__ENET0_RXD1 | MUX_CONFIG_ENET,
368 + MX28_PAD_ENET0_TXD0__ENET0_TXD0 | MUX_CONFIG_ENET,
369 + MX28_PAD_ENET0_TXD1__ENET0_TXD1 | MUX_CONFIG_ENET,
370 + MX28_PAD_ENET_CLK__CLKCTRL_ENET | MUX_CONFIG_ENET,
371 +
372 + /* EMI */
373 + MX28_PAD_EMI_D00__EMI_DATA0 | MUX_CONFIG_EMI,
374 + MX28_PAD_EMI_D01__EMI_DATA1 | MUX_CONFIG_EMI,
375 + MX28_PAD_EMI_D02__EMI_DATA2 | MUX_CONFIG_EMI,
376 + MX28_PAD_EMI_D03__EMI_DATA3 | MUX_CONFIG_EMI,
377 + MX28_PAD_EMI_D04__EMI_DATA4 | MUX_CONFIG_EMI,
378 + MX28_PAD_EMI_D05__EMI_DATA5 | MUX_CONFIG_EMI,
379 + MX28_PAD_EMI_D06__EMI_DATA6 | MUX_CONFIG_EMI,
380 + MX28_PAD_EMI_D07__EMI_DATA7 | MUX_CONFIG_EMI,
381 + MX28_PAD_EMI_D08__EMI_DATA8 | MUX_CONFIG_EMI,
382 + MX28_PAD_EMI_D09__EMI_DATA9 | MUX_CONFIG_EMI,
383 + MX28_PAD_EMI_D10__EMI_DATA10 | MUX_CONFIG_EMI,
384 + MX28_PAD_EMI_D11__EMI_DATA11 | MUX_CONFIG_EMI,
385 + MX28_PAD_EMI_D12__EMI_DATA12 | MUX_CONFIG_EMI,
386 + MX28_PAD_EMI_D13__EMI_DATA13 | MUX_CONFIG_EMI,
387 + MX28_PAD_EMI_D14__EMI_DATA14 | MUX_CONFIG_EMI,
388 + MX28_PAD_EMI_D15__EMI_DATA15 | MUX_CONFIG_EMI,
389 + MX28_PAD_EMI_ODT0__EMI_ODT0 | MUX_CONFIG_EMI,
390 + MX28_PAD_EMI_DQM0__EMI_DQM0 | MUX_CONFIG_EMI,
391 + MX28_PAD_EMI_ODT1__EMI_ODT1 | MUX_CONFIG_EMI,
392 + MX28_PAD_EMI_DQM1__EMI_DQM1 | MUX_CONFIG_EMI,
393 + MX28_PAD_EMI_DDR_OPEN_FB__EMI_DDR_OPEN_FEEDBACK | MUX_CONFIG_EMI,
394 + MX28_PAD_EMI_CLK__EMI_CLK | MUX_CONFIG_EMI,
395 + MX28_PAD_EMI_DQS0__EMI_DQS0 | MUX_CONFIG_EMI,
396 + MX28_PAD_EMI_DQS1__EMI_DQS1 | MUX_CONFIG_EMI,
397 + MX28_PAD_EMI_DDR_OPEN__EMI_DDR_OPEN | MUX_CONFIG_EMI,
398 +
399 + MX28_PAD_EMI_A00__EMI_ADDR0 | MUX_CONFIG_EMI,
400 + MX28_PAD_EMI_A01__EMI_ADDR1 | MUX_CONFIG_EMI,
401 + MX28_PAD_EMI_A02__EMI_ADDR2 | MUX_CONFIG_EMI,
402 + MX28_PAD_EMI_A03__EMI_ADDR3 | MUX_CONFIG_EMI,
403 + MX28_PAD_EMI_A04__EMI_ADDR4 | MUX_CONFIG_EMI,
404 + MX28_PAD_EMI_A05__EMI_ADDR5 | MUX_CONFIG_EMI,
405 + MX28_PAD_EMI_A06__EMI_ADDR6 | MUX_CONFIG_EMI,
406 + MX28_PAD_EMI_A07__EMI_ADDR7 | MUX_CONFIG_EMI,
407 + MX28_PAD_EMI_A08__EMI_ADDR8 | MUX_CONFIG_EMI,
408 + MX28_PAD_EMI_A09__EMI_ADDR9 | MUX_CONFIG_EMI,
409 + MX28_PAD_EMI_A10__EMI_ADDR10 | MUX_CONFIG_EMI,
410 + MX28_PAD_EMI_A11__EMI_ADDR11 | MUX_CONFIG_EMI,
411 + MX28_PAD_EMI_A12__EMI_ADDR12 | MUX_CONFIG_EMI,
412 + MX28_PAD_EMI_A13__EMI_ADDR13 | MUX_CONFIG_EMI,
413 + MX28_PAD_EMI_A14__EMI_ADDR14 | MUX_CONFIG_EMI,
414 + MX28_PAD_EMI_BA0__EMI_BA0 | MUX_CONFIG_EMI,
415 + MX28_PAD_EMI_BA1__EMI_BA1 | MUX_CONFIG_EMI,
416 + MX28_PAD_EMI_BA2__EMI_BA2 | MUX_CONFIG_EMI,
417 + MX28_PAD_EMI_CASN__EMI_CASN | MUX_CONFIG_EMI,
418 + MX28_PAD_EMI_RASN__EMI_RASN | MUX_CONFIG_EMI,
419 + MX28_PAD_EMI_WEN__EMI_WEN | MUX_CONFIG_EMI,
420 + MX28_PAD_EMI_CE0N__EMI_CE0N | MUX_CONFIG_EMI,
421 + MX28_PAD_EMI_CE1N__EMI_CE1N | MUX_CONFIG_EMI,
422 + MX28_PAD_EMI_CKE__EMI_CKE | MUX_CONFIG_EMI,
423 +
424 + /* Revision pin(s) */
425 + MX28_PAD_LCD_D17__GPIO_1_17,
426 +};
427 +
428 +/* For revision 1 only */
429 +const iomux_cfg_t iomux_setup_v1[] = {
430 + /* PHY reset */
431 + MX28_PAD_SSP0_DATA7__GPIO_2_7 |
432 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
433 +
434 + /* LEDs */
435 + MX28_PAD_AUART1_RX__GPIO_3_4,
436 + MX28_PAD_AUART1_TX__GPIO_3_5,
437 +};
438 +
439 +/* For revision 2 only */
440 +const iomux_cfg_t iomux_setup_v2[] = {
441 + /* eMMC (v2) */
442 + MX28_PAD_SSP0_DATA4__SSP0_D4 | MUX_CONFIG_SSP0,
443 + MX28_PAD_SSP0_DATA5__SSP0_D5 | MUX_CONFIG_SSP0,
444 + MX28_PAD_SSP0_DATA6__SSP0_D6 | MUX_CONFIG_SSP0,
445 + MX28_PAD_SSP0_DATA7__SSP0_D7 | MUX_CONFIG_SSP0,
446 +
447 + /* PHY reset */
448 + MX28_PAD_GPMI_ALE__GPIO_0_26 |
449 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
450 +
451 + /* LEDs */
452 + MX28_PAD_SAIF0_LRCLK__GPIO_3_21,
453 + MX28_PAD_SAIF0_MCLK__GPIO_3_20,
454 +};
455 +
456 +#define HW_DRAM_CTL29 (0x74 >> 2)
457 +#define CS_MAP 0xf
458 +#define COLUMN_SIZE 0x2
459 +#define ADDR_PINS 0x1
460 +#define APREBIT 0xa
461 +
462 +#define HW_DRAM_CTL29_CONFIG (CS_MAP << 24 | COLUMN_SIZE << 16 | \
463 + ADDR_PINS << 8 | APREBIT)
464 +
465 +void mxs_adjust_memory_params(uint32_t *dram_vals)
466 +{
467 + dram_vals[HW_DRAM_CTL29] = HW_DRAM_CTL29_CONFIG;
468 +}
469 +
470 +void board_init_ll(const uint32_t arg, const uint32_t *resptr)
471 +{
472 + mxs_common_spl_init(arg, resptr, iomux_setup, ARRAY_SIZE(iomux_setup));
473 +
474 + gpio_direction_input(MX28_PAD_LCD_D17__GPIO_1_17);
475 +
476 + if (gpio_get_value(MX28_PAD_LCD_D17__GPIO_1_17))
477 + mxs_iomux_setup_multiple_pads(iomux_setup_v2, ARRAY_SIZE(iomux_setup_v2));
478 + else
479 + mxs_iomux_setup_multiple_pads(iomux_setup_v1, ARRAY_SIZE(iomux_setup_v1));
480 +}
481 diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig
482 new file mode 100644
483 index 0000000..2adce92
484 --- /dev/null
485 +++ b/configs/duckbill_defconfig
486 @@ -0,0 +1,31 @@
487 +CONFIG_ARM=y
488 +CONFIG_TARGET_DUCKBILL=y
489 +CONFIG_SPL_GPIO_SUPPORT=y
490 +CONFIG_SPL_LIBCOMMON_SUPPORT=y
491 +CONFIG_SPL_LIBGENERIC_SUPPORT=y
492 +CONFIG_SPL_SERIAL_SUPPORT=y
493 +CONFIG_BOOTDELAY=1
494 +# CONFIG_CONSOLE_MUX is not set
495 +CONFIG_SYS_CONSOLE_IS_IN_ENV=y
496 +CONFIG_VERSION_VARIABLE=y
497 +# CONFIG_DISPLAY_BOARDINFO is not set
498 +# CONFIG_EFI_LOADER is not set
499 +CONFIG_ARCH_MISC_INIT=y
500 +CONFIG_SPL=y
501 +CONFIG_HUSH_PARSER=y
502 +CONFIG_CMD_BOOTZ=y
503 +# CONFIG_CMD_IMLS is not set
504 +# CONFIG_CMD_FLASH is not set
505 +CONFIG_CMD_MMC=y
506 +CONFIG_CMD_GPIO=y
507 +CONFIG_CMD_DHCP=y
508 +CONFIG_CMD_MII=y
509 +CONFIG_CMD_PING=y
510 +CONFIG_CMD_CACHE=y
511 +CONFIG_CMD_EXT4=y
512 +CONFIG_CMD_EXT4_WRITE=y
513 +CONFIG_CMD_FAT=y
514 +CONFIG_CMD_FS_GENERIC=y
515 +CONFIG_ENV_IS_IN_MMC=y
516 +CONFIG_MMC_MXS=y
517 +CONFIG_OF_LIBFDT=y
518 diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h
519 new file mode 100644
520 index 0000000..f9374c6
521 --- /dev/null
522 +++ b/include/configs/duckbill.h
523 @@ -0,0 +1,199 @@
524 +/*
525 + * Copyright (C) 2014-2015 Michael Heimpold <mhei@heimpold.de>
526 + *
527 + * SPDX-License-Identifier: GPL-2.0+
528 + */
529 +#ifndef __CONFIGS_DUCKBILL_H__
530 +#define __CONFIGS_DUCKBILL_H__
531 +
532 +/* System configurations */
533 +#define CONFIG_MX28 /* i.MX28 SoC */
534 +#define CONFIG_MACH_TYPE MACH_TYPE_DUCKBILL
535 +
536 +#define CONFIG_MISC_INIT_R
537 +
538 +#define CONFIG_SYS_MXS_VDD5V_ONLY
539 +
540 +/* U-Boot Commands */
541 +#define CONFIG_CMD_FUSE
542 +#define CONFIG_CMD_UNZIP
543 +
544 +/* Memory configuration */
545 +#define CONFIG_NR_DRAM_BANKS 1 /* 1 bank of DRAM */
546 +#define PHYS_SDRAM_1 0x40000000 /* Base address */
547 +#define PHYS_SDRAM_1_SIZE 0x40000000 /* Max 1 GB RAM */
548 +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
549 +
550 +/* Environment is in MMC */
551 +#define CONFIG_ENV_OVERWRITE
552 +#define CONFIG_ENV_SIZE (128 * 1024)
553 +#define CONFIG_ENV_OFFSET (128 * 1024)
554 +#define CONFIG_ENV_OFFSET_REDUND (256 * 1024)
555 +#define CONFIG_SYS_MMC_ENV_DEV 0
556 +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
557 +
558 +/* FEC Ethernet on SoC */
559 +#ifdef CONFIG_CMD_NET
560 +#define CONFIG_FEC_MXC
561 +#define CONFIG_NET_MULTI
562 +#define CONFIG_MX28_FEC_MAC_IN_OCOTP
563 +#define CONFIG_FEC_MXC_PHYADDR 1
564 +#define IMX_FEC_BASE MXS_ENET0_BASE
565 +#endif
566 +
567 +#define CONFIG_IPADDR 192.168.1.10
568 +#define CONFIG_SERVERIP 192.168.1.1
569 +#define CONFIG_NETMASK 255.255.255.0
570 +#define CONFIG_GATEWAYIP 192.168.1.254
571 +
572 +/* BOOTP options */
573 +#define CONFIG_BOOTP_SUBNETMASK
574 +#define CONFIG_BOOTP_GATEWAY
575 +#define CONFIG_BOOTP_HOSTNAME
576 +
577 +/* SPI */
578 +#ifdef CONFIG_CMD_SPI
579 +#define CONFIG_DEFAULT_SPI_BUS 2
580 +#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
581 +#endif
582 +
583 +/* Boot Linux */
584 +#define CONFIG_BOOTDELAY 1
585 +#define CONFIG_BOOTFILE "zImage"
586 +#define CONFIG_LOADADDR 0x42000000
587 +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
588 +#define CONFIG_REVISION_TAG
589 +#define CONFIG_SERIAL_TAG
590 +#define CONFIG_OF_BOARD_SETUP
591 +#define CONFIG_BOOT_RETRY_TIME 120 /* retry autoboot after 120 seconds */
592 +#define CONFIG_AUTOBOOT_KEYED
593 +#define CONFIG_AUTOBOOT_PROMPT "Autobooting in %d seconds, " \
594 + "press <c> to stop\n"
595 +#define CONFIG_AUTOBOOT_DELAY_STR "\x63" /* allows retry after retry time */
596 +#define CONFIG_AUTOBOOT_STOP_STR " " /* stop autoboot with <Space> */
597 +#define CONFIG_RESET_TO_RETRY /* reset board to retry booting */
598 +
599 +/* Extra Environment */
600 +#define CONFIG_EXTRA_ENV_SETTINGS \
601 + "mmc_part2_offset=1000\0" \
602 + "mmc_part3_offset=19000\0" \
603 + "update_openwrt_firmware_filename=openwrt-mxs-root.ext4\0" \
604 + "update_openwrt_firmware=" \
605 + "if mmc rescan; then " \
606 + "if tftp ${update_openwrt_firmware_filename}; then " \
607 + "setexpr fw_sz ${filesize} + 1ff; " \
608 + "setexpr fw_sz ${fw_sz} / 200; " \
609 + "mmc write ${loadaddr} ${mmc_part2_offset} ${fw_sz}; " \
610 + "mmc write ${loadaddr} ${mmc_part3_offset} ${fw_sz}; " \
611 + "fi; " \
612 + "fi\0" \
613 + "update_fw_filename_prefix=emmc.img.\0" \
614 + "update_fw_filename_suffix=.gz\0" \
615 + "update_fw_parts=0x6\0" \
616 + "update_fw_fsize_uncompressed=4000000\0" \
617 + "gzwrite_wbuf=100000\0" \
618 + "update_emmc_firmware=" \
619 + "setexpr i ${update_fw_parts}; setexpr error 0; " \
620 + "while itest ${i} -gt 0; do " \
621 + "echo Transfering firmware image part ${i} of ${update_fw_parts}; " \
622 + "if itest ${i} -le 9; then " \
623 + "setenv j 0${i}; " \
624 + "else " \
625 + "setenv j ${i}; " \
626 + "fi; " \
627 + "if tftp ${loadaddr} ${update_fw_basedir}${update_fw_filename_prefix}${j}${update_fw_filename_suffix}; then " \
628 + "setexpr k ${i} - 1; " \
629 + "setexpr offset ${update_fw_fsize_uncompressed} * ${k}; " \
630 + "if gzwrite mmc ${mmcdev} ${loadaddr} ${filesize} ${gzwrite_wbuf} ${offset}; then " \
631 + "setexpr i ${i} - 1; " \
632 + "else " \
633 + "setexpr i 0; " \
634 + "setexpr error 1; " \
635 + "fi; " \
636 + "else " \
637 + "setexpr i 0; " \
638 + "setexpr error 1; " \
639 + "fi; " \
640 + "done; setenv i; setenv j; setenv k; setenv fsize; setenv filesize; setenv offset; " \
641 + "if test ${error} -eq 1; then " \
642 + "echo Firmware Update FAILED; " \
643 + "else " \
644 + "echo Firmware Update OK; " \
645 + "fi; setenv error\0" \
646 + "erase_mmc=mmc erase 0 2\0" \
647 + "erase_env1=mmc erase 100 100\0" \
648 + "erase_env2=mmc erase 200 100\0" \
649 + "image=zImage\0" \
650 + "console=ttyAMA0\0" \
651 + "fdt_file=imx28-duckbill-2.dtb\0" \
652 + "fdt_addr=0x41000000\0" \
653 + "boot_fdt=try\0" \
654 + "ip_dyn=yes\0" \
655 + "bootsys=1\0" \
656 + "mmcdev=0\0" \
657 + "mmcpart=2\0" \
658 + "mmcroot=/dev/mmcblk0p2\0" \
659 + "mmcargs=setenv bootargs console=${console},${baudrate} " \
660 + "root=${mmcroot} " \
661 + "rootwait bootsys=${bootsys} panic=1\0" \
662 + "loadimage=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${image}\0" \
663 + "loadfdt=ext4load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/${fdt_file}\0" \
664 + "mmcboot=echo Booting from mmc ...; " \
665 + "setexpr mmcpart 1 + ${bootsys}; " \
666 + "setenv mmcroot /dev/mmcblk0p${mmcpart}; " \
667 + "run mmcargs; " \
668 + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
669 + "if run loadfdt; then " \
670 + "bootz ${loadaddr} - ${fdt_addr}; " \
671 + "else " \
672 + "if test ${boot_fdt} = try; then " \
673 + "bootz; " \
674 + "else " \
675 + "echo WARN: Cannot load the DT; " \
676 + "fi; " \
677 + "fi; " \
678 + "else " \
679 + "bootz; " \
680 + "fi\0" \
681 + "nfsroot=/\0" \
682 + "netargs=setenv bootargs console=${console},${baudrate} " \
683 + "root=/dev/nfs " \
684 + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
685 + "netboot=echo Booting from net ...; " \
686 + "run netargs; " \
687 + "if test ${ip_dyn} = yes; then " \
688 + "setenv get_cmd dhcp; " \
689 + "else " \
690 + "setenv get_cmd tftp; " \
691 + "fi; " \
692 + "${get_cmd} ${image}; " \
693 + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
694 + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
695 + "bootz ${loadaddr} - ${fdt_addr}; " \
696 + "else " \
697 + "if test ${boot_fdt} = try; then " \
698 + "bootz; " \
699 + "else " \
700 + "echo WARN: Cannot load the DT; " \
701 + "fi;" \
702 + "fi; " \
703 + "else " \
704 + "bootz; " \
705 + "fi\0"
706 +
707 +#define CONFIG_BOOTCOMMAND \
708 + "mmc dev ${mmcdev}; " \
709 + "if mmc rescan; then " \
710 + "if run loadimage; then " \
711 + "run mmcboot; " \
712 + "else " \
713 + "run netboot; " \
714 + "fi; " \
715 + "else " \
716 + "run netboot; " \
717 + "fi"
718 +
719 +/* The rest of the configuration is shared */
720 +#include <configs/mxs.h>
721 +
722 +#endif /* __CONFIGS_DUCKBILL_H__ */
723 --
724 2.7.4
725