Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 Gateworks Corporation |
| 3 | * |
| 4 | * Author: Tim Harvey <tharvey@gateworks.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <asm/arch/mx6-pins.h> |
| 10 | #include <asm/arch/sys_proto.h> |
| 11 | #include <asm/gpio.h> |
| 12 | #include <asm/imx-common/mxc_i2c.h> |
| 13 | #include <hwconfig.h> |
| 14 | #include <power/pmic.h> |
| 15 | #include <power/ltc3676_pmic.h> |
| 16 | #include <power/pfuze100_pmic.h> |
| 17 | |
| 18 | #include "common.h" |
| 19 | |
| 20 | /* UART1: Function varies per baseboard */ |
| 21 | static iomux_v3_cfg_t const uart1_pads[] = { |
| 22 | IOMUX_PADS(PAD_SD3_DAT6__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
| 23 | IOMUX_PADS(PAD_SD3_DAT7__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
| 24 | }; |
| 25 | |
| 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 | { |
| 34 | SETUP_IOMUX_PADS(uart1_pads); |
| 35 | SETUP_IOMUX_PADS(uart2_pads); |
| 36 | } |
| 37 | |
| 38 | /* I2C1: GSC */ |
| 39 | static struct i2c_pads_info mx6q_i2c_pad_info0 = { |
| 40 | .scl = { |
| 41 | .i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC, |
| 42 | .gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | PC, |
| 43 | .gp = IMX_GPIO_NR(3, 21) |
| 44 | }, |
| 45 | .sda = { |
| 46 | .i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC, |
| 47 | .gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | PC, |
| 48 | .gp = IMX_GPIO_NR(3, 28) |
| 49 | } |
| 50 | }; |
| 51 | static struct i2c_pads_info mx6dl_i2c_pad_info0 = { |
| 52 | .scl = { |
| 53 | .i2c_mode = MX6DL_PAD_EIM_D21__I2C1_SCL | PC, |
| 54 | .gpio_mode = MX6DL_PAD_EIM_D21__GPIO3_IO21 | PC, |
| 55 | .gp = IMX_GPIO_NR(3, 21) |
| 56 | }, |
| 57 | .sda = { |
| 58 | .i2c_mode = MX6DL_PAD_EIM_D28__I2C1_SDA | PC, |
| 59 | .gpio_mode = MX6DL_PAD_EIM_D28__GPIO3_IO28 | PC, |
| 60 | .gp = IMX_GPIO_NR(3, 28) |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | /* I2C2: PMIC/PCIe Switch/PCIe Clock/Mezz */ |
| 65 | static struct i2c_pads_info mx6q_i2c_pad_info1 = { |
| 66 | .scl = { |
| 67 | .i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC, |
| 68 | .gpio_mode = MX6Q_PAD_KEY_COL3__GPIO4_IO12 | PC, |
| 69 | .gp = IMX_GPIO_NR(4, 12) |
| 70 | }, |
| 71 | .sda = { |
| 72 | .i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC, |
| 73 | .gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO4_IO13 | PC, |
| 74 | .gp = IMX_GPIO_NR(4, 13) |
| 75 | } |
| 76 | }; |
| 77 | static struct i2c_pads_info mx6dl_i2c_pad_info1 = { |
| 78 | .scl = { |
| 79 | .i2c_mode = MX6DL_PAD_KEY_COL3__I2C2_SCL | PC, |
| 80 | .gpio_mode = MX6DL_PAD_KEY_COL3__GPIO4_IO12 | PC, |
| 81 | .gp = IMX_GPIO_NR(4, 12) |
| 82 | }, |
| 83 | .sda = { |
| 84 | .i2c_mode = MX6DL_PAD_KEY_ROW3__I2C2_SDA | PC, |
| 85 | .gpio_mode = MX6DL_PAD_KEY_ROW3__GPIO4_IO13 | PC, |
| 86 | .gp = IMX_GPIO_NR(4, 13) |
| 87 | } |
| 88 | }; |
| 89 | |
| 90 | /* I2C3: Misc/Expansion */ |
| 91 | static struct i2c_pads_info mx6q_i2c_pad_info2 = { |
| 92 | .scl = { |
| 93 | .i2c_mode = MX6Q_PAD_GPIO_3__I2C3_SCL | PC, |
| 94 | .gpio_mode = MX6Q_PAD_GPIO_3__GPIO1_IO03 | PC, |
| 95 | .gp = IMX_GPIO_NR(1, 3) |
| 96 | }, |
| 97 | .sda = { |
| 98 | .i2c_mode = MX6Q_PAD_GPIO_6__I2C3_SDA | PC, |
| 99 | .gpio_mode = MX6Q_PAD_GPIO_6__GPIO1_IO06 | PC, |
| 100 | .gp = IMX_GPIO_NR(1, 6) |
| 101 | } |
| 102 | }; |
| 103 | static struct i2c_pads_info mx6dl_i2c_pad_info2 = { |
| 104 | .scl = { |
| 105 | .i2c_mode = MX6DL_PAD_GPIO_3__I2C3_SCL | PC, |
| 106 | .gpio_mode = MX6DL_PAD_GPIO_3__GPIO1_IO03 | PC, |
| 107 | .gp = IMX_GPIO_NR(1, 3) |
| 108 | }, |
| 109 | .sda = { |
| 110 | .i2c_mode = MX6DL_PAD_GPIO_6__I2C3_SDA | PC, |
| 111 | .gpio_mode = MX6DL_PAD_GPIO_6__GPIO1_IO06 | PC, |
| 112 | .gp = IMX_GPIO_NR(1, 6) |
| 113 | } |
| 114 | }; |
| 115 | |
| 116 | void setup_ventana_i2c(void) |
| 117 | { |
| 118 | if (is_cpu_type(MXC_CPU_MX6Q)) { |
| 119 | setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info0); |
| 120 | setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info1); |
| 121 | setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info2); |
| 122 | } else { |
| 123 | setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info0); |
| 124 | setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info1); |
| 125 | setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info2); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | * Baseboard specific GPIO |
| 131 | */ |
| 132 | |
| 133 | /* common to add baseboards */ |
| 134 | static iomux_v3_cfg_t const gw_gpio_pads[] = { |
Tim Harvey | 147b576 | 2016-05-24 11:03:59 -0700 | [diff] [blame] | 135 | /* SD3_VSELECT */ |
| 136 | IOMUX_PADS(PAD_NANDF_CS1__GPIO6_IO14 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 137 | }; |
| 138 | |
| 139 | /* prototype */ |
| 140 | static iomux_v3_cfg_t const gwproto_gpio_pads[] = { |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 141 | /* RS232_EN# */ |
| 142 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 143 | /* PANLEDG# */ |
| 144 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 145 | /* PANLEDR# */ |
| 146 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 147 | /* LOCLED# */ |
| 148 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
| 149 | /* RS485_EN */ |
| 150 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
| 151 | /* IOEXP_PWREN# */ |
| 152 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 153 | /* IOEXP_IRQ# */ |
| 154 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
| 155 | /* VID_EN */ |
| 156 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
| 157 | /* DIOI2C_DIS# */ |
| 158 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
| 159 | /* PCICK_SSON */ |
| 160 | IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20 | DIO_PAD_CFG), |
| 161 | /* PCI_RST# */ |
| 162 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
| 163 | }; |
| 164 | |
| 165 | static iomux_v3_cfg_t const gw51xx_gpio_pads[] = { |
| 166 | /* PANLEDG# */ |
| 167 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 168 | /* PANLEDR# */ |
| 169 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 170 | /* IOEXP_PWREN# */ |
| 171 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 172 | /* IOEXP_IRQ# */ |
| 173 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
| 174 | |
| 175 | /* GPS_SHDN */ |
| 176 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
| 177 | /* VID_PWR */ |
| 178 | IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20 | DIO_PAD_CFG), |
| 179 | /* PCI_RST# */ |
| 180 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
| 181 | /* PCIESKT_WDIS# */ |
| 182 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 183 | }; |
| 184 | |
| 185 | static iomux_v3_cfg_t const gw52xx_gpio_pads[] = { |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 186 | /* RS232_EN# */ |
| 187 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 188 | /* MSATA_EN */ |
| 189 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 190 | /* PANLEDG# */ |
| 191 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 192 | /* PANLEDR# */ |
| 193 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 194 | /* IOEXP_PWREN# */ |
| 195 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 196 | /* IOEXP_IRQ# */ |
| 197 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 198 | /* CAN_STBY */ |
| 199 | IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 200 | /* MX6_LOCLED# */ |
| 201 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
| 202 | /* GPS_SHDN */ |
| 203 | IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | DIO_PAD_CFG), |
| 204 | /* USBOTG_SEL */ |
| 205 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
| 206 | /* VID_PWR */ |
| 207 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
| 208 | /* PCI_RST# */ |
| 209 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
| 210 | /* PCI_RST# (GW522x) */ |
| 211 | IOMUX_PADS(PAD_EIM_D23__GPIO3_IO23 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 212 | /* RS485_EN */ |
| 213 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 214 | /* PCIESKT_WDIS# */ |
| 215 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 216 | }; |
| 217 | |
| 218 | static iomux_v3_cfg_t const gw53xx_gpio_pads[] = { |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 219 | /* RS232_EN# */ |
| 220 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 221 | /* MSATA_EN */ |
| 222 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 223 | /* CAN_STBY */ |
| 224 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
| 225 | /* USB_HUBRST# */ |
| 226 | IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 227 | /* PANLEDG# */ |
| 228 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 229 | /* PANLEDR# */ |
| 230 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 231 | /* MX6_LOCLED# */ |
| 232 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
| 233 | /* IOEXP_PWREN# */ |
| 234 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
| 235 | /* IOEXP_IRQ# */ |
| 236 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
| 237 | /* DIOI2C_DIS# */ |
| 238 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
| 239 | /* GPS_SHDN */ |
| 240 | IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | DIO_PAD_CFG), |
| 241 | /* VID_EN */ |
| 242 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
| 243 | /* PCI_RST# */ |
| 244 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 245 | /* RS485_EN */ |
| 246 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 247 | /* PCIESKT_WDIS# */ |
| 248 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 249 | }; |
| 250 | |
| 251 | static iomux_v3_cfg_t const gw54xx_gpio_pads[] = { |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 252 | /* RS232_EN# */ |
| 253 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 254 | /* MSATA_EN */ |
| 255 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 256 | /* CAN_STBY */ |
| 257 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 258 | /* PANLEDG# */ |
| 259 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 260 | /* PANLEDR# */ |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 261 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 262 | /* MX6_LOCLED# */ |
| 263 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 264 | /* USB_HUBRST# */ |
| 265 | IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 266 | /* MIPI_DIO */ |
| 267 | IOMUX_PADS(PAD_SD1_DAT3__GPIO1_IO21 | DIO_PAD_CFG), |
| 268 | /* RS485_EN */ |
| 269 | IOMUX_PADS(PAD_EIM_D24__GPIO3_IO24 | DIO_PAD_CFG), |
| 270 | /* IOEXP_PWREN# */ |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 271 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 272 | /* IOEXP_IRQ# */ |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 273 | 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] | 274 | /* DIOI2C_DIS# */ |
| 275 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
| 276 | /* PCI_RST# */ |
| 277 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
| 278 | /* VID_EN */ |
| 279 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 280 | /* RS485_EN */ |
| 281 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 282 | /* PCIESKT_WDIS# */ |
| 283 | IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG), |
| 284 | }; |
| 285 | |
| 286 | static iomux_v3_cfg_t const gw551x_gpio_pads[] = { |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 287 | /* CAN_STBY */ |
| 288 | IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 289 | /* PANLED# */ |
| 290 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 291 | /* PCI_RST# */ |
| 292 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
| 293 | /* PCIESKT_WDIS# */ |
| 294 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 295 | }; |
| 296 | |
| 297 | static iomux_v3_cfg_t const gw552x_gpio_pads[] = { |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 298 | /* MSATA_EN */ |
| 299 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 300 | /* USBOTG_SEL */ |
| 301 | IOMUX_PADS(PAD_GPIO_7__GPIO1_IO07 | DIO_PAD_CFG), |
| 302 | /* USB_HUBRST# */ |
| 303 | IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 304 | /* PANLEDG# */ |
| 305 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 306 | /* PANLEDR# */ |
| 307 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 308 | /* MX6_LOCLED# */ |
| 309 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
| 310 | /* PCI_RST# */ |
| 311 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
| 312 | /* MX6_DIO[4:9] */ |
| 313 | IOMUX_PADS(PAD_CSI0_PIXCLK__GPIO5_IO18 | DIO_PAD_CFG), |
| 314 | IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20 | DIO_PAD_CFG), |
| 315 | IOMUX_PADS(PAD_CSI0_VSYNC__GPIO5_IO21 | DIO_PAD_CFG), |
| 316 | IOMUX_PADS(PAD_CSI0_DAT4__GPIO5_IO22 | DIO_PAD_CFG), |
| 317 | IOMUX_PADS(PAD_CSI0_DAT5__GPIO5_IO23 | DIO_PAD_CFG), |
| 318 | IOMUX_PADS(PAD_CSI0_DAT7__GPIO5_IO25 | DIO_PAD_CFG), |
| 319 | /* PCIEGBE1_OFF# */ |
| 320 | IOMUX_PADS(PAD_GPIO_1__GPIO1_IO01 | DIO_PAD_CFG), |
| 321 | /* PCIEGBE2_OFF# */ |
| 322 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
| 323 | /* PCIESKT_WDIS# */ |
| 324 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 325 | }; |
| 326 | |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 327 | static iomux_v3_cfg_t const gw553x_gpio_pads[] = { |
| 328 | /* PANLEDG# */ |
| 329 | IOMUX_PADS(PAD_KEY_COL2__GPIO4_IO10 | DIO_PAD_CFG), |
| 330 | /* PANLEDR# */ |
| 331 | IOMUX_PADS(PAD_KEY_ROW2__GPIO4_IO11 | DIO_PAD_CFG), |
| 332 | |
| 333 | /* VID_PWR */ |
| 334 | IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20 | DIO_PAD_CFG), |
| 335 | /* PCI_RST# */ |
| 336 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
| 337 | /* PCIESKT_WDIS# */ |
| 338 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 339 | }; |
| 340 | |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 341 | /* Digital I/O */ |
| 342 | struct dio_cfg gw51xx_dio[] = { |
| 343 | { |
| 344 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 345 | IMX_GPIO_NR(1, 16), |
| 346 | { 0, 0 }, |
| 347 | 0 |
| 348 | }, |
| 349 | { |
| 350 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 351 | IMX_GPIO_NR(1, 19), |
| 352 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 353 | 2 |
| 354 | }, |
| 355 | { |
| 356 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 357 | IMX_GPIO_NR(1, 17), |
| 358 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 359 | 3 |
| 360 | }, |
| 361 | { |
| 362 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 363 | IMX_GPIO_NR(1, 18), |
| 364 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 365 | 4 |
| 366 | }, |
| 367 | }; |
| 368 | |
| 369 | struct dio_cfg gw52xx_dio[] = { |
| 370 | { |
| 371 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 372 | IMX_GPIO_NR(1, 16), |
| 373 | { 0, 0 }, |
| 374 | 0 |
| 375 | }, |
| 376 | { |
| 377 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 378 | IMX_GPIO_NR(1, 19), |
| 379 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 380 | 2 |
| 381 | }, |
| 382 | { |
| 383 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 384 | IMX_GPIO_NR(1, 17), |
| 385 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 386 | 3 |
| 387 | }, |
| 388 | { |
| 389 | { IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 390 | IMX_GPIO_NR(1, 20), |
| 391 | { 0, 0 }, |
| 392 | 0 |
| 393 | }, |
| 394 | }; |
| 395 | |
| 396 | struct dio_cfg gw53xx_dio[] = { |
| 397 | { |
| 398 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 399 | IMX_GPIO_NR(1, 16), |
| 400 | { 0, 0 }, |
| 401 | 0 |
| 402 | }, |
| 403 | { |
| 404 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 405 | IMX_GPIO_NR(1, 19), |
| 406 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 407 | 2 |
| 408 | }, |
| 409 | { |
| 410 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 411 | IMX_GPIO_NR(1, 17), |
| 412 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 413 | 3 |
| 414 | }, |
| 415 | { |
| 416 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 417 | IMX_GPIO_NR(1, 20), |
| 418 | { 0, 0 }, |
| 419 | 0 |
| 420 | }, |
| 421 | }; |
| 422 | |
| 423 | struct dio_cfg gw54xx_dio[] = { |
| 424 | { |
| 425 | { IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09) }, |
| 426 | IMX_GPIO_NR(1, 9), |
| 427 | { IOMUX_PADS(PAD_GPIO_9__PWM1_OUT) }, |
| 428 | 1 |
| 429 | }, |
| 430 | { |
| 431 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 432 | IMX_GPIO_NR(1, 19), |
| 433 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 434 | 2 |
| 435 | }, |
| 436 | { |
| 437 | { IOMUX_PADS(PAD_SD4_DAT1__GPIO2_IO09) }, |
| 438 | IMX_GPIO_NR(2, 9), |
| 439 | { IOMUX_PADS(PAD_SD4_DAT1__PWM3_OUT) }, |
| 440 | 3 |
| 441 | }, |
| 442 | { |
| 443 | { IOMUX_PADS(PAD_SD4_DAT2__GPIO2_IO10) }, |
| 444 | IMX_GPIO_NR(2, 10), |
| 445 | { IOMUX_PADS(PAD_SD4_DAT2__PWM4_OUT) }, |
| 446 | 4 |
| 447 | }, |
| 448 | }; |
| 449 | |
| 450 | struct dio_cfg gw551x_dio[] = { |
| 451 | { |
| 452 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 453 | IMX_GPIO_NR(1, 19), |
| 454 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 455 | 2 |
| 456 | }, |
| 457 | { |
| 458 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 459 | IMX_GPIO_NR(1, 17), |
| 460 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 461 | 3 |
| 462 | }, |
| 463 | }; |
| 464 | |
| 465 | struct dio_cfg gw552x_dio[] = { |
| 466 | { |
| 467 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 468 | IMX_GPIO_NR(1, 16), |
| 469 | { 0, 0 }, |
| 470 | 0 |
| 471 | }, |
| 472 | { |
| 473 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 474 | IMX_GPIO_NR(1, 19), |
| 475 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 476 | 2 |
| 477 | }, |
| 478 | { |
| 479 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 480 | IMX_GPIO_NR(1, 17), |
| 481 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 482 | 3 |
| 483 | }, |
| 484 | { |
| 485 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 486 | IMX_GPIO_NR(1, 20), |
| 487 | { 0, 0 }, |
| 488 | 0 |
| 489 | }, |
Tim Harvey | b1243da | 2016-07-15 07:14:24 -0700 | [diff] [blame] | 490 | { |
| 491 | {IOMUX_PADS(PAD_CSI0_PIXCLK__GPIO5_IO18) }, |
| 492 | IMX_GPIO_NR(5, 18), |
| 493 | { 0, 0 }, |
| 494 | 0 |
| 495 | }, |
| 496 | { |
| 497 | {IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20) }, |
| 498 | IMX_GPIO_NR(5, 20), |
| 499 | { 0, 0 }, |
| 500 | 0 |
| 501 | }, |
| 502 | { |
| 503 | {IOMUX_PADS(PAD_CSI0_VSYNC__GPIO5_IO21) }, |
| 504 | IMX_GPIO_NR(5, 21), |
| 505 | { 0, 0 }, |
| 506 | 0 |
| 507 | }, |
| 508 | { |
| 509 | {IOMUX_PADS(PAD_CSI0_DAT4__GPIO5_IO22) }, |
| 510 | IMX_GPIO_NR(5, 22), |
| 511 | { 0, 0 }, |
| 512 | 0 |
| 513 | }, |
| 514 | { |
| 515 | {IOMUX_PADS(PAD_CSI0_DAT5__GPIO5_IO23) }, |
| 516 | IMX_GPIO_NR(5, 23), |
| 517 | { 0, 0 }, |
| 518 | 0 |
| 519 | }, |
| 520 | { |
| 521 | {IOMUX_PADS(PAD_CSI0_DAT7__GPIO5_IO25) }, |
| 522 | IMX_GPIO_NR(5, 25), |
| 523 | { 0, 0 }, |
| 524 | 0 |
| 525 | }, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 526 | }; |
| 527 | |
| 528 | struct dio_cfg gw553x_dio[] = { |
| 529 | { |
| 530 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 531 | IMX_GPIO_NR(1, 16), |
| 532 | { 0, 0 }, |
| 533 | 0 |
| 534 | }, |
| 535 | { |
| 536 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 537 | IMX_GPIO_NR(1, 19), |
| 538 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 539 | 2 |
| 540 | }, |
| 541 | { |
| 542 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 543 | IMX_GPIO_NR(1, 17), |
| 544 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 545 | 3 |
| 546 | }, |
| 547 | { |
| 548 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 549 | IMX_GPIO_NR(1, 18), |
| 550 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 551 | 4 |
| 552 | }, |
| 553 | }; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 554 | |
| 555 | /* |
| 556 | * Board Specific GPIO |
| 557 | */ |
| 558 | struct ventana gpio_cfg[GW_UNKNOWN] = { |
| 559 | /* GW5400proto */ |
| 560 | { |
| 561 | .gpio_pads = gw54xx_gpio_pads, |
| 562 | .num_pads = ARRAY_SIZE(gw54xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 563 | .dio_cfg = gw54xx_dio, |
| 564 | .dio_num = ARRAY_SIZE(gw54xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 565 | .leds = { |
| 566 | IMX_GPIO_NR(4, 6), |
| 567 | IMX_GPIO_NR(4, 10), |
| 568 | IMX_GPIO_NR(4, 15), |
| 569 | }, |
| 570 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 571 | .mezz_pwren = IMX_GPIO_NR(4, 7), |
| 572 | .mezz_irq = IMX_GPIO_NR(4, 9), |
| 573 | .rs485en = IMX_GPIO_NR(3, 24), |
| 574 | .dioi2c_en = IMX_GPIO_NR(4, 5), |
| 575 | .pcie_sson = IMX_GPIO_NR(1, 20), |
| 576 | }, |
| 577 | |
| 578 | /* GW51xx */ |
| 579 | { |
| 580 | .gpio_pads = gw51xx_gpio_pads, |
| 581 | .num_pads = ARRAY_SIZE(gw51xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 582 | .dio_cfg = gw51xx_dio, |
| 583 | .dio_num = ARRAY_SIZE(gw51xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 584 | .leds = { |
| 585 | IMX_GPIO_NR(4, 6), |
| 586 | IMX_GPIO_NR(4, 10), |
| 587 | }, |
| 588 | .pcie_rst = IMX_GPIO_NR(1, 0), |
| 589 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 590 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 591 | .gps_shdn = IMX_GPIO_NR(1, 2), |
| 592 | .vidin_en = IMX_GPIO_NR(5, 20), |
| 593 | .wdis = IMX_GPIO_NR(7, 12), |
| 594 | }, |
| 595 | |
| 596 | /* GW52xx */ |
| 597 | { |
| 598 | .gpio_pads = gw52xx_gpio_pads, |
| 599 | .num_pads = ARRAY_SIZE(gw52xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 600 | .dio_cfg = gw52xx_dio, |
| 601 | .dio_num = ARRAY_SIZE(gw52xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 602 | .leds = { |
| 603 | IMX_GPIO_NR(4, 6), |
| 604 | IMX_GPIO_NR(4, 7), |
| 605 | IMX_GPIO_NR(4, 15), |
| 606 | }, |
| 607 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 608 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 609 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 610 | .gps_shdn = IMX_GPIO_NR(1, 27), |
| 611 | .vidin_en = IMX_GPIO_NR(3, 31), |
| 612 | .usb_sel = IMX_GPIO_NR(1, 2), |
| 613 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 614 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 615 | .rs232_en = GP_RS232_EN, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 616 | }, |
| 617 | |
| 618 | /* GW53xx */ |
| 619 | { |
| 620 | .gpio_pads = gw53xx_gpio_pads, |
| 621 | .num_pads = ARRAY_SIZE(gw53xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 622 | .dio_cfg = gw53xx_dio, |
| 623 | .dio_num = ARRAY_SIZE(gw53xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 624 | .leds = { |
| 625 | IMX_GPIO_NR(4, 6), |
| 626 | IMX_GPIO_NR(4, 7), |
| 627 | IMX_GPIO_NR(4, 15), |
| 628 | }, |
| 629 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 630 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 631 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 632 | .gps_shdn = IMX_GPIO_NR(1, 27), |
| 633 | .vidin_en = IMX_GPIO_NR(3, 31), |
| 634 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 635 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 636 | .rs232_en = GP_RS232_EN, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 637 | }, |
| 638 | |
| 639 | /* GW54xx */ |
| 640 | { |
| 641 | .gpio_pads = gw54xx_gpio_pads, |
| 642 | .num_pads = ARRAY_SIZE(gw54xx_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 643 | .dio_cfg = gw54xx_dio, |
| 644 | .dio_num = ARRAY_SIZE(gw54xx_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 645 | .leds = { |
| 646 | IMX_GPIO_NR(4, 6), |
| 647 | IMX_GPIO_NR(4, 7), |
| 648 | IMX_GPIO_NR(4, 15), |
| 649 | }, |
| 650 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 651 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 652 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 653 | .rs485en = IMX_GPIO_NR(7, 1), |
| 654 | .vidin_en = IMX_GPIO_NR(3, 31), |
| 655 | .dioi2c_en = IMX_GPIO_NR(4, 5), |
| 656 | .pcie_sson = IMX_GPIO_NR(1, 20), |
| 657 | .wdis = IMX_GPIO_NR(5, 17), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 658 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 659 | .rs232_en = GP_RS232_EN, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 660 | }, |
| 661 | |
| 662 | /* GW551x */ |
| 663 | { |
| 664 | .gpio_pads = gw551x_gpio_pads, |
| 665 | .num_pads = ARRAY_SIZE(gw551x_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 666 | .dio_cfg = gw551x_dio, |
| 667 | .dio_num = ARRAY_SIZE(gw551x_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 668 | .leds = { |
| 669 | IMX_GPIO_NR(4, 7), |
| 670 | }, |
| 671 | .pcie_rst = IMX_GPIO_NR(1, 0), |
| 672 | .wdis = IMX_GPIO_NR(7, 12), |
| 673 | }, |
| 674 | |
| 675 | /* GW552x */ |
| 676 | { |
| 677 | .gpio_pads = gw552x_gpio_pads, |
| 678 | .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 679 | .dio_cfg = gw552x_dio, |
| 680 | .dio_num = ARRAY_SIZE(gw552x_dio), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 681 | .leds = { |
| 682 | IMX_GPIO_NR(4, 6), |
| 683 | IMX_GPIO_NR(4, 7), |
| 684 | IMX_GPIO_NR(4, 15), |
| 685 | }, |
| 686 | .pcie_rst = IMX_GPIO_NR(1, 29), |
Tim Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 687 | .usb_sel = IMX_GPIO_NR(1, 7), |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 688 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 689 | .msata_en = GP_MSATA_SEL, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 690 | }, |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 691 | |
| 692 | /* GW553x */ |
| 693 | { |
| 694 | .gpio_pads = gw553x_gpio_pads, |
| 695 | .num_pads = ARRAY_SIZE(gw553x_gpio_pads)/2, |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 696 | .dio_cfg = gw553x_dio, |
| 697 | .dio_num = ARRAY_SIZE(gw553x_dio), |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 698 | .leds = { |
| 699 | IMX_GPIO_NR(4, 10), |
| 700 | IMX_GPIO_NR(4, 11), |
| 701 | }, |
| 702 | .pcie_rst = IMX_GPIO_NR(1, 0), |
| 703 | .vidin_en = IMX_GPIO_NR(5, 20), |
| 704 | .wdis = IMX_GPIO_NR(7, 12), |
| 705 | }, |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 706 | }; |
| 707 | |
| 708 | void setup_iomux_gpio(int board, struct ventana_board_info *info) |
| 709 | { |
| 710 | int i; |
| 711 | |
| 712 | /* iomux common to all Ventana boards */ |
| 713 | SETUP_IOMUX_PADS(gw_gpio_pads); |
| 714 | |
| 715 | /* OTG power off */ |
| 716 | gpio_request(GP_USB_OTG_PWR, "usbotg_pwr"); |
| 717 | gpio_direction_output(GP_USB_OTG_PWR, 0); |
| 718 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 719 | if (board >= GW_UNKNOWN) |
| 720 | return; |
| 721 | |
| 722 | /* board specific iomux */ |
| 723 | imx_iomux_v3_setup_multiple_pads(gpio_cfg[board].gpio_pads, |
| 724 | gpio_cfg[board].num_pads); |
| 725 | |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 726 | /* RS232_EN# */ |
| 727 | if (gpio_cfg[board].rs232_en) { |
| 728 | gpio_request(gpio_cfg[board].rs232_en, "rs232_en"); |
| 729 | gpio_direction_output(gpio_cfg[board].rs232_en, 0); |
| 730 | } |
| 731 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 732 | /* GW522x Uses GPIO3_IO23 for PCIE_RST# */ |
| 733 | if (board == GW52xx && info->model[4] == '2') |
| 734 | gpio_cfg[board].pcie_rst = IMX_GPIO_NR(3, 23); |
| 735 | |
| 736 | /* assert PCI_RST# */ |
| 737 | gpio_request(gpio_cfg[board].pcie_rst, "pci_rst#"); |
| 738 | gpio_direction_output(gpio_cfg[board].pcie_rst, 0); |
| 739 | |
| 740 | /* turn off (active-high) user LED's */ |
| 741 | for (i = 0; i < ARRAY_SIZE(gpio_cfg[board].leds); i++) { |
| 742 | char name[16]; |
| 743 | if (gpio_cfg[board].leds[i]) { |
| 744 | sprintf(name, "led_user%d", i); |
| 745 | gpio_request(gpio_cfg[board].leds[i], name); |
| 746 | gpio_direction_output(gpio_cfg[board].leds[i], 1); |
| 747 | } |
| 748 | } |
| 749 | |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 750 | /* MSATA Enable - default to PCI */ |
| 751 | if (gpio_cfg[board].msata_en) { |
| 752 | gpio_request(gpio_cfg[board].msata_en, "msata_en"); |
| 753 | gpio_direction_output(gpio_cfg[board].msata_en, 0); |
| 754 | } |
| 755 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 756 | /* Expansion Mezzanine IO */ |
| 757 | if (gpio_cfg[board].mezz_pwren) { |
| 758 | gpio_request(gpio_cfg[board].mezz_pwren, "mezz_pwr"); |
| 759 | gpio_direction_output(gpio_cfg[board].mezz_pwren, 0); |
| 760 | } |
| 761 | if (gpio_cfg[board].mezz_irq) { |
| 762 | gpio_request(gpio_cfg[board].mezz_irq, "mezz_irq#"); |
| 763 | gpio_direction_input(gpio_cfg[board].mezz_irq); |
| 764 | } |
| 765 | |
| 766 | /* RS485 Transmit Enable */ |
| 767 | if (gpio_cfg[board].rs485en) { |
| 768 | gpio_request(gpio_cfg[board].rs485en, "rs485_en"); |
| 769 | gpio_direction_output(gpio_cfg[board].rs485en, 0); |
| 770 | } |
| 771 | |
| 772 | /* GPS_SHDN */ |
| 773 | if (gpio_cfg[board].gps_shdn) { |
| 774 | gpio_request(gpio_cfg[board].gps_shdn, "gps_shdn"); |
| 775 | gpio_direction_output(gpio_cfg[board].gps_shdn, 1); |
| 776 | } |
| 777 | |
| 778 | /* Analog video codec power enable */ |
| 779 | if (gpio_cfg[board].vidin_en) { |
| 780 | gpio_request(gpio_cfg[board].vidin_en, "anavidin_en"); |
| 781 | gpio_direction_output(gpio_cfg[board].vidin_en, 1); |
| 782 | } |
| 783 | |
| 784 | /* DIOI2C_DIS# */ |
| 785 | if (gpio_cfg[board].dioi2c_en) { |
| 786 | gpio_request(gpio_cfg[board].dioi2c_en, "dioi2c_dis#"); |
| 787 | gpio_direction_output(gpio_cfg[board].dioi2c_en, 0); |
| 788 | } |
| 789 | |
| 790 | /* PCICK_SSON: disable spread-spectrum clock */ |
| 791 | if (gpio_cfg[board].pcie_sson) { |
| 792 | gpio_request(gpio_cfg[board].pcie_sson, "pci_sson"); |
| 793 | gpio_direction_output(gpio_cfg[board].pcie_sson, 0); |
| 794 | } |
| 795 | |
| 796 | /* USBOTG mux routing */ |
| 797 | if (gpio_cfg[board].usb_sel) { |
| 798 | gpio_request(gpio_cfg[board].usb_sel, "usb_pcisel"); |
| 799 | gpio_direction_output(gpio_cfg[board].usb_sel, 0); |
| 800 | } |
| 801 | |
| 802 | /* PCISKT_WDIS# (Wireless disable GPIO to miniPCIe sockets) */ |
| 803 | if (gpio_cfg[board].wdis) { |
| 804 | gpio_request(gpio_cfg[board].wdis, "wlan_dis"); |
| 805 | gpio_direction_output(gpio_cfg[board].wdis, 1); |
| 806 | } |
Tim Harvey | 147b576 | 2016-05-24 11:03:59 -0700 | [diff] [blame] | 807 | |
| 808 | /* sense vselect pin to see if we support uhs-i */ |
| 809 | gpio_request(GP_SD3_VSELECT, "sd3_vselect"); |
| 810 | gpio_direction_input(GP_SD3_VSELECT); |
| 811 | gpio_cfg[board].usd_vsel = !gpio_get_value(GP_SD3_VSELECT); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 812 | } |
| 813 | |
| 814 | /* setup GPIO pinmux and default configuration per baseboard and env */ |
| 815 | void setup_board_gpio(int board, struct ventana_board_info *info) |
| 816 | { |
| 817 | const char *s; |
| 818 | char arg[10]; |
| 819 | size_t len; |
| 820 | int i; |
| 821 | int quiet = simple_strtol(getenv("quiet"), NULL, 10); |
| 822 | |
| 823 | if (board >= GW_UNKNOWN) |
| 824 | return; |
| 825 | |
| 826 | /* RS232_EN# */ |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 827 | if (gpio_cfg[board].rs232_en) { |
| 828 | gpio_direction_output(gpio_cfg[board].rs232_en, |
| 829 | (hwconfig("rs232")) ? 0 : 1); |
| 830 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 831 | |
| 832 | /* MSATA Enable */ |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 833 | if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 834 | gpio_direction_output(GP_MSATA_SEL, |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 835 | (hwconfig("msata")) ? 1 : 0); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 836 | } |
| 837 | |
| 838 | /* USBOTG Select (PCISKT or FrontPanel) */ |
| 839 | if (gpio_cfg[board].usb_sel) { |
| 840 | gpio_direction_output(gpio_cfg[board].usb_sel, |
| 841 | (hwconfig("usb_pcisel")) ? 1 : 0); |
| 842 | } |
| 843 | |
| 844 | /* |
| 845 | * Configure DIO pinmux/padctl registers |
| 846 | * see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions |
| 847 | */ |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 848 | for (i = 0; i < gpio_cfg[board].dio_num; i++) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 849 | struct dio_cfg *cfg = &gpio_cfg[board].dio_cfg[i]; |
| 850 | iomux_v3_cfg_t ctrl = DIO_PAD_CFG; |
| 851 | unsigned cputype = is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1; |
| 852 | |
| 853 | if (!cfg->gpio_padmux[0] && !cfg->gpio_padmux[1]) |
| 854 | continue; |
| 855 | sprintf(arg, "dio%d", i); |
| 856 | if (!hwconfig(arg)) |
| 857 | continue; |
| 858 | s = hwconfig_subarg(arg, "padctrl", &len); |
| 859 | if (s) { |
| 860 | ctrl = MUX_PAD_CTRL(simple_strtoul(s, NULL, 16) |
| 861 | & 0x1ffff) | MUX_MODE_SION; |
| 862 | } |
| 863 | if (hwconfig_subarg_cmp(arg, "mode", "gpio")) { |
| 864 | if (!quiet) { |
| 865 | printf("DIO%d: GPIO%d_IO%02d (gpio-%d)\n", i, |
| 866 | (cfg->gpio_param/32)+1, |
| 867 | cfg->gpio_param%32, |
| 868 | cfg->gpio_param); |
| 869 | } |
| 870 | imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] | |
| 871 | ctrl); |
| 872 | gpio_requestf(cfg->gpio_param, "dio%d", i); |
| 873 | gpio_direction_input(cfg->gpio_param); |
Tim Harvey | c0e03c3 | 2016-05-24 11:03:54 -0700 | [diff] [blame] | 874 | } else if (hwconfig_subarg_cmp(arg, "mode", "pwm") && |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 875 | cfg->pwm_padmux) { |
Tim Harvey | 8d2d8df | 2016-05-24 11:03:55 -0700 | [diff] [blame] | 876 | if (!cfg->pwm_param) { |
| 877 | printf("DIO%d: Error: pwm config invalid\n", |
| 878 | i); |
| 879 | continue; |
| 880 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 881 | if (!quiet) |
| 882 | printf("DIO%d: pwm%d\n", i, cfg->pwm_param); |
| 883 | imx_iomux_v3_setup_pad(cfg->pwm_padmux[cputype] | |
| 884 | MUX_PAD_CTRL(ctrl)); |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | if (!quiet) { |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 889 | if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) { |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 890 | printf("MSATA: %s\n", (hwconfig("msata") ? |
| 891 | "enabled" : "disabled")); |
| 892 | } |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 893 | if (gpio_cfg[board].rs232_en) { |
| 894 | printf("RS232: %s\n", (hwconfig("rs232")) ? |
| 895 | "enabled" : "disabled"); |
| 896 | } |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 897 | } |
| 898 | } |
| 899 | |
| 900 | /* setup board specific PMIC */ |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 901 | void setup_pmic(void) |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 902 | { |
| 903 | struct pmic *p; |
| 904 | u32 reg; |
| 905 | |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 906 | i2c_set_bus_num(CONFIG_I2C_PMIC); |
| 907 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 908 | /* configure PFUZE100 PMIC */ |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 909 | if (!i2c_probe(CONFIG_POWER_PFUZE100_I2C_ADDR)) { |
| 910 | debug("probed PFUZE100@0x%x\n", CONFIG_POWER_PFUZE100_I2C_ADDR); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 911 | power_pfuze100_init(CONFIG_I2C_PMIC); |
| 912 | p = pmic_get("PFUZE100"); |
| 913 | if (p && !pmic_probe(p)) { |
| 914 | pmic_reg_read(p, PFUZE100_DEVICEID, ®); |
| 915 | printf("PMIC: PFUZE100 ID=0x%02x\n", reg); |
| 916 | |
| 917 | /* Set VGEN1 to 1.5V and enable */ |
| 918 | pmic_reg_read(p, PFUZE100_VGEN1VOL, ®); |
| 919 | reg &= ~(LDO_VOL_MASK); |
| 920 | reg |= (LDOA_1_50V | LDO_EN); |
| 921 | pmic_reg_write(p, PFUZE100_VGEN1VOL, reg); |
| 922 | |
| 923 | /* Set SWBST to 5.0V and enable */ |
| 924 | pmic_reg_read(p, PFUZE100_SWBSTCON1, ®); |
| 925 | reg &= ~(SWBST_MODE_MASK | SWBST_VOL_MASK); |
Marek Vasut | 2aaeb91 | 2015-11-26 14:08:50 +0100 | [diff] [blame] | 926 | reg |= (SWBST_5_00V | (SWBST_MODE_AUTO << SWBST_MODE_SHIFT)); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 927 | pmic_reg_write(p, PFUZE100_SWBSTCON1, reg); |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | /* configure LTC3676 PMIC */ |
Tim Harvey | 195bc97 | 2015-05-08 18:28:37 -0700 | [diff] [blame] | 932 | else if (!i2c_probe(CONFIG_POWER_LTC3676_I2C_ADDR)) { |
| 933 | debug("probed LTC3676@0x%x\n", CONFIG_POWER_LTC3676_I2C_ADDR); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 934 | power_ltc3676_init(CONFIG_I2C_PMIC); |
| 935 | p = pmic_get("LTC3676_PMIC"); |
| 936 | if (p && !pmic_probe(p)) { |
| 937 | puts("PMIC: LTC3676\n"); |
| 938 | /* |
| 939 | * set board-specific scalar for max CPU frequency |
| 940 | * per CPU based on the LDO enabled Operating Ranges |
| 941 | * defined in the respective IMX6DQ and IMX6SDL |
| 942 | * datasheets. The voltage resulting from the R1/R2 |
| 943 | * feedback inputs on Ventana is 1308mV. Note that this |
| 944 | * is a bit shy of the Vmin of 1350mV in the datasheet |
| 945 | * for LDO enabled mode but is as high as we can go. |
| 946 | * |
| 947 | * We will rely on an OS kernel driver to properly |
| 948 | * regulate these per CPU operating point and use LDO |
| 949 | * bypass mode when using the higher frequency |
| 950 | * operating points to compensate as LDO bypass mode |
| 951 | * allows the rails be 125mV lower. |
| 952 | */ |
| 953 | /* mask PGOOD during SW1 transition */ |
| 954 | pmic_reg_write(p, LTC3676_DVB1B, |
| 955 | 0x1f | LTC3676_PGOOD_MASK); |
| 956 | /* set SW1 (VDD_SOC) */ |
| 957 | pmic_reg_write(p, LTC3676_DVB1A, 0x1f); |
| 958 | |
| 959 | /* mask PGOOD during SW3 transition */ |
| 960 | pmic_reg_write(p, LTC3676_DVB3B, |
| 961 | 0x1f | LTC3676_PGOOD_MASK); |
| 962 | /* set SW3 (VDD_ARM) */ |
| 963 | pmic_reg_write(p, LTC3676_DVB3A, 0x1f); |
| 964 | } |
| 965 | } |
| 966 | } |