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