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