Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Freescale Semiconductor, Inc. |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 4 | */ |
| 5 | |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 6 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 7 | #include <net.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 8 | #include <asm/arch/clock.h> |
| 9 | #include <asm/arch/imx-regs.h> |
| 10 | #include <asm/arch/mx7-pins.h> |
| 11 | #include <asm/arch/sys_proto.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 12 | #include <asm/global_data.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 13 | #include <asm/gpio.h> |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 14 | #include <asm/mach-imx/iomux-v3.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 15 | #include <asm/io.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 16 | #include <linux/delay.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 17 | #include <linux/sizes.h> |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 18 | #include <fsl_esdhc_imx.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 19 | #include <mmc.h> |
| 20 | #include <miiphy.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 21 | #include <power/pmic.h> |
| 22 | #include <power/pfuze3000_pmic.h> |
| 23 | #include "../common/pfuze.h" |
| 24 | #include <i2c.h> |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 25 | #include <asm/mach-imx/mxc_i2c.h> |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 26 | #include <asm/arch/crm_regs.h> |
| 27 | |
| 28 | DECLARE_GLOBAL_DATA_PTR; |
| 29 | |
| 30 | #define UART_PAD_CTRL (PAD_CTL_DSE_3P3V_49OHM | \ |
| 31 | PAD_CTL_PUS_PU100KOHM | PAD_CTL_HYS) |
| 32 | |
Peng Fan | 55be1ed | 2015-10-29 15:54:53 +0800 | [diff] [blame] | 33 | #define LCD_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_PU100KOHM | \ |
| 34 | PAD_CTL_DSE_3P3V_49OHM) |
| 35 | |
Peng Fan | 62f9260 | 2015-12-22 17:04:24 +0800 | [diff] [blame] | 36 | #define NAND_PAD_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_SRE_SLOW | PAD_CTL_HYS) |
| 37 | |
Angus Ainslie | aa7ea8c | 2016-11-11 11:31:39 -0700 | [diff] [blame] | 38 | #define SPI_PAD_CTRL \ |
| 39 | (PAD_CTL_HYS | PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_SRE_FAST) |
| 40 | |
Peng Fan | 62f9260 | 2015-12-22 17:04:24 +0800 | [diff] [blame] | 41 | #define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUS_PU5KOHM) |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 42 | |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 43 | #ifdef CONFIG_MXC_SPI |
Angus Ainslie | aa7ea8c | 2016-11-11 11:31:39 -0700 | [diff] [blame] | 44 | static iomux_v3_cfg_t const ecspi3_pads[] = { |
| 45 | MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL), |
| 46 | MX7D_PAD_SAI2_TX_SYNC__ECSPI3_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL), |
| 47 | MX7D_PAD_SAI2_TX_BCLK__ECSPI3_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL), |
| 48 | MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 | MUX_PAD_CTRL(NO_PAD_CTRL), |
| 49 | }; |
| 50 | |
| 51 | int board_spi_cs_gpio(unsigned bus, unsigned cs) |
| 52 | { |
| 53 | return (bus == 2 && cs == 0) ? (IMX_GPIO_NR(6, 22)) : -1; |
| 54 | } |
| 55 | |
| 56 | static void setup_spi(void) |
| 57 | { |
| 58 | imx_iomux_v3_setup_multiple_pads(ecspi3_pads, ARRAY_SIZE(ecspi3_pads)); |
| 59 | } |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 60 | #endif |
Angus Ainslie | aa7ea8c | 2016-11-11 11:31:39 -0700 | [diff] [blame] | 61 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 62 | int dram_init(void) |
| 63 | { |
| 64 | gd->ram_size = PHYS_SDRAM_SIZE; |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | static iomux_v3_cfg_t const wdog_pads[] = { |
| 70 | MX7D_PAD_GPIO1_IO00__WDOG1_WDOG_B | MUX_PAD_CTRL(NO_PAD_CTRL), |
| 71 | }; |
| 72 | |
| 73 | static iomux_v3_cfg_t const uart1_pads[] = { |
| 74 | MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL), |
| 75 | MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL), |
| 76 | }; |
| 77 | |
Peng Fan | 62f9260 | 2015-12-22 17:04:24 +0800 | [diff] [blame] | 78 | #ifdef CONFIG_NAND_MXS |
| 79 | static iomux_v3_cfg_t const gpmi_pads[] = { |
| 80 | MX7D_PAD_SD3_DATA0__NAND_DATA00 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 81 | MX7D_PAD_SD3_DATA1__NAND_DATA01 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 82 | MX7D_PAD_SD3_DATA2__NAND_DATA02 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 83 | MX7D_PAD_SD3_DATA3__NAND_DATA03 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 84 | MX7D_PAD_SD3_DATA4__NAND_DATA04 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 85 | MX7D_PAD_SD3_DATA5__NAND_DATA05 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 86 | MX7D_PAD_SD3_DATA6__NAND_DATA06 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 87 | MX7D_PAD_SD3_DATA7__NAND_DATA07 | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 88 | MX7D_PAD_SD3_CLK__NAND_CLE | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 89 | MX7D_PAD_SD3_CMD__NAND_ALE | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 90 | MX7D_PAD_SD3_STROBE__NAND_RE_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 91 | MX7D_PAD_SD3_RESET_B__NAND_WE_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 92 | MX7D_PAD_SAI1_MCLK__NAND_WP_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 93 | MX7D_PAD_SAI1_RX_BCLK__NAND_CE3_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 94 | MX7D_PAD_SAI1_RX_SYNC__NAND_CE2_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 95 | MX7D_PAD_SAI1_RX_DATA__NAND_CE1_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 96 | MX7D_PAD_SAI1_TX_BCLK__NAND_CE0_B | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 97 | MX7D_PAD_SAI1_TX_SYNC__NAND_DQS | MUX_PAD_CTRL(NAND_PAD_CTRL), |
| 98 | MX7D_PAD_SAI1_TX_DATA__NAND_READY_B | MUX_PAD_CTRL(NAND_PAD_READY0_CTRL), |
| 99 | }; |
| 100 | |
| 101 | static void setup_gpmi_nand(void) |
| 102 | { |
| 103 | imx_iomux_v3_setup_multiple_pads(gpmi_pads, ARRAY_SIZE(gpmi_pads)); |
| 104 | |
| 105 | /* NAND_USDHC_BUS_CLK is set in rom */ |
| 106 | set_clk_nand(); |
| 107 | } |
| 108 | #endif |
| 109 | |
Peng Fan | 55be1ed | 2015-10-29 15:54:53 +0800 | [diff] [blame] | 110 | #ifdef CONFIG_VIDEO_MXS |
| 111 | static iomux_v3_cfg_t const lcd_pads[] = { |
| 112 | MX7D_PAD_LCD_CLK__LCD_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 113 | MX7D_PAD_LCD_ENABLE__LCD_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 114 | MX7D_PAD_LCD_HSYNC__LCD_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 115 | MX7D_PAD_LCD_VSYNC__LCD_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 116 | MX7D_PAD_LCD_DATA00__LCD_DATA0 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 117 | MX7D_PAD_LCD_DATA01__LCD_DATA1 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 118 | MX7D_PAD_LCD_DATA02__LCD_DATA2 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 119 | MX7D_PAD_LCD_DATA03__LCD_DATA3 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 120 | MX7D_PAD_LCD_DATA04__LCD_DATA4 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 121 | MX7D_PAD_LCD_DATA05__LCD_DATA5 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 122 | MX7D_PAD_LCD_DATA06__LCD_DATA6 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 123 | MX7D_PAD_LCD_DATA07__LCD_DATA7 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 124 | MX7D_PAD_LCD_DATA08__LCD_DATA8 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 125 | MX7D_PAD_LCD_DATA09__LCD_DATA9 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 126 | MX7D_PAD_LCD_DATA10__LCD_DATA10 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 127 | MX7D_PAD_LCD_DATA11__LCD_DATA11 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 128 | MX7D_PAD_LCD_DATA12__LCD_DATA12 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 129 | MX7D_PAD_LCD_DATA13__LCD_DATA13 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 130 | MX7D_PAD_LCD_DATA14__LCD_DATA14 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 131 | MX7D_PAD_LCD_DATA15__LCD_DATA15 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 132 | MX7D_PAD_LCD_DATA16__LCD_DATA16 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 133 | MX7D_PAD_LCD_DATA17__LCD_DATA17 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 134 | MX7D_PAD_LCD_DATA18__LCD_DATA18 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 135 | MX7D_PAD_LCD_DATA19__LCD_DATA19 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 136 | MX7D_PAD_LCD_DATA20__LCD_DATA20 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 137 | MX7D_PAD_LCD_DATA21__LCD_DATA21 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 138 | MX7D_PAD_LCD_DATA22__LCD_DATA22 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 139 | MX7D_PAD_LCD_DATA23__LCD_DATA23 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 140 | |
| 141 | MX7D_PAD_LCD_RESET__GPIO3_IO4 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 142 | }; |
| 143 | |
| 144 | static iomux_v3_cfg_t const pwm_pads[] = { |
| 145 | /* Use GPIO for Brightness adjustment, duty cycle = period */ |
| 146 | MX7D_PAD_GPIO1_IO01__GPIO1_IO1 | MUX_PAD_CTRL(NO_PAD_CTRL), |
| 147 | }; |
| 148 | |
| 149 | static int setup_lcd(void) |
| 150 | { |
| 151 | imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads)); |
| 152 | |
| 153 | imx_iomux_v3_setup_multiple_pads(pwm_pads, ARRAY_SIZE(pwm_pads)); |
| 154 | |
| 155 | /* Reset LCD */ |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 156 | gpio_request(IMX_GPIO_NR(3, 4), "lcd reset"); |
Peng Fan | 55be1ed | 2015-10-29 15:54:53 +0800 | [diff] [blame] | 157 | gpio_direction_output(IMX_GPIO_NR(3, 4) , 0); |
| 158 | udelay(500); |
| 159 | gpio_direction_output(IMX_GPIO_NR(3, 4) , 1); |
| 160 | |
| 161 | /* Set Brightness to high */ |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 162 | gpio_request(IMX_GPIO_NR(1, 1), "lcd backlight"); |
Peng Fan | 55be1ed | 2015-10-29 15:54:53 +0800 | [diff] [blame] | 163 | gpio_direction_output(IMX_GPIO_NR(1, 1) , 1); |
| 164 | |
| 165 | return 0; |
| 166 | } |
| 167 | #endif |
| 168 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 169 | static void setup_iomux_uart(void) |
| 170 | { |
| 171 | imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); |
| 172 | } |
| 173 | |
Peng Fan | 6c9d8fb | 2016-01-28 16:51:25 +0800 | [diff] [blame] | 174 | int board_mmc_get_env_dev(int devno) |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 175 | { |
Peng Fan | 6c9d8fb | 2016-01-28 16:51:25 +0800 | [diff] [blame] | 176 | if (devno == 2) |
| 177 | devno--; |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 178 | |
Peng Fan | 6c9d8fb | 2016-01-28 16:51:25 +0800 | [diff] [blame] | 179 | return devno; |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 180 | } |
| 181 | |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 182 | int mmc_map_to_kernel_blk(int dev_no) |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 183 | { |
| 184 | if (dev_no == 1) |
| 185 | dev_no++; |
| 186 | |
| 187 | return dev_no; |
| 188 | } |
| 189 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 190 | #ifdef CONFIG_FEC_MXC |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 191 | static int setup_fec(void) |
| 192 | { |
| 193 | struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs |
| 194 | = (struct iomuxc_gpr_base_regs *) IOMUXC_GPR_BASE_ADDR; |
| 195 | |
| 196 | /* Use 125M anatop REF_CLK1 for ENET1, clear gpr1[13], gpr1[17]*/ |
| 197 | clrsetbits_le32(&iomuxc_gpr_regs->gpr[1], |
| 198 | (IOMUXC_GPR_GPR1_GPR_ENET1_TX_CLK_SEL_MASK | |
| 199 | IOMUXC_GPR_GPR1_GPR_ENET1_CLK_DIR_MASK), 0); |
| 200 | |
Eric Nelson | eadd732 | 2017-08-31 08:34:23 -0700 | [diff] [blame] | 201 | return set_clk_enet(ENET_125MHZ); |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 202 | } |
| 203 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 204 | int board_phy_config(struct phy_device *phydev) |
| 205 | { |
| 206 | /* enable rgmii rxc skew and phy mode select to RGMII copper */ |
| 207 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x21); |
| 208 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1f, 0x7ea8); |
| 209 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x2f); |
| 210 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1f, 0x71b7); |
| 211 | |
| 212 | if (phydev->drv->config) |
| 213 | phydev->drv->config(phydev); |
| 214 | return 0; |
| 215 | } |
| 216 | #endif |
| 217 | |
Peng Fan | 7431e70 | 2015-11-30 17:45:02 +0800 | [diff] [blame] | 218 | #ifdef CONFIG_FSL_QSPI |
Peng Fan | 7431e70 | 2015-11-30 17:45:02 +0800 | [diff] [blame] | 219 | int board_qspi_init(void) |
| 220 | { |
Peng Fan | 7431e70 | 2015-11-30 17:45:02 +0800 | [diff] [blame] | 221 | /* Set the clock */ |
| 222 | set_clk_qspi(); |
| 223 | |
| 224 | return 0; |
| 225 | } |
| 226 | #endif |
| 227 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 228 | int board_early_init_f(void) |
| 229 | { |
| 230 | setup_iomux_uart(); |
| 231 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | int board_init(void) |
| 236 | { |
| 237 | /* address of boot parameters */ |
| 238 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 239 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 240 | #ifdef CONFIG_FEC_MXC |
| 241 | setup_fec(); |
| 242 | #endif |
| 243 | |
Peng Fan | 62f9260 | 2015-12-22 17:04:24 +0800 | [diff] [blame] | 244 | #ifdef CONFIG_NAND_MXS |
| 245 | setup_gpmi_nand(); |
| 246 | #endif |
| 247 | |
Peng Fan | 55be1ed | 2015-10-29 15:54:53 +0800 | [diff] [blame] | 248 | #ifdef CONFIG_VIDEO_MXS |
| 249 | setup_lcd(); |
| 250 | #endif |
| 251 | |
Peng Fan | 7431e70 | 2015-11-30 17:45:02 +0800 | [diff] [blame] | 252 | #ifdef CONFIG_FSL_QSPI |
| 253 | board_qspi_init(); |
| 254 | #endif |
| 255 | |
Angus Ainslie | aa7ea8c | 2016-11-11 11:31:39 -0700 | [diff] [blame] | 256 | #ifdef CONFIG_MXC_SPI |
| 257 | setup_spi(); |
| 258 | #endif |
| 259 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 260 | return 0; |
| 261 | } |
| 262 | |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 263 | #ifdef CONFIG_DM_PMIC |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 264 | int power_init_board(void) |
| 265 | { |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 266 | struct udevice *dev; |
| 267 | int ret, dev_id, rev_id; |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 268 | |
Fabio Estevam | 8457bcf | 2023-12-13 09:37:08 -0300 | [diff] [blame] | 269 | ret = pmic_get("pmic@8", &dev); |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 270 | if (ret == -ENODEV) |
| 271 | return 0; |
| 272 | if (ret != 0) |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 273 | return ret; |
| 274 | |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 275 | dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID); |
| 276 | rev_id = pmic_reg_read(dev, PFUZE3000_REVID); |
| 277 | printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", dev_id, rev_id); |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 278 | |
Peng Fan | 9aa9c41 | 2017-04-13 14:09:57 +0800 | [diff] [blame] | 279 | pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1); |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 280 | |
Gautam Bhat | 0782281 | 2017-07-03 00:50:32 +0530 | [diff] [blame] | 281 | /* |
| 282 | * Set the voltage of VLDO4 output to 2.8V which feeds |
| 283 | * the MIPI DSI and MIPI CSI inputs. |
| 284 | */ |
| 285 | pmic_clrsetbits(dev, PFUZE3000_VLD4CTL, 0xF, 0xA); |
| 286 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 287 | return 0; |
| 288 | } |
| 289 | #endif |
| 290 | |
| 291 | int board_late_init(void) |
| 292 | { |
Peng Fan | 6b7c3dc | 2015-09-14 13:34:45 +0800 | [diff] [blame] | 293 | struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; |
Fabio Estevam | ff4c1b2 | 2023-07-11 18:57:57 -0300 | [diff] [blame] | 294 | unsigned char eth1addr[6]; |
Peng Fan | 6b7c3dc | 2015-09-14 13:34:45 +0800 | [diff] [blame] | 295 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 296 | imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads)); |
| 297 | |
Peng Fan | 6b7c3dc | 2015-09-14 13:34:45 +0800 | [diff] [blame] | 298 | set_wdog_reset(wdog); |
| 299 | |
| 300 | /* |
| 301 | * Do not assert internal WDOG_RESET_B_DEB(controlled by bit 4), |
| 302 | * since we use PMIC_PWRON to reset the board. |
| 303 | */ |
| 304 | clrsetbits_le16(&wdog->wcr, 0, 0x10); |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 305 | |
Fabio Estevam | ff4c1b2 | 2023-07-11 18:57:57 -0300 | [diff] [blame] | 306 | /* Get the second MAC address */ |
| 307 | imx_get_mac_from_fuse(1, eth1addr); |
| 308 | if (!env_get("eth1addr") && is_valid_ethaddr(eth1addr)) |
| 309 | eth_env_set_enetaddr("eth1addr", eth1addr); |
| 310 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 311 | return 0; |
| 312 | } |
| 313 | |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 314 | int checkboard(void) |
| 315 | { |
Fabio Estevam | ea696c7 | 2016-07-28 20:49:46 -0300 | [diff] [blame] | 316 | char *mode; |
| 317 | |
| 318 | if (IS_ENABLED(CONFIG_ARMV7_BOOT_SEC_DEFAULT)) |
| 319 | mode = "secure"; |
| 320 | else |
| 321 | mode = "non-secure"; |
| 322 | |
| 323 | printf("Board: i.MX7D SABRESD in %s mode\n", mode); |
Adrian Alonso | 9881077 | 2015-09-03 11:49:28 -0500 | [diff] [blame] | 324 | |
| 325 | return 0; |
| 326 | } |