blob: f7a5f0d51307956fe871f71ade6b4d773916e693 [file] [log] [blame]
Adrian Alonso98810772015-09-03 11:49:28 -05001/*
2 * Copyright (C) 2015 Freescale Semiconductor, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <asm/arch/clock.h>
8#include <asm/arch/imx-regs.h>
9#include <asm/arch/mx7-pins.h>
10#include <asm/arch/sys_proto.h>
11#include <asm/gpio.h>
12#include <asm/imx-common/iomux-v3.h>
Adrian Alonso98810772015-09-03 11:49:28 -050013#include <asm/io.h>
14#include <linux/sizes.h>
15#include <common.h>
16#include <fsl_esdhc.h>
17#include <mmc.h>
18#include <miiphy.h>
19#include <netdev.h>
20#include <power/pmic.h>
21#include <power/pfuze3000_pmic.h>
22#include "../common/pfuze.h"
23#include <i2c.h>
24#include <asm/imx-common/mxc_i2c.h>
25#include <asm/arch/crm_regs.h>
Fabio Estevama256f932016-02-17 13:34:22 -020026#include <usb.h>
Mateusz Kulikowski3add69e2016-03-31 23:12:23 +020027#include <usb/ehci-ci.h>
Adrian Alonso98810772015-09-03 11:49:28 -050028
29DECLARE_GLOBAL_DATA_PTR;
30
31#define UART_PAD_CTRL (PAD_CTL_DSE_3P3V_49OHM | \
32 PAD_CTL_PUS_PU100KOHM | PAD_CTL_HYS)
33
Adrian Alonso98810772015-09-03 11:49:28 -050034#define ENET_PAD_CTRL (PAD_CTL_PUS_PU100KOHM | PAD_CTL_DSE_3P3V_49OHM)
35#define ENET_PAD_CTRL_MII (PAD_CTL_DSE_3P3V_32OHM)
36
37#define ENET_RX_PAD_CTRL (PAD_CTL_PUS_PU100KOHM | PAD_CTL_DSE_3P3V_49OHM)
38
Peng Fan55be1ed2015-10-29 15:54:53 +080039#define LCD_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_PU100KOHM | \
40 PAD_CTL_DSE_3P3V_49OHM)
41
Peng Fan7431e702015-11-30 17:45:02 +080042#define QSPI_PAD_CTRL \
43 (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUE | PAD_CTL_PUS_PU47KOHM)
44
Peng Fan62f92602015-12-22 17:04:24 +080045#define NAND_PAD_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_SRE_SLOW | PAD_CTL_HYS)
46
Angus Ainslieaa7ea8c2016-11-11 11:31:39 -070047#define SPI_PAD_CTRL \
48 (PAD_CTL_HYS | PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_SRE_FAST)
49
Peng Fan62f92602015-12-22 17:04:24 +080050#define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUS_PU5KOHM)
Adrian Alonso98810772015-09-03 11:49:28 -050051
Peng Fan9aa9c412017-04-13 14:09:57 +080052#ifdef CONFIG_MXC_SPI
Angus Ainslieaa7ea8c2016-11-11 11:31:39 -070053static iomux_v3_cfg_t const ecspi3_pads[] = {
54 MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
55 MX7D_PAD_SAI2_TX_SYNC__ECSPI3_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
56 MX7D_PAD_SAI2_TX_BCLK__ECSPI3_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
57 MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 | MUX_PAD_CTRL(NO_PAD_CTRL),
58};
59
60int board_spi_cs_gpio(unsigned bus, unsigned cs)
61{
62 return (bus == 2 && cs == 0) ? (IMX_GPIO_NR(6, 22)) : -1;
63}
64
65static void setup_spi(void)
66{
67 imx_iomux_v3_setup_multiple_pads(ecspi3_pads, ARRAY_SIZE(ecspi3_pads));
68}
Peng Fan9aa9c412017-04-13 14:09:57 +080069#endif
Angus Ainslieaa7ea8c2016-11-11 11:31:39 -070070
Adrian Alonso98810772015-09-03 11:49:28 -050071int dram_init(void)
72{
73 gd->ram_size = PHYS_SDRAM_SIZE;
74
75 return 0;
76}
77
78static iomux_v3_cfg_t const wdog_pads[] = {
79 MX7D_PAD_GPIO1_IO00__WDOG1_WDOG_B | MUX_PAD_CTRL(NO_PAD_CTRL),
80};
81
82static iomux_v3_cfg_t const uart1_pads[] = {
83 MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
84 MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
85};
86
Fabio Estevama256f932016-02-17 13:34:22 -020087static iomux_v3_cfg_t const usb_otg1_pads[] = {
88 MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
89};
90
91static iomux_v3_cfg_t const usb_otg2_pads[] = {
92 MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
93};
94
Peng Fan62f92602015-12-22 17:04:24 +080095#ifdef CONFIG_NAND_MXS
96static iomux_v3_cfg_t const gpmi_pads[] = {
97 MX7D_PAD_SD3_DATA0__NAND_DATA00 | MUX_PAD_CTRL(NAND_PAD_CTRL),
98 MX7D_PAD_SD3_DATA1__NAND_DATA01 | MUX_PAD_CTRL(NAND_PAD_CTRL),
99 MX7D_PAD_SD3_DATA2__NAND_DATA02 | MUX_PAD_CTRL(NAND_PAD_CTRL),
100 MX7D_PAD_SD3_DATA3__NAND_DATA03 | MUX_PAD_CTRL(NAND_PAD_CTRL),
101 MX7D_PAD_SD3_DATA4__NAND_DATA04 | MUX_PAD_CTRL(NAND_PAD_CTRL),
102 MX7D_PAD_SD3_DATA5__NAND_DATA05 | MUX_PAD_CTRL(NAND_PAD_CTRL),
103 MX7D_PAD_SD3_DATA6__NAND_DATA06 | MUX_PAD_CTRL(NAND_PAD_CTRL),
104 MX7D_PAD_SD3_DATA7__NAND_DATA07 | MUX_PAD_CTRL(NAND_PAD_CTRL),
105 MX7D_PAD_SD3_CLK__NAND_CLE | MUX_PAD_CTRL(NAND_PAD_CTRL),
106 MX7D_PAD_SD3_CMD__NAND_ALE | MUX_PAD_CTRL(NAND_PAD_CTRL),
107 MX7D_PAD_SD3_STROBE__NAND_RE_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
108 MX7D_PAD_SD3_RESET_B__NAND_WE_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
109 MX7D_PAD_SAI1_MCLK__NAND_WP_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
110 MX7D_PAD_SAI1_RX_BCLK__NAND_CE3_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
111 MX7D_PAD_SAI1_RX_SYNC__NAND_CE2_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
112 MX7D_PAD_SAI1_RX_DATA__NAND_CE1_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
113 MX7D_PAD_SAI1_TX_BCLK__NAND_CE0_B | MUX_PAD_CTRL(NAND_PAD_CTRL),
114 MX7D_PAD_SAI1_TX_SYNC__NAND_DQS | MUX_PAD_CTRL(NAND_PAD_CTRL),
115 MX7D_PAD_SAI1_TX_DATA__NAND_READY_B | MUX_PAD_CTRL(NAND_PAD_READY0_CTRL),
116};
117
118static void setup_gpmi_nand(void)
119{
120 imx_iomux_v3_setup_multiple_pads(gpmi_pads, ARRAY_SIZE(gpmi_pads));
121
122 /* NAND_USDHC_BUS_CLK is set in rom */
123 set_clk_nand();
124}
125#endif
126
Peng Fan55be1ed2015-10-29 15:54:53 +0800127#ifdef CONFIG_VIDEO_MXS
128static iomux_v3_cfg_t const lcd_pads[] = {
129 MX7D_PAD_LCD_CLK__LCD_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL),
130 MX7D_PAD_LCD_ENABLE__LCD_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL),
131 MX7D_PAD_LCD_HSYNC__LCD_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
132 MX7D_PAD_LCD_VSYNC__LCD_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
133 MX7D_PAD_LCD_DATA00__LCD_DATA0 | MUX_PAD_CTRL(LCD_PAD_CTRL),
134 MX7D_PAD_LCD_DATA01__LCD_DATA1 | MUX_PAD_CTRL(LCD_PAD_CTRL),
135 MX7D_PAD_LCD_DATA02__LCD_DATA2 | MUX_PAD_CTRL(LCD_PAD_CTRL),
136 MX7D_PAD_LCD_DATA03__LCD_DATA3 | MUX_PAD_CTRL(LCD_PAD_CTRL),
137 MX7D_PAD_LCD_DATA04__LCD_DATA4 | MUX_PAD_CTRL(LCD_PAD_CTRL),
138 MX7D_PAD_LCD_DATA05__LCD_DATA5 | MUX_PAD_CTRL(LCD_PAD_CTRL),
139 MX7D_PAD_LCD_DATA06__LCD_DATA6 | MUX_PAD_CTRL(LCD_PAD_CTRL),
140 MX7D_PAD_LCD_DATA07__LCD_DATA7 | MUX_PAD_CTRL(LCD_PAD_CTRL),
141 MX7D_PAD_LCD_DATA08__LCD_DATA8 | MUX_PAD_CTRL(LCD_PAD_CTRL),
142 MX7D_PAD_LCD_DATA09__LCD_DATA9 | MUX_PAD_CTRL(LCD_PAD_CTRL),
143 MX7D_PAD_LCD_DATA10__LCD_DATA10 | MUX_PAD_CTRL(LCD_PAD_CTRL),
144 MX7D_PAD_LCD_DATA11__LCD_DATA11 | MUX_PAD_CTRL(LCD_PAD_CTRL),
145 MX7D_PAD_LCD_DATA12__LCD_DATA12 | MUX_PAD_CTRL(LCD_PAD_CTRL),
146 MX7D_PAD_LCD_DATA13__LCD_DATA13 | MUX_PAD_CTRL(LCD_PAD_CTRL),
147 MX7D_PAD_LCD_DATA14__LCD_DATA14 | MUX_PAD_CTRL(LCD_PAD_CTRL),
148 MX7D_PAD_LCD_DATA15__LCD_DATA15 | MUX_PAD_CTRL(LCD_PAD_CTRL),
149 MX7D_PAD_LCD_DATA16__LCD_DATA16 | MUX_PAD_CTRL(LCD_PAD_CTRL),
150 MX7D_PAD_LCD_DATA17__LCD_DATA17 | MUX_PAD_CTRL(LCD_PAD_CTRL),
151 MX7D_PAD_LCD_DATA18__LCD_DATA18 | MUX_PAD_CTRL(LCD_PAD_CTRL),
152 MX7D_PAD_LCD_DATA19__LCD_DATA19 | MUX_PAD_CTRL(LCD_PAD_CTRL),
153 MX7D_PAD_LCD_DATA20__LCD_DATA20 | MUX_PAD_CTRL(LCD_PAD_CTRL),
154 MX7D_PAD_LCD_DATA21__LCD_DATA21 | MUX_PAD_CTRL(LCD_PAD_CTRL),
155 MX7D_PAD_LCD_DATA22__LCD_DATA22 | MUX_PAD_CTRL(LCD_PAD_CTRL),
156 MX7D_PAD_LCD_DATA23__LCD_DATA23 | MUX_PAD_CTRL(LCD_PAD_CTRL),
157
158 MX7D_PAD_LCD_RESET__GPIO3_IO4 | MUX_PAD_CTRL(LCD_PAD_CTRL),
159};
160
161static iomux_v3_cfg_t const pwm_pads[] = {
162 /* Use GPIO for Brightness adjustment, duty cycle = period */
163 MX7D_PAD_GPIO1_IO01__GPIO1_IO1 | MUX_PAD_CTRL(NO_PAD_CTRL),
164};
165
166static int setup_lcd(void)
167{
168 imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
169
170 imx_iomux_v3_setup_multiple_pads(pwm_pads, ARRAY_SIZE(pwm_pads));
171
172 /* Reset LCD */
Peng Fan9aa9c412017-04-13 14:09:57 +0800173 gpio_request(IMX_GPIO_NR(3, 4), "lcd reset");
Peng Fan55be1ed2015-10-29 15:54:53 +0800174 gpio_direction_output(IMX_GPIO_NR(3, 4) , 0);
175 udelay(500);
176 gpio_direction_output(IMX_GPIO_NR(3, 4) , 1);
177
178 /* Set Brightness to high */
Peng Fan9aa9c412017-04-13 14:09:57 +0800179 gpio_request(IMX_GPIO_NR(1, 1), "lcd backlight");
Peng Fan55be1ed2015-10-29 15:54:53 +0800180 gpio_direction_output(IMX_GPIO_NR(1, 1) , 1);
181
182 return 0;
183}
184#endif
185
Adrian Alonso98810772015-09-03 11:49:28 -0500186#ifdef CONFIG_FEC_MXC
187static iomux_v3_cfg_t const fec1_pads[] = {
188 MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
189 MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
190 MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
191 MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
192 MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
193 MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
194 MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
195 MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
196 MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
197 MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
198 MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
199 MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
200 MX7D_PAD_GPIO1_IO10__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL_MII),
201 MX7D_PAD_GPIO1_IO11__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL_MII),
202};
203
204static void setup_iomux_fec(void)
205{
206 imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
207}
208#endif
209
210static void setup_iomux_uart(void)
211{
212 imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
213}
214
Peng Fan6c9d8fb2016-01-28 16:51:25 +0800215int board_mmc_get_env_dev(int devno)
Adrian Alonso98810772015-09-03 11:49:28 -0500216{
Peng Fan6c9d8fb2016-01-28 16:51:25 +0800217 if (devno == 2)
218 devno--;
Adrian Alonso98810772015-09-03 11:49:28 -0500219
Peng Fan6c9d8fb2016-01-28 16:51:25 +0800220 return devno;
Adrian Alonso98810772015-09-03 11:49:28 -0500221}
222
Peng Fan9aa9c412017-04-13 14:09:57 +0800223int mmc_map_to_kernel_blk(int dev_no)
Adrian Alonso98810772015-09-03 11:49:28 -0500224{
225 if (dev_no == 1)
226 dev_no++;
227
228 return dev_no;
229}
230
Adrian Alonso98810772015-09-03 11:49:28 -0500231#ifdef CONFIG_FEC_MXC
232int board_eth_init(bd_t *bis)
233{
234 int ret;
Peng Fan12f46112017-04-13 14:09:58 +0800235 unsigned int gpio;
236
237 ret = gpio_lookup_name("gpio_spi@0_5", NULL, NULL, &gpio);
238 if (ret) {
239 printf("GPIO: 'gpio_spi@0_5' not found\n");
240 return -ENODEV;
241 }
242
243 ret = gpio_request(gpio, "fec_rst");
244 if (ret && ret != -EBUSY) {
245 printf("gpio: requesting pin %u failed\n", gpio);
246 return ret;
247 }
248
249 gpio_direction_output(gpio, 0);
250 udelay(500);
251 gpio_direction_output(gpio, 1);
Adrian Alonso98810772015-09-03 11:49:28 -0500252
253 setup_iomux_fec();
254
255 ret = fecmxc_initialize_multi(bis, 0,
256 CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE);
257 if (ret)
258 printf("FEC1 MXC: %s:failed\n", __func__);
259
260 return ret;
261}
262
263static int setup_fec(void)
264{
265 struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs
266 = (struct iomuxc_gpr_base_regs *) IOMUXC_GPR_BASE_ADDR;
267
268 /* Use 125M anatop REF_CLK1 for ENET1, clear gpr1[13], gpr1[17]*/
269 clrsetbits_le32(&iomuxc_gpr_regs->gpr[1],
270 (IOMUXC_GPR_GPR1_GPR_ENET1_TX_CLK_SEL_MASK |
271 IOMUXC_GPR_GPR1_GPR_ENET1_CLK_DIR_MASK), 0);
272
273 return set_clk_enet(ENET_125MHz);
274}
275
276
277int board_phy_config(struct phy_device *phydev)
278{
279 /* enable rgmii rxc skew and phy mode select to RGMII copper */
280 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x21);
281 phy_write(phydev, MDIO_DEVAD_NONE, 0x1f, 0x7ea8);
282 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x2f);
283 phy_write(phydev, MDIO_DEVAD_NONE, 0x1f, 0x71b7);
284
285 if (phydev->drv->config)
286 phydev->drv->config(phydev);
287 return 0;
288}
289#endif
290
Peng Fan7431e702015-11-30 17:45:02 +0800291#ifdef CONFIG_FSL_QSPI
292static iomux_v3_cfg_t const quadspi_pads[] = {
293 MX7D_PAD_EPDC_DATA00__QSPI_A_DATA0 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
294 MX7D_PAD_EPDC_DATA01__QSPI_A_DATA1 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
295 MX7D_PAD_EPDC_DATA02__QSPI_A_DATA2 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
296 MX7D_PAD_EPDC_DATA03__QSPI_A_DATA3 | MUX_PAD_CTRL(QSPI_PAD_CTRL),
297 MX7D_PAD_EPDC_DATA05__QSPI_A_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL),
298 MX7D_PAD_EPDC_DATA06__QSPI_A_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL),
299};
300
301int board_qspi_init(void)
302{
303 /* Set the iomux */
304 imx_iomux_v3_setup_multiple_pads(quadspi_pads,
305 ARRAY_SIZE(quadspi_pads));
306
307 /* Set the clock */
308 set_clk_qspi();
309
310 return 0;
311}
312#endif
313
Adrian Alonso98810772015-09-03 11:49:28 -0500314int board_early_init_f(void)
315{
316 setup_iomux_uart();
317
Fabio Estevama256f932016-02-17 13:34:22 -0200318 imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
319 ARRAY_SIZE(usb_otg1_pads));
320 imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
321 ARRAY_SIZE(usb_otg2_pads));
Adrian Alonso98810772015-09-03 11:49:28 -0500322
323 return 0;
324}
325
326int board_init(void)
327{
328 /* address of boot parameters */
329 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
330
Adrian Alonso98810772015-09-03 11:49:28 -0500331#ifdef CONFIG_FEC_MXC
332 setup_fec();
333#endif
334
Peng Fan62f92602015-12-22 17:04:24 +0800335#ifdef CONFIG_NAND_MXS
336 setup_gpmi_nand();
337#endif
338
Peng Fan55be1ed2015-10-29 15:54:53 +0800339#ifdef CONFIG_VIDEO_MXS
340 setup_lcd();
341#endif
342
Peng Fan7431e702015-11-30 17:45:02 +0800343#ifdef CONFIG_FSL_QSPI
344 board_qspi_init();
345#endif
346
Angus Ainslieaa7ea8c2016-11-11 11:31:39 -0700347#ifdef CONFIG_MXC_SPI
348 setup_spi();
349#endif
350
Adrian Alonso98810772015-09-03 11:49:28 -0500351 return 0;
352}
353
Peng Fan9aa9c412017-04-13 14:09:57 +0800354#ifdef CONFIG_DM_PMIC
Adrian Alonso98810772015-09-03 11:49:28 -0500355int power_init_board(void)
356{
Peng Fan9aa9c412017-04-13 14:09:57 +0800357 struct udevice *dev;
358 int ret, dev_id, rev_id;
Adrian Alonso98810772015-09-03 11:49:28 -0500359
Peng Fan9aa9c412017-04-13 14:09:57 +0800360 ret = pmic_get("pfuze3000", &dev);
361 if (ret == -ENODEV)
362 return 0;
363 if (ret != 0)
Adrian Alonso98810772015-09-03 11:49:28 -0500364 return ret;
365
Peng Fan9aa9c412017-04-13 14:09:57 +0800366 dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID);
367 rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
368 printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", dev_id, rev_id);
Adrian Alonso98810772015-09-03 11:49:28 -0500369
Peng Fan9aa9c412017-04-13 14:09:57 +0800370 pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1);
Adrian Alonso98810772015-09-03 11:49:28 -0500371
372 return 0;
373}
374#endif
375
376int board_late_init(void)
377{
Peng Fan6b7c3dc2015-09-14 13:34:45 +0800378 struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
379
Adrian Alonso98810772015-09-03 11:49:28 -0500380 imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads));
381
Peng Fan6b7c3dc2015-09-14 13:34:45 +0800382 set_wdog_reset(wdog);
383
384 /*
385 * Do not assert internal WDOG_RESET_B_DEB(controlled by bit 4),
386 * since we use PMIC_PWRON to reset the board.
387 */
388 clrsetbits_le16(&wdog->wcr, 0, 0x10);
Adrian Alonso98810772015-09-03 11:49:28 -0500389
390 return 0;
391}
392
Adrian Alonso98810772015-09-03 11:49:28 -0500393int checkboard(void)
394{
Fabio Estevamea696c72016-07-28 20:49:46 -0300395 char *mode;
396
397 if (IS_ENABLED(CONFIG_ARMV7_BOOT_SEC_DEFAULT))
398 mode = "secure";
399 else
400 mode = "non-secure";
401
402 printf("Board: i.MX7D SABRESD in %s mode\n", mode);
Adrian Alonso98810772015-09-03 11:49:28 -0500403
404 return 0;
405}
406
407#ifdef CONFIG_USB_EHCI_MX7
Fabio Estevama256f932016-02-17 13:34:22 -0200408int board_usb_phy_mode(int port)
Adrian Alonso98810772015-09-03 11:49:28 -0500409{
Fabio Estevama256f932016-02-17 13:34:22 -0200410 if (port == 0)
411 return USB_INIT_DEVICE;
412 else
413 return USB_INIT_HOST;
Adrian Alonso98810772015-09-03 11:49:28 -0500414}
415#endif