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