Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [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 <common.h> |
| 10 | #include <asm/io.h> |
| 11 | #include <asm/arch/clock.h> |
| 12 | #include <asm/arch/imx-regs.h> |
| 13 | #include <asm/arch/iomux.h> |
| 14 | #include <asm/arch/mx6-pins.h> |
Tim Harvey | fb64cc7 | 2014-04-25 15:39:07 -0700 | [diff] [blame] | 15 | #include <asm/arch/mxc_hdmi.h> |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 16 | #include <asm/arch/crm_regs.h> |
| 17 | #include <asm/arch/sys_proto.h> |
| 18 | #include <asm/gpio.h> |
| 19 | #include <asm/imx-common/iomux-v3.h> |
| 20 | #include <asm/imx-common/mxc_i2c.h> |
| 21 | #include <asm/imx-common/boot_mode.h> |
| 22 | #include <asm/imx-common/sata.h> |
Eric Nelson | 16acd1c | 2014-09-30 15:40:03 -0700 | [diff] [blame] | 23 | #include <asm/imx-common/spi.h> |
Tim Harvey | fb64cc7 | 2014-04-25 15:39:07 -0700 | [diff] [blame] | 24 | #include <asm/imx-common/video.h> |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 25 | #include <jffs2/load_kernel.h> |
| 26 | #include <hwconfig.h> |
| 27 | #include <i2c.h> |
| 28 | #include <linux/ctype.h> |
| 29 | #include <fdt_support.h> |
| 30 | #include <fsl_esdhc.h> |
| 31 | #include <miiphy.h> |
| 32 | #include <mmc.h> |
| 33 | #include <mtd_node.h> |
| 34 | #include <netdev.h> |
Tim Harvey | 33791d5 | 2014-08-07 22:49:57 -0700 | [diff] [blame] | 35 | #include <pci.h> |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 36 | #include <power/pmic.h> |
Tim Harvey | 0dff16f | 2014-05-05 08:22:25 -0700 | [diff] [blame] | 37 | #include <power/ltc3676_pmic.h> |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 38 | #include <power/pfuze100_pmic.h> |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 39 | #include <fdt_support.h> |
| 40 | #include <jffs2/load_kernel.h> |
| 41 | #include <spi_flash.h> |
| 42 | |
| 43 | #include "gsc.h" |
| 44 | #include "ventana_eeprom.h" |
| 45 | |
| 46 | DECLARE_GLOBAL_DATA_PTR; |
| 47 | |
| 48 | /* GPIO's common to all baseboards */ |
| 49 | #define GP_PHY_RST IMX_GPIO_NR(1, 30) |
| 50 | #define GP_USB_OTG_PWR IMX_GPIO_NR(3, 22) |
| 51 | #define GP_SD3_CD IMX_GPIO_NR(7, 0) |
| 52 | #define GP_RS232_EN IMX_GPIO_NR(2, 11) |
| 53 | #define GP_MSATA_SEL IMX_GPIO_NR(2, 8) |
| 54 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 55 | #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ |
| 56 | PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ |
| 57 | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) |
| 58 | |
| 59 | #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ |
| 60 | PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \ |
| 61 | PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) |
| 62 | |
| 63 | #define ENET_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ |
| 64 | PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ |
| 65 | PAD_CTL_DSE_40ohm | PAD_CTL_HYS) |
| 66 | |
| 67 | #define SPI_PAD_CTRL (PAD_CTL_HYS | \ |
| 68 | PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \ |
| 69 | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) |
| 70 | |
| 71 | #define DIO_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ |
| 72 | PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ |
| 73 | PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST) |
| 74 | |
| 75 | #define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ |
| 76 | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ |
| 77 | PAD_CTL_ODE | PAD_CTL_SRE_FAST) |
| 78 | |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 79 | #define IRQ_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ |
| 80 | PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ |
| 81 | PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST) |
| 82 | |
| 83 | #define DIO_PAD_CFG (MUX_PAD_CTRL(DIO_PAD_CTRL) | MUX_MODE_SION) |
| 84 | |
| 85 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 86 | /* |
| 87 | * EEPROM board info struct populated by read_eeprom so that we only have to |
| 88 | * read it once. |
| 89 | */ |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 90 | struct ventana_board_info ventana_info; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 91 | |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 92 | static int board_type; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 93 | |
| 94 | /* UART1: Function varies per baseboard */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 95 | static iomux_v3_cfg_t const uart1_pads[] = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 96 | IOMUX_PADS(PAD_SD3_DAT6__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
| 97 | IOMUX_PADS(PAD_SD3_DAT7__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | /* UART2: Serial Console */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 101 | static iomux_v3_cfg_t const uart2_pads[] = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 102 | IOMUX_PADS(PAD_SD4_DAT7__UART2_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
| 103 | IOMUX_PADS(PAD_SD4_DAT4__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | #define PC MUX_PAD_CTRL(I2C_PAD_CTRL) |
| 107 | |
| 108 | /* I2C1: GSC */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 109 | static struct i2c_pads_info mx6q_i2c_pad_info0 = { |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 110 | .scl = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 111 | .i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC, |
| 112 | .gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | PC, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 113 | .gp = IMX_GPIO_NR(3, 21) |
| 114 | }, |
| 115 | .sda = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 116 | .i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC, |
| 117 | .gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | PC, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 118 | .gp = IMX_GPIO_NR(3, 28) |
| 119 | } |
| 120 | }; |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 121 | static struct i2c_pads_info mx6dl_i2c_pad_info0 = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 122 | .scl = { |
| 123 | .i2c_mode = MX6DL_PAD_EIM_D21__I2C1_SCL | PC, |
| 124 | .gpio_mode = MX6DL_PAD_EIM_D21__GPIO3_IO21 | PC, |
| 125 | .gp = IMX_GPIO_NR(3, 21) |
| 126 | }, |
| 127 | .sda = { |
| 128 | .i2c_mode = MX6DL_PAD_EIM_D28__I2C1_SDA | PC, |
| 129 | .gpio_mode = MX6DL_PAD_EIM_D28__GPIO3_IO28 | PC, |
| 130 | .gp = IMX_GPIO_NR(3, 28) |
| 131 | } |
| 132 | }; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 133 | |
| 134 | /* I2C2: PMIC/PCIe Switch/PCIe Clock/Mezz */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 135 | static struct i2c_pads_info mx6q_i2c_pad_info1 = { |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 136 | .scl = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 137 | .i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC, |
| 138 | .gpio_mode = MX6Q_PAD_KEY_COL3__GPIO4_IO12 | PC, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 139 | .gp = IMX_GPIO_NR(4, 12) |
| 140 | }, |
| 141 | .sda = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 142 | .i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC, |
| 143 | .gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO4_IO13 | PC, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 144 | .gp = IMX_GPIO_NR(4, 13) |
| 145 | } |
| 146 | }; |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 147 | static struct i2c_pads_info mx6dl_i2c_pad_info1 = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 148 | .scl = { |
| 149 | .i2c_mode = MX6DL_PAD_KEY_COL3__I2C2_SCL | PC, |
| 150 | .gpio_mode = MX6DL_PAD_KEY_COL3__GPIO4_IO12 | PC, |
| 151 | .gp = IMX_GPIO_NR(4, 12) |
| 152 | }, |
| 153 | .sda = { |
| 154 | .i2c_mode = MX6DL_PAD_KEY_ROW3__I2C2_SDA | PC, |
| 155 | .gpio_mode = MX6DL_PAD_KEY_ROW3__GPIO4_IO13 | PC, |
| 156 | .gp = IMX_GPIO_NR(4, 13) |
| 157 | } |
| 158 | }; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 159 | |
| 160 | /* I2C3: Misc/Expansion */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 161 | static struct i2c_pads_info mx6q_i2c_pad_info2 = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 162 | .scl = { |
| 163 | .i2c_mode = MX6Q_PAD_GPIO_3__I2C3_SCL | PC, |
| 164 | .gpio_mode = MX6Q_PAD_GPIO_3__GPIO1_IO03 | PC, |
| 165 | .gp = IMX_GPIO_NR(1, 3) |
| 166 | }, |
| 167 | .sda = { |
| 168 | .i2c_mode = MX6Q_PAD_GPIO_6__I2C3_SDA | PC, |
| 169 | .gpio_mode = MX6Q_PAD_GPIO_6__GPIO1_IO06 | PC, |
| 170 | .gp = IMX_GPIO_NR(1, 6) |
| 171 | } |
| 172 | }; |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 173 | static struct i2c_pads_info mx6dl_i2c_pad_info2 = { |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 174 | .scl = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 175 | .i2c_mode = MX6DL_PAD_GPIO_3__I2C3_SCL | PC, |
| 176 | .gpio_mode = MX6DL_PAD_GPIO_3__GPIO1_IO03 | PC, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 177 | .gp = IMX_GPIO_NR(1, 3) |
| 178 | }, |
| 179 | .sda = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 180 | .i2c_mode = MX6DL_PAD_GPIO_6__I2C3_SDA | PC, |
| 181 | .gpio_mode = MX6DL_PAD_GPIO_6__GPIO1_IO06 | PC, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 182 | .gp = IMX_GPIO_NR(1, 6) |
| 183 | } |
| 184 | }; |
| 185 | |
| 186 | /* MMC */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 187 | static iomux_v3_cfg_t const usdhc3_pads[] = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 188 | IOMUX_PADS(PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 189 | IOMUX_PADS(PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 190 | IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 191 | IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 192 | IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 193 | IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), |
| 194 | /* CD */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 195 | IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | /* ENET */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 199 | static iomux_v3_cfg_t const enet_pads[] = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 200 | IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 201 | IOMUX_PADS(PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 202 | IOMUX_PADS(PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 203 | IOMUX_PADS(PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 204 | IOMUX_PADS(PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 205 | IOMUX_PADS(PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 206 | IOMUX_PADS(PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 207 | IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL | |
| 208 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 209 | IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK | |
| 210 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 211 | IOMUX_PADS(PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 212 | IOMUX_PADS(PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 213 | IOMUX_PADS(PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 214 | IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 215 | IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
| 216 | IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL | |
| 217 | MUX_PAD_CTRL(ENET_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 218 | /* PHY nRST */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 219 | IOMUX_PADS(PAD_ENET_TXD0__GPIO1_IO30 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | /* NAND */ |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 223 | static iomux_v3_cfg_t const nfc_pads[] = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 224 | IOMUX_PADS(PAD_NANDF_CLE__NAND_CLE | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 225 | IOMUX_PADS(PAD_NANDF_ALE__NAND_ALE | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 226 | IOMUX_PADS(PAD_NANDF_WP_B__NAND_WP_B | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 227 | IOMUX_PADS(PAD_NANDF_RB0__NAND_READY_B | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 228 | IOMUX_PADS(PAD_NANDF_CS0__NAND_CE0_B | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 229 | IOMUX_PADS(PAD_SD4_CMD__NAND_RE_B | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 230 | IOMUX_PADS(PAD_SD4_CLK__NAND_WE_B | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 231 | IOMUX_PADS(PAD_NANDF_D0__NAND_DATA00 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 232 | IOMUX_PADS(PAD_NANDF_D1__NAND_DATA01 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 233 | IOMUX_PADS(PAD_NANDF_D2__NAND_DATA02 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 234 | IOMUX_PADS(PAD_NANDF_D3__NAND_DATA03 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 235 | IOMUX_PADS(PAD_NANDF_D4__NAND_DATA04 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 236 | IOMUX_PADS(PAD_NANDF_D5__NAND_DATA05 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 237 | IOMUX_PADS(PAD_NANDF_D6__NAND_DATA06 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
| 238 | IOMUX_PADS(PAD_NANDF_D7__NAND_DATA07 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 239 | }; |
| 240 | |
| 241 | #ifdef CONFIG_CMD_NAND |
| 242 | static void setup_gpmi_nand(void) |
| 243 | { |
| 244 | struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; |
| 245 | |
| 246 | /* config gpmi nand iomux */ |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 247 | SETUP_IOMUX_PADS(nfc_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 248 | |
| 249 | /* config gpmi and bch clock to 100 MHz */ |
| 250 | clrsetbits_le32(&mxc_ccm->cs2cdr, |
| 251 | MXC_CCM_CS2CDR_ENFC_CLK_PODF_MASK | |
| 252 | MXC_CCM_CS2CDR_ENFC_CLK_PRED_MASK | |
| 253 | MXC_CCM_CS2CDR_ENFC_CLK_SEL_MASK, |
| 254 | MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) | |
| 255 | MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) | |
| 256 | MXC_CCM_CS2CDR_ENFC_CLK_SEL(3)); |
| 257 | |
| 258 | /* enable gpmi and bch clock gating */ |
| 259 | setbits_le32(&mxc_ccm->CCGR4, |
| 260 | MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK | |
| 261 | MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK | |
| 262 | MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK | |
| 263 | MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK | |
| 264 | MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_OFFSET); |
| 265 | |
| 266 | /* enable apbh clock gating */ |
| 267 | setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK); |
| 268 | } |
| 269 | #endif |
| 270 | |
| 271 | static void setup_iomux_enet(void) |
| 272 | { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 273 | SETUP_IOMUX_PADS(enet_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 274 | |
| 275 | /* toggle PHY_RST# */ |
| 276 | gpio_direction_output(GP_PHY_RST, 0); |
| 277 | mdelay(2); |
| 278 | gpio_set_value(GP_PHY_RST, 1); |
| 279 | } |
| 280 | |
| 281 | static void setup_iomux_uart(void) |
| 282 | { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 283 | SETUP_IOMUX_PADS(uart1_pads); |
| 284 | SETUP_IOMUX_PADS(uart2_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | #ifdef CONFIG_USB_EHCI_MX6 |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 288 | static iomux_v3_cfg_t const usb_pads[] = { |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 289 | IOMUX_PADS(PAD_GPIO_1__USB_OTG_ID | DIO_PAD_CFG), |
| 290 | IOMUX_PADS(PAD_KEY_COL4__USB_OTG_OC | DIO_PAD_CFG), |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 291 | /* OTG PWR */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 292 | IOMUX_PADS(PAD_EIM_D22__GPIO3_IO22 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 293 | }; |
| 294 | |
| 295 | int board_ehci_hcd_init(int port) |
| 296 | { |
| 297 | struct ventana_board_info *info = &ventana_info; |
| 298 | |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 299 | SETUP_IOMUX_PADS(usb_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 300 | |
| 301 | /* Reset USB HUB (present on GW54xx/GW53xx) */ |
| 302 | switch (info->model[3]) { |
| 303 | case '3': /* GW53xx */ |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 304 | case '5': /* GW552x */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 305 | SETUP_IOMUX_PAD(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 306 | gpio_direction_output(IMX_GPIO_NR(1, 9), 0); |
| 307 | mdelay(2); |
| 308 | gpio_set_value(IMX_GPIO_NR(1, 9), 1); |
| 309 | break; |
| 310 | case '4': /* GW54xx */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 311 | SETUP_IOMUX_PAD(PAD_SD1_DAT0__GPIO1_IO16 | DIO_PAD_CFG); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 312 | gpio_direction_output(IMX_GPIO_NR(1, 16), 0); |
| 313 | mdelay(2); |
| 314 | gpio_set_value(IMX_GPIO_NR(1, 16), 1); |
| 315 | break; |
| 316 | } |
| 317 | |
| 318 | return 0; |
| 319 | } |
| 320 | |
| 321 | int board_ehci_power(int port, int on) |
| 322 | { |
| 323 | if (port) |
| 324 | return 0; |
| 325 | gpio_set_value(GP_USB_OTG_PWR, on); |
| 326 | return 0; |
| 327 | } |
| 328 | #endif /* CONFIG_USB_EHCI_MX6 */ |
| 329 | |
| 330 | #ifdef CONFIG_FSL_ESDHC |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 331 | static struct fsl_esdhc_cfg usdhc_cfg = { USDHC3_BASE_ADDR }; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 332 | |
| 333 | int board_mmc_getcd(struct mmc *mmc) |
| 334 | { |
| 335 | /* Card Detect */ |
| 336 | gpio_direction_input(GP_SD3_CD); |
| 337 | return !gpio_get_value(GP_SD3_CD); |
| 338 | } |
| 339 | |
| 340 | int board_mmc_init(bd_t *bis) |
| 341 | { |
| 342 | /* Only one USDHC controller on Ventana */ |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 343 | SETUP_IOMUX_PADS(usdhc3_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 344 | usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); |
| 345 | usdhc_cfg.max_bus_width = 4; |
| 346 | |
| 347 | return fsl_esdhc_initialize(bis, &usdhc_cfg); |
| 348 | } |
| 349 | #endif /* CONFIG_FSL_ESDHC */ |
| 350 | |
| 351 | #ifdef CONFIG_MXC_SPI |
| 352 | iomux_v3_cfg_t const ecspi1_pads[] = { |
| 353 | /* SS1 */ |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 354 | IOMUX_PADS(PAD_EIM_D19__GPIO3_IO19 | MUX_PAD_CTRL(SPI_PAD_CTRL)), |
| 355 | IOMUX_PADS(PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL)), |
| 356 | IOMUX_PADS(PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL)), |
| 357 | IOMUX_PADS(PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 358 | }; |
| 359 | |
Nikita Kiryanov | 00cd738 | 2014-08-20 15:08:50 +0300 | [diff] [blame] | 360 | int board_spi_cs_gpio(unsigned bus, unsigned cs) |
| 361 | { |
| 362 | return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(3, 19)) : -1; |
| 363 | } |
| 364 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 365 | static void setup_spi(void) |
| 366 | { |
Nikita Kiryanov | 00cd738 | 2014-08-20 15:08:50 +0300 | [diff] [blame] | 367 | gpio_direction_output(IMX_GPIO_NR(3, 19), 1); |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 368 | SETUP_IOMUX_PADS(ecspi1_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 369 | } |
| 370 | #endif |
| 371 | |
| 372 | /* configure eth0 PHY board-specific LED behavior */ |
| 373 | int board_phy_config(struct phy_device *phydev) |
| 374 | { |
| 375 | unsigned short val; |
| 376 | |
| 377 | /* Marvel 88E1510 */ |
| 378 | if (phydev->phy_id == 0x1410dd1) { |
| 379 | /* |
| 380 | * Page 3, Register 16: LED[2:0] Function Control Register |
| 381 | * LED[0] (SPD:Amber) R16_3.3:0 to 0111: on-GbE link |
| 382 | * LED[1] (LNK:Green) R16_3.7:4 to 0001: on-link, blink-activity |
| 383 | */ |
| 384 | phy_write(phydev, MDIO_DEVAD_NONE, 22, 3); |
| 385 | val = phy_read(phydev, MDIO_DEVAD_NONE, 16); |
| 386 | val &= 0xff00; |
| 387 | val |= 0x0017; |
| 388 | phy_write(phydev, MDIO_DEVAD_NONE, 16, val); |
| 389 | phy_write(phydev, MDIO_DEVAD_NONE, 22, 0); |
| 390 | } |
| 391 | |
| 392 | if (phydev->drv->config) |
| 393 | phydev->drv->config(phydev); |
| 394 | |
| 395 | return 0; |
| 396 | } |
| 397 | |
| 398 | int board_eth_init(bd_t *bis) |
| 399 | { |
| 400 | setup_iomux_enet(); |
| 401 | |
| 402 | #ifdef CONFIG_FEC_MXC |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 403 | if (board_type != GW551x && board_type != GW552x) |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 404 | cpu_eth_init(bis); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 405 | #endif |
| 406 | |
Tim Harvey | 472884d | 2015-04-08 12:54:32 -0700 | [diff] [blame] | 407 | #ifdef CONFIG_E1000 |
| 408 | e1000_initialize(bis); |
| 409 | #endif |
| 410 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 411 | #ifdef CONFIG_CI_UDC |
| 412 | /* For otg ethernet*/ |
| 413 | usb_eth_initialize(bis); |
| 414 | #endif |
| 415 | |
Tim Harvey | fc5ff94 | 2015-04-08 12:54:33 -0700 | [diff] [blame] | 416 | /* default to the first detected enet dev */ |
| 417 | if (!getenv("ethprime")) { |
| 418 | struct eth_device *dev = eth_get_dev_by_index(0); |
| 419 | if (dev) { |
| 420 | setenv("ethprime", dev->name); |
| 421 | printf("set ethprime to %s\n", getenv("ethprime")); |
| 422 | } |
| 423 | } |
| 424 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 425 | return 0; |
| 426 | } |
| 427 | |
Tim Harvey | fb64cc7 | 2014-04-25 15:39:07 -0700 | [diff] [blame] | 428 | #if defined(CONFIG_VIDEO_IPUV3) |
| 429 | |
| 430 | static void enable_hdmi(struct display_info_t const *dev) |
| 431 | { |
| 432 | imx_enable_hdmi_phy(); |
| 433 | } |
| 434 | |
| 435 | static int detect_i2c(struct display_info_t const *dev) |
| 436 | { |
| 437 | return i2c_set_bus_num(dev->bus) == 0 && |
| 438 | i2c_probe(dev->addr) == 0; |
| 439 | } |
| 440 | |
| 441 | static void enable_lvds(struct display_info_t const *dev) |
| 442 | { |
| 443 | struct iomuxc *iomux = (struct iomuxc *) |
| 444 | IOMUXC_BASE_ADDR; |
| 445 | |
| 446 | /* set CH0 data width to 24bit (IOMUXC_GPR2:5 0=18bit, 1=24bit) */ |
| 447 | u32 reg = readl(&iomux->gpr[2]); |
| 448 | reg |= IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT; |
| 449 | writel(reg, &iomux->gpr[2]); |
| 450 | |
| 451 | /* Enable Backlight */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 452 | SETUP_IOMUX_PAD(PAD_SD1_CMD__GPIO1_IO18 | DIO_PAD_CFG); |
Tim Harvey | fb64cc7 | 2014-04-25 15:39:07 -0700 | [diff] [blame] | 453 | gpio_direction_output(IMX_GPIO_NR(1, 18), 1); |
| 454 | } |
| 455 | |
| 456 | struct display_info_t const displays[] = {{ |
| 457 | /* HDMI Output */ |
| 458 | .bus = -1, |
| 459 | .addr = 0, |
| 460 | .pixfmt = IPU_PIX_FMT_RGB24, |
| 461 | .detect = detect_hdmi, |
| 462 | .enable = enable_hdmi, |
| 463 | .mode = { |
| 464 | .name = "HDMI", |
| 465 | .refresh = 60, |
| 466 | .xres = 1024, |
| 467 | .yres = 768, |
| 468 | .pixclock = 15385, |
| 469 | .left_margin = 220, |
| 470 | .right_margin = 40, |
| 471 | .upper_margin = 21, |
| 472 | .lower_margin = 7, |
| 473 | .hsync_len = 60, |
| 474 | .vsync_len = 10, |
| 475 | .sync = FB_SYNC_EXT, |
| 476 | .vmode = FB_VMODE_NONINTERLACED |
| 477 | } }, { |
| 478 | /* Freescale MXC-LVDS1: HannStar HSD100PXN1-A00 w/ egalx_ts cont */ |
| 479 | .bus = 2, |
| 480 | .addr = 0x4, |
| 481 | .pixfmt = IPU_PIX_FMT_LVDS666, |
| 482 | .detect = detect_i2c, |
| 483 | .enable = enable_lvds, |
| 484 | .mode = { |
| 485 | .name = "Hannstar-XGA", |
| 486 | .refresh = 60, |
| 487 | .xres = 1024, |
| 488 | .yres = 768, |
| 489 | .pixclock = 15385, |
| 490 | .left_margin = 220, |
| 491 | .right_margin = 40, |
| 492 | .upper_margin = 21, |
| 493 | .lower_margin = 7, |
| 494 | .hsync_len = 60, |
| 495 | .vsync_len = 10, |
| 496 | .sync = FB_SYNC_EXT, |
| 497 | .vmode = FB_VMODE_NONINTERLACED |
| 498 | } } }; |
| 499 | size_t display_count = ARRAY_SIZE(displays); |
| 500 | |
| 501 | static void setup_display(void) |
| 502 | { |
| 503 | struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; |
| 504 | struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; |
| 505 | int reg; |
| 506 | |
| 507 | enable_ipu_clock(); |
| 508 | imx_setup_hdmi(); |
| 509 | /* Turn on LDB0,IPU,IPU DI0 clocks */ |
| 510 | reg = __raw_readl(&mxc_ccm->CCGR3); |
| 511 | reg |= MXC_CCM_CCGR3_LDB_DI0_MASK; |
| 512 | writel(reg, &mxc_ccm->CCGR3); |
| 513 | |
| 514 | /* set LDB0, LDB1 clk select to 011/011 */ |
| 515 | reg = readl(&mxc_ccm->cs2cdr); |
| 516 | reg &= ~(MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_MASK |
| 517 | |MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_MASK); |
| 518 | reg |= (3<<MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_OFFSET) |
| 519 | |(3<<MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_OFFSET); |
| 520 | writel(reg, &mxc_ccm->cs2cdr); |
| 521 | |
| 522 | reg = readl(&mxc_ccm->cscmr2); |
| 523 | reg |= MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV; |
| 524 | writel(reg, &mxc_ccm->cscmr2); |
| 525 | |
| 526 | reg = readl(&mxc_ccm->chsccdr); |
| 527 | reg |= (CHSCCDR_CLK_SEL_LDB_DI0 |
| 528 | <<MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET); |
| 529 | writel(reg, &mxc_ccm->chsccdr); |
| 530 | |
| 531 | reg = IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES |
| 532 | |IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_HIGH |
| 533 | |IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW |
| 534 | |IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG |
| 535 | |IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT |
| 536 | |IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG |
| 537 | |IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT |
| 538 | |IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED |
| 539 | |IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0; |
| 540 | writel(reg, &iomux->gpr[2]); |
| 541 | |
| 542 | reg = readl(&iomux->gpr[3]); |
| 543 | reg = (reg & ~IOMUXC_GPR3_LVDS0_MUX_CTL_MASK) |
| 544 | | (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 |
| 545 | <<IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET); |
| 546 | writel(reg, &iomux->gpr[3]); |
| 547 | |
| 548 | /* Backlight CABEN on LVDS connector */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 549 | SETUP_IOMUX_PAD(PAD_SD2_CLK__GPIO1_IO10 | DIO_PAD_CFG); |
Tim Harvey | fb64cc7 | 2014-04-25 15:39:07 -0700 | [diff] [blame] | 550 | gpio_direction_output(IMX_GPIO_NR(1, 10), 0); |
| 551 | } |
| 552 | #endif /* CONFIG_VIDEO_IPUV3 */ |
| 553 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 554 | /* |
| 555 | * Baseboard specific GPIO |
| 556 | */ |
| 557 | |
| 558 | /* common to add baseboards */ |
| 559 | static iomux_v3_cfg_t const gw_gpio_pads[] = { |
| 560 | /* MSATA_EN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 561 | IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 562 | /* RS232_EN# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 563 | IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 564 | }; |
| 565 | |
| 566 | /* prototype */ |
| 567 | static iomux_v3_cfg_t const gwproto_gpio_pads[] = { |
| 568 | /* PANLEDG# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 569 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 570 | /* PANLEDR# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 571 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 572 | /* LOCLED# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 573 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 574 | /* RS485_EN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 575 | IOMUX_PADS(PAD_SD3_DAT4__GPIO7_IO01 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 576 | /* IOEXP_PWREN# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 577 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 578 | /* IOEXP_IRQ# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 579 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 580 | /* VID_EN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 581 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 582 | /* DIOI2C_DIS# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 583 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 584 | /* PCICK_SSON */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 585 | IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 586 | /* PCI_RST# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 587 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 588 | }; |
| 589 | |
| 590 | static iomux_v3_cfg_t const gw51xx_gpio_pads[] = { |
| 591 | /* PANLEDG# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 592 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 593 | /* PANLEDR# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 594 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 595 | /* IOEXP_PWREN# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 596 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 597 | /* IOEXP_IRQ# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 598 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 599 | |
| 600 | /* GPS_SHDN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 601 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 602 | /* VID_PWR */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 603 | IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 604 | /* PCI_RST# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 605 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 606 | /* PCIESKT_WDIS# */ |
| 607 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 608 | }; |
| 609 | |
| 610 | static iomux_v3_cfg_t const gw52xx_gpio_pads[] = { |
| 611 | /* PANLEDG# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 612 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 613 | /* PANLEDR# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 614 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 615 | /* IOEXP_PWREN# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 616 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 617 | /* IOEXP_IRQ# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 618 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 619 | |
| 620 | /* MX6_LOCLED# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 621 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 622 | /* GPS_SHDN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 623 | IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 624 | /* USBOTG_SEL */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 625 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 626 | /* VID_PWR */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 627 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 628 | /* PCI_RST# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 629 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 630 | /* PCIESKT_WDIS# */ |
| 631 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 632 | }; |
| 633 | |
| 634 | static iomux_v3_cfg_t const gw53xx_gpio_pads[] = { |
| 635 | /* PANLEDG# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 636 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 637 | /* PANLEDR# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 638 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 639 | /* MX6_LOCLED# */ |
| 640 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 641 | /* IOEXP_PWREN# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 642 | IOMUX_PADS(PAD_EIM_A19__GPIO2_IO19 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 643 | /* IOEXP_IRQ# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 644 | IOMUX_PADS(PAD_EIM_A20__GPIO2_IO18 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 2722ac3 | 2014-08-07 22:35:48 -0700 | [diff] [blame] | 645 | /* DIOI2C_DIS# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 646 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 647 | /* GPS_SHDN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 648 | IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 649 | /* VID_EN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 650 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 651 | /* PCI_RST# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 652 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 653 | /* PCIESKT_WDIS# */ |
| 654 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 655 | }; |
| 656 | |
| 657 | static iomux_v3_cfg_t const gw54xx_gpio_pads[] = { |
| 658 | /* PANLEDG# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 659 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 660 | /* PANLEDR# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 661 | IOMUX_PADS(PAD_KEY_COL2__GPIO4_IO10 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 662 | /* MX6_LOCLED# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 663 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 664 | /* MIPI_DIO */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 665 | IOMUX_PADS(PAD_SD1_DAT3__GPIO1_IO21 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 666 | /* RS485_EN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 667 | IOMUX_PADS(PAD_EIM_D24__GPIO3_IO24 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 668 | /* IOEXP_PWREN# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 669 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 670 | /* IOEXP_IRQ# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 671 | IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09 | MUX_PAD_CTRL(IRQ_PAD_CTRL)), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 672 | /* DIOI2C_DIS# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 673 | IOMUX_PADS(PAD_GPIO_19__GPIO4_IO05 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 674 | /* PCI_RST# */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 675 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
Tim Harvey | de1ef8e | 2014-08-07 22:35:46 -0700 | [diff] [blame] | 676 | /* VID_EN */ |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 677 | IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | DIO_PAD_CFG), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 678 | /* PCIESKT_WDIS# */ |
| 679 | IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 680 | }; |
| 681 | |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 682 | static iomux_v3_cfg_t const gw551x_gpio_pads[] = { |
| 683 | /* PANLED# */ |
| 684 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 685 | /* PCI_RST# */ |
| 686 | IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG), |
| 687 | /* PCIESKT_WDIS# */ |
| 688 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 689 | }; |
| 690 | |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 691 | static iomux_v3_cfg_t const gw552x_gpio_pads[] = { |
| 692 | /* PANLEDG# */ |
| 693 | IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG), |
| 694 | /* PANLEDR# */ |
| 695 | IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG), |
| 696 | /* MX6_LOCLED# */ |
| 697 | IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG), |
| 698 | /* PCI_RST# */ |
| 699 | IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | DIO_PAD_CFG), |
| 700 | /* MX6_DIO[4:9] */ |
| 701 | IOMUX_PADS(PAD_CSI0_PIXCLK__GPIO5_IO18 | DIO_PAD_CFG), |
| 702 | IOMUX_PADS(PAD_CSI0_DATA_EN__GPIO5_IO20 | DIO_PAD_CFG), |
| 703 | IOMUX_PADS(PAD_CSI0_VSYNC__GPIO5_IO21 | DIO_PAD_CFG), |
| 704 | IOMUX_PADS(PAD_CSI0_DAT4__GPIO5_IO22 | DIO_PAD_CFG), |
| 705 | IOMUX_PADS(PAD_CSI0_DAT5__GPIO5_IO23 | DIO_PAD_CFG), |
| 706 | IOMUX_PADS(PAD_CSI0_DAT7__GPIO5_IO25 | DIO_PAD_CFG), |
| 707 | /* PCIEGBE1_OFF# */ |
| 708 | IOMUX_PADS(PAD_GPIO_1__GPIO1_IO01 | DIO_PAD_CFG), |
| 709 | /* PCIEGBE2_OFF# */ |
| 710 | IOMUX_PADS(PAD_GPIO_2__GPIO1_IO02 | DIO_PAD_CFG), |
| 711 | /* PCIESKT_WDIS# */ |
| 712 | IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), |
| 713 | }; |
| 714 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 715 | /* |
| 716 | * each baseboard has 4 user configurable Digital IO lines which can |
| 717 | * be pinmuxed as a GPIO or in some cases a PWM |
| 718 | */ |
| 719 | struct dio_cfg { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 720 | iomux_v3_cfg_t gpio_padmux[2]; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 721 | unsigned gpio_param; |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 722 | iomux_v3_cfg_t pwm_padmux[2]; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 723 | unsigned pwm_param; |
| 724 | }; |
| 725 | |
| 726 | struct ventana { |
| 727 | /* pinmux */ |
| 728 | iomux_v3_cfg_t const *gpio_pads; |
| 729 | int num_pads; |
| 730 | /* DIO pinmux/val */ |
| 731 | struct dio_cfg dio_cfg[4]; |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 732 | int num_gpios; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 733 | /* various gpios (0 if non-existent) */ |
| 734 | int leds[3]; |
| 735 | int pcie_rst; |
| 736 | int mezz_pwren; |
| 737 | int mezz_irq; |
| 738 | int rs485en; |
| 739 | int gps_shdn; |
| 740 | int vidin_en; |
| 741 | int dioi2c_en; |
| 742 | int pcie_sson; |
| 743 | int usb_sel; |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 744 | int wdis; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 745 | }; |
| 746 | |
Tim Harvey | 8b92bdf | 2015-04-08 12:54:43 -0700 | [diff] [blame] | 747 | static struct ventana gpio_cfg[] = { |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 748 | /* GW5400proto */ |
| 749 | { |
| 750 | .gpio_pads = gw54xx_gpio_pads, |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 751 | .num_pads = ARRAY_SIZE(gw54xx_gpio_pads)/2, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 752 | .dio_cfg = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 753 | { |
| 754 | { IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09) }, |
| 755 | IMX_GPIO_NR(1, 9), |
| 756 | { IOMUX_PADS(PAD_GPIO_9__PWM1_OUT) }, |
| 757 | 1 |
| 758 | }, |
| 759 | { |
| 760 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 761 | IMX_GPIO_NR(1, 19), |
| 762 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 763 | 2 |
| 764 | }, |
| 765 | { |
| 766 | { IOMUX_PADS(PAD_SD4_DAT1__GPIO2_IO09) }, |
| 767 | IMX_GPIO_NR(2, 9), |
| 768 | { IOMUX_PADS(PAD_SD4_DAT1__PWM3_OUT) }, |
| 769 | 3 |
| 770 | }, |
| 771 | { |
| 772 | { IOMUX_PADS(PAD_SD4_DAT2__GPIO2_IO10) }, |
| 773 | IMX_GPIO_NR(2, 10), |
| 774 | { IOMUX_PADS(PAD_SD4_DAT2__PWM4_OUT) }, |
| 775 | 4 |
| 776 | }, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 777 | }, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 778 | .num_gpios = 4, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 779 | .leds = { |
| 780 | IMX_GPIO_NR(4, 6), |
| 781 | IMX_GPIO_NR(4, 10), |
| 782 | IMX_GPIO_NR(4, 15), |
| 783 | }, |
| 784 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 785 | .mezz_pwren = IMX_GPIO_NR(4, 7), |
| 786 | .mezz_irq = IMX_GPIO_NR(4, 9), |
| 787 | .rs485en = IMX_GPIO_NR(3, 24), |
| 788 | .dioi2c_en = IMX_GPIO_NR(4, 5), |
| 789 | .pcie_sson = IMX_GPIO_NR(1, 20), |
| 790 | }, |
| 791 | |
| 792 | /* GW51xx */ |
| 793 | { |
| 794 | .gpio_pads = gw51xx_gpio_pads, |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 795 | .num_pads = ARRAY_SIZE(gw51xx_gpio_pads)/2, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 796 | .dio_cfg = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 797 | { |
| 798 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 799 | IMX_GPIO_NR(1, 16), |
| 800 | { 0, 0 }, |
| 801 | 0 |
| 802 | }, |
| 803 | { |
| 804 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 805 | IMX_GPIO_NR(1, 19), |
| 806 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 807 | 2 |
| 808 | }, |
| 809 | { |
| 810 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 811 | IMX_GPIO_NR(1, 17), |
| 812 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 813 | 3 |
| 814 | }, |
| 815 | { |
| 816 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 817 | IMX_GPIO_NR(1, 18), |
| 818 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 819 | 4 |
| 820 | }, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 821 | }, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 822 | .num_gpios = 4, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 823 | .leds = { |
| 824 | IMX_GPIO_NR(4, 6), |
| 825 | IMX_GPIO_NR(4, 10), |
| 826 | }, |
| 827 | .pcie_rst = IMX_GPIO_NR(1, 0), |
| 828 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 829 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 830 | .gps_shdn = IMX_GPIO_NR(1, 2), |
| 831 | .vidin_en = IMX_GPIO_NR(5, 20), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 832 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 833 | }, |
| 834 | |
| 835 | /* GW52xx */ |
| 836 | { |
| 837 | .gpio_pads = gw52xx_gpio_pads, |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 838 | .num_pads = ARRAY_SIZE(gw52xx_gpio_pads)/2, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 839 | .dio_cfg = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 840 | { |
| 841 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 842 | IMX_GPIO_NR(1, 16), |
| 843 | { 0, 0 }, |
| 844 | 0 |
| 845 | }, |
| 846 | { |
| 847 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 848 | IMX_GPIO_NR(1, 19), |
| 849 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 850 | 2 |
| 851 | }, |
| 852 | { |
| 853 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 854 | IMX_GPIO_NR(1, 17), |
| 855 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 856 | 3 |
| 857 | }, |
| 858 | { |
| 859 | { IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 860 | IMX_GPIO_NR(1, 20), |
| 861 | { 0, 0 }, |
| 862 | 0 |
| 863 | }, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 864 | }, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 865 | .num_gpios = 4, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 866 | .leds = { |
| 867 | IMX_GPIO_NR(4, 6), |
| 868 | IMX_GPIO_NR(4, 7), |
| 869 | IMX_GPIO_NR(4, 15), |
| 870 | }, |
| 871 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 872 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 873 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 874 | .gps_shdn = IMX_GPIO_NR(1, 27), |
| 875 | .vidin_en = IMX_GPIO_NR(3, 31), |
| 876 | .usb_sel = IMX_GPIO_NR(1, 2), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 877 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 878 | }, |
| 879 | |
| 880 | /* GW53xx */ |
| 881 | { |
| 882 | .gpio_pads = gw53xx_gpio_pads, |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 883 | .num_pads = ARRAY_SIZE(gw53xx_gpio_pads)/2, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 884 | .dio_cfg = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 885 | { |
| 886 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 887 | IMX_GPIO_NR(1, 16), |
| 888 | { 0, 0 }, |
| 889 | 0 |
| 890 | }, |
| 891 | { |
| 892 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 893 | IMX_GPIO_NR(1, 19), |
| 894 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 895 | 2 |
| 896 | }, |
| 897 | { |
| 898 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 899 | IMX_GPIO_NR(1, 17), |
| 900 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 901 | 3 |
| 902 | }, |
| 903 | { |
| 904 | {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, |
| 905 | IMX_GPIO_NR(1, 20), |
| 906 | { 0, 0 }, |
| 907 | 0 |
| 908 | }, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 909 | }, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 910 | .num_gpios = 4, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 911 | .leds = { |
| 912 | IMX_GPIO_NR(4, 6), |
| 913 | IMX_GPIO_NR(4, 7), |
| 914 | IMX_GPIO_NR(4, 15), |
| 915 | }, |
| 916 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 917 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 918 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 919 | .gps_shdn = IMX_GPIO_NR(1, 27), |
| 920 | .vidin_en = IMX_GPIO_NR(3, 31), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 921 | .wdis = IMX_GPIO_NR(7, 12), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 922 | }, |
| 923 | |
| 924 | /* GW54xx */ |
| 925 | { |
| 926 | .gpio_pads = gw54xx_gpio_pads, |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 927 | .num_pads = ARRAY_SIZE(gw54xx_gpio_pads)/2, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 928 | .dio_cfg = { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 929 | { |
| 930 | { IOMUX_PADS(PAD_GPIO_9__GPIO1_IO09) }, |
| 931 | IMX_GPIO_NR(1, 9), |
| 932 | { IOMUX_PADS(PAD_GPIO_9__PWM1_OUT) }, |
| 933 | 1 |
| 934 | }, |
| 935 | { |
| 936 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 937 | IMX_GPIO_NR(1, 19), |
| 938 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 939 | 2 |
| 940 | }, |
| 941 | { |
| 942 | { IOMUX_PADS(PAD_SD4_DAT1__GPIO2_IO09) }, |
| 943 | IMX_GPIO_NR(2, 9), |
| 944 | { IOMUX_PADS(PAD_SD4_DAT1__PWM3_OUT) }, |
| 945 | 3 |
| 946 | }, |
| 947 | { |
| 948 | { IOMUX_PADS(PAD_SD4_DAT2__GPIO2_IO10) }, |
| 949 | IMX_GPIO_NR(2, 10), |
| 950 | { IOMUX_PADS(PAD_SD4_DAT2__PWM4_OUT) }, |
| 951 | 4 |
| 952 | }, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 953 | }, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 954 | .num_gpios = 4, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 955 | .leds = { |
| 956 | IMX_GPIO_NR(4, 6), |
| 957 | IMX_GPIO_NR(4, 7), |
| 958 | IMX_GPIO_NR(4, 15), |
| 959 | }, |
| 960 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 961 | .mezz_pwren = IMX_GPIO_NR(2, 19), |
| 962 | .mezz_irq = IMX_GPIO_NR(2, 18), |
| 963 | .rs485en = IMX_GPIO_NR(7, 1), |
| 964 | .vidin_en = IMX_GPIO_NR(3, 31), |
| 965 | .dioi2c_en = IMX_GPIO_NR(4, 5), |
| 966 | .pcie_sson = IMX_GPIO_NR(1, 20), |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 967 | .wdis = IMX_GPIO_NR(5, 17), |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 968 | }, |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 969 | |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 970 | /* GW551x */ |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 971 | { |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 972 | .gpio_pads = gw551x_gpio_pads, |
| 973 | .num_pads = ARRAY_SIZE(gw551x_gpio_pads)/2, |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 974 | .dio_cfg = { |
| 975 | { |
| 976 | { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, |
| 977 | IMX_GPIO_NR(1, 16), |
| 978 | { 0, 0 }, |
| 979 | 0 |
| 980 | }, |
| 981 | { |
| 982 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 983 | IMX_GPIO_NR(1, 19), |
| 984 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 985 | 2 |
| 986 | }, |
| 987 | { |
| 988 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 989 | IMX_GPIO_NR(1, 17), |
| 990 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 991 | 3 |
| 992 | }, |
| 993 | { |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 994 | { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, |
| 995 | IMX_GPIO_NR(1, 18), |
| 996 | { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, |
| 997 | 4 |
| 998 | }, |
| 999 | }, |
| 1000 | .num_gpios = 2, |
| 1001 | .leds = { |
| 1002 | IMX_GPIO_NR(4, 7), |
| 1003 | }, |
| 1004 | .pcie_rst = IMX_GPIO_NR(1, 0), |
| 1005 | .wdis = IMX_GPIO_NR(7, 12), |
| 1006 | }, |
| 1007 | |
| 1008 | /* GW552x */ |
| 1009 | { |
| 1010 | .gpio_pads = gw552x_gpio_pads, |
| 1011 | .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2, |
| 1012 | .dio_cfg = { |
| 1013 | { |
| 1014 | { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, |
| 1015 | IMX_GPIO_NR(1, 19), |
| 1016 | { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) }, |
| 1017 | 2 |
| 1018 | }, |
| 1019 | { |
| 1020 | { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) }, |
| 1021 | IMX_GPIO_NR(1, 17), |
| 1022 | { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, |
| 1023 | 3 |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 1024 | }, |
| 1025 | }, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 1026 | .num_gpios = 4, |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 1027 | .leds = { |
| 1028 | IMX_GPIO_NR(4, 6), |
| 1029 | IMX_GPIO_NR(4, 7), |
| 1030 | IMX_GPIO_NR(4, 15), |
| 1031 | }, |
| 1032 | .pcie_rst = IMX_GPIO_NR(1, 29), |
| 1033 | }, |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1034 | }; |
| 1035 | |
Tim Harvey | 0dff16f | 2014-05-05 08:22:25 -0700 | [diff] [blame] | 1036 | /* setup board specific PMIC */ |
| 1037 | int power_init_board(void) |
| 1038 | { |
| 1039 | struct pmic *p; |
| 1040 | u32 reg; |
| 1041 | |
| 1042 | /* configure PFUZE100 PMIC */ |
| 1043 | if (board_type == GW54xx || board_type == GW54proto) { |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1044 | power_pfuze100_init(CONFIG_I2C_PMIC); |
Fabio Estevam | b96df4f | 2014-08-01 08:50:03 -0300 | [diff] [blame] | 1045 | p = pmic_get("PFUZE100"); |
Tim Harvey | 0dff16f | 2014-05-05 08:22:25 -0700 | [diff] [blame] | 1046 | if (p && !pmic_probe(p)) { |
| 1047 | pmic_reg_read(p, PFUZE100_DEVICEID, ®); |
| 1048 | printf("PMIC: PFUZE100 ID=0x%02x\n", reg); |
| 1049 | |
| 1050 | /* Set VGEN1 to 1.5V and enable */ |
| 1051 | pmic_reg_read(p, PFUZE100_VGEN1VOL, ®); |
| 1052 | reg &= ~(LDO_VOL_MASK); |
| 1053 | reg |= (LDOA_1_50V | LDO_EN); |
| 1054 | pmic_reg_write(p, PFUZE100_VGEN1VOL, reg); |
| 1055 | |
| 1056 | /* Set SWBST to 5.0V and enable */ |
| 1057 | pmic_reg_read(p, PFUZE100_SWBSTCON1, ®); |
| 1058 | reg &= ~(SWBST_MODE_MASK | SWBST_VOL_MASK); |
| 1059 | reg |= (SWBST_5_00V | SWBST_MODE_AUTO); |
| 1060 | pmic_reg_write(p, PFUZE100_SWBSTCON1, reg); |
| 1061 | } |
| 1062 | } |
| 1063 | |
| 1064 | /* configure LTC3676 PMIC */ |
| 1065 | else { |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1066 | power_ltc3676_init(CONFIG_I2C_PMIC); |
Tim Harvey | 0dff16f | 2014-05-05 08:22:25 -0700 | [diff] [blame] | 1067 | p = pmic_get("LTC3676_PMIC"); |
| 1068 | if (p && !pmic_probe(p)) { |
| 1069 | puts("PMIC: LTC3676\n"); |
Tim Harvey | 6e0b504 | 2015-04-08 12:54:38 -0700 | [diff] [blame] | 1070 | /* |
| 1071 | * set board-specific scalar for max CPU frequency |
| 1072 | * per CPU based on the LDO enabled Operating Ranges |
| 1073 | * defined in the respective IMX6DQ and IMX6SDL |
| 1074 | * datasheets. The voltage resulting from the R1/R2 |
| 1075 | * feedback inputs on Ventana is 1308mV. Note that this |
| 1076 | * is a bit shy of the Vmin of 1350mV in the datasheet |
| 1077 | * for LDO enabled mode but is as high as we can go. |
| 1078 | * |
| 1079 | * We will rely on an OS kernel driver to properly |
| 1080 | * regulate these per CPU operating point and use LDO |
| 1081 | * bypass mode when using the higher frequency |
| 1082 | * operating points to compensate as LDO bypass mode |
| 1083 | * allows the rails be 125mV lower. |
| 1084 | */ |
| 1085 | /* mask PGOOD during SW1 transition */ |
| 1086 | pmic_reg_write(p, LTC3676_DVB1B, |
| 1087 | 0x1f | LTC3676_PGOOD_MASK); |
| 1088 | /* set SW1 (VDD_SOC) */ |
| 1089 | pmic_reg_write(p, LTC3676_DVB1A, 0x1f); |
Tim Harvey | 0dff16f | 2014-05-05 08:22:25 -0700 | [diff] [blame] | 1090 | |
Tim Harvey | 6e0b504 | 2015-04-08 12:54:38 -0700 | [diff] [blame] | 1091 | /* mask PGOOD during SW3 transition */ |
| 1092 | pmic_reg_write(p, LTC3676_DVB3B, |
| 1093 | 0x1f | LTC3676_PGOOD_MASK); |
| 1094 | /* set SW3 (VDD_ARM) */ |
| 1095 | pmic_reg_write(p, LTC3676_DVB3A, 0x1f); |
Tim Harvey | 0dff16f | 2014-05-05 08:22:25 -0700 | [diff] [blame] | 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | return 0; |
| 1100 | } |
| 1101 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1102 | /* setup GPIO pinmux and default configuration per baseboard */ |
| 1103 | static void setup_board_gpio(int board) |
| 1104 | { |
| 1105 | struct ventana_board_info *info = &ventana_info; |
| 1106 | const char *s; |
| 1107 | char arg[10]; |
| 1108 | size_t len; |
| 1109 | int i; |
| 1110 | int quiet = simple_strtol(getenv("quiet"), NULL, 10); |
| 1111 | |
| 1112 | if (board >= GW_UNKNOWN) |
| 1113 | return; |
| 1114 | |
| 1115 | /* RS232_EN# */ |
| 1116 | gpio_direction_output(GP_RS232_EN, (hwconfig("rs232")) ? 0 : 1); |
| 1117 | |
| 1118 | /* MSATA Enable */ |
| 1119 | if (is_cpu_type(MXC_CPU_MX6Q) && |
| 1120 | test_bit(EECONFIG_SATA, info->config)) { |
| 1121 | gpio_direction_output(GP_MSATA_SEL, |
| 1122 | (hwconfig("msata")) ? 1 : 0); |
| 1123 | } else { |
| 1124 | gpio_direction_output(GP_MSATA_SEL, 0); |
| 1125 | } |
| 1126 | |
Tim Harvey | 6b0efae | 2014-08-07 22:35:51 -0700 | [diff] [blame] | 1127 | #if !defined(CONFIG_CMD_PCI) |
| 1128 | /* assert PCI_RST# (released by OS when clock is valid) */ |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1129 | gpio_direction_output(gpio_cfg[board].pcie_rst, 0); |
Tim Harvey | 6b0efae | 2014-08-07 22:35:51 -0700 | [diff] [blame] | 1130 | #endif |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1131 | |
| 1132 | /* turn off (active-high) user LED's */ |
Thierry Reding | 7fcdf28 | 2014-08-22 09:46:35 +0200 | [diff] [blame] | 1133 | for (i = 0; i < ARRAY_SIZE(gpio_cfg[board].leds); i++) { |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1134 | if (gpio_cfg[board].leds[i]) |
| 1135 | gpio_direction_output(gpio_cfg[board].leds[i], 1); |
| 1136 | } |
| 1137 | |
| 1138 | /* Expansion Mezzanine IO */ |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 1139 | if (gpio_cfg[board].mezz_pwren) |
| 1140 | gpio_direction_output(gpio_cfg[board].mezz_pwren, 0); |
| 1141 | if (gpio_cfg[board].mezz_irq) |
| 1142 | gpio_direction_input(gpio_cfg[board].mezz_irq); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1143 | |
| 1144 | /* RS485 Transmit Enable */ |
| 1145 | if (gpio_cfg[board].rs485en) |
| 1146 | gpio_direction_output(gpio_cfg[board].rs485en, 0); |
| 1147 | |
| 1148 | /* GPS_SHDN */ |
| 1149 | if (gpio_cfg[board].gps_shdn) |
| 1150 | gpio_direction_output(gpio_cfg[board].gps_shdn, 1); |
| 1151 | |
| 1152 | /* Analog video codec power enable */ |
| 1153 | if (gpio_cfg[board].vidin_en) |
| 1154 | gpio_direction_output(gpio_cfg[board].vidin_en, 1); |
| 1155 | |
| 1156 | /* DIOI2C_DIS# */ |
| 1157 | if (gpio_cfg[board].dioi2c_en) |
| 1158 | gpio_direction_output(gpio_cfg[board].dioi2c_en, 0); |
| 1159 | |
| 1160 | /* PCICK_SSON: disable spread-spectrum clock */ |
| 1161 | if (gpio_cfg[board].pcie_sson) |
| 1162 | gpio_direction_output(gpio_cfg[board].pcie_sson, 0); |
| 1163 | |
| 1164 | /* USBOTG Select (PCISKT or FrontPanel) */ |
| 1165 | if (gpio_cfg[board].usb_sel) |
Tim Harvey | 46eadeb | 2015-04-08 12:54:35 -0700 | [diff] [blame] | 1166 | gpio_direction_output(gpio_cfg[board].usb_sel, |
| 1167 | (hwconfig("usb_pcisel")) ? 1 : 0); |
| 1168 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1169 | |
Tim Harvey | b6eb1d5 | 2014-08-07 22:35:50 -0700 | [diff] [blame] | 1170 | /* PCISKT_WDIS# (Wireless disable GPIO to miniPCIe sockets) */ |
| 1171 | if (gpio_cfg[board].wdis) |
| 1172 | gpio_direction_output(gpio_cfg[board].wdis, 1); |
| 1173 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1174 | /* |
| 1175 | * Configure DIO pinmux/padctl registers |
| 1176 | * see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions |
| 1177 | */ |
| 1178 | for (i = 0; i < 4; i++) { |
| 1179 | struct dio_cfg *cfg = &gpio_cfg[board].dio_cfg[i]; |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 1180 | iomux_v3_cfg_t ctrl = DIO_PAD_CFG; |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1181 | unsigned cputype = is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1182 | |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 1183 | if (!cfg->gpio_padmux[0] && !cfg->gpio_padmux[1]) |
| 1184 | continue; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1185 | sprintf(arg, "dio%d", i); |
| 1186 | if (!hwconfig(arg)) |
| 1187 | continue; |
| 1188 | s = hwconfig_subarg(arg, "padctrl", &len); |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 1189 | if (s) { |
| 1190 | ctrl = MUX_PAD_CTRL(simple_strtoul(s, NULL, 16) |
| 1191 | & 0x1ffff) | MUX_MODE_SION; |
| 1192 | } |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1193 | if (hwconfig_subarg_cmp(arg, "mode", "gpio")) { |
| 1194 | if (!quiet) { |
| 1195 | printf("DIO%d: GPIO%d_IO%02d (gpio-%d)\n", i, |
| 1196 | (cfg->gpio_param/32)+1, |
| 1197 | cfg->gpio_param%32, |
| 1198 | cfg->gpio_param); |
| 1199 | } |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1200 | imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] | |
Tim Harvey | 2699336 | 2014-08-07 22:35:49 -0700 | [diff] [blame] | 1201 | ctrl); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1202 | gpio_direction_input(cfg->gpio_param); |
| 1203 | } else if (hwconfig_subarg_cmp("dio2", "mode", "pwm") && |
| 1204 | cfg->pwm_padmux) { |
| 1205 | if (!quiet) |
| 1206 | printf("DIO%d: pwm%d\n", i, cfg->pwm_param); |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1207 | imx_iomux_v3_setup_pad(cfg->pwm_padmux[cputype] | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1208 | MUX_PAD_CTRL(ctrl)); |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | if (!quiet) { |
| 1213 | if (is_cpu_type(MXC_CPU_MX6Q) && |
| 1214 | (test_bit(EECONFIG_SATA, info->config))) { |
| 1215 | printf("MSATA: %s\n", (hwconfig("msata") ? |
| 1216 | "enabled" : "disabled")); |
| 1217 | } |
| 1218 | printf("RS232: %s\n", (hwconfig("rs232")) ? |
| 1219 | "enabled" : "disabled"); |
| 1220 | } |
| 1221 | } |
| 1222 | |
| 1223 | #if defined(CONFIG_CMD_PCI) |
| 1224 | int imx6_pcie_toggle_reset(void) |
| 1225 | { |
| 1226 | if (board_type < GW_UNKNOWN) { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1227 | uint pin = gpio_cfg[board_type].pcie_rst; |
| 1228 | gpio_direction_output(pin, 0); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1229 | mdelay(50); |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1230 | gpio_direction_output(pin, 1); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1231 | } |
| 1232 | return 0; |
| 1233 | } |
Tim Harvey | 33791d5 | 2014-08-07 22:49:57 -0700 | [diff] [blame] | 1234 | |
| 1235 | /* |
| 1236 | * Most Ventana boards have a PLX PEX860x PCIe switch onboard and use its |
| 1237 | * GPIO's as PERST# signals for its downstream ports - configure the GPIO's |
| 1238 | * properly and assert reset for 100ms. |
| 1239 | */ |
| 1240 | void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev, |
| 1241 | unsigned short vendor, unsigned short device, |
| 1242 | unsigned short class) |
| 1243 | { |
| 1244 | u32 dw; |
| 1245 | |
| 1246 | debug("%s: %02d:%02d.%02d: %04x:%04x\n", __func__, |
| 1247 | PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), vendor, device); |
| 1248 | if (vendor == PCI_VENDOR_ID_PLX && |
| 1249 | (device & 0xfff0) == 0x8600 && |
| 1250 | PCI_DEV(dev) == 0 && PCI_FUNC(dev) == 0) { |
| 1251 | debug("configuring PLX 860X downstream PERST#\n"); |
| 1252 | pci_hose_read_config_dword(hose, dev, 0x62c, &dw); |
| 1253 | dw |= 0xaaa8; /* GPIO1-7 outputs */ |
| 1254 | pci_hose_write_config_dword(hose, dev, 0x62c, dw); |
| 1255 | |
| 1256 | pci_hose_read_config_dword(hose, dev, 0x644, &dw); |
| 1257 | dw |= 0xfe; /* GPIO1-7 output high */ |
| 1258 | pci_hose_write_config_dword(hose, dev, 0x644, dw); |
| 1259 | |
| 1260 | mdelay(100); |
| 1261 | } |
| 1262 | } |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1263 | #endif /* CONFIG_CMD_PCI */ |
| 1264 | |
| 1265 | #ifdef CONFIG_SERIAL_TAG |
| 1266 | /* |
| 1267 | * called when setting up ATAGS before booting kernel |
| 1268 | * populate serialnum from the following (in order of priority): |
| 1269 | * serial# env var |
| 1270 | * eeprom |
| 1271 | */ |
| 1272 | void get_board_serial(struct tag_serialnr *serialnr) |
| 1273 | { |
| 1274 | char *serial = getenv("serial#"); |
| 1275 | |
| 1276 | if (serial) { |
| 1277 | serialnr->high = 0; |
| 1278 | serialnr->low = simple_strtoul(serial, NULL, 10); |
| 1279 | } else if (ventana_info.model[0]) { |
| 1280 | serialnr->high = 0; |
| 1281 | serialnr->low = ventana_info.serial; |
| 1282 | } else { |
| 1283 | serialnr->high = 0; |
| 1284 | serialnr->low = 0; |
| 1285 | } |
| 1286 | } |
| 1287 | #endif |
| 1288 | |
| 1289 | /* |
| 1290 | * Board Support |
| 1291 | */ |
| 1292 | |
Tim Harvey | bfa2dae | 2014-06-02 16:13:27 -0700 | [diff] [blame] | 1293 | /* called from SPL board_init_f() */ |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1294 | int board_early_init_f(void) |
| 1295 | { |
| 1296 | setup_iomux_uart(); |
| 1297 | gpio_direction_output(GP_USB_OTG_PWR, 0); /* OTG power off */ |
| 1298 | |
Tim Harvey | fb64cc7 | 2014-04-25 15:39:07 -0700 | [diff] [blame] | 1299 | #if defined(CONFIG_VIDEO_IPUV3) |
| 1300 | setup_display(); |
| 1301 | #endif |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1302 | return 0; |
| 1303 | } |
| 1304 | |
| 1305 | int dram_init(void) |
| 1306 | { |
Tim Harvey | bfa2dae | 2014-06-02 16:13:27 -0700 | [diff] [blame] | 1307 | gd->ram_size = imx_ddr_size(); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1308 | return 0; |
| 1309 | } |
| 1310 | |
| 1311 | int board_init(void) |
| 1312 | { |
Fabio Estevam | ceb74c4 | 2014-07-09 17:59:54 -0300 | [diff] [blame] | 1313 | struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1314 | |
| 1315 | clrsetbits_le32(&iomuxc_regs->gpr[1], |
| 1316 | IOMUXC_GPR1_OTG_ID_MASK, |
| 1317 | IOMUXC_GPR1_OTG_ID_GPIO1); |
| 1318 | |
| 1319 | /* address of linux boot parameters */ |
| 1320 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 1321 | |
| 1322 | #ifdef CONFIG_CMD_NAND |
| 1323 | setup_gpmi_nand(); |
| 1324 | #endif |
| 1325 | #ifdef CONFIG_MXC_SPI |
| 1326 | setup_spi(); |
| 1327 | #endif |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1328 | if (is_cpu_type(MXC_CPU_MX6Q)) { |
| 1329 | setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info0); |
| 1330 | setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info1); |
| 1331 | setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info2); |
| 1332 | } else { |
| 1333 | setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info0); |
| 1334 | setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info1); |
| 1335 | setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info2); |
| 1336 | } |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1337 | |
| 1338 | #ifdef CONFIG_CMD_SATA |
| 1339 | setup_sata(); |
| 1340 | #endif |
| 1341 | /* read Gateworks EEPROM into global struct (used later) */ |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1342 | board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1343 | |
| 1344 | /* board-specifc GPIO iomux */ |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1345 | SETUP_IOMUX_PADS(gw_gpio_pads); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1346 | if (board_type < GW_UNKNOWN) { |
Tim Harvey | 02fb592 | 2014-06-02 16:13:26 -0700 | [diff] [blame] | 1347 | iomux_v3_cfg_t const *p = gpio_cfg[board_type].gpio_pads; |
| 1348 | int count = gpio_cfg[board_type].num_pads; |
| 1349 | |
| 1350 | imx_iomux_v3_setup_multiple_pads(p, count); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1351 | } |
| 1352 | |
| 1353 | return 0; |
| 1354 | } |
| 1355 | |
| 1356 | #if defined(CONFIG_DISPLAY_BOARDINFO_LATE) |
| 1357 | /* |
| 1358 | * called during late init (after relocation and after board_init()) |
| 1359 | * by virtue of CONFIG_DISPLAY_BOARDINFO_LATE as we needed i2c initialized and |
| 1360 | * EEPROM read. |
| 1361 | */ |
| 1362 | int checkboard(void) |
| 1363 | { |
| 1364 | struct ventana_board_info *info = &ventana_info; |
| 1365 | unsigned char buf[4]; |
| 1366 | const char *p; |
| 1367 | int quiet; /* Quiet or minimal output mode */ |
| 1368 | |
| 1369 | quiet = 0; |
| 1370 | p = getenv("quiet"); |
| 1371 | if (p) |
| 1372 | quiet = simple_strtol(p, NULL, 10); |
| 1373 | else |
| 1374 | setenv("quiet", "0"); |
| 1375 | |
| 1376 | puts("\nGateworks Corporation Copyright 2014\n"); |
| 1377 | if (info->model[0]) { |
| 1378 | printf("Model: %s\n", info->model); |
| 1379 | printf("MFGDate: %02x-%02x-%02x%02x\n", |
| 1380 | info->mfgdate[0], info->mfgdate[1], |
| 1381 | info->mfgdate[2], info->mfgdate[3]); |
| 1382 | printf("Serial:%d\n", info->serial); |
| 1383 | } else { |
| 1384 | puts("Invalid EEPROM - board will not function fully\n"); |
| 1385 | } |
| 1386 | if (quiet) |
| 1387 | return 0; |
| 1388 | |
| 1389 | /* Display GSC firmware revision/CRC/status */ |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1390 | i2c_set_bus_num(CONFIG_I2C_GSC); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1391 | if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_FWVER, 1, buf, 1)) { |
| 1392 | printf("GSC: v%d", buf[0]); |
| 1393 | if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_STATUS, 1, buf, 4)) { |
| 1394 | printf(" 0x%04x", buf[2] | buf[3]<<8); /* CRC */ |
| 1395 | printf(" 0x%02x", buf[0]); /* irq status */ |
| 1396 | } |
| 1397 | puts("\n"); |
| 1398 | } |
| 1399 | /* Display RTC */ |
| 1400 | if (!gsc_i2c_read(GSC_RTC_ADDR, 0x00, 1, buf, 4)) { |
| 1401 | printf("RTC: %d\n", |
| 1402 | buf[0] | buf[1]<<8 | buf[2]<<16 | buf[3]<<24); |
| 1403 | } |
| 1404 | |
| 1405 | return 0; |
| 1406 | } |
| 1407 | #endif |
| 1408 | |
| 1409 | #ifdef CONFIG_CMD_BMODE |
| 1410 | /* |
| 1411 | * BOOT_CFG1, BOOT_CFG2, BOOT_CFG3, BOOT_CFG4 |
| 1412 | * see Table 8-11 and Table 5-9 |
| 1413 | * BOOT_CFG1[7] = 1 (boot from NAND) |
| 1414 | * BOOT_CFG1[5] = 0 - raw NAND |
| 1415 | * BOOT_CFG1[4] = 0 - default pad settings |
| 1416 | * BOOT_CFG1[3:2] = 00 - devices = 1 |
| 1417 | * BOOT_CFG1[1:0] = 00 - Row Address Cycles = 3 |
| 1418 | * BOOT_CFG2[4:3] = 00 - Boot Search Count = 2 |
| 1419 | * BOOT_CFG2[2:1] = 01 - Pages In Block = 64 |
| 1420 | * BOOT_CFG2[0] = 0 - Reset time 12ms |
| 1421 | */ |
| 1422 | static const struct boot_mode board_boot_modes[] = { |
| 1423 | /* NAND: 64pages per block, 3 row addr cycles, 2 copies of FCB/DBBT */ |
| 1424 | { "nand", MAKE_CFGVAL(0x80, 0x02, 0x00, 0x00) }, |
| 1425 | { NULL, 0 }, |
| 1426 | }; |
| 1427 | #endif |
| 1428 | |
| 1429 | /* late init */ |
| 1430 | int misc_init_r(void) |
| 1431 | { |
| 1432 | struct ventana_board_info *info = &ventana_info; |
| 1433 | unsigned char reg; |
| 1434 | |
| 1435 | /* set env vars based on EEPROM data */ |
| 1436 | if (ventana_info.model[0]) { |
| 1437 | char str[16], fdt[36]; |
| 1438 | char *p; |
| 1439 | const char *cputype = ""; |
| 1440 | int i; |
| 1441 | |
| 1442 | /* |
| 1443 | * FDT name will be prefixed with CPU type. Three versions |
| 1444 | * will be created each increasingly generic and bootloader |
| 1445 | * env scripts will try loading each from most specific to |
| 1446 | * least. |
| 1447 | */ |
Tim Harvey | bfa2dae | 2014-06-02 16:13:27 -0700 | [diff] [blame] | 1448 | if (is_cpu_type(MXC_CPU_MX6Q) || |
| 1449 | is_cpu_type(MXC_CPU_MX6D)) |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1450 | cputype = "imx6q"; |
Tim Harvey | bfa2dae | 2014-06-02 16:13:27 -0700 | [diff] [blame] | 1451 | else if (is_cpu_type(MXC_CPU_MX6DL) || |
| 1452 | is_cpu_type(MXC_CPU_MX6SOLO)) |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1453 | cputype = "imx6dl"; |
Tim Harvey | bf94258 | 2014-08-07 22:35:42 -0700 | [diff] [blame] | 1454 | setenv("soctype", cputype); |
Tim Harvey | 06d8743 | 2014-08-07 22:35:41 -0700 | [diff] [blame] | 1455 | if (8 << (ventana_info.nand_flash_size-1) >= 2048) |
| 1456 | setenv("flash_layout", "large"); |
| 1457 | else |
| 1458 | setenv("flash_layout", "normal"); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1459 | memset(str, 0, sizeof(str)); |
| 1460 | for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++) |
| 1461 | str[i] = tolower(info->model[i]); |
| 1462 | if (!getenv("model")) |
| 1463 | setenv("model", str); |
| 1464 | if (!getenv("fdt_file")) { |
| 1465 | sprintf(fdt, "%s-%s.dtb", cputype, str); |
| 1466 | setenv("fdt_file", fdt); |
| 1467 | } |
| 1468 | p = strchr(str, '-'); |
| 1469 | if (p) { |
| 1470 | *p++ = 0; |
| 1471 | |
| 1472 | setenv("model_base", str); |
| 1473 | if (!getenv("fdt_file1")) { |
| 1474 | sprintf(fdt, "%s-%s.dtb", cputype, str); |
| 1475 | setenv("fdt_file1", fdt); |
| 1476 | } |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame^] | 1477 | if (board_type != GW551x && board_type != GW552x) |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 1478 | str[4] = 'x'; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1479 | str[5] = 'x'; |
| 1480 | str[6] = 0; |
| 1481 | if (!getenv("fdt_file2")) { |
| 1482 | sprintf(fdt, "%s-%s.dtb", cputype, str); |
| 1483 | setenv("fdt_file2", fdt); |
| 1484 | } |
| 1485 | } |
| 1486 | |
| 1487 | /* initialize env from EEPROM */ |
| 1488 | if (test_bit(EECONFIG_ETH0, info->config) && |
| 1489 | !getenv("ethaddr")) { |
| 1490 | eth_setenv_enetaddr("ethaddr", info->mac0); |
| 1491 | } |
| 1492 | if (test_bit(EECONFIG_ETH1, info->config) && |
| 1493 | !getenv("eth1addr")) { |
| 1494 | eth_setenv_enetaddr("eth1addr", info->mac1); |
| 1495 | } |
| 1496 | |
| 1497 | /* board serial-number */ |
| 1498 | sprintf(str, "%6d", info->serial); |
| 1499 | setenv("serial#", str); |
| 1500 | } |
| 1501 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1502 | |
| 1503 | /* setup baseboard specific GPIO pinmux and config */ |
| 1504 | setup_board_gpio(board_type); |
| 1505 | |
| 1506 | #ifdef CONFIG_CMD_BMODE |
| 1507 | add_board_boot_modes(board_boot_modes); |
| 1508 | #endif |
| 1509 | |
| 1510 | /* |
| 1511 | * The Gateworks System Controller implements a boot |
| 1512 | * watchdog (always enabled) as a workaround for IMX6 boot related |
| 1513 | * errata such as: |
Tim Harvey | 2be6614 | 2014-08-20 23:30:36 -0700 | [diff] [blame] | 1514 | * ERR005768 - no fix scheduled |
| 1515 | * ERR006282 - fixed in silicon r1.2 |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1516 | * ERR007117 - fixed in silicon r1.3 |
| 1517 | * ERR007220 - fixed in silicon r1.3 |
Tim Harvey | 2be6614 | 2014-08-20 23:30:36 -0700 | [diff] [blame] | 1518 | * ERR007926 - no fix scheduled |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1519 | * see http://cache.freescale.com/files/32bit/doc/errata/IMX6DQCE.pdf |
| 1520 | * |
| 1521 | * Disable the boot watchdog and display/clear the timeout flag if set |
| 1522 | */ |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1523 | i2c_set_bus_num(CONFIG_I2C_GSC); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1524 | if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, ®, 1)) { |
| 1525 | reg |= (1 << GSC_SC_CTRL1_WDDIS); |
| 1526 | if (gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, 1, ®, 1)) |
| 1527 | puts("Error: could not disable GSC Watchdog\n"); |
| 1528 | } else { |
| 1529 | puts("Error: could not disable GSC Watchdog\n"); |
| 1530 | } |
| 1531 | if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_STATUS, 1, ®, 1)) { |
| 1532 | if (reg & (1 << GSC_SC_IRQ_WATCHDOG)) { /* watchdog timeout */ |
Tim Harvey | fc3883a | 2014-08-07 22:35:47 -0700 | [diff] [blame] | 1533 | puts("GSC boot watchdog timeout detected\n"); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1534 | reg &= ~(1 << GSC_SC_IRQ_WATCHDOG); /* clear flag */ |
| 1535 | gsc_i2c_write(GSC_SC_ADDR, GSC_SC_STATUS, 1, ®, 1); |
| 1536 | } |
| 1537 | } |
| 1538 | |
| 1539 | return 0; |
| 1540 | } |
| 1541 | |
| 1542 | #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) |
| 1543 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1544 | /* |
| 1545 | * called prior to booting kernel or by 'fdt boardsetup' command |
| 1546 | * |
| 1547 | * unless 'fdt_noauto' env var is set we will update the following in the DTB: |
| 1548 | * - mtd partitions based on mtdparts/mtdids env |
| 1549 | * - system-serial (board serial num from EEPROM) |
| 1550 | * - board (full model from EEPROM) |
| 1551 | * - peripherals removed from DTB if not loaded on board (per EEPROM config) |
| 1552 | */ |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 1553 | int ft_board_setup(void *blob, bd_t *bd) |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1554 | { |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1555 | struct ventana_board_info *info = &ventana_info; |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1556 | struct ventana_eeprom_config *cfg; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1557 | struct node_info nodes[] = { |
| 1558 | { "sst,w25q256", MTD_DEV_TYPE_NOR, }, /* SPI flash */ |
| 1559 | { "fsl,imx6q-gpmi-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */ |
| 1560 | }; |
| 1561 | const char *model = getenv("model"); |
Tim Harvey | 16e0eae | 2015-04-08 12:54:44 -0700 | [diff] [blame] | 1562 | int i; |
| 1563 | char rev = 0; |
| 1564 | |
| 1565 | /* determine board revision */ |
| 1566 | for (i = sizeof(ventana_info.model) - 1; i > 0; i--) { |
| 1567 | if (ventana_info.model[i] >= 'A') { |
| 1568 | rev = ventana_info.model[i]; |
| 1569 | break; |
| 1570 | } |
| 1571 | } |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1572 | |
| 1573 | if (getenv("fdt_noauto")) { |
| 1574 | puts(" Skiping ft_board_setup (fdt_noauto defined)\n"); |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 1575 | return 0; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1576 | } |
| 1577 | |
| 1578 | /* Update partition nodes using info from mtdparts env var */ |
| 1579 | puts(" Updating MTD partitions...\n"); |
| 1580 | fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); |
| 1581 | |
| 1582 | if (!model) { |
| 1583 | puts("invalid board info: Leaving FDT fully enabled\n"); |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 1584 | return 0; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1585 | } |
| 1586 | printf(" Adjusting FDT per EEPROM for %s...\n", model); |
| 1587 | |
| 1588 | /* board serial number */ |
| 1589 | fdt_setprop(blob, 0, "system-serial", getenv("serial#"), |
Tim Harvey | ae35ded | 2014-04-25 09:18:33 -0700 | [diff] [blame] | 1590 | strlen(getenv("serial#")) + 1); |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1591 | |
| 1592 | /* board (model contains model from device-tree) */ |
| 1593 | fdt_setprop(blob, 0, "board", info->model, |
| 1594 | strlen((const char *)info->model) + 1); |
| 1595 | |
| 1596 | /* |
Tim Harvey | 16e0eae | 2015-04-08 12:54:44 -0700 | [diff] [blame] | 1597 | * disable wdog1/wdog2 nodes for GW51xx below revC to work around |
| 1598 | * errata causing wdog timer to be unreliable. |
| 1599 | */ |
| 1600 | if (board_type == GW51xx && rev >= 'A' && rev < 'C') { |
| 1601 | i = fdt_path_offset(blob, |
| 1602 | "/soc/aips-bus@02000000/wdog@020bc000"); |
| 1603 | if (i) |
| 1604 | fdt_status_disabled(blob, i); |
| 1605 | } |
| 1606 | |
| 1607 | /* |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1608 | * Peripheral Config: |
| 1609 | * remove nodes by alias path if EEPROM config tells us the |
| 1610 | * peripheral is not loaded on the board. |
| 1611 | */ |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1612 | if (getenv("fdt_noconfig")) { |
| 1613 | puts(" Skiping periperhal config (fdt_noconfig defined)\n"); |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 1614 | return 0; |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 1615 | } |
| 1616 | cfg = econfig; |
| 1617 | while (cfg->name) { |
| 1618 | if (!test_bit(cfg->bit, info->config)) { |
| 1619 | fdt_del_node_and_alias(blob, cfg->dtalias ? |
| 1620 | cfg->dtalias : cfg->name); |
| 1621 | } |
| 1622 | cfg++; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1623 | } |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 1624 | |
| 1625 | return 0; |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 1626 | } |
| 1627 | #endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */ |
| 1628 | |