Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 Gateworks Corporation |
| 4 | * |
| 5 | * Author: Tim Harvey <tharvey@gateworks.com> |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
Simon Glass | 1e26864 | 2020-05-10 11:39:55 -0600 | [diff] [blame] | 8 | #include <common.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 9 | #include <log.h> |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 10 | #include <asm/arch/clock.h> |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 11 | #include <asm/arch/mx6-pins.h> |
| 12 | #include <asm/arch/sys_proto.h> |
| 13 | #include <asm/gpio.h> |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 14 | #include <asm/mach-imx/mxc_i2c.h> |
Simon Glass | 0af6e2d | 2019-08-01 09:46:52 -0600 | [diff] [blame] | 15 | #include <env.h> |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 16 | #include <fsl_esdhc_imx.h> |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 17 | #include <hwconfig.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 18 | #include <linux/delay.h> |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 19 | #include <power/pmic.h> |
| 20 | #include <power/ltc3676_pmic.h> |
| 21 | #include <power/pfuze100_pmic.h> |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 22 | #include <power/mp5416.h> |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 23 | |
| 24 | #include "common.h" |
| 25 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 26 | /* UART2: Serial Console */ |
| 27 | static iomux_v3_cfg_t const uart2_pads[] = { |
| 28 | IOMUX_PADS(PAD_SD4_DAT7__UART2_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
| 29 | IOMUX_PADS(PAD_SD4_DAT4__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
| 30 | }; |
| 31 | |
| 32 | void setup_iomux_uart(void) |
| 33 | { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 34 | SETUP_IOMUX_PADS(uart2_pads); |
| 35 | } |
| 36 | |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 37 | /* MMC */ |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 38 | static iomux_v3_cfg_t const gw5904_emmc_pads[] = { |
| 39 | IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 40 | IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 41 | IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 42 | IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 43 | IOMUX_PADS(PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 44 | IOMUX_PADS(PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 45 | IOMUX_PADS(PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 46 | IOMUX_PADS(PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 47 | IOMUX_PADS(PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 48 | IOMUX_PADS(PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 49 | IOMUX_PADS(PAD_SD3_RST__SD3_RESET | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 50 | }; |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 51 | /* 4-bit microSD on SD2 */ |
| 52 | static iomux_v3_cfg_t const gw5904_mmc_pads[] = { |
| 53 | IOMUX_PADS(PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 54 | IOMUX_PADS(PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 55 | IOMUX_PADS(PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 56 | IOMUX_PADS(PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 57 | IOMUX_PADS(PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 58 | IOMUX_PADS(PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 59 | /* CD */ |
| 60 | IOMUX_PADS(PAD_NANDF_CS0__GPIO6_IO11 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 61 | }; |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 62 | /* 8-bit eMMC on SD2/NAND */ |
| 63 | static iomux_v3_cfg_t const gw560x_emmc_sd2_pads[] = { |
| 64 | IOMUX_PADS(PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 65 | IOMUX_PADS(PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 66 | IOMUX_PADS(PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 67 | IOMUX_PADS(PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 68 | IOMUX_PADS(PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 69 | IOMUX_PADS(PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 70 | IOMUX_PADS(PAD_NANDF_D4__SD2_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 71 | IOMUX_PADS(PAD_NANDF_D5__SD2_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 72 | IOMUX_PADS(PAD_NANDF_D6__SD2_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 73 | IOMUX_PADS(PAD_NANDF_D7__SD2_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 74 | }; |
| 75 | |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 76 | static iomux_v3_cfg_t const usdhc3_pads[] = { |
| 77 | IOMUX_PADS(PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 78 | IOMUX_PADS(PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 79 | IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 80 | IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 81 | IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 82 | IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 83 | IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 84 | }; |
| 85 | |
Tim Harvey | d04dc81 | 2019-02-04 13:10:49 -0800 | [diff] [blame] | 86 | /* |
| 87 | * I2C pad configs: |
| 88 | * I2C1: GSC |
| 89 | * I2C2: PMIC,PCIe Switch,Clock,Mezz |
| 90 | * I2C3: Multimedia/Expansion |
| 91 | */ |
| 92 | static struct i2c_pads_info mx6q_i2c_pad_info[] = { |
| 93 | { |
| 94 | .scl = { |
| 95 | .i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC, |
| 96 | .gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | PC, |
| 97 | .gp = IMX_GPIO_NR(3, 21) |
| 98 | }, |
| 99 | .sda = { |
| 100 | .i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC, |
| 101 | .gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | PC, |
| 102 | .gp = IMX_GPIO_NR(3, 28) |
| 103 | } |
| 104 | }, { |
| 105 | .scl = { |
| 106 | .i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC, |
| 107 | .gpio_mode = MX6Q_PAD_KEY_COL3__GPIO4_IO12 | PC, |
| 108 | .gp = IMX_GPIO_NR(4, 12) |
| 109 | }, |
| 110 | .sda = { |
| 111 | .i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC, |
| 112 | .gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO4_IO13 | PC, |
| 113 | .gp = IMX_GPIO_NR(4, 13) |
| 114 | } |
| 115 | }, { |
| 116 | .scl = { |
| 117 | .i2c_mode = MX6Q_PAD_GPIO_3__I2C3_SCL | PC, |
| 118 | .gpio_mode = MX6Q_PAD_GPIO_3__GPIO1_IO03 | PC, |
| 119 | .gp = IMX_GPIO_NR(1, 3) |
| 120 | }, |
| 121 | .sda = { |
| 122 | .i2c_mode = MX6Q_PAD_GPIO_6__I2C3_SDA | PC, |
| 123 | .gpio_mode = MX6Q_PAD_GPIO_6__GPIO1_IO06 | PC, |
| 124 | .gp = IMX_GPIO_NR(1, 6) |
| 125 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 126 | } |
| 127 | }; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 128 | |
Tim Harvey | d04dc81 | 2019-02-04 13:10:49 -0800 | [diff] [blame] | 129 | static struct i2c_pads_info mx6dl_i2c_pad_info[] = { |
| 130 | { |
| 131 | .scl = { |
| 132 | .i2c_mode = MX6DL_PAD_EIM_D21__I2C1_SCL | PC, |
| 133 | .gpio_mode = MX6DL_PAD_EIM_D21__GPIO3_IO21 | PC, |
| 134 | .gp = IMX_GPIO_NR(3, 21) |
| 135 | }, |
| 136 | .sda = { |
| 137 | .i2c_mode = MX6DL_PAD_EIM_D28__I2C1_SDA | PC, |
| 138 | .gpio_mode = MX6DL_PAD_EIM_D28__GPIO3_IO28 | PC, |
| 139 | .gp = IMX_GPIO_NR(3, 28) |
| 140 | } |
| 141 | }, { |
| 142 | .scl = { |
| 143 | .i2c_mode = MX6DL_PAD_KEY_COL3__I2C2_SCL | PC, |
| 144 | .gpio_mode = MX6DL_PAD_KEY_COL3__GPIO4_IO12 | PC, |
| 145 | .gp = IMX_GPIO_NR(4, 12) |
| 146 | }, |
| 147 | .sda = { |
| 148 | .i2c_mode = MX6DL_PAD_KEY_ROW3__I2C2_SDA | PC, |
| 149 | .gpio_mode = MX6DL_PAD_KEY_ROW3__GPIO4_IO13 | PC, |
| 150 | .gp = IMX_GPIO_NR(4, 13) |
| 151 | } |
| 152 | }, { |
| 153 | .scl = { |
| 154 | .i2c_mode = MX6DL_PAD_GPIO_3__I2C3_SCL | PC, |
| 155 | .gpio_mode = MX6DL_PAD_GPIO_3__GPIO1_IO03 | PC, |
| 156 | .gp = IMX_GPIO_NR(1, 3) |
| 157 | }, |
| 158 | .sda = { |
| 159 | .i2c_mode = MX6DL_PAD_GPIO_6__I2C3_SDA | PC, |
| 160 | .gpio_mode = MX6DL_PAD_GPIO_6__GPIO1_IO06 | PC, |
| 161 | .gp = IMX_GPIO_NR(1, 6) |
| 162 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 163 | } |
| 164 | }; |
| 165 | |
Tim Harvey | d04dc81 | 2019-02-04 13:10:49 -0800 | [diff] [blame] | 166 | void setup_ventana_i2c(int i2c) |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 167 | { |
Tim Harvey | d04dc81 | 2019-02-04 13:10:49 -0800 | [diff] [blame] | 168 | struct i2c_pads_info *p; |
| 169 | |
| 170 | if (is_cpu_type(MXC_CPU_MX6Q)) |
| 171 | p = &mx6q_i2c_pad_info[i2c]; |
| 172 | else |
| 173 | p = &mx6dl_i2c_pad_info[i2c]; |
| 174 | |
| 175 | setup_i2c(i2c, CONFIG_SYS_I2C_SPEED, 0x7f, p); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | /* |
| 179 | * Baseboard specific GPIO |
| 180 | */ |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 181 | static iomux_v3_cfg_t const gw51xx_gpio_pads[] = { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 182 | /* IOEXP_PWREN# */ |
| 183 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 184 | /* IOEXP_IRQ# */ |
| 185 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 186 | /* GPS_SHDN */ |
| 187 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 188 | /* PCIESKT_WDIS# */ |
| 189 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 190 | }; |
| 191 | |
| 192 | static iomux_v3_cfg_t const gw52xx_gpio_pads[] = { |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 193 | /* SD3_VSELECT */ |
| 194 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 195 | /* RS232_EN# */ |
| 196 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 197 | /* MSATA_EN */ |
| 198 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 199 | /* IOEXP_PWREN# */ |
| 200 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 201 | /* IOEXP_IRQ# */ |
| 202 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 203 | /* GPS_SHDN */ |
| 204 | IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | DIO_PAD_CFG), |
| 205 | /* USBOTG_SEL */ |
| 206 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 207 | /* RS485_EN */ |
| 208 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 209 | /* PCIESKT_WDIS# */ |
| 210 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 211 | }; |
| 212 | |
| 213 | static iomux_v3_cfg_t const gw53xx_gpio_pads[] = { |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 214 | /* SD3_VSELECT */ |
| 215 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 216 | /* RS232_EN# */ |
| 217 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 218 | /* MSATA_EN */ |
| 219 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 220 | /* IOEXP_PWREN# */ |
| 221 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 222 | /* IOEXP_IRQ# */ |
| 223 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
| 224 | /* DIOI2C_DIS# */ |
| 225 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
| 226 | /* GPS_SHDN */ |
| 227 | IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 228 | /* RS485_EN */ |
| 229 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 230 | /* PCIESKT_WDIS# */ |
| 231 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
Tim Harvey | 409fe9a | 2021-07-24 10:40:45 -0700 | [diff] [blame] | 232 | /* J6_PWREN */ |
| 233 | IOMUX_PADS(PAD_EIM_DA15__GPIO3_IO15 | DIO_PAD_CFG), |
| 234 | /* PCIEGBE_EN */ |
| 235 | IOMUX_PADS(PAD_EIM_DA14__GPIO3_IO14 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 236 | }; |
| 237 | |
| 238 | static iomux_v3_cfg_t const gw54xx_gpio_pads[] = { |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 239 | /* SD3_VSELECT */ |
| 240 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 241 | /* RS232_EN# */ |
| 242 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 243 | /* MSATA_EN */ |
| 244 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 245 | /* MIPI_DIO */ |
| 246 | IOMUX_PADS(PAD_SD1_DAT3__GPIO1_IO21 | DIO_PAD_CFG), |
| 247 | /* RS485_EN */ |
| 248 | IOMUX_PADS(PAD_EIM_D24__GPIO3_IO24 | DIO_PAD_CFG), |
| 249 | /* IOEXP_PWREN# */ |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 250 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 251 | /* IOEXP_IRQ# */ |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 252 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 253 | /* DIOI2C_DIS# */ |
| 254 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 255 | /* RS485_EN */ |
| 256 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 257 | /* PCIESKT_WDIS# */ |
| 258 | IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG), |
Tim Harvey | db06398 | 2021-07-24 10:40:46 -0700 | [diff] [blame^] | 259 | /* J7_PWREN */ |
| 260 | IOMUX_PADS(PAD_EIM_DA15__GPIO3_IO15 | DIO_PAD_CFG), |
| 261 | /* PCIEGBE_EN */ |
| 262 | IOMUX_PADS(PAD_EIM_DA14__GPIO3_IO14 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | static iomux_v3_cfg_t const gw551x_gpio_pads[] = { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 266 | /* PCIESKT_WDIS# */ |
| 267 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 268 | }; |
| 269 | |
| 270 | static iomux_v3_cfg_t const gw552x_gpio_pads[] = { |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 271 | /* MSATA_EN */ |
| 272 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 273 | /* USBOTG_SEL */ |
| 274 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 275 | /* MX6_DIO[4:9] */ |
| 276 | IOMUX_PADS(PAD_CSI0_PIXCLK__GPIO5_IO18 | DIO_PAD_CFG), |
| 277 | IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20 | DIO_PAD_CFG), |
| 278 | IOMUX_PADS(PAD_CSI0_VSYNC__GPIO5_IO21 | DIO_PAD_CFG), |
| 279 | IOMUX_PADS(PAD_CSI0_DAT4__GPIO5_IO22 | DIO_PAD_CFG), |
| 280 | IOMUX_PADS(PAD_CSI0_DAT5__GPIO5_IO23 | DIO_PAD_CFG), |
| 281 | IOMUX_PADS(PAD_CSI0_DAT7__GPIO5_IO25 | DIO_PAD_CFG), |
| 282 | /* PCIEGBE1_OFF# */ |
| 283 | IOMUX_PADS(PAD_GPIO_1__GPIO1_IO01 | DIO_PAD_CFG), |
| 284 | /* PCIEGBE2_OFF# */ |
| 285 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
| 286 | /* PCIESKT_WDIS# */ |
| 287 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 288 | }; |
| 289 | |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 290 | static iomux_v3_cfg_t const gw553x_gpio_pads[] = { |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 291 | /* SD3_VSELECT */ |
| 292 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 293 | /* PCIESKT_WDIS# */ |
| 294 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 295 | }; |
| 296 | |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 297 | static iomux_v3_cfg_t const gw560x_gpio_pads[] = { |
| 298 | /* RS232_EN# */ |
| 299 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 300 | /* IOEXP_PWREN# */ |
| 301 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 302 | /* IOEXP_IRQ# */ |
| 303 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
| 304 | /* DIOI2C_DIS# */ |
| 305 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 306 | /* RS485_EN */ |
| 307 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
| 308 | /* PCIESKT_WDIS# */ |
| 309 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 310 | /* 12V0_PWR_EN */ |
| 311 | IOMUX_PADS(PAD_DISP0_DAT5__GPIO4_IO26 | DIO_PAD_CFG), |
| 312 | }; |
| 313 | |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 314 | static iomux_v3_cfg_t const gw5901_gpio_pads[] = { |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 315 | /* ETH1_EN */ |
| 316 | IOMUX_PADS(PAD_GPIO_1__GPIO1_IO01 | DIO_PAD_CFG), |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 317 | /* PMIC reset */ |
| 318 | IOMUX_PADS(PAD_DISP0_DAT8__WDOG1_B | DIO_PAD_CFG), |
| 319 | /* COM_CFGA/B/C/D */ |
| 320 | IOMUX_PADS(PAD_DISP0_DAT20__GPIO5_IO14 | DIO_PAD_CFG), |
| 321 | IOMUX_PADS(PAD_DISP0_DAT21__GPIO5_IO15 | DIO_PAD_CFG), |
| 322 | IOMUX_PADS(PAD_DISP0_DAT22__GPIO5_IO16 | DIO_PAD_CFG), |
| 323 | IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG), |
| 324 | /* ETI_IRQ# */ |
| 325 | IOMUX_PADS(PAD_GPIO_5__GPIO1_IO05 | DIO_PAD_CFG), |
| 326 | /* DIO_IRQ# */ |
| 327 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
| 328 | /* FIBER_SIGDET */ |
| 329 | IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG), |
| 330 | }; |
| 331 | |
| 332 | static iomux_v3_cfg_t const gw5902_gpio_pads[] = { |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 333 | /* UART1_EN# */ |
| 334 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 335 | /* 5V_UVLO */ |
| 336 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 337 | /* ETI_IRQ# */ |
| 338 | IOMUX_PADS(PAD_GPIO_5__GPIO1_IO05 | DIO_PAD_CFG), |
| 339 | /* DIO_IRQ# */ |
| 340 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 341 | }; |
| 342 | |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 343 | static iomux_v3_cfg_t const gw5903_gpio_pads[] = { |
| 344 | /* BKLT_12VEN */ |
| 345 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
| 346 | /* EMMY_PDN# */ |
| 347 | IOMUX_PADS(PAD_NANDF_D2__GPIO2_IO02 | DIO_PAD_CFG), |
| 348 | /* EMMY_CFG1# */ |
| 349 | IOMUX_PADS(PAD_NANDF_D3__GPIO2_IO03 | DIO_PAD_CFG), |
| 350 | /* EMMY_CFG1# */ |
| 351 | IOMUX_PADS(PAD_NANDF_D4__GPIO2_IO04 | DIO_PAD_CFG), |
| 352 | /* USBH1_PEN (EHCI) */ |
| 353 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 354 | /* USBDPC_PEN */ |
| 355 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 356 | /* TOUCH_RST */ |
| 357 | IOMUX_PADS(PAD_KEY_COL1__GPIO4_IO08 | DIO_PAD_CFG), |
| 358 | /* AUDIO_RST# */ |
| 359 | IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG), |
| 360 | /* UART1_TEN# */ |
| 361 | IOMUX_PADS(PAD_CSI0_DAT12__GPIO5_IO30 | DIO_PAD_CFG), |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 362 | /* LVDS_BKLEN # */ |
| 363 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 364 | /* RGMII_PDWN# */ |
| 365 | IOMUX_PADS(PAD_ENET_CRS_DV__GPIO1_IO25 | DIO_PAD_CFG), |
| 366 | /* TOUCH_IRQ# */ |
| 367 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 368 | /* TOUCH_RST# */ |
| 369 | IOMUX_PADS(PAD_KEY_COL1__GPIO4_IO08 | DIO_PAD_CFG), |
| 370 | }; |
| 371 | |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 372 | static iomux_v3_cfg_t const gw5904_gpio_pads[] = { |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 373 | /* IOEXP_PWREN# */ |
| 374 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 375 | /* IOEXP_IRQ# */ |
| 376 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
| 377 | /* DIOI2C_DIS# */ |
| 378 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
| 379 | /* UART_RS485 */ |
| 380 | IOMUX_PADS(PAD_DISP0_DAT2__GPIO4_IO23 | DIO_PAD_CFG), |
| 381 | /* UART_HALF */ |
| 382 | IOMUX_PADS(PAD_DISP0_DAT3__GPIO4_IO24 | DIO_PAD_CFG), |
| 383 | /* SKT1_WDIS# */ |
| 384 | IOMUX_PADS(PAD_DISP0_DAT17__GPIO5_IO11 | DIO_PAD_CFG), |
| 385 | /* SKT1_RST# */ |
| 386 | IOMUX_PADS(PAD_DISP0_DAT18__GPIO5_IO12 | DIO_PAD_CFG), |
| 387 | /* SKT2_WDIS# */ |
| 388 | IOMUX_PADS(PAD_DISP0_DAT19__GPIO5_IO13 | DIO_PAD_CFG), |
| 389 | /* SKT2_RST# */ |
| 390 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
| 391 | /* M2_OFF# */ |
| 392 | IOMUX_PADS(PAD_SD2_DAT0__GPIO1_IO15 | DIO_PAD_CFG), |
| 393 | /* M2_WDIS# */ |
| 394 | IOMUX_PADS(PAD_SD2_DAT1__GPIO1_IO14 | DIO_PAD_CFG), |
| 395 | /* M2_RST# */ |
| 396 | IOMUX_PADS(PAD_SD2_DAT2__GPIO1_IO13 | DIO_PAD_CFG), |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 397 | /* RS232_EN# */ |
| 398 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 399 | }; |
| 400 | |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 401 | static iomux_v3_cfg_t const gw5905_gpio_pads[] = { |
| 402 | /* EMMY_PDN# */ |
| 403 | IOMUX_PADS(PAD_NANDF_D3__GPIO2_IO03 | DIO_PAD_CFG), |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 404 | /* MIPI_RST */ |
| 405 | IOMUX_PADS(PAD_SD2_DAT0__GPIO1_IO15 | DIO_PAD_CFG), |
| 406 | /* MIPI_PWDN */ |
| 407 | IOMUX_PADS(PAD_SD2_DAT1__GPIO1_IO14 | DIO_PAD_CFG), |
| 408 | /* USBEHCI_SEL */ |
| 409 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 410 | /* LVDS_BKLEN # */ |
| 411 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 412 | /* PCIESKT_WDIS# */ |
| 413 | IOMUX_PADS(PAD_GPIO_18__GPIO7_IO13 | DIO_PAD_CFG), |
| 414 | /* SPK_SHDN# */ |
| 415 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 416 | /* DECT_RST# */ |
| 417 | IOMUX_PADS(PAD_DISP0_DAT20__GPIO5_IO14 | DIO_PAD_CFG), |
| 418 | /* USBH1_PEN (EHCI) */ |
| 419 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
| 420 | /* LVDS_PWM */ |
| 421 | IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG), |
| 422 | /* CODEC_RST */ |
| 423 | IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG), |
| 424 | /* GYRO_CONTROL/DATA_EN */ |
| 425 | IOMUX_PADS(PAD_CSI0_DAT8__GPIO5_IO26 | DIO_PAD_CFG), |
| 426 | /* TOUCH_RST */ |
| 427 | IOMUX_PADS(PAD_KEY_COL1__GPIO4_IO08 | DIO_PAD_CFG), |
| 428 | /* TOUCH_IRQ */ |
| 429 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 430 | }; |
| 431 | |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 432 | static iomux_v3_cfg_t const gw5910_gpio_pads[] = { |
| 433 | /* SD3_VSELECT */ |
| 434 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
| 435 | /* RS232_EN# */ |
| 436 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
| 437 | /* RF_RESET# */ |
| 438 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
| 439 | /* RF_BOOT */ |
| 440 | IOMUX_PADS(PAD_GPIO_8__GPIO1_IO08 | DIO_PAD_CFG), |
| 441 | /* PCIESKT_WDIS# */ |
| 442 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 443 | }; |
| 444 | |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 445 | static iomux_v3_cfg_t const gw5912_gpio_pads[] = { |
| 446 | /* SD3_VSELECT */ |
| 447 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
| 448 | /* RS232_EN# */ |
| 449 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
| 450 | /* PCIESKT_WDIS# */ |
| 451 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
| 452 | }; |
| 453 | |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 454 | /* Digital I/O */ |
| 455 | struct dio_cfg gw51xx_dio[] = { |
| 456 | { |
| 457 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 458 | IMX_GPIO_NR(1, 16), |
| 459 | { 0, 0 }, |
| 460 | 0 |
| 461 | }, |
| 462 | { |
| 463 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 464 | IMX_GPIO_NR(1, 19), |
| 465 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 466 | 2 |
| 467 | }, |
| 468 | { |
| 469 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 470 | IMX_GPIO_NR(1, 17), |
| 471 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 472 | 3 |
| 473 | }, |
| 474 | { |
| 475 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 476 | IMX_GPIO_NR(1, 18), |
| 477 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 478 | 4 |
| 479 | }, |
| 480 | }; |
| 481 | |
| 482 | struct dio_cfg gw52xx_dio[] = { |
| 483 | { |
| 484 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 485 | IMX_GPIO_NR(1, 16), |
| 486 | { 0, 0 }, |
| 487 | 0 |
| 488 | }, |
| 489 | { |
| 490 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 491 | IMX_GPIO_NR(1, 19), |
| 492 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 493 | 2 |
| 494 | }, |
| 495 | { |
| 496 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 497 | IMX_GPIO_NR(1, 17), |
| 498 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 499 | 3 |
| 500 | }, |
| 501 | { |
| 502 | { IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 503 | IMX_GPIO_NR(1, 20), |
| 504 | { 0, 0 }, |
| 505 | 0 |
| 506 | }, |
| 507 | }; |
| 508 | |
| 509 | struct dio_cfg gw53xx_dio[] = { |
| 510 | { |
| 511 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 512 | IMX_GPIO_NR(1, 16), |
| 513 | { 0, 0 }, |
| 514 | 0 |
| 515 | }, |
| 516 | { |
| 517 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 518 | IMX_GPIO_NR(1, 19), |
| 519 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 520 | 2 |
| 521 | }, |
| 522 | { |
| 523 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 524 | IMX_GPIO_NR(1, 17), |
| 525 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 526 | 3 |
| 527 | }, |
| 528 | { |
| 529 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 530 | IMX_GPIO_NR(1, 20), |
| 531 | { 0, 0 }, |
| 532 | 0 |
| 533 | }, |
| 534 | }; |
| 535 | |
| 536 | struct dio_cfg gw54xx_dio[] = { |
| 537 | { |
| 538 | { IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09) }, |
| 539 | IMX_GPIO_NR(1, 9), |
| 540 | { IOMUX_PADS(PAD_GPIO_9__PWM1_OUT) }, |
| 541 | 1 |
| 542 | }, |
| 543 | { |
| 544 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 545 | IMX_GPIO_NR(1, 19), |
| 546 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 547 | 2 |
| 548 | }, |
| 549 | { |
| 550 | { IOMUX_PADS(PAD_SD4_DAT1__GPIO2_IO09) }, |
| 551 | IMX_GPIO_NR(2, 9), |
| 552 | { IOMUX_PADS(PAD_SD4_DAT1__PWM3_OUT) }, |
| 553 | 3 |
| 554 | }, |
| 555 | { |
| 556 | { IOMUX_PADS(PAD_SD4_DAT2__GPIO2_IO10) }, |
| 557 | IMX_GPIO_NR(2, 10), |
| 558 | { IOMUX_PADS(PAD_SD4_DAT2__PWM4_OUT) }, |
| 559 | 4 |
| 560 | }, |
| 561 | }; |
| 562 | |
| 563 | struct dio_cfg gw551x_dio[] = { |
| 564 | { |
| 565 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 566 | IMX_GPIO_NR(1, 19), |
| 567 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 568 | 2 |
| 569 | }, |
| 570 | { |
| 571 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 572 | IMX_GPIO_NR(1, 17), |
| 573 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 574 | 3 |
| 575 | }, |
| 576 | }; |
| 577 | |
| 578 | struct dio_cfg gw552x_dio[] = { |
| 579 | { |
| 580 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 581 | IMX_GPIO_NR(1, 16), |
| 582 | { 0, 0 }, |
| 583 | 0 |
| 584 | }, |
| 585 | { |
| 586 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 587 | IMX_GPIO_NR(1, 19), |
| 588 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 589 | 2 |
| 590 | }, |
| 591 | { |
| 592 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 593 | IMX_GPIO_NR(1, 17), |
| 594 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 595 | 3 |
| 596 | }, |
| 597 | { |
| 598 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 599 | IMX_GPIO_NR(1, 20), |
| 600 | { 0, 0 }, |
| 601 | 0 |
| 602 | }, |
Tim Harvey | b1243da | 2016-07-15 07:14:24 -0700 | [diff] [blame] | 603 | { |
| 604 | {IOMUX_PADS(PAD_CSI0_PIXCLK__GPIO5_IO18) }, |
| 605 | IMX_GPIO_NR(5, 18), |
| 606 | { 0, 0 }, |
| 607 | 0 |
| 608 | }, |
| 609 | { |
| 610 | {IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20) }, |
| 611 | IMX_GPIO_NR(5, 20), |
| 612 | { 0, 0 }, |
| 613 | 0 |
| 614 | }, |
| 615 | { |
| 616 | {IOMUX_PADS(PAD_CSI0_VSYNC__GPIO5_IO21) }, |
| 617 | IMX_GPIO_NR(5, 21), |
| 618 | { 0, 0 }, |
| 619 | 0 |
| 620 | }, |
| 621 | { |
| 622 | {IOMUX_PADS(PAD_CSI0_DAT4__GPIO5_IO22) }, |
| 623 | IMX_GPIO_NR(5, 22), |
| 624 | { 0, 0 }, |
| 625 | 0 |
| 626 | }, |
| 627 | { |
| 628 | {IOMUX_PADS(PAD_CSI0_DAT5__GPIO5_IO23) }, |
| 629 | IMX_GPIO_NR(5, 23), |
| 630 | { 0, 0 }, |
| 631 | 0 |
| 632 | }, |
| 633 | { |
| 634 | {IOMUX_PADS(PAD_CSI0_DAT7__GPIO5_IO25) }, |
| 635 | IMX_GPIO_NR(5, 25), |
| 636 | { 0, 0 }, |
| 637 | 0 |
| 638 | }, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 639 | }; |
| 640 | |
| 641 | struct dio_cfg gw553x_dio[] = { |
| 642 | { |
| 643 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 644 | IMX_GPIO_NR(1, 16), |
| 645 | { 0, 0 }, |
| 646 | 0 |
| 647 | }, |
| 648 | { |
| 649 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 650 | IMX_GPIO_NR(1, 19), |
| 651 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 652 | 2 |
| 653 | }, |
| 654 | { |
| 655 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 656 | IMX_GPIO_NR(1, 17), |
| 657 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 658 | 3 |
| 659 | }, |
| 660 | { |
| 661 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 662 | IMX_GPIO_NR(1, 18), |
| 663 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 664 | 4 |
| 665 | }, |
| 666 | }; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 667 | |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 668 | struct dio_cfg gw560x_dio[] = { |
| 669 | { |
| 670 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 671 | IMX_GPIO_NR(1, 16), |
| 672 | { 0, 0 }, |
| 673 | 0 |
| 674 | }, |
| 675 | { |
| 676 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 677 | IMX_GPIO_NR(1, 19), |
| 678 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 679 | 2 |
| 680 | }, |
| 681 | { |
| 682 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 683 | IMX_GPIO_NR(1, 17), |
| 684 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 685 | 3 |
| 686 | }, |
| 687 | { |
| 688 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 689 | IMX_GPIO_NR(1, 20), |
| 690 | { 0, 0 }, |
| 691 | 0 |
| 692 | }, |
| 693 | }; |
| 694 | |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 695 | struct dio_cfg gw5901_dio[] = { |
| 696 | { |
| 697 | { IOMUX_PADS(PAD_DISP0_DAT20__GPIO5_IO14) }, |
| 698 | IMX_GPIO_NR(5, 14), |
| 699 | { 0, 0 }, |
| 700 | 0 |
| 701 | }, |
| 702 | { |
| 703 | { IOMUX_PADS(PAD_DISP0_DAT21__GPIO5_IO15) }, |
| 704 | IMX_GPIO_NR(5, 15), |
| 705 | { 0, 0 }, |
| 706 | 0 |
| 707 | }, |
| 708 | { |
| 709 | { IOMUX_PADS(PAD_DISP0_DAT22__GPIO5_IO16) }, |
| 710 | IMX_GPIO_NR(5, 16), |
| 711 | { 0, 0 }, |
| 712 | 0 |
| 713 | }, |
| 714 | { |
| 715 | { IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17) }, |
| 716 | IMX_GPIO_NR(5, 17), |
| 717 | { 0, 0 }, |
| 718 | 0 |
| 719 | }, |
| 720 | }; |
| 721 | |
| 722 | struct dio_cfg gw5902_dio[] = { |
| 723 | { |
| 724 | { IOMUX_PADS(PAD_DISP0_DAT20__GPIO5_IO14) }, |
| 725 | IMX_GPIO_NR(5, 14), |
| 726 | { 0, 0 }, |
| 727 | 0 |
| 728 | }, |
| 729 | { |
| 730 | { IOMUX_PADS(PAD_DISP0_DAT21__GPIO5_IO15) }, |
| 731 | IMX_GPIO_NR(5, 15), |
| 732 | { 0, 0 }, |
| 733 | 0 |
| 734 | }, |
| 735 | { |
| 736 | { IOMUX_PADS(PAD_DISP0_DAT22__GPIO5_IO16) }, |
| 737 | IMX_GPIO_NR(5, 16), |
| 738 | { 0, 0 }, |
| 739 | 0 |
| 740 | }, |
| 741 | { |
| 742 | { IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17) }, |
| 743 | IMX_GPIO_NR(5, 17), |
| 744 | { 0, 0 }, |
| 745 | 0 |
| 746 | }, |
| 747 | }; |
| 748 | |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 749 | struct dio_cfg gw5903_dio[] = { |
| 750 | }; |
| 751 | |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 752 | struct dio_cfg gw5904_dio[] = { |
| 753 | { |
| 754 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 755 | IMX_GPIO_NR(1, 16), |
| 756 | { 0, 0 }, |
| 757 | 0 |
| 758 | }, |
| 759 | { |
| 760 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 761 | IMX_GPIO_NR(1, 19), |
| 762 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 763 | 2 |
| 764 | }, |
| 765 | { |
| 766 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 767 | IMX_GPIO_NR(1, 17), |
| 768 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 769 | 3 |
| 770 | }, |
| 771 | { |
| 772 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 773 | IMX_GPIO_NR(1, 20), |
| 774 | { 0, 0 }, |
| 775 | 0 |
| 776 | }, |
| 777 | { |
| 778 | {IOMUX_PADS(PAD_NANDF_D0__GPIO2_IO00) }, |
| 779 | IMX_GPIO_NR(2, 0), |
| 780 | { 0, 0 }, |
| 781 | 0 |
| 782 | }, |
| 783 | { |
| 784 | {IOMUX_PADS(PAD_NANDF_D1__GPIO2_IO01) }, |
| 785 | IMX_GPIO_NR(2, 1), |
| 786 | { 0, 0 }, |
| 787 | 0 |
| 788 | }, |
| 789 | { |
| 790 | {IOMUX_PADS(PAD_NANDF_D2__GPIO2_IO02) }, |
| 791 | IMX_GPIO_NR(2, 2), |
| 792 | { 0, 0 }, |
| 793 | 0 |
| 794 | }, |
| 795 | { |
| 796 | {IOMUX_PADS(PAD_NANDF_D3__GPIO2_IO03) }, |
| 797 | IMX_GPIO_NR(2, 3), |
| 798 | { 0, 0 }, |
| 799 | 0 |
| 800 | }, |
| 801 | { |
| 802 | {IOMUX_PADS(PAD_NANDF_D4__GPIO2_IO04) }, |
| 803 | IMX_GPIO_NR(2, 4), |
| 804 | { 0, 0 }, |
| 805 | 0 |
| 806 | }, |
| 807 | { |
| 808 | {IOMUX_PADS(PAD_NANDF_D5__GPIO2_IO05) }, |
| 809 | IMX_GPIO_NR(2, 5), |
| 810 | { 0, 0 }, |
| 811 | 0 |
| 812 | }, |
| 813 | { |
| 814 | {IOMUX_PADS(PAD_NANDF_D6__GPIO2_IO06) }, |
| 815 | IMX_GPIO_NR(2, 6), |
| 816 | { 0, 0 }, |
| 817 | 0 |
| 818 | }, |
| 819 | { |
| 820 | {IOMUX_PADS(PAD_NANDF_D7__GPIO2_IO07) }, |
| 821 | IMX_GPIO_NR(2, 7), |
| 822 | { 0, 0 }, |
| 823 | 0 |
| 824 | }, |
| 825 | }; |
| 826 | |
Tim Harvey | b7c48a9 | 2019-02-04 13:10:54 -0800 | [diff] [blame] | 827 | struct dio_cfg gw5906_dio[] = { |
| 828 | { |
| 829 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 830 | IMX_GPIO_NR(1, 16), |
| 831 | { 0, 0 }, |
| 832 | 0 |
| 833 | }, |
| 834 | { |
| 835 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 836 | IMX_GPIO_NR(1, 19), |
| 837 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 838 | 2 |
| 839 | }, |
| 840 | { |
| 841 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 842 | IMX_GPIO_NR(1, 17), |
| 843 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 844 | 3 |
| 845 | }, |
| 846 | { |
| 847 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 848 | IMX_GPIO_NR(1, 20), |
| 849 | { 0, 0 }, |
| 850 | 0 |
| 851 | }, |
| 852 | }; |
| 853 | |
Tim Harvey | b7c9f36 | 2021-07-24 10:40:44 -0700 | [diff] [blame] | 854 | struct dio_cfg gw5913_dio[] = { |
| 855 | { |
| 856 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 857 | IMX_GPIO_NR(1, 16), |
| 858 | { 0, 0 }, |
| 859 | 0 |
| 860 | }, |
| 861 | { |
| 862 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 863 | IMX_GPIO_NR(1, 19), |
| 864 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 865 | 2 |
| 866 | }, |
| 867 | { |
| 868 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 869 | IMX_GPIO_NR(1, 17), |
| 870 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 871 | 3 |
| 872 | }, |
| 873 | { |
| 874 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 875 | IMX_GPIO_NR(1, 18), |
| 876 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 877 | 4 |
| 878 | }, |
| 879 | { |
| 880 | { IOMUX_PADS(PAD_SD2_DAT0__GPIO1_IO15) }, |
| 881 | IMX_GPIO_NR(1, 15), |
| 882 | { 0, 0 }, |
| 883 | 0 |
| 884 | }, |
| 885 | { |
| 886 | { IOMUX_PADS(PAD_SD2_DAT1__GPIO1_IO14) }, |
| 887 | IMX_GPIO_NR(1, 14), |
| 888 | { 0, 0 }, |
| 889 | 0 |
| 890 | }, |
| 891 | { |
| 892 | { IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05) }, |
| 893 | IMX_GPIO_NR(4, 5), |
| 894 | { 0, 0 }, |
| 895 | 0 |
| 896 | }, |
| 897 | }; |
| 898 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 899 | /* |
| 900 | * Board Specific GPIO |
| 901 | */ |
| 902 | struct ventana gpio_cfg[GW_UNKNOWN] = { |
| 903 | /* GW5400proto */ |
| 904 | { |
| 905 | .gpio_pads = gw54xx_gpio_pads, |
| 906 | .num_pads = ARRAY_SIZE(gw54xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 907 | .dio_cfg = gw54xx_dio, |
| 908 | .dio_num = ARRAY_SIZE(gw54xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 909 | .mezz_pwren = IMX_GPIO_NR(4, 7), |
| 910 | .mezz_irq = IMX_GPIO_NR(4, 9), |
| 911 | .rs485en = IMX_GPIO_NR(3, 24), |
| 912 | .dioi2c_en = IMX_GPIO_NR(4, 5), |
| 913 | .pcie_sson = IMX_GPIO_NR(1, 20), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 914 | .mmc_cd = IMX_GPIO_NR(7, 0), |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 915 | .wdis = -1, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 916 | }, |
| 917 | |
| 918 | /* GW51xx */ |
| 919 | { |
| 920 | .gpio_pads = gw51xx_gpio_pads, |
| 921 | .num_pads = ARRAY_SIZE(gw51xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 922 | .dio_cfg = gw51xx_dio, |
| 923 | .dio_num = ARRAY_SIZE(gw51xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 924 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 925 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 926 | .gps_shdn = IMX_GPIO_NR(1, 2), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 927 | .wdis = IMX_GPIO_NR(7, 12), |
| 928 | }, |
| 929 | |
| 930 | /* GW52xx */ |
| 931 | { |
| 932 | .gpio_pads = gw52xx_gpio_pads, |
| 933 | .num_pads = ARRAY_SIZE(gw52xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 934 | .dio_cfg = gw52xx_dio, |
| 935 | .dio_num = ARRAY_SIZE(gw52xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 936 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 937 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 938 | .gps_shdn = IMX_GPIO_NR(1, 27), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 939 | .usb_sel = IMX_GPIO_NR(1, 2), |
| 940 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 941 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 942 | .rs232_en = GP_RS232_EN, |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 943 | .vsel_pin = IMX_GPIO_NR(6, 14), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 944 | .mmc_cd = IMX_GPIO_NR(7, 0), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 945 | }, |
| 946 | |
| 947 | /* GW53xx */ |
| 948 | { |
| 949 | .gpio_pads = gw53xx_gpio_pads, |
| 950 | .num_pads = ARRAY_SIZE(gw53xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 951 | .dio_cfg = gw53xx_dio, |
| 952 | .dio_num = ARRAY_SIZE(gw53xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 953 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 954 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 955 | .gps_shdn = IMX_GPIO_NR(1, 27), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 956 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 957 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 958 | .rs232_en = GP_RS232_EN, |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 959 | .vsel_pin = IMX_GPIO_NR(6, 14), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 960 | .mmc_cd = IMX_GPIO_NR(7, 0), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 961 | }, |
| 962 | |
| 963 | /* GW54xx */ |
| 964 | { |
| 965 | .gpio_pads = gw54xx_gpio_pads, |
| 966 | .num_pads = ARRAY_SIZE(gw54xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 967 | .dio_cfg = gw54xx_dio, |
| 968 | .dio_num = ARRAY_SIZE(gw54xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 969 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 970 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 971 | .rs485en = IMX_GPIO_NR(7, 1), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 972 | .dioi2c_en = IMX_GPIO_NR(4, 5), |
| 973 | .pcie_sson = IMX_GPIO_NR(1, 20), |
| 974 | .wdis = IMX_GPIO_NR(5, 17), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 975 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 976 | .rs232_en = GP_RS232_EN, |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 977 | .vsel_pin = IMX_GPIO_NR(6, 14), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 978 | .mmc_cd = IMX_GPIO_NR(7, 0), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 979 | }, |
| 980 | |
| 981 | /* GW551x */ |
| 982 | { |
| 983 | .gpio_pads = gw551x_gpio_pads, |
| 984 | .num_pads = ARRAY_SIZE(gw551x_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 985 | .dio_cfg = gw551x_dio, |
| 986 | .dio_num = ARRAY_SIZE(gw551x_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 987 | .wdis = IMX_GPIO_NR(7, 12), |
| 988 | }, |
| 989 | |
| 990 | /* GW552x */ |
| 991 | { |
| 992 | .gpio_pads = gw552x_gpio_pads, |
| 993 | .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 994 | .dio_cfg = gw552x_dio, |
| 995 | .dio_num = ARRAY_SIZE(gw552x_dio), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 996 | .usb_sel = IMX_GPIO_NR(1, 7), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 997 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 998 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 999 | }, |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 1000 | |
| 1001 | /* GW553x */ |
| 1002 | { |
| 1003 | .gpio_pads = gw553x_gpio_pads, |
| 1004 | .num_pads = ARRAY_SIZE(gw553x_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 1005 | .dio_cfg = gw553x_dio, |
| 1006 | .dio_num = ARRAY_SIZE(gw553x_dio), |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 1007 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 1008 | .vsel_pin = IMX_GPIO_NR(6, 14), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1009 | .mmc_cd = IMX_GPIO_NR(7, 0), |
| 1010 | }, |
| 1011 | |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1012 | /* GW560x */ |
| 1013 | { |
| 1014 | .gpio_pads = gw560x_gpio_pads, |
| 1015 | .num_pads = ARRAY_SIZE(gw560x_gpio_pads)/2, |
| 1016 | .dio_cfg = gw560x_dio, |
| 1017 | .dio_num = ARRAY_SIZE(gw560x_dio), |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1018 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 1019 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 1020 | .rs232_en = GP_RS232_EN, |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1021 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1022 | .mmc_cd = IMX_GPIO_NR(7, 0), |
| 1023 | }, |
| 1024 | |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 1025 | /* GW5901 */ |
| 1026 | { |
| 1027 | .gpio_pads = gw5901_gpio_pads, |
| 1028 | .num_pads = ARRAY_SIZE(gw5901_gpio_pads)/2, |
| 1029 | .dio_cfg = gw5901_dio, |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1030 | .wdis = -1, |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 1031 | }, |
| 1032 | |
| 1033 | /* GW5902 */ |
| 1034 | { |
| 1035 | .gpio_pads = gw5902_gpio_pads, |
| 1036 | .num_pads = ARRAY_SIZE(gw5902_gpio_pads)/2, |
| 1037 | .dio_cfg = gw5902_dio, |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 1038 | .rs232_en = GP_RS232_EN, |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1039 | .wdis = -1, |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 1040 | }, |
| 1041 | |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1042 | /* GW5903 */ |
| 1043 | { |
| 1044 | .gpio_pads = gw5903_gpio_pads, |
| 1045 | .num_pads = ARRAY_SIZE(gw5903_gpio_pads)/2, |
| 1046 | .dio_cfg = gw5903_dio, |
| 1047 | .dio_num = ARRAY_SIZE(gw5903_dio), |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1048 | .mmc_cd = IMX_GPIO_NR(6, 11), |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1049 | .wdis = -1, |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1050 | }, |
| 1051 | |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1052 | /* GW5904 */ |
| 1053 | { |
| 1054 | .gpio_pads = gw5904_gpio_pads, |
| 1055 | .num_pads = ARRAY_SIZE(gw5904_gpio_pads)/2, |
| 1056 | .dio_cfg = gw5904_dio, |
| 1057 | .dio_num = ARRAY_SIZE(gw5904_dio), |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1058 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 1059 | .mezz_irq = IMX_GPIO_NR(2, 18), |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1060 | .wdis = -1, |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 1061 | }, |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1062 | |
| 1063 | /* GW5905 */ |
| 1064 | { |
| 1065 | .gpio_pads = gw5905_gpio_pads, |
| 1066 | .num_pads = ARRAY_SIZE(gw5905_gpio_pads)/2, |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1067 | .wdis = IMX_GPIO_NR(7, 13), |
| 1068 | }, |
Tim Harvey | b7c48a9 | 2019-02-04 13:10:54 -0800 | [diff] [blame] | 1069 | |
| 1070 | /* GW5906 */ |
| 1071 | { |
| 1072 | .gpio_pads = gw552x_gpio_pads, |
| 1073 | .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2, |
| 1074 | .dio_cfg = gw5906_dio, |
| 1075 | .dio_num = ARRAY_SIZE(gw5906_dio), |
Tim Harvey | b7c48a9 | 2019-02-04 13:10:54 -0800 | [diff] [blame] | 1076 | .usb_sel = IMX_GPIO_NR(1, 7), |
| 1077 | .wdis = IMX_GPIO_NR(7, 12), |
| 1078 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | b7c48a9 | 2019-02-04 13:10:54 -0800 | [diff] [blame] | 1079 | }, |
Tim Harvey | 83cad80 | 2019-02-04 13:10:55 -0800 | [diff] [blame] | 1080 | |
| 1081 | /* GW5907 */ |
| 1082 | { |
| 1083 | .gpio_pads = gw51xx_gpio_pads, |
| 1084 | .num_pads = ARRAY_SIZE(gw51xx_gpio_pads)/2, |
| 1085 | .dio_cfg = gw51xx_dio, |
| 1086 | .dio_num = ARRAY_SIZE(gw51xx_dio), |
Tim Harvey | 83cad80 | 2019-02-04 13:10:55 -0800 | [diff] [blame] | 1087 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 83cad80 | 2019-02-04 13:10:55 -0800 | [diff] [blame] | 1088 | }, |
Tim Harvey | c262540 | 2019-02-04 13:10:56 -0800 | [diff] [blame] | 1089 | |
| 1090 | /* GW5908 */ |
| 1091 | { |
| 1092 | .gpio_pads = gw53xx_gpio_pads, |
| 1093 | .num_pads = ARRAY_SIZE(gw53xx_gpio_pads)/2, |
| 1094 | .dio_cfg = gw53xx_dio, |
| 1095 | .dio_num = ARRAY_SIZE(gw53xx_dio), |
Tim Harvey | c262540 | 2019-02-04 13:10:56 -0800 | [diff] [blame] | 1096 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 1097 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 1098 | .gps_shdn = IMX_GPIO_NR(1, 27), |
Tim Harvey | c262540 | 2019-02-04 13:10:56 -0800 | [diff] [blame] | 1099 | .wdis = IMX_GPIO_NR(7, 12), |
| 1100 | .msata_en = GP_MSATA_SEL, |
| 1101 | .rs232_en = GP_RS232_EN, |
| 1102 | }, |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 1103 | |
| 1104 | /* GW5909 */ |
| 1105 | { |
| 1106 | .gpio_pads = gw5904_gpio_pads, |
| 1107 | .num_pads = ARRAY_SIZE(gw5904_gpio_pads)/2, |
| 1108 | .dio_cfg = gw5904_dio, |
| 1109 | .dio_num = ARRAY_SIZE(gw5904_dio), |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 1110 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 1111 | .mezz_irq = IMX_GPIO_NR(2, 18), |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1112 | .wdis = -1, |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 1113 | }, |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 1114 | |
| 1115 | /* GW5910 */ |
| 1116 | { |
| 1117 | .gpio_pads = gw5910_gpio_pads, |
| 1118 | .num_pads = ARRAY_SIZE(gw5910_gpio_pads) / 2, |
| 1119 | .dio_cfg = gw52xx_dio, |
| 1120 | .dio_num = ARRAY_SIZE(gw52xx_dio), |
| 1121 | .wdis = IMX_GPIO_NR(7, 12), |
| 1122 | .rs232_en = GP_RS232_EN, |
| 1123 | .vsel_pin = IMX_GPIO_NR(6, 14), |
| 1124 | .mmc_cd = IMX_GPIO_NR(7, 0), |
| 1125 | }, |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1126 | |
| 1127 | /* GW5912 */ |
| 1128 | { |
| 1129 | .gpio_pads = gw5912_gpio_pads, |
| 1130 | .num_pads = ARRAY_SIZE(gw5912_gpio_pads) / 2, |
| 1131 | .dio_cfg = gw54xx_dio, |
| 1132 | .dio_num = ARRAY_SIZE(gw54xx_dio), |
| 1133 | .wdis = IMX_GPIO_NR(1, 0), |
| 1134 | .rs232_en = GP_RS232_EN, |
| 1135 | .vsel_pin = IMX_GPIO_NR(6, 14), |
| 1136 | .mmc_cd = IMX_GPIO_NR(7, 0), |
| 1137 | }, |
Tim Harvey | b7c9f36 | 2021-07-24 10:40:44 -0700 | [diff] [blame] | 1138 | |
| 1139 | /* GW5913 */ |
| 1140 | { |
| 1141 | .gpio_pads = gw5912_gpio_pads, |
| 1142 | .num_pads = ARRAY_SIZE(gw5912_gpio_pads) / 2, |
| 1143 | .dio_cfg = gw5913_dio, |
| 1144 | .dio_num = ARRAY_SIZE(gw5913_dio), |
| 1145 | .wdis = IMX_GPIO_NR(1, 0), |
| 1146 | }, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1147 | }; |
| 1148 | |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1149 | #define SETUP_GPIO_OUTPUT(gpio, name, level) \ |
| 1150 | gpio_request(gpio, name); \ |
| 1151 | gpio_direction_output(gpio, level); |
| 1152 | #define SETUP_GPIO_INPUT(gpio, name) \ |
| 1153 | gpio_request(gpio, name); \ |
| 1154 | gpio_direction_input(gpio); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1155 | void setup_iomux_gpio(int board, struct ventana_board_info *info) |
| 1156 | { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1157 | if (board >= GW_UNKNOWN) |
| 1158 | return; |
| 1159 | |
| 1160 | /* board specific iomux */ |
| 1161 | imx_iomux_v3_setup_multiple_pads(gpio_cfg[board].gpio_pads, |
| 1162 | gpio_cfg[board].num_pads); |
| 1163 | |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 1164 | /* RS232_EN# */ |
| 1165 | if (gpio_cfg[board].rs232_en) { |
Tim Harvey | 6ea02c9 | 2017-03-13 08:51:05 -0700 | [diff] [blame] | 1166 | gpio_request(gpio_cfg[board].rs232_en, "rs232_en#"); |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 1167 | gpio_direction_output(gpio_cfg[board].rs232_en, 0); |
| 1168 | } |
| 1169 | |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 1170 | /* MSATA Enable - default to PCI */ |
| 1171 | if (gpio_cfg[board].msata_en) { |
| 1172 | gpio_request(gpio_cfg[board].msata_en, "msata_en"); |
| 1173 | gpio_direction_output(gpio_cfg[board].msata_en, 0); |
| 1174 | } |
| 1175 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1176 | /* Expansion Mezzanine IO */ |
| 1177 | if (gpio_cfg[board].mezz_pwren) { |
| 1178 | gpio_request(gpio_cfg[board].mezz_pwren, "mezz_pwr"); |
| 1179 | gpio_direction_output(gpio_cfg[board].mezz_pwren, 0); |
| 1180 | } |
| 1181 | if (gpio_cfg[board].mezz_irq) { |
| 1182 | gpio_request(gpio_cfg[board].mezz_irq, "mezz_irq#"); |
| 1183 | gpio_direction_input(gpio_cfg[board].mezz_irq); |
| 1184 | } |
| 1185 | |
| 1186 | /* RS485 Transmit Enable */ |
| 1187 | if (gpio_cfg[board].rs485en) { |
| 1188 | gpio_request(gpio_cfg[board].rs485en, "rs485_en"); |
| 1189 | gpio_direction_output(gpio_cfg[board].rs485en, 0); |
| 1190 | } |
| 1191 | |
| 1192 | /* GPS_SHDN */ |
| 1193 | if (gpio_cfg[board].gps_shdn) { |
| 1194 | gpio_request(gpio_cfg[board].gps_shdn, "gps_shdn"); |
| 1195 | gpio_direction_output(gpio_cfg[board].gps_shdn, 1); |
| 1196 | } |
| 1197 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1198 | /* DIOI2C_DIS# */ |
| 1199 | if (gpio_cfg[board].dioi2c_en) { |
| 1200 | gpio_request(gpio_cfg[board].dioi2c_en, "dioi2c_dis#"); |
| 1201 | gpio_direction_output(gpio_cfg[board].dioi2c_en, 0); |
| 1202 | } |
| 1203 | |
| 1204 | /* PCICK_SSON: disable spread-spectrum clock */ |
| 1205 | if (gpio_cfg[board].pcie_sson) { |
| 1206 | gpio_request(gpio_cfg[board].pcie_sson, "pci_sson"); |
| 1207 | gpio_direction_output(gpio_cfg[board].pcie_sson, 0); |
| 1208 | } |
| 1209 | |
| 1210 | /* USBOTG mux routing */ |
| 1211 | if (gpio_cfg[board].usb_sel) { |
| 1212 | gpio_request(gpio_cfg[board].usb_sel, "usb_pcisel"); |
| 1213 | gpio_direction_output(gpio_cfg[board].usb_sel, 0); |
| 1214 | } |
| 1215 | |
| 1216 | /* PCISKT_WDIS# (Wireless disable GPIO to miniPCIe sockets) */ |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1217 | if (gpio_cfg[board].wdis != -1) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1218 | gpio_request(gpio_cfg[board].wdis, "wlan_dis"); |
| 1219 | gpio_direction_output(gpio_cfg[board].wdis, 1); |
| 1220 | } |
Tim Harvey | 147b576 | 2016-05-24 11:03:59 -0700 | [diff] [blame] | 1221 | |
| 1222 | /* sense vselect pin to see if we support uhs-i */ |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 1223 | if (gpio_cfg[board].vsel_pin) { |
| 1224 | gpio_request(gpio_cfg[board].vsel_pin, "sd3_vselect"); |
| 1225 | gpio_direction_input(gpio_cfg[board].vsel_pin); |
| 1226 | gpio_cfg[board].usd_vsel = !gpio_get_value(gpio_cfg[board].vsel_pin); |
| 1227 | } |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1228 | |
| 1229 | /* microSD CD */ |
| 1230 | if (gpio_cfg[board].mmc_cd) { |
| 1231 | gpio_request(gpio_cfg[board].mmc_cd, "sd_cd"); |
| 1232 | gpio_direction_input(gpio_cfg[board].mmc_cd); |
| 1233 | } |
| 1234 | |
| 1235 | /* Anything else board specific */ |
| 1236 | switch(board) { |
Tim Harvey | 409fe9a | 2021-07-24 10:40:45 -0700 | [diff] [blame] | 1237 | case GW53xx: |
| 1238 | gpio_request(IMX_GPIO_NR(3, 15), "j6_pwren"); |
| 1239 | gpio_direction_output(IMX_GPIO_NR(3, 15), 1); |
| 1240 | gpio_request(IMX_GPIO_NR(3, 14), "gbe_en"); |
| 1241 | gpio_direction_output(IMX_GPIO_NR(3, 14), 1); |
| 1242 | break; |
Tim Harvey | db06398 | 2021-07-24 10:40:46 -0700 | [diff] [blame^] | 1243 | case GW54xx: |
| 1244 | gpio_request(IMX_GPIO_NR(3, 15), "j7_pwren"); |
| 1245 | gpio_direction_output(IMX_GPIO_NR(3, 15), 1); |
| 1246 | gpio_request(IMX_GPIO_NR(3, 14), "gbe_en"); |
| 1247 | gpio_direction_output(IMX_GPIO_NR(3, 14), 1); |
| 1248 | break; |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1249 | case GW560x: |
| 1250 | gpio_request(IMX_GPIO_NR(4, 26), "12p0_en"); |
| 1251 | gpio_direction_output(IMX_GPIO_NR(4, 26), 1); |
| 1252 | break; |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 1253 | case GW5902: |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 1254 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(7, 12), "5P0V_EN", 1); |
| 1255 | break; |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1256 | case GW5903: |
| 1257 | gpio_request(IMX_GPIO_NR(3, 31) , "usbh1-ehci_pwr"); |
| 1258 | gpio_direction_output(IMX_GPIO_NR(3, 31), 1); |
| 1259 | gpio_request(IMX_GPIO_NR(4, 15) , "usbh2-otg_pwr"); |
| 1260 | gpio_direction_output(IMX_GPIO_NR(4, 15), 1); |
| 1261 | gpio_request(IMX_GPIO_NR(4, 7) , "usbdpc_pwr"); |
| 1262 | gpio_direction_output(IMX_GPIO_NR(4, 15), 1); |
| 1263 | gpio_request(IMX_GPIO_NR(1, 25) , "rgmii_en"); |
| 1264 | gpio_direction_output(IMX_GPIO_NR(1, 25), 1); |
| 1265 | gpio_request(IMX_GPIO_NR(4, 6) , "touch_irq#"); |
| 1266 | gpio_direction_input(IMX_GPIO_NR(4, 6)); |
| 1267 | gpio_request(IMX_GPIO_NR(4, 8) , "touch_rst"); |
| 1268 | gpio_direction_output(IMX_GPIO_NR(4, 8), 1); |
| 1269 | gpio_request(IMX_GPIO_NR(1, 7) , "bklt_12ven"); |
| 1270 | gpio_direction_output(IMX_GPIO_NR(1, 7), 1); |
| 1271 | break; |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 1272 | case GW5909: |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1273 | case GW5904: |
Tim Harvey | 74107f7 | 2019-02-04 13:10:59 -0800 | [diff] [blame] | 1274 | gpio_request(IMX_GPIO_NR(4, 23), "rs485_en"); |
| 1275 | gpio_direction_output(IMX_GPIO_NR(4, 23), 0); |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1276 | gpio_request(IMX_GPIO_NR(5, 11), "skt1_wdis#"); |
| 1277 | gpio_direction_output(IMX_GPIO_NR(5, 11), 1); |
| 1278 | gpio_request(IMX_GPIO_NR(5, 12), "skt1_rst#"); |
| 1279 | gpio_direction_output(IMX_GPIO_NR(5, 12), 1); |
| 1280 | gpio_request(IMX_GPIO_NR(5, 13), "skt2_wdis#"); |
| 1281 | gpio_direction_output(IMX_GPIO_NR(5, 13), 1); |
| 1282 | gpio_request(IMX_GPIO_NR(1, 15), "m2_off#"); |
| 1283 | gpio_direction_output(IMX_GPIO_NR(1, 15), 1); |
| 1284 | gpio_request(IMX_GPIO_NR(1, 14), "m2_wdis#"); |
| 1285 | gpio_direction_output(IMX_GPIO_NR(1, 14), 1); |
| 1286 | gpio_request(IMX_GPIO_NR(1, 13), "m2_rst#"); |
| 1287 | gpio_direction_output(IMX_GPIO_NR(1, 13), 1); |
| 1288 | break; |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1289 | case GW5905: |
| 1290 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(1, 7), "usb_pcisel", 0); |
| 1291 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(1, 9), "lvds_cabc", 1); |
| 1292 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(1, 14), "mipi_pdwn", 1); |
| 1293 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(1, 15), "mipi_rst#", 0); |
| 1294 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(2, 3), "emmy_pdwn#", 1); |
| 1295 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(4, 5), "spk_shdn#", 0); |
| 1296 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(4, 8), "touch_rst", 0); |
| 1297 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(4, 6), "touch_irq", 0); |
| 1298 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(5, 5), "flash_en1", 0); |
| 1299 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(5, 6), "flash_en2", 0); |
| 1300 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(5, 14), "dect_rst#", 1); |
| 1301 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(5, 17), "codec_rst#", 0); |
| 1302 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(5, 26), "imu_den", 1); |
| 1303 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(7, 12), "lvds_cabc", 0); |
| 1304 | mdelay(100); |
| 1305 | /* |
| 1306 | * gauruntee touch controller comes out of reset with INT |
| 1307 | * low for address |
| 1308 | */ |
| 1309 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(4, 8), "touch_rst", 1); |
| 1310 | break; |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 1311 | case GW5910: |
| 1312 | /* CC1352 */ |
| 1313 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(1, 7), "rf_reset#", 1); |
| 1314 | SETUP_GPIO_OUTPUT(IMX_GPIO_NR(1, 8), "rf_boot", 1); |
| 1315 | break; |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1316 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1317 | } |
| 1318 | |
| 1319 | /* setup GPIO pinmux and default configuration per baseboard and env */ |
| 1320 | void setup_board_gpio(int board, struct ventana_board_info *info) |
| 1321 | { |
| 1322 | const char *s; |
| 1323 | char arg[10]; |
| 1324 | size_t len; |
| 1325 | int i; |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 1326 | int quiet = simple_strtol(env_get("quiet"), NULL, 10); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1327 | |
| 1328 | if (board >= GW_UNKNOWN) |
| 1329 | return; |
| 1330 | |
| 1331 | /* RS232_EN# */ |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 1332 | if (gpio_cfg[board].rs232_en) { |
| 1333 | gpio_direction_output(gpio_cfg[board].rs232_en, |
| 1334 | (hwconfig("rs232")) ? 0 : 1); |
| 1335 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1336 | |
| 1337 | /* MSATA Enable */ |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 1338 | if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1339 | gpio_direction_output(GP_MSATA_SEL, |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 1340 | (hwconfig("msata")) ? 1 : 0); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1341 | } |
| 1342 | |
| 1343 | /* USBOTG Select (PCISKT or FrontPanel) */ |
| 1344 | if (gpio_cfg[board].usb_sel) { |
| 1345 | gpio_direction_output(gpio_cfg[board].usb_sel, |
| 1346 | (hwconfig("usb_pcisel")) ? 1 : 0); |
| 1347 | } |
| 1348 | |
| 1349 | /* |
| 1350 | * Configure DIO pinmux/padctl registers |
| 1351 | * see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions |
| 1352 | */ |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 1353 | for (i = 0; i < gpio_cfg[board].dio_num; i++) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1354 | struct dio_cfg *cfg = &gpio_cfg[board].dio_cfg[i]; |
| 1355 | iomux_v3_cfg_t ctrl = DIO_PAD_CFG; |
| 1356 | unsigned cputype = is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1; |
| 1357 | |
| 1358 | if (!cfg->gpio_padmux[0] && !cfg->gpio_padmux[1]) |
| 1359 | continue; |
| 1360 | sprintf(arg, "dio%d", i); |
| 1361 | if (!hwconfig(arg)) |
| 1362 | continue; |
| 1363 | s = hwconfig_subarg(arg, "padctrl", &len); |
| 1364 | if (s) { |
Simon Glass | 3ff49ec | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 1365 | ctrl = MUX_PAD_CTRL(hextoul(s, NULL) |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1366 | & 0x1ffff) | MUX_MODE_SION; |
| 1367 | } |
| 1368 | if (hwconfig_subarg_cmp(arg, "mode", "gpio")) { |
| 1369 | if (!quiet) { |
| 1370 | printf("DIO%d: GPIO%d_IO%02d (gpio-%d)\n", i, |
| 1371 | (cfg->gpio_param/32)+1, |
| 1372 | cfg->gpio_param%32, |
| 1373 | cfg->gpio_param); |
| 1374 | } |
| 1375 | imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] | |
| 1376 | ctrl); |
| 1377 | gpio_requestf(cfg->gpio_param, "dio%d", i); |
| 1378 | gpio_direction_input(cfg->gpio_param); |
Tim Harvey | c0e03c3 | 2016-05-24 11:03:54 -0700 | [diff] [blame] | 1379 | } else if (hwconfig_subarg_cmp(arg, "mode", "pwm") && |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1380 | cfg->pwm_padmux) { |
Tim Harvey | 8d2d8df | 2016-05-24 11:03:55 -0700 | [diff] [blame] | 1381 | if (!cfg->pwm_param) { |
| 1382 | printf("DIO%d: Error: pwm config invalid\n", |
| 1383 | i); |
| 1384 | continue; |
| 1385 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1386 | if (!quiet) |
| 1387 | printf("DIO%d: pwm%d\n", i, cfg->pwm_param); |
| 1388 | imx_iomux_v3_setup_pad(cfg->pwm_padmux[cputype] | |
| 1389 | MUX_PAD_CTRL(ctrl)); |
| 1390 | } |
| 1391 | } |
| 1392 | |
| 1393 | if (!quiet) { |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 1394 | if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1395 | printf("MSATA: %s\n", (hwconfig("msata") ? |
| 1396 | "enabled" : "disabled")); |
| 1397 | } |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 1398 | if (gpio_cfg[board].rs232_en) { |
| 1399 | printf("RS232: %s\n", (hwconfig("rs232")) ? |
| 1400 | "enabled" : "disabled"); |
| 1401 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1402 | } |
| 1403 | } |
| 1404 | |
| 1405 | /* setup board specific PMIC */ |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 1406 | void setup_pmic(void) |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1407 | { |
| 1408 | struct pmic *p; |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1409 | struct ventana_board_info ventana_info; |
| 1410 | int board = read_eeprom(CONFIG_I2C_GSC, &ventana_info); |
Simon Glass | 4148d75 | 2017-04-26 22:27:47 -0600 | [diff] [blame] | 1411 | const int i2c_pmic = 1; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1412 | u32 reg; |
Tim Harvey | 5a1760b | 2021-06-11 12:46:22 -0700 | [diff] [blame] | 1413 | char rev; |
| 1414 | int i; |
| 1415 | |
| 1416 | /* determine board revision */ |
| 1417 | rev = 'A'; |
| 1418 | for (i = sizeof(ventana_info.model) - 1; i > 0; i--) { |
| 1419 | if (ventana_info.model[i] >= 'A') { |
| 1420 | rev = ventana_info.model[i]; |
| 1421 | break; |
| 1422 | } |
| 1423 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1424 | |
Simon Glass | 4148d75 | 2017-04-26 22:27:47 -0600 | [diff] [blame] | 1425 | i2c_set_bus_num(i2c_pmic); |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 1426 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1427 | /* configure PFUZE100 PMIC */ |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 1428 | if (!i2c_probe(CONFIG_POWER_PFUZE100_I2C_ADDR)) { |
| 1429 | debug("probed PFUZE100@0x%x\n", CONFIG_POWER_PFUZE100_I2C_ADDR); |
Simon Glass | 4148d75 | 2017-04-26 22:27:47 -0600 | [diff] [blame] | 1430 | power_pfuze100_init(i2c_pmic); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1431 | p = pmic_get("PFUZE100"); |
| 1432 | if (p && !pmic_probe(p)) { |
| 1433 | pmic_reg_read(p, PFUZE100_DEVICEID, ®); |
| 1434 | printf("PMIC: PFUZE100 ID=0x%02x\n", reg); |
| 1435 | |
| 1436 | /* Set VGEN1 to 1.5V and enable */ |
| 1437 | pmic_reg_read(p, PFUZE100_VGEN1VOL, ®); |
| 1438 | reg &= ~(LDO_VOL_MASK); |
| 1439 | reg |= (LDOA_1_50V | LDO_EN); |
| 1440 | pmic_reg_write(p, PFUZE100_VGEN1VOL, reg); |
| 1441 | |
| 1442 | /* Set SWBST to 5.0V and enable */ |
| 1443 | pmic_reg_read(p, PFUZE100_SWBSTCON1, ®); |
| 1444 | reg &= ~(SWBST_MODE_MASK | SWBST_VOL_MASK); |
Marek Vasut | 2aaeb91 | 2015-11-26 14:08:50 +0100 | [diff] [blame] | 1445 | reg |= (SWBST_5_00V | (SWBST_MODE_AUTO << SWBST_MODE_SHIFT)); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1446 | pmic_reg_write(p, PFUZE100_SWBSTCON1, reg); |
Tim Harvey | 5a1760b | 2021-06-11 12:46:22 -0700 | [diff] [blame] | 1447 | |
| 1448 | if (board == GW54xx && (rev == 'G')) { |
| 1449 | /* Disable VGEN5 */ |
| 1450 | pmic_reg_write(p, PFUZE100_VGEN5VOL, 0); |
| 1451 | |
| 1452 | /* Set VGEN6 to 2.5V and enable */ |
| 1453 | pmic_reg_read(p, PFUZE100_VGEN6VOL, ®); |
| 1454 | reg &= ~(LDO_VOL_MASK); |
| 1455 | reg |= (LDOB_2_50V | LDO_EN); |
| 1456 | pmic_reg_write(p, PFUZE100_VGEN6VOL, reg); |
| 1457 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1458 | } |
Tim Harvey | 0bf47d7 | 2021-06-11 12:46:23 -0700 | [diff] [blame] | 1459 | |
| 1460 | /* put all switchers in continuous mode */ |
| 1461 | pmic_reg_read(p, PFUZE100_SW1ABMODE, ®); |
| 1462 | reg &= ~(SW_MODE_MASK); |
| 1463 | reg |= PWM_PWM; |
| 1464 | pmic_reg_write(p, PFUZE100_SW1ABMODE, reg); |
| 1465 | |
| 1466 | pmic_reg_read(p, PFUZE100_SW2MODE, ®); |
| 1467 | reg &= ~(SW_MODE_MASK); |
| 1468 | reg |= PWM_PWM; |
| 1469 | pmic_reg_write(p, PFUZE100_SW2MODE, reg); |
| 1470 | |
| 1471 | pmic_reg_read(p, PFUZE100_SW3AMODE, ®); |
| 1472 | reg &= ~(SW_MODE_MASK); |
| 1473 | reg |= PWM_PWM; |
| 1474 | pmic_reg_write(p, PFUZE100_SW3AMODE, reg); |
| 1475 | |
| 1476 | pmic_reg_read(p, PFUZE100_SW3BMODE, ®); |
| 1477 | reg &= ~(SW_MODE_MASK); |
| 1478 | reg |= PWM_PWM; |
| 1479 | pmic_reg_write(p, PFUZE100_SW3BMODE, reg); |
| 1480 | |
| 1481 | pmic_reg_read(p, PFUZE100_SW4MODE, ®); |
| 1482 | reg &= ~(SW_MODE_MASK); |
| 1483 | reg |= PWM_PWM; |
| 1484 | pmic_reg_write(p, PFUZE100_SW4MODE, reg); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1485 | } |
| 1486 | |
| 1487 | /* configure LTC3676 PMIC */ |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 1488 | else if (!i2c_probe(CONFIG_POWER_LTC3676_I2C_ADDR)) { |
| 1489 | debug("probed LTC3676@0x%x\n", CONFIG_POWER_LTC3676_I2C_ADDR); |
Simon Glass | 4148d75 | 2017-04-26 22:27:47 -0600 | [diff] [blame] | 1490 | power_ltc3676_init(i2c_pmic); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1491 | p = pmic_get("LTC3676_PMIC"); |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1492 | if (!p || pmic_probe(p)) |
| 1493 | return; |
| 1494 | puts("PMIC: LTC3676\n"); |
| 1495 | /* |
| 1496 | * set board-specific scalar for max CPU frequency |
| 1497 | * per CPU based on the LDO enabled Operating Ranges |
| 1498 | * defined in the respective IMX6DQ and IMX6SDL |
| 1499 | * datasheets. The voltage resulting from the R1/R2 |
| 1500 | * feedback inputs on Ventana is 1308mV. Note that this |
| 1501 | * is a bit shy of the Vmin of 1350mV in the datasheet |
| 1502 | * for LDO enabled mode but is as high as we can go. |
| 1503 | */ |
| 1504 | switch (board) { |
| 1505 | case GW560x: |
| 1506 | /* mask PGOOD during SW3 transition */ |
| 1507 | pmic_reg_write(p, LTC3676_DVB3B, |
| 1508 | 0x1f | LTC3676_PGOOD_MASK); |
| 1509 | /* set SW3 (VDD_ARM) */ |
| 1510 | pmic_reg_write(p, LTC3676_DVB3A, 0x1f); |
| 1511 | break; |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1512 | case GW5903: |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1513 | /* mask PGOOD during SW3 transition */ |
Tim Harvey | 5f2a189 | 2017-03-21 07:50:13 -0700 | [diff] [blame] | 1514 | pmic_reg_write(p, LTC3676_DVB3B, |
| 1515 | 0x1f | LTC3676_PGOOD_MASK); |
| 1516 | /* set SW3 (VDD_ARM) */ |
| 1517 | pmic_reg_write(p, LTC3676_DVB3A, 0x1f); |
| 1518 | |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1519 | /* mask PGOOD during SW4 transition */ |
| 1520 | pmic_reg_write(p, LTC3676_DVB4B, |
| 1521 | 0x1f | LTC3676_PGOOD_MASK); |
| 1522 | /* set SW4 (VDD_SOC) */ |
| 1523 | pmic_reg_write(p, LTC3676_DVB4A, 0x1f); |
| 1524 | break; |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1525 | case GW5905: |
| 1526 | /* mask PGOOD during SW1 transition */ |
| 1527 | pmic_reg_write(p, LTC3676_DVB1B, |
| 1528 | 0x1f | LTC3676_PGOOD_MASK); |
| 1529 | /* set SW1 (VDD_ARM) */ |
| 1530 | pmic_reg_write(p, LTC3676_DVB1A, 0x1f); |
| 1531 | |
| 1532 | /* mask PGOOD during SW3 transition */ |
| 1533 | pmic_reg_write(p, LTC3676_DVB3B, |
| 1534 | 0x1f | LTC3676_PGOOD_MASK); |
| 1535 | /* set SW3 (VDD_SOC) */ |
| 1536 | pmic_reg_write(p, LTC3676_DVB3A, 0x1f); |
| 1537 | break; |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1538 | default: |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1539 | /* mask PGOOD during SW1 transition */ |
| 1540 | pmic_reg_write(p, LTC3676_DVB1B, |
| 1541 | 0x1f | LTC3676_PGOOD_MASK); |
| 1542 | /* set SW1 (VDD_SOC) */ |
| 1543 | pmic_reg_write(p, LTC3676_DVB1A, 0x1f); |
| 1544 | |
| 1545 | /* mask PGOOD during SW3 transition */ |
| 1546 | pmic_reg_write(p, LTC3676_DVB3B, |
| 1547 | 0x1f | LTC3676_PGOOD_MASK); |
| 1548 | /* set SW3 (VDD_ARM) */ |
| 1549 | pmic_reg_write(p, LTC3676_DVB3A, 0x1f); |
| 1550 | } |
Tim Harvey | 3b1db85 | 2021-06-11 12:46:24 -0700 | [diff] [blame] | 1551 | |
| 1552 | /* put all switchers in continuous mode */ |
| 1553 | pmic_reg_write(p, LTC3676_BUCK1, 0xc0); |
| 1554 | pmic_reg_write(p, LTC3676_BUCK2, 0xc0); |
| 1555 | pmic_reg_write(p, LTC3676_BUCK3, 0xc0); |
| 1556 | pmic_reg_write(p, LTC3676_BUCK4, 0xc0); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1557 | } |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 1558 | |
| 1559 | /* configure MP5416 PMIC */ |
| 1560 | else if (!i2c_probe(0x69)) { |
| 1561 | puts("PMIC: MP5416\n"); |
| 1562 | switch (board) { |
| 1563 | case GW5910: |
| 1564 | /* SW1: VDD_ARM 1.2V -> (1.275 to 1.475) */ |
| 1565 | reg = MP5416_VSET_EN | MP5416_VSET_SW1_SVAL(1475000); |
| 1566 | i2c_write(0x69, MP5416_VSET_SW1, 1, (uint8_t *)®, 1); |
| 1567 | /* SW4: VDD_SOC 1.2V -> (1.350 to 1.475) */ |
| 1568 | reg = MP5416_VSET_EN | MP5416_VSET_SW4_SVAL(1475000); |
| 1569 | i2c_write(0x69, MP5416_VSET_SW4, 1, (uint8_t *)®, 1); |
| 1570 | break; |
| 1571 | } |
| 1572 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1573 | } |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1574 | |
Tim Harvey | 28db4e4 | 2021-07-24 10:40:32 -0700 | [diff] [blame] | 1575 | #include <fdt_support.h> |
| 1576 | #define WDOG1_ADDR 0x20bc000 |
| 1577 | #define WDOG2_ADDR 0x20c0000 |
| 1578 | #define GPIO3_ADDR 0x20a4000 |
| 1579 | #define USDHC3_ADDR 0x2198000 |
| 1580 | |
| 1581 | static void ft_board_wdog_fixup(void *blob, phys_addr_t addr) |
| 1582 | { |
| 1583 | int off = fdt_node_offset_by_compat_reg(blob, "fsl,imx6q-wdt", addr); |
| 1584 | |
| 1585 | if (off) { |
| 1586 | fdt_delprop(blob, off, "ext-reset-output"); |
| 1587 | fdt_delprop(blob, off, "fsl,ext-reset-output"); |
| 1588 | } |
| 1589 | } |
| 1590 | |
| 1591 | void ft_early_fixup(void *blob, int board_type) |
| 1592 | { |
| 1593 | struct ventana_board_info *info = &ventana_info; |
| 1594 | char rev = 0; |
| 1595 | int i; |
| 1596 | |
| 1597 | /* determine board revision */ |
| 1598 | for (i = sizeof(ventana_info.model) - 1; i > 0; i--) { |
| 1599 | if (ventana_info.model[i] >= 'A') { |
| 1600 | rev = ventana_info.model[i]; |
| 1601 | break; |
| 1602 | } |
| 1603 | } |
| 1604 | |
| 1605 | /* |
| 1606 | * Board model specific fixups |
| 1607 | */ |
| 1608 | switch (board_type) { |
| 1609 | case GW51xx: |
| 1610 | /* |
| 1611 | * disable wdog node for GW51xx-A/B to work around |
| 1612 | * errata causing wdog timer to be unreliable. |
| 1613 | */ |
| 1614 | if (rev >= 'A' && rev < 'C') { |
| 1615 | i = fdt_node_offset_by_compat_reg(blob, "fsl,imx6q-wdt", |
| 1616 | WDOG1_ADDR); |
| 1617 | if (i) |
| 1618 | fdt_status_disabled(blob, i); |
| 1619 | } |
| 1620 | |
| 1621 | /* GW51xx-E adds WDOG1_B external reset */ |
| 1622 | if (rev < 'E') |
| 1623 | ft_board_wdog_fixup(blob, WDOG1_ADDR); |
| 1624 | break; |
| 1625 | |
| 1626 | case GW52xx: |
| 1627 | /* GW522x Uses GPIO3_IO23 instead of GPIO1_IO29 */ |
| 1628 | if (info->model[4] == '2') { |
| 1629 | u32 handle = 0; |
| 1630 | u32 *range = NULL; |
| 1631 | |
| 1632 | i = fdt_node_offset_by_compatible(blob, -1, |
| 1633 | "fsl,imx6q-pcie"); |
| 1634 | if (i) |
| 1635 | range = (u32 *)fdt_getprop(blob, i, |
| 1636 | "reset-gpio", NULL); |
| 1637 | |
| 1638 | if (range) { |
| 1639 | i = fdt_node_offset_by_compat_reg(blob, |
| 1640 | "fsl,imx6q-gpio", GPIO3_ADDR); |
| 1641 | if (i) |
| 1642 | handle = fdt_get_phandle(blob, i); |
| 1643 | if (handle) { |
| 1644 | range[0] = cpu_to_fdt32(handle); |
| 1645 | range[1] = cpu_to_fdt32(23); |
| 1646 | } |
| 1647 | } |
| 1648 | |
| 1649 | /* these have broken usd_vsel */ |
| 1650 | if (strstr((const char *)info->model, "SP318-B") || |
| 1651 | strstr((const char *)info->model, "SP331-B")) |
| 1652 | gpio_cfg[board_type].usd_vsel = 0; |
| 1653 | |
| 1654 | /* GW522x-B adds WDOG1_B external reset */ |
| 1655 | if (rev < 'B') |
| 1656 | ft_board_wdog_fixup(blob, WDOG1_ADDR); |
| 1657 | } |
| 1658 | |
| 1659 | /* GW520x-E adds WDOG1_B external reset */ |
| 1660 | else if (info->model[4] == '0' && rev < 'E') |
| 1661 | ft_board_wdog_fixup(blob, WDOG1_ADDR); |
| 1662 | break; |
| 1663 | |
| 1664 | case GW53xx: |
| 1665 | /* GW53xx-E adds WDOG1_B external reset */ |
| 1666 | if (rev < 'E') |
| 1667 | ft_board_wdog_fixup(blob, WDOG1_ADDR); |
Tim Harvey | 409fe9a | 2021-07-24 10:40:45 -0700 | [diff] [blame] | 1668 | |
| 1669 | /* GW53xx-G has an adv7280 instead of an adv7180 */ |
| 1670 | else if (rev > 'F') { |
| 1671 | i = fdt_node_offset_by_compatible(blob, -1, "adi,adv7180"); |
| 1672 | if (i) { |
| 1673 | fdt_setprop_string(blob, i, "compatible", "adi,adv7280"); |
| 1674 | fdt_setprop_empty(blob, i, "adv,force-bt656-4"); |
| 1675 | } |
| 1676 | } |
Tim Harvey | 28db4e4 | 2021-07-24 10:40:32 -0700 | [diff] [blame] | 1677 | break; |
| 1678 | |
| 1679 | case GW54xx: |
| 1680 | /* |
| 1681 | * disable serial2 node for GW54xx for compatibility with older |
| 1682 | * 3.10.x kernel that improperly had this node enabled in the DT |
| 1683 | */ |
| 1684 | fdt_set_status_by_alias(blob, "serial2", FDT_STATUS_DISABLED, |
| 1685 | 0); |
| 1686 | |
| 1687 | /* GW54xx-E adds WDOG2_B external reset */ |
| 1688 | if (rev < 'E') |
| 1689 | ft_board_wdog_fixup(blob, WDOG2_ADDR); |
Tim Harvey | db06398 | 2021-07-24 10:40:46 -0700 | [diff] [blame^] | 1690 | |
| 1691 | /* GW54xx-G has an adv7280 instead of an adv7180 */ |
| 1692 | else if (rev > 'F') { |
| 1693 | i = fdt_node_offset_by_compatible(blob, -1, "adi,adv7180"); |
| 1694 | if (i) { |
| 1695 | fdt_setprop_string(blob, i, "compatible", "adi,adv7280"); |
| 1696 | fdt_setprop_empty(blob, i, "adv,force-bt656-4"); |
| 1697 | } |
| 1698 | } |
Tim Harvey | 28db4e4 | 2021-07-24 10:40:32 -0700 | [diff] [blame] | 1699 | break; |
| 1700 | |
| 1701 | case GW551x: |
| 1702 | /* GW551x-C adds WDOG1_B external reset */ |
| 1703 | if (rev < 'C') |
| 1704 | ft_board_wdog_fixup(blob, WDOG1_ADDR); |
| 1705 | break; |
| 1706 | case GW5901: |
| 1707 | case GW5902: |
| 1708 | /* GW5901/GW5901 revB adds WDOG1_B as an external reset */ |
| 1709 | if (rev < 'B') |
| 1710 | ft_board_wdog_fixup(blob, WDOG1_ADDR); |
| 1711 | break; |
| 1712 | } |
| 1713 | |
| 1714 | /* remove no-1-8-v if UHS-I support is present */ |
| 1715 | if (gpio_cfg[board_type].usd_vsel) { |
| 1716 | debug("Enabling UHS-I support\n"); |
| 1717 | i = fdt_node_offset_by_compat_reg(blob, "fsl,imx6q-usdhc", |
| 1718 | USDHC3_ADDR); |
| 1719 | if (i) |
| 1720 | fdt_delprop(blob, i, "no-1-8-v"); |
| 1721 | } |
| 1722 | } |
| 1723 | |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 1724 | #ifdef CONFIG_FSL_ESDHC_IMX |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1725 | static struct fsl_esdhc_cfg usdhc_cfg[2]; |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1726 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 1727 | int board_mmc_init(struct bd_info *bis) |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1728 | { |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1729 | struct ventana_board_info ventana_info; |
| 1730 | int board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info); |
| 1731 | int ret; |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1732 | |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1733 | switch (board_type) { |
| 1734 | case GW52xx: |
| 1735 | case GW53xx: |
| 1736 | case GW54xx: |
| 1737 | case GW553x: |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 1738 | case GW5910: |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 1739 | case GW5912: |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1740 | /* usdhc3: 4bit microSD */ |
| 1741 | SETUP_IOMUX_PADS(usdhc3_pads); |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1742 | usdhc_cfg[0].esdhc_base = USDHC3_BASE_ADDR; |
| 1743 | usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); |
| 1744 | usdhc_cfg[0].max_bus_width = 4; |
| 1745 | return fsl_esdhc_initialize(bis, &usdhc_cfg[0]); |
| 1746 | case GW560x: |
| 1747 | /* usdhc2: 8-bit eMMC */ |
| 1748 | SETUP_IOMUX_PADS(gw560x_emmc_sd2_pads); |
| 1749 | usdhc_cfg[0].esdhc_base = USDHC2_BASE_ADDR; |
| 1750 | usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); |
| 1751 | usdhc_cfg[0].max_bus_width = 8; |
| 1752 | ret = fsl_esdhc_initialize(bis, &usdhc_cfg[0]); |
| 1753 | if (ret) |
| 1754 | return ret; |
| 1755 | /* usdhc3: 4-bit microSD */ |
| 1756 | SETUP_IOMUX_PADS(usdhc3_pads); |
| 1757 | usdhc_cfg[1].esdhc_base = USDHC3_BASE_ADDR; |
| 1758 | usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); |
| 1759 | usdhc_cfg[1].max_bus_width = 4; |
| 1760 | return fsl_esdhc_initialize(bis, &usdhc_cfg[1]); |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1761 | case GW5903: |
| 1762 | /* usdhc3: 8-bit eMMC */ |
| 1763 | SETUP_IOMUX_PADS(gw5904_emmc_pads); |
| 1764 | usdhc_cfg[0].esdhc_base = USDHC3_BASE_ADDR; |
| 1765 | usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); |
| 1766 | usdhc_cfg[0].max_bus_width = 8; |
| 1767 | ret = fsl_esdhc_initialize(bis, &usdhc_cfg[0]); |
| 1768 | if (ret) |
| 1769 | return ret; |
| 1770 | /* usdhc2: 4-bit microSD */ |
| 1771 | SETUP_IOMUX_PADS(gw5904_mmc_pads); |
| 1772 | usdhc_cfg[1].esdhc_base = USDHC2_BASE_ADDR; |
| 1773 | usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); |
| 1774 | usdhc_cfg[1].max_bus_width = 4; |
| 1775 | return fsl_esdhc_initialize(bis, &usdhc_cfg[1]); |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1776 | case GW5904: |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1777 | case GW5905: |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 1778 | case GW5909: |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1779 | /* usdhc3: 8bit eMMC */ |
| 1780 | SETUP_IOMUX_PADS(gw5904_emmc_pads); |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1781 | usdhc_cfg[0].esdhc_base = USDHC3_BASE_ADDR; |
| 1782 | usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); |
| 1783 | usdhc_cfg[0].max_bus_width = 8; |
| 1784 | return fsl_esdhc_initialize(bis, &usdhc_cfg[0]); |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1785 | default: |
| 1786 | /* doesn't have MMC */ |
Tim Harvey | d0744d1 | 2021-06-11 12:46:28 -0700 | [diff] [blame] | 1787 | printf("None"); |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1788 | return -1; |
| 1789 | } |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1790 | } |
| 1791 | |
| 1792 | int board_mmc_getcd(struct mmc *mmc) |
| 1793 | { |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1794 | struct ventana_board_info ventana_info; |
| 1795 | struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; |
| 1796 | int board = read_eeprom(CONFIG_I2C_GSC, &ventana_info); |
| 1797 | int gpio = gpio_cfg[board].mmc_cd; |
| 1798 | |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1799 | /* Card Detect */ |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1800 | switch (board) { |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 1801 | case GW560x: |
| 1802 | /* emmc is always present */ |
| 1803 | if (cfg->esdhc_base == USDHC2_BASE_ADDR) |
| 1804 | return 1; |
| 1805 | break; |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 1806 | case GW5903: |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1807 | case GW5904: |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 1808 | case GW5905: |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 1809 | case GW5909: |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1810 | /* emmc is always present */ |
| 1811 | if (cfg->esdhc_base == USDHC3_BASE_ADDR) |
| 1812 | return 1; |
| 1813 | break; |
| 1814 | } |
| 1815 | |
| 1816 | if (gpio) { |
| 1817 | debug("%s: gpio%d=%d\n", __func__, gpio, gpio_get_value(gpio)); |
| 1818 | return !gpio_get_value(gpio); |
| 1819 | } |
| 1820 | |
| 1821 | return -1; |
Tim Harvey | 84ae191 | 2017-03-13 08:51:03 -0700 | [diff] [blame] | 1822 | } |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 1823 | |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 1824 | #endif /* CONFIG_FSL_ESDHC_IMX */ |