blob: c3bbcff0cf58df53f4cf481e0bdb5fbd95900260 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Eric Benard3cbeb0f2014-04-04 19:05:55 +02002/*
3 * Copyright (C) 2014 Eukréa Electromatique
4 * Author: Eric Bénard <eric@eukrea.com>
5 * Fabio Estevam <fabio.estevam@freescale.com>
6 * Jon Nettleton <jon.nettleton@gmail.com>
7 *
8 * based on sabresd.c which is :
9 * Copyright (C) 2012 Freescale Semiconductor, Inc.
10 * and on hummingboard.c which is :
11 * Copyright (C) 2013 SolidRun ltd.
12 * Copyright (C) 2013 Jon Nettleton <jon.nettleton@gmail.com>.
Eric Benard3cbeb0f2014-04-04 19:05:55 +020013 */
14
Simon Glassc3dc39a2020-05-10 11:39:55 -060015#include <common.h>
Simon Glass52559322019-11-14 12:57:46 -070016#include <init.h>
Simon Glass90526e92020-05-10 11:39:56 -060017#include <net.h>
Eric Benard3cbeb0f2014-04-04 19:05:55 +020018#include <asm/arch/clock.h>
19#include <asm/arch/sys_proto.h>
20#include <asm/arch/imx-regs.h>
21#include <asm/arch/iomux.h>
22#include <asm/arch/mx6-pins.h>
Simon Glass401d1c42020-10-30 21:38:53 -060023#include <asm/global_data.h>
Simon Glassc05ed002020-05-10 11:40:11 -060024#include <linux/delay.h>
Masahiro Yamada1221ce42016-09-21 11:28:55 +090025#include <linux/errno.h>
Eric Benard3cbeb0f2014-04-04 19:05:55 +020026#include <asm/gpio.h>
Stefano Babic552a8482017-06-29 10:16:06 +020027#include <asm/mach-imx/iomux-v3.h>
28#include <asm/mach-imx/boot_mode.h>
29#include <asm/mach-imx/mxc_i2c.h>
30#include <asm/mach-imx/spi.h>
31#include <asm/mach-imx/video.h>
Eric Benard3cbeb0f2014-04-04 19:05:55 +020032#include <i2c.h>
Diego Dorta7594c512017-09-22 12:12:18 -030033#include <input.h>
Eric Benard3cbeb0f2014-04-04 19:05:55 +020034#include <miiphy.h>
35#include <netdev.h>
36#include <asm/arch/mxc_hdmi.h>
37#include <asm/arch/crm_regs.h>
38#include <linux/fb.h>
39#include <ipu_pixfmt.h>
40#include <asm/io.h>
Lukasz Majewski8ea754d2017-11-07 11:10:29 +010041
Eric Benard3cbeb0f2014-04-04 19:05:55 +020042DECLARE_GLOBAL_DATA_PTR;
43
44#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
45 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
46 PAD_CTL_SRE_FAST | PAD_CTL_HYS)
47
48#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \
49 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
50 PAD_CTL_SRE_FAST | PAD_CTL_HYS)
51
52#define USDHC_PAD_CLK_CTRL (PAD_CTL_SPEED_LOW | \
53 PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | \
54 PAD_CTL_HYS)
55
56#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
57 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
58
59#define ENET_PAD_CTRL_PD (PAD_CTL_PUS_100K_DOWN | \
60 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
61
62#define ENET_PAD_CTRL_CLK ((PAD_CTL_PUS_100K_UP & ~PAD_CTL_PKE) | \
63 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
64
65#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
66 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
67 PAD_CTL_ODE | PAD_CTL_SRE_FAST)
68
69#define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \
70 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
71
72static int board_type = -1;
73#define BOARD_IS_MARSBOARD 0
74#define BOARD_IS_RIOTBOARD 1
75
76int dram_init(void)
77{
78 gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
79
80 return 0;
81}
82
83static iomux_v3_cfg_t const uart2_pads[] = {
84 MX6_PAD_EIM_D26__UART2_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
85 MX6_PAD_EIM_D27__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
86};
87
88static void setup_iomux_uart(void)
89{
90 imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads));
91}
92
93iomux_v3_cfg_t const enet_pads[] = {
94 MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
95 MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
96 /* GPIO16 -> AR8035 25MHz */
97 MX6_PAD_GPIO_16__ENET_REF_CLK | MUX_PAD_CTRL(NO_PAD_CTRL),
98 MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(NO_PAD_CTRL),
99 MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
100 MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
101 MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
102 MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
103 MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
104 /* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
105 MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL_CLK),
106 MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
107 MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
108 MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
109 MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
110 MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
111 MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
112 /* AR8035 PHY Reset */
113 MX6_PAD_EIM_D31__GPIO3_IO31 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
114 /* AR8035 PHY Interrupt */
115 MX6_PAD_ENET_TX_EN__GPIO1_IO28 | MUX_PAD_CTRL(ENET_PAD_CTRL),
116};
117
118static void setup_iomux_enet(void)
119{
120 imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
121
122 /* Reset AR8035 PHY */
123 gpio_direction_output(IMX_GPIO_NR(3, 31) , 0);
124 mdelay(2);
125 gpio_set_value(IMX_GPIO_NR(3, 31), 1);
126}
127
128int mx6_rgmii_rework(struct phy_device *phydev)
129{
130 /* from linux/arch/arm/mach-imx/mach-imx6q.c :
131 * Ar803x phy SmartEEE feature cause link status generates glitch,
132 * which cause ethernet link down/up issue, so disable SmartEEE
133 */
134 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);
135 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x805d);
136 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4003);
137
138 return 0;
139}
140
141int board_phy_config(struct phy_device *phydev)
142{
143 mx6_rgmii_rework(phydev);
144
145 if (phydev->drv->config)
146 phydev->drv->config(phydev);
147
148 return 0;
149}
150
Eric Benard3cbeb0f2014-04-04 19:05:55 +0200151#ifdef CONFIG_MXC_SPI
152iomux_v3_cfg_t const ecspi1_pads[] = {
153 MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
154 MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
155 MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
156 MX6_PAD_EIM_EB2__GPIO2_IO30 | MUX_PAD_CTRL(NO_PAD_CTRL),
157};
158
Nikita Kiryanov155fa9a2014-08-20 15:08:50 +0300159int board_spi_cs_gpio(unsigned bus, unsigned cs)
160{
161 return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(2, 30)) : -1;
162}
163
Eric Benard3cbeb0f2014-04-04 19:05:55 +0200164static void setup_spi(void)
165{
166 imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
167}
168#endif
169
170struct i2c_pads_info i2c_pad_info1 = {
171 .scl = {
172 .i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL
173 | MUX_PAD_CTRL(I2C_PAD_CTRL),
174 .gpio_mode = MX6_PAD_CSI0_DAT9__GPIO5_IO27
175 | MUX_PAD_CTRL(I2C_PAD_CTRL),
176 .gp = IMX_GPIO_NR(5, 27)
177 },
178 .sda = {
179 .i2c_mode = MX6_PAD_CSI0_DAT8__I2C1_SDA
180 | MUX_PAD_CTRL(I2C_PAD_CTRL),
181 .gpio_mode = MX6_PAD_CSI0_DAT8__GPIO5_IO26
182 | MUX_PAD_CTRL(I2C_PAD_CTRL),
183 .gp = IMX_GPIO_NR(5, 26)
184 }
185};
186
187struct i2c_pads_info i2c_pad_info2 = {
188 .scl = {
189 .i2c_mode = MX6_PAD_KEY_COL3__I2C2_SCL
190 | MUX_PAD_CTRL(I2C_PAD_CTRL),
191 .gpio_mode = MX6_PAD_KEY_COL3__GPIO4_IO12
192 | MUX_PAD_CTRL(I2C_PAD_CTRL),
193 .gp = IMX_GPIO_NR(4, 12)
194 },
195 .sda = {
196 .i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA
197 | MUX_PAD_CTRL(I2C_PAD_CTRL),
198 .gpio_mode = MX6_PAD_KEY_ROW3__GPIO4_IO13
199 | MUX_PAD_CTRL(I2C_PAD_CTRL),
200 .gp = IMX_GPIO_NR(4, 13)
201 }
202};
203
204struct i2c_pads_info i2c_pad_info3 = {
205 .scl = {
206 .i2c_mode = MX6_PAD_GPIO_5__I2C3_SCL
207 | MUX_PAD_CTRL(I2C_PAD_CTRL),
208 .gpio_mode = MX6_PAD_GPIO_5__GPIO1_IO05
209 | MUX_PAD_CTRL(I2C_PAD_CTRL),
210 .gp = IMX_GPIO_NR(1, 5)
211 },
212 .sda = {
213 .i2c_mode = MX6_PAD_GPIO_6__I2C3_SDA
214 | MUX_PAD_CTRL(I2C_PAD_CTRL),
215 .gpio_mode = MX6_PAD_GPIO_6__GPIO1_IO06
216 | MUX_PAD_CTRL(I2C_PAD_CTRL),
217 .gp = IMX_GPIO_NR(1, 6)
218 }
219};
220
221iomux_v3_cfg_t const tft_pads_riot[] = {
222 /* LCD_PWR_EN */
223 MX6_PAD_ENET_TXD1__GPIO1_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
224 /* TOUCH_INT */
225 MX6_PAD_NANDF_CS1__GPIO6_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL),
226 /* LED_PWR_EN */
227 MX6_PAD_NANDF_CS2__GPIO6_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL),
228 /* BL LEVEL */
229 MX6_PAD_SD1_CMD__GPIO1_IO18 | MUX_PAD_CTRL(NO_PAD_CTRL),
230};
231
232iomux_v3_cfg_t const tft_pads_mars[] = {
233 /* LCD_PWR_EN */
234 MX6_PAD_ENET_TXD1__GPIO1_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
235 /* TOUCH_INT */
236 MX6_PAD_NANDF_CS1__GPIO6_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL),
237 /* LED_PWR_EN */
238 MX6_PAD_NANDF_CS2__GPIO6_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL),
239 /* BL LEVEL (PWM4) */
240 MX6_PAD_SD4_DAT2__GPIO2_IO10 | MUX_PAD_CTRL(NO_PAD_CTRL),
241};
242
243#if defined(CONFIG_VIDEO_IPUV3)
244
245static void enable_lvds(struct display_info_t const *dev)
246{
247 struct iomuxc *iomux = (struct iomuxc *)
248 IOMUXC_BASE_ADDR;
249 setbits_le32(&iomux->gpr[2],
250 IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT);
251 /* set backlight level to ON */
252 if (board_type == BOARD_IS_RIOTBOARD)
253 gpio_direction_output(IMX_GPIO_NR(1, 18) , 1);
254 else if (board_type == BOARD_IS_MARSBOARD)
255 gpio_direction_output(IMX_GPIO_NR(2, 10) , 1);
256}
257
258static void disable_lvds(struct display_info_t const *dev)
259{
260 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
261
262 /* set backlight level to OFF */
263 if (board_type == BOARD_IS_RIOTBOARD)
264 gpio_direction_output(IMX_GPIO_NR(1, 18) , 0);
265 else if (board_type == BOARD_IS_MARSBOARD)
266 gpio_direction_output(IMX_GPIO_NR(2, 10) , 0);
267
268 clrbits_le32(&iomux->gpr[2],
269 IOMUXC_GPR2_LVDS_CH0_MODE_MASK);
270}
271
Eric Benard3cbeb0f2014-04-04 19:05:55 +0200272static void do_enable_hdmi(struct display_info_t const *dev)
273{
274 disable_lvds(dev);
275 imx_enable_hdmi_phy();
276}
277
278static int detect_i2c(struct display_info_t const *dev)
279{
280 return (0 == i2c_set_bus_num(dev->bus)) &&
281 (0 == i2c_probe(dev->addr));
282}
283
284struct display_info_t const displays[] = {{
285 .bus = -1,
286 .addr = 0,
287 .pixfmt = IPU_PIX_FMT_RGB24,
288 .detect = detect_hdmi,
289 .enable = do_enable_hdmi,
290 .mode = {
291 .name = "HDMI",
292 .refresh = 60,
293 .xres = 1024,
294 .yres = 768,
295 .pixclock = 15385,
296 .left_margin = 220,
297 .right_margin = 40,
298 .upper_margin = 21,
299 .lower_margin = 7,
300 .hsync_len = 60,
301 .vsync_len = 10,
302 .sync = FB_SYNC_EXT,
303 .vmode = FB_VMODE_NONINTERLACED
304} }, {
305 .bus = 2,
306 .addr = 0x1,
307 .pixfmt = IPU_PIX_FMT_LVDS666,
308 .detect = detect_i2c,
309 .enable = enable_lvds,
310 .mode = {
311 .name = "LCD8000-97C",
312 .refresh = 60,
313 .xres = 1024,
314 .yres = 768,
315 .pixclock = 15385,
316 .left_margin = 100,
317 .right_margin = 200,
318 .upper_margin = 10,
319 .lower_margin = 20,
320 .hsync_len = 20,
321 .vsync_len = 8,
322 .sync = FB_SYNC_EXT,
323 .vmode = FB_VMODE_NONINTERLACED
324} } };
325size_t display_count = ARRAY_SIZE(displays);
326
327static void setup_display(void)
328{
329 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
330 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
331 int reg;
332
333 enable_ipu_clock();
334 imx_setup_hdmi();
335
336 /* Turn on LDB0, IPU,IPU DI0 clocks */
337 setbits_le32(&mxc_ccm->CCGR3,
338 MXC_CCM_CCGR3_LDB_DI0_MASK);
339
340 /* set LDB0 clk select to 011/011 */
341 clrsetbits_le32(&mxc_ccm->cs2cdr,
342 MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_MASK,
343 (3 << MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_OFFSET));
344
345 setbits_le32(&mxc_ccm->cscmr2,
346 MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV);
347
348 setbits_le32(&mxc_ccm->chsccdr,
349 (CHSCCDR_CLK_SEL_LDB_DI0
350 << MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET));
351
352 reg = IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES
353 | IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW
354 | IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG
355 | IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT
356 | IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG
357 | IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT
358 | IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED
359 | IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0;
360 writel(reg, &iomux->gpr[2]);
361
362 clrsetbits_le32(&iomux->gpr[3],
363 IOMUXC_GPR3_LVDS0_MUX_CTL_MASK |
364 IOMUXC_GPR3_HDMI_MUX_CTL_MASK,
365 IOMUXC_GPR3_MUX_SRC_IPU1_DI0
366 << IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET);
367}
368#endif /* CONFIG_VIDEO_IPUV3 */
369
370/*
371 * Do not overwrite the console
372 * Use always serial for U-Boot console
373 */
374int overwrite_console(void)
375{
376 return 1;
377}
378
Masahiro Yamadab75d8dc2020-06-26 15:13:33 +0900379int board_eth_init(struct bd_info *bis)
Eric Benard3cbeb0f2014-04-04 19:05:55 +0200380{
381 setup_iomux_enet();
382
383 return cpu_eth_init(bis);
384}
385
386int board_early_init_f(void)
387{
388 u32 cputype = cpu_type(get_cpu_rev());
389
390 switch (cputype) {
391 case MXC_CPU_MX6SOLO:
392 board_type = BOARD_IS_RIOTBOARD;
393 break;
394 case MXC_CPU_MX6D:
395 board_type = BOARD_IS_MARSBOARD;
396 break;
397 }
398
399 setup_iomux_uart();
400
401 if (board_type == BOARD_IS_RIOTBOARD)
402 imx_iomux_v3_setup_multiple_pads(
403 tft_pads_riot, ARRAY_SIZE(tft_pads_riot));
404 else if (board_type == BOARD_IS_MARSBOARD)
405 imx_iomux_v3_setup_multiple_pads(
406 tft_pads_mars, ARRAY_SIZE(tft_pads_mars));
407#if defined(CONFIG_VIDEO_IPUV3)
408 /* power ON LCD */
409 gpio_direction_output(IMX_GPIO_NR(1, 29) , 1);
410 /* touch interrupt is an input */
411 gpio_direction_input(IMX_GPIO_NR(6, 14));
412 /* power ON backlight */
413 gpio_direction_output(IMX_GPIO_NR(6, 15) , 1);
414 /* set backlight level to off */
415 if (board_type == BOARD_IS_RIOTBOARD)
416 gpio_direction_output(IMX_GPIO_NR(1, 18) , 0);
417 else if (board_type == BOARD_IS_MARSBOARD)
418 gpio_direction_output(IMX_GPIO_NR(2, 10) , 0);
419 setup_display();
420#endif
421
422 return 0;
423}
424
425int board_init(void)
426{
427 /* address of boot parameters */
428 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
429 /* i2c1 : PMIC, Audio codec on RiOT, Expansion connector on MarS */
430 setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
431 /* i2c2 : HDMI EDID */
432 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
433 /* i2c3 : LVDS, Expansion connector */
434 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3);
435#ifdef CONFIG_MXC_SPI
436 setup_spi();
437#endif
438 return 0;
439}
440
441#ifdef CONFIG_CMD_BMODE
442static const struct boot_mode riotboard_boot_modes[] = {
443 {"sd2", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
444 {"sd3", MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)},
445 {"emmc", MAKE_CFGVAL(0x40, 0x38, 0x00, 0x00)},
446 {NULL, 0},
447};
448static const struct boot_mode marsboard_boot_modes[] = {
449 {"sd2", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
450 {"emmc", MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)},
451 {NULL, 0},
452};
453#endif
454
455int board_late_init(void)
456{
457#ifdef CONFIG_CMD_BMODE
458 if (board_type == BOARD_IS_RIOTBOARD)
459 add_board_boot_modes(riotboard_boot_modes);
460 else if (board_type == BOARD_IS_RIOTBOARD)
461 add_board_boot_modes(marsboard_boot_modes);
462#endif
463
464 return 0;
465}
466
467int checkboard(void)
468{
469 puts("Board: ");
470 if (board_type == BOARD_IS_MARSBOARD)
471 puts("MarSBoard\n");
472 else if (board_type == BOARD_IS_RIOTBOARD)
473 puts("RIoTboard\n");
474 else
475 printf("unknown - cputype : %02x\n", cpu_type(get_cpu_rev()));
476
477 return 0;
478}
Fabien Lahoudere725019b2018-11-08 11:28:05 +0100479
480#ifdef CONFIG_SPL_BUILD
481#include <spl.h>
482
483void board_init_f(ulong dummy)
484{
485 u32 cputype = cpu_type(get_cpu_rev());
486
487 switch (cputype) {
488 case MXC_CPU_MX6SOLO:
489 board_type = BOARD_IS_RIOTBOARD;
490 break;
491 case MXC_CPU_MX6D:
492 board_type = BOARD_IS_MARSBOARD;
493 break;
494 }
495 arch_cpu_init();
496
497 /* setup GP timer */
498 timer_init();
499
500#ifdef CONFIG_SPL_SERIAL_SUPPORT
501 setup_iomux_uart();
502 preloader_console_init();
503#endif
504}
505
506void board_boot_order(u32 *spl_boot_list)
507{
508 spl_boot_list[0] = BOOT_DEVICE_MMC1;
509}
510
511/*
512 * In order to jump to standard u-boot shell, you have to connect pin 5 of J13
513 * to pin 3 (ground).
514 */
515int spl_start_uboot(void)
516{
517 int gpio_key = IMX_GPIO_NR(4, 16);
518
519 gpio_direction_input(gpio_key);
520 if (gpio_get_value(gpio_key) == 0)
521 return 1;
522 else
523 return 0;
524}
525
526#endif