Commit 3ddc0dd0011ea1448191ecb2461ed9a0ff7bf387

Authored by guoyin.chen
1 parent 18aff32789

MA-5830 Align Fastboot NAND config with bootloader partition 64M

Align the "MLK-9918: Reserve more space in uboot partition for NAND boot configurations"
to enlarge the bootloader partition to be 64M

Signed-off-by: guoyin.chen <guoyin.chen@freescale.com>

Showing 4 changed files with 10 additions and 4 deletions Inline Diff

board/freescale/mx6qsabreauto/mx6qsabreauto.c
1 /* 1 /*
2 * Copyright (C) 2012-2014 Freescale Semiconductor, Inc. 2 * Copyright (C) 2012-2014 Freescale Semiconductor, Inc.
3 * 3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com> 4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 * 5 *
6 * SPDX-License-Identifier: GPL-2.0+ 6 * SPDX-License-Identifier: GPL-2.0+
7 */ 7 */
8 8
9 #include <common.h> 9 #include <common.h>
10 #include <asm/io.h> 10 #include <asm/io.h>
11 #include <asm/arch/clock.h> 11 #include <asm/arch/clock.h>
12 #include <asm/arch/imx-regs.h> 12 #include <asm/arch/imx-regs.h>
13 #include <asm/arch/iomux.h> 13 #include <asm/arch/iomux.h>
14 #include <asm/arch/mx6-pins.h> 14 #include <asm/arch/mx6-pins.h>
15 #include <asm/arch/crm_regs.h> 15 #include <asm/arch/crm_regs.h>
16 #include <asm/errno.h> 16 #include <asm/errno.h>
17 #include <asm/gpio.h> 17 #include <asm/gpio.h>
18 #include <asm/imx-common/iomux-v3.h> 18 #include <asm/imx-common/iomux-v3.h>
19 #include <asm/imx-common/mxc_i2c.h> 19 #include <asm/imx-common/mxc_i2c.h>
20 #include <asm/imx-common/boot_mode.h> 20 #include <asm/imx-common/boot_mode.h>
21 #include <mmc.h> 21 #include <mmc.h>
22 #include <fsl_esdhc.h> 22 #include <fsl_esdhc.h>
23 #include <miiphy.h> 23 #include <miiphy.h>
24 #include <netdev.h> 24 #include <netdev.h>
25 #include <asm/arch/sys_proto.h> 25 #include <asm/arch/sys_proto.h>
26 #include <asm/arch/mxc_hdmi.h> 26 #include <asm/arch/mxc_hdmi.h>
27 #include <linux/fb.h> 27 #include <linux/fb.h>
28 #include <ipu_pixfmt.h> 28 #include <ipu_pixfmt.h>
29 29
30 #include <i2c.h> 30 #include <i2c.h>
31 31
32 #ifdef CONFIG_CMD_SATA 32 #ifdef CONFIG_CMD_SATA
33 #include <asm/imx-common/sata.h> 33 #include <asm/imx-common/sata.h>
34 #endif 34 #endif
35 #ifdef CONFIG_FASTBOOT 35 #ifdef CONFIG_FASTBOOT
36 #include <fastboot.h> 36 #include <fastboot.h>
37 #ifdef CONFIG_ANDROID_RECOVERY 37 #ifdef CONFIG_ANDROID_RECOVERY
38 #include <recovery.h> 38 #include <recovery.h>
39 #endif 39 #endif
40 #endif /*CONFIG_FASTBOOT*/ 40 #endif /*CONFIG_FASTBOOT*/
41 41
42 #ifdef CONFIG_MAX7310_IOEXP 42 #ifdef CONFIG_MAX7310_IOEXP
43 #include <gpio_exp.h> 43 #include <gpio_exp.h>
44 #endif 44 #endif
45 45
46 DECLARE_GLOBAL_DATA_PTR; 46 DECLARE_GLOBAL_DATA_PTR;
47 47
48 #define I2C_EXP_RST IMX_GPIO_NR(1, 15) 48 #define I2C_EXP_RST IMX_GPIO_NR(1, 15)
49 #define I2C3_STEER IMX_GPIO_NR(5, 4) 49 #define I2C3_STEER IMX_GPIO_NR(5, 4)
50 #define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ 50 #define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
51 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ 51 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
52 PAD_CTL_SRE_FAST | PAD_CTL_HYS) 52 PAD_CTL_SRE_FAST | PAD_CTL_HYS)
53 53
54 #define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \ 54 #define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \
55 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \ 55 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
56 PAD_CTL_SRE_FAST | PAD_CTL_HYS) 56 PAD_CTL_SRE_FAST | PAD_CTL_HYS)
57 57
58 /*Need more drive strength for SD1 slot on base board*/ 58 /*Need more drive strength for SD1 slot on base board*/
59 #define USDHC1_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 59 #define USDHC1_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
60 PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \ 60 PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
61 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) 61 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
62 62
63 #define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ 63 #define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
64 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS) 64 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
65 65
66 #define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ 66 #define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
67 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ 67 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
68 PAD_CTL_ODE | PAD_CTL_SRE_FAST) 68 PAD_CTL_ODE | PAD_CTL_SRE_FAST)
69 69
70 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL) 70 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
71 71
72 #define SPI_PAD_CTRL (PAD_CTL_HYS | \ 72 #define SPI_PAD_CTRL (PAD_CTL_HYS | \
73 PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \ 73 PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
74 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) 74 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
75 75
76 #define WEIM_NOR_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 76 #define WEIM_NOR_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
77 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ 77 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
78 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) 78 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
79 79
80 80
81 #define GPMI_PAD_CTRL0 (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP) 81 #define GPMI_PAD_CTRL0 (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP)
82 #define GPMI_PAD_CTRL1 (PAD_CTL_DSE_40ohm | PAD_CTL_SPEED_MED | \ 82 #define GPMI_PAD_CTRL1 (PAD_CTL_DSE_40ohm | PAD_CTL_SPEED_MED | \
83 PAD_CTL_SRE_FAST) 83 PAD_CTL_SRE_FAST)
84 #define GPMI_PAD_CTRL2 (GPMI_PAD_CTRL0 | GPMI_PAD_CTRL1) 84 #define GPMI_PAD_CTRL2 (GPMI_PAD_CTRL0 | GPMI_PAD_CTRL1)
85 85
86 int dram_init(void) 86 int dram_init(void)
87 { 87 {
88 gd->ram_size = ((ulong)CONFIG_DDR_MB * 1024 * 1024); 88 gd->ram_size = ((ulong)CONFIG_DDR_MB * 1024 * 1024);
89 89
90 return 0; 90 return 0;
91 } 91 }
92 92
93 iomux_v3_cfg_t const uart4_pads[] = { 93 iomux_v3_cfg_t const uart4_pads[] = {
94 MX6_PAD_KEY_COL0__UART4_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), 94 MX6_PAD_KEY_COL0__UART4_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
95 MX6_PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), 95 MX6_PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
96 }; 96 };
97 97
98 iomux_v3_cfg_t const enet_pads[] = { 98 iomux_v3_cfg_t const enet_pads[] = {
99 MX6_PAD_KEY_COL1__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL), 99 MX6_PAD_KEY_COL1__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
100 MX6_PAD_KEY_COL2__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL), 100 MX6_PAD_KEY_COL2__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
101 MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL), 101 MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
102 MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL), 102 MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
103 MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL), 103 MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
104 MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL), 104 MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
105 MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL), 105 MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
106 MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL), 106 MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
107 MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL), 107 MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),
108 MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL), 108 MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
109 MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL), 109 MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
110 MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL), 110 MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
111 MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL), 111 MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
112 MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL), 112 MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
113 MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL), 113 MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
114 }; 114 };
115 115
116 /* I2C2 PMIC, iPod, Tuner, Codec, Touch, HDMI EDID, MIPI CSI2 card */ 116 /* I2C2 PMIC, iPod, Tuner, Codec, Touch, HDMI EDID, MIPI CSI2 card */
117 struct i2c_pads_info i2c_pad_info1 = { 117 struct i2c_pads_info i2c_pad_info1 = {
118 .scl = { 118 .scl = {
119 .i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC, 119 .i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
120 .gpio_mode = MX6_PAD_EIM_EB2__GPIO2_IO30 | PC, 120 .gpio_mode = MX6_PAD_EIM_EB2__GPIO2_IO30 | PC,
121 .gp = IMX_GPIO_NR(2, 30) 121 .gp = IMX_GPIO_NR(2, 30)
122 }, 122 },
123 .sda = { 123 .sda = {
124 .i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA | PC, 124 .i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA | PC,
125 .gpio_mode = MX6_PAD_KEY_ROW3__GPIO4_IO13 | PC, 125 .gpio_mode = MX6_PAD_KEY_ROW3__GPIO4_IO13 | PC,
126 .gp = IMX_GPIO_NR(4, 13) 126 .gp = IMX_GPIO_NR(4, 13)
127 } 127 }
128 }; 128 };
129 129
130 /* 130 /*
131 * I2C3 MLB, Port Expanders (A, B, C), Video ADC, Light Sensor, 131 * I2C3 MLB, Port Expanders (A, B, C), Video ADC, Light Sensor,
132 * Compass Sensor, Accelerometer, Res Touch 132 * Compass Sensor, Accelerometer, Res Touch
133 */ 133 */
134 struct i2c_pads_info i2c_pad_info2 = { 134 struct i2c_pads_info i2c_pad_info2 = {
135 .scl = { 135 .scl = {
136 .i2c_mode = MX6_PAD_GPIO_3__I2C3_SCL | PC, 136 .i2c_mode = MX6_PAD_GPIO_3__I2C3_SCL | PC,
137 .gpio_mode = MX6_PAD_GPIO_3__GPIO1_IO03 | PC, 137 .gpio_mode = MX6_PAD_GPIO_3__GPIO1_IO03 | PC,
138 .gp = IMX_GPIO_NR(1, 3) 138 .gp = IMX_GPIO_NR(1, 3)
139 }, 139 },
140 .sda = { 140 .sda = {
141 .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC, 141 .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
142 .gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC, 142 .gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
143 .gp = IMX_GPIO_NR(3, 18) 143 .gp = IMX_GPIO_NR(3, 18)
144 } 144 }
145 }; 145 };
146 146
147 iomux_v3_cfg_t const i2c3_pads[] = { 147 iomux_v3_cfg_t const i2c3_pads[] = {
148 MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), 148 MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL),
149 }; 149 };
150 150
151 iomux_v3_cfg_t const port_exp[] = { 151 iomux_v3_cfg_t const port_exp[] = {
152 MX6_PAD_SD2_DAT0__GPIO1_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL), 152 MX6_PAD_SD2_DAT0__GPIO1_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL),
153 }; 153 };
154 154
155 static void setup_iomux_enet(void) 155 static void setup_iomux_enet(void)
156 { 156 {
157 imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads)); 157 imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
158 } 158 }
159 159
160 iomux_v3_cfg_t const usdhc1_pads[] = { 160 iomux_v3_cfg_t const usdhc1_pads[] = {
161 /*To avoid pin conflict with NAND, set usdhc1 to 4 pins*/ 161 /*To avoid pin conflict with NAND, set usdhc1 to 4 pins*/
162 MX6_PAD_SD1_CLK__SD1_CLK | MUX_PAD_CTRL(USDHC1_PAD_CTRL), 162 MX6_PAD_SD1_CLK__SD1_CLK | MUX_PAD_CTRL(USDHC1_PAD_CTRL),
163 MX6_PAD_SD1_CMD__SD1_CMD | MUX_PAD_CTRL(USDHC1_PAD_CTRL), 163 MX6_PAD_SD1_CMD__SD1_CMD | MUX_PAD_CTRL(USDHC1_PAD_CTRL),
164 MX6_PAD_SD1_DAT0__SD1_DATA0 | MUX_PAD_CTRL(USDHC1_PAD_CTRL), 164 MX6_PAD_SD1_DAT0__SD1_DATA0 | MUX_PAD_CTRL(USDHC1_PAD_CTRL),
165 MX6_PAD_SD1_DAT1__SD1_DATA1 | MUX_PAD_CTRL(USDHC1_PAD_CTRL), 165 MX6_PAD_SD1_DAT1__SD1_DATA1 | MUX_PAD_CTRL(USDHC1_PAD_CTRL),
166 MX6_PAD_SD1_DAT2__SD1_DATA2 | MUX_PAD_CTRL(USDHC1_PAD_CTRL), 166 MX6_PAD_SD1_DAT2__SD1_DATA2 | MUX_PAD_CTRL(USDHC1_PAD_CTRL),
167 MX6_PAD_SD1_DAT3__SD1_DATA3 | MUX_PAD_CTRL(USDHC1_PAD_CTRL), 167 MX6_PAD_SD1_DAT3__SD1_DATA3 | MUX_PAD_CTRL(USDHC1_PAD_CTRL),
168 168
169 /*CD pin*/ 169 /*CD pin*/
170 MX6_PAD_GPIO_1__GPIO1_IO01 | MUX_PAD_CTRL(NO_PAD_CTRL), 170 MX6_PAD_GPIO_1__GPIO1_IO01 | MUX_PAD_CTRL(NO_PAD_CTRL),
171 }; 171 };
172 172
173 iomux_v3_cfg_t const usdhc3_pads[] = { 173 iomux_v3_cfg_t const usdhc3_pads[] = {
174 MX6_PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), 174 MX6_PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
175 MX6_PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), 175 MX6_PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
176 MX6_PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 176 MX6_PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
177 MX6_PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 177 MX6_PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
178 MX6_PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 178 MX6_PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
179 MX6_PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 179 MX6_PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
180 MX6_PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 180 MX6_PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
181 MX6_PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 181 MX6_PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
182 MX6_PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 182 MX6_PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
183 MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 183 MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
184 MX6_PAD_GPIO_18__SD3_VSELECT | MUX_PAD_CTRL(USDHC_PAD_CTRL), 184 MX6_PAD_GPIO_18__SD3_VSELECT | MUX_PAD_CTRL(USDHC_PAD_CTRL),
185 MX6_PAD_NANDF_CS2__GPIO6_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL), 185 MX6_PAD_NANDF_CS2__GPIO6_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL),
186 }; 186 };
187 187
188 #ifdef CONFIG_SYS_I2C_MXC 188 #ifdef CONFIG_SYS_I2C_MXC
189 /* set all switches APS in normal and PFM mode in standby */ 189 /* set all switches APS in normal and PFM mode in standby */
190 static int setup_pmic_mode(int chip) 190 static int setup_pmic_mode(int chip)
191 { 191 {
192 unsigned char offset, i, switch_num, value; 192 unsigned char offset, i, switch_num, value;
193 193
194 if (!chip) { 194 if (!chip) {
195 /* pfuze100 */ 195 /* pfuze100 */
196 switch_num = 6; 196 switch_num = 6;
197 offset = 0x31; 197 offset = 0x31;
198 } else { 198 } else {
199 /* pfuze200 */ 199 /* pfuze200 */
200 switch_num = 4; 200 switch_num = 4;
201 offset = 0x38; 201 offset = 0x38;
202 } 202 }
203 203
204 value = 0xc; 204 value = 0xc;
205 if (i2c_write(0x8, 0x23, 1, &value, 1)) { 205 if (i2c_write(0x8, 0x23, 1, &value, 1)) {
206 printf("Set SW1AB mode error!\n"); 206 printf("Set SW1AB mode error!\n");
207 return -1; 207 return -1;
208 } 208 }
209 209
210 for (i = 0; i < switch_num - 1; i++) { 210 for (i = 0; i < switch_num - 1; i++) {
211 if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) { 211 if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
212 printf("Set switch%x mode error!\n", offset); 212 printf("Set switch%x mode error!\n", offset);
213 return -1; 213 return -1;
214 } 214 }
215 } 215 }
216 216
217 return 0; 217 return 0;
218 } 218 }
219 219
220 static int setup_pmic_voltages(void) 220 static int setup_pmic_voltages(void)
221 { 221 {
222 unsigned char value, rev_id = 0 ; 222 unsigned char value, rev_id = 0 ;
223 i2c_set_bus_num(1); 223 i2c_set_bus_num(1);
224 if (!i2c_probe(0x8)) { 224 if (!i2c_probe(0x8)) {
225 if (i2c_read(0x8, 0, 1, &value, 1)) { 225 if (i2c_read(0x8, 0, 1, &value, 1)) {
226 printf("Read device ID error!\n"); 226 printf("Read device ID error!\n");
227 return -1; 227 return -1;
228 } 228 }
229 if (i2c_read(0x8, 3, 1, &rev_id, 1)) { 229 if (i2c_read(0x8, 3, 1, &rev_id, 1)) {
230 printf("Read Rev ID error!\n"); 230 printf("Read Rev ID error!\n");
231 return -1; 231 return -1;
232 } 232 }
233 printf("Found PFUZE100! deviceid=%x,revid=%x\n", value, rev_id); 233 printf("Found PFUZE100! deviceid=%x,revid=%x\n", value, rev_id);
234 234
235 if (setup_pmic_mode(value & 0xf)) { 235 if (setup_pmic_mode(value & 0xf)) {
236 printf("setup pmic mode error!\n"); 236 printf("setup pmic mode error!\n");
237 return -1; 237 return -1;
238 } 238 }
239 /* set SW1AB staby volatage 0.975V*/ 239 /* set SW1AB staby volatage 0.975V*/
240 if (i2c_read(0x8, 0x21, 1, &value, 1)) { 240 if (i2c_read(0x8, 0x21, 1, &value, 1)) {
241 printf("Read SW1ABSTBY error!\n"); 241 printf("Read SW1ABSTBY error!\n");
242 return -1; 242 return -1;
243 } 243 }
244 value &= ~0x3f; 244 value &= ~0x3f;
245 value |= 0x1b; 245 value |= 0x1b;
246 if (i2c_write(0x8, 0x21, 1, &value, 1)) { 246 if (i2c_write(0x8, 0x21, 1, &value, 1)) {
247 printf("Set SW1ABSTBY error!\n"); 247 printf("Set SW1ABSTBY error!\n");
248 return -1; 248 return -1;
249 } 249 }
250 /* set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */ 250 /* set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */
251 if (i2c_read(0x8, 0x24, 1, &value, 1)) { 251 if (i2c_read(0x8, 0x24, 1, &value, 1)) {
252 printf("Read SW1ABSTBY error!\n"); 252 printf("Read SW1ABSTBY error!\n");
253 return -1; 253 return -1;
254 } 254 }
255 value &= ~0xc0; 255 value &= ~0xc0;
256 value |= 0x40; 256 value |= 0x40;
257 if (i2c_write(0x8, 0x24, 1, &value, 1)) { 257 if (i2c_write(0x8, 0x24, 1, &value, 1)) {
258 printf("Set SW1ABSTBY error!\n"); 258 printf("Set SW1ABSTBY error!\n");
259 return -1; 259 return -1;
260 } 260 }
261 261
262 /* set SW1C staby volatage 0.975V*/ 262 /* set SW1C staby volatage 0.975V*/
263 if (i2c_read(0x8, 0x2f, 1, &value, 1)) { 263 if (i2c_read(0x8, 0x2f, 1, &value, 1)) {
264 printf("Read SW1CSTBY error!\n"); 264 printf("Read SW1CSTBY error!\n");
265 return -1; 265 return -1;
266 } 266 }
267 value &= ~0x3f; 267 value &= ~0x3f;
268 value |= 0x1b; 268 value |= 0x1b;
269 if (i2c_write(0x8, 0x2f, 1, &value, 1)) { 269 if (i2c_write(0x8, 0x2f, 1, &value, 1)) {
270 printf("Set SW1CSTBY error!\n"); 270 printf("Set SW1CSTBY error!\n");
271 return -1; 271 return -1;
272 } 272 }
273 273
274 /* set SW1C/VDDSOC step ramp up time to from 16us to 4us/25mV */ 274 /* set SW1C/VDDSOC step ramp up time to from 16us to 4us/25mV */
275 if (i2c_read(0x8, 0x32, 1, &value, 1)) { 275 if (i2c_read(0x8, 0x32, 1, &value, 1)) {
276 printf("Read SW1ABSTBY error!\n"); 276 printf("Read SW1ABSTBY error!\n");
277 return -1; 277 return -1;
278 } 278 }
279 value &= ~0xc0; 279 value &= ~0xc0;
280 value |= 0x40; 280 value |= 0x40;
281 if (i2c_write(0x8, 0x32, 1, &value, 1)) { 281 if (i2c_write(0x8, 0x32, 1, &value, 1)) {
282 printf("Set SW1ABSTBY error!\n"); 282 printf("Set SW1ABSTBY error!\n");
283 return -1; 283 return -1;
284 } 284 }
285 } 285 }
286 286
287 return 0; 287 return 0;
288 } 288 }
289 289
290 #ifdef CONFIG_LDO_BYPASS_CHECK 290 #ifdef CONFIG_LDO_BYPASS_CHECK
291 void ldo_mode_set(int ldo_bypass) 291 void ldo_mode_set(int ldo_bypass)
292 { 292 {
293 unsigned char value; 293 unsigned char value;
294 /* increase VDDARM/VDDSOC to support 1.2G chip */ 294 /* increase VDDARM/VDDSOC to support 1.2G chip */
295 if (check_1_2G()) { 295 if (check_1_2G()) {
296 ldo_bypass = 0; /* ldo_enable on 1.2G chip */ 296 ldo_bypass = 0; /* ldo_enable on 1.2G chip */
297 printf("1.2G chip, increase VDDARM_IN/VDDSOC_IN\n"); 297 printf("1.2G chip, increase VDDARM_IN/VDDSOC_IN\n");
298 /* increase VDDARM to 1.425V */ 298 /* increase VDDARM to 1.425V */
299 if (i2c_read(0x8, 0x20, 1, &value, 1)) { 299 if (i2c_read(0x8, 0x20, 1, &value, 1)) {
300 printf("Read SW1AB error!\n"); 300 printf("Read SW1AB error!\n");
301 return; 301 return;
302 } 302 }
303 value &= ~0x3f; 303 value &= ~0x3f;
304 value |= 0x2d; 304 value |= 0x2d;
305 if (i2c_write(0x8, 0x20, 1, &value, 1)) { 305 if (i2c_write(0x8, 0x20, 1, &value, 1)) {
306 printf("Set SW1AB error!\n"); 306 printf("Set SW1AB error!\n");
307 return; 307 return;
308 } 308 }
309 /* increase VDDSOC to 1.425V */ 309 /* increase VDDSOC to 1.425V */
310 if (i2c_read(0x8, 0x2e, 1, &value, 1)) { 310 if (i2c_read(0x8, 0x2e, 1, &value, 1)) {
311 printf("Read SW1C error!\n"); 311 printf("Read SW1C error!\n");
312 return; 312 return;
313 } 313 }
314 value &= ~0x3f; 314 value &= ~0x3f;
315 value |= 0x2d; 315 value |= 0x2d;
316 if (i2c_write(0x8, 0x2e, 1, &value, 1)) { 316 if (i2c_write(0x8, 0x2e, 1, &value, 1)) {
317 printf("Set SW1C error!\n"); 317 printf("Set SW1C error!\n");
318 return; 318 return;
319 } 319 }
320 } 320 }
321 } 321 }
322 #endif 322 #endif
323 #endif 323 #endif
324 324
325 static void setup_iomux_uart(void) 325 static void setup_iomux_uart(void)
326 { 326 {
327 imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads)); 327 imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
328 } 328 }
329 329
330 #ifdef CONFIG_FSL_ESDHC 330 #ifdef CONFIG_FSL_ESDHC
331 331
332 #define USDHC1_CD_GPIO IMX_GPIO_NR(1, 1) 332 #define USDHC1_CD_GPIO IMX_GPIO_NR(1, 1)
333 #define USDHC3_CD_GPIO IMX_GPIO_NR(6, 15) 333 #define USDHC3_CD_GPIO IMX_GPIO_NR(6, 15)
334 334
335 struct fsl_esdhc_cfg usdhc_cfg[2] = { 335 struct fsl_esdhc_cfg usdhc_cfg[2] = {
336 {USDHC1_BASE_ADDR, 0, 4}, 336 {USDHC1_BASE_ADDR, 0, 4},
337 {USDHC3_BASE_ADDR}, 337 {USDHC3_BASE_ADDR},
338 }; 338 };
339 339
340 int mmc_get_env_devno(void) 340 int mmc_get_env_devno(void)
341 { 341 {
342 u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4); 342 u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
343 u32 dev_no; 343 u32 dev_no;
344 u32 bootsel; 344 u32 bootsel;
345 345
346 bootsel = (soc_sbmr & 0x000000FF) >> 6 ; 346 bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
347 347
348 /* If not boot from sd/mmc, use default value */ 348 /* If not boot from sd/mmc, use default value */
349 if (bootsel != 1) 349 if (bootsel != 1)
350 return CONFIG_SYS_MMC_ENV_DEV; 350 return CONFIG_SYS_MMC_ENV_DEV;
351 351
352 /* BOOT_CFG2[3] and BOOT_CFG2[4] */ 352 /* BOOT_CFG2[3] and BOOT_CFG2[4] */
353 dev_no = (soc_sbmr & 0x00001800) >> 11; 353 dev_no = (soc_sbmr & 0x00001800) >> 11;
354 354
355 /* need ubstract 1 to map to the mmc3 device id 355 /* need ubstract 1 to map to the mmc3 device id
356 * see the comments in board_mmc_init function 356 * see the comments in board_mmc_init function
357 */ 357 */
358 if (2 == dev_no) 358 if (2 == dev_no)
359 dev_no--; 359 dev_no--;
360 360
361 return dev_no; 361 return dev_no;
362 } 362 }
363 363
364 int mmc_map_to_kernel_blk(int dev_no) 364 int mmc_map_to_kernel_blk(int dev_no)
365 { 365 {
366 if (1 == dev_no) 366 if (1 == dev_no)
367 dev_no = 2; 367 dev_no = 2;
368 368
369 return dev_no; 369 return dev_no;
370 } 370 }
371 371
372 int board_mmc_getcd(struct mmc *mmc) 372 int board_mmc_getcd(struct mmc *mmc)
373 { 373 {
374 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; 374 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
375 int ret = 0; 375 int ret = 0;
376 376
377 switch (cfg->esdhc_base) { 377 switch (cfg->esdhc_base) {
378 case USDHC1_BASE_ADDR: 378 case USDHC1_BASE_ADDR:
379 ret = !gpio_get_value(USDHC1_CD_GPIO); 379 ret = !gpio_get_value(USDHC1_CD_GPIO);
380 break; 380 break;
381 case USDHC3_BASE_ADDR: 381 case USDHC3_BASE_ADDR:
382 ret = !gpio_get_value(USDHC3_CD_GPIO); 382 ret = !gpio_get_value(USDHC3_CD_GPIO);
383 break; 383 break;
384 } 384 }
385 385
386 return ret; 386 return ret;
387 } 387 }
388 388
389 int board_mmc_init(bd_t *bis) 389 int board_mmc_init(bd_t *bis)
390 { 390 {
391 int i; 391 int i;
392 392
393 /* 393 /*
394 * According to the board_mmc_init() the following map is done: 394 * According to the board_mmc_init() the following map is done:
395 * (U-boot device node) (Physical Port) 395 * (U-boot device node) (Physical Port)
396 * mmc0 USDHC1 396 * mmc0 USDHC1
397 * mmc1 USDHC3 397 * mmc1 USDHC3
398 */ 398 */
399 for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) { 399 for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
400 switch (i) { 400 switch (i) {
401 case 0: 401 case 0:
402 imx_iomux_v3_setup_multiple_pads( 402 imx_iomux_v3_setup_multiple_pads(
403 usdhc1_pads, ARRAY_SIZE(usdhc1_pads)); 403 usdhc1_pads, ARRAY_SIZE(usdhc1_pads));
404 gpio_direction_input(USDHC1_CD_GPIO); 404 gpio_direction_input(USDHC1_CD_GPIO);
405 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); 405 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
406 break; 406 break;
407 case 1: 407 case 1:
408 imx_iomux_v3_setup_multiple_pads( 408 imx_iomux_v3_setup_multiple_pads(
409 usdhc3_pads, ARRAY_SIZE(usdhc3_pads)); 409 usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
410 gpio_direction_input(USDHC3_CD_GPIO); 410 gpio_direction_input(USDHC3_CD_GPIO);
411 usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); 411 usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
412 break; 412 break;
413 default: 413 default:
414 printf("Warning: you configured more USDHC controllers" 414 printf("Warning: you configured more USDHC controllers"
415 "(%d) than supported by the board\n", i + 1); 415 "(%d) than supported by the board\n", i + 1);
416 return 0; 416 return 0;
417 } 417 }
418 418
419 if (fsl_esdhc_initialize(bis, &usdhc_cfg[i])) 419 if (fsl_esdhc_initialize(bis, &usdhc_cfg[i]))
420 printf("Warning: failed to initialize mmc dev %d\n", i); 420 printf("Warning: failed to initialize mmc dev %d\n", i);
421 } 421 }
422 422
423 return 0; 423 return 0;
424 } 424 }
425 425
426 int check_mmc_autodetect(void) 426 int check_mmc_autodetect(void)
427 { 427 {
428 char *autodetect_str = getenv("mmcautodetect"); 428 char *autodetect_str = getenv("mmcautodetect");
429 429
430 if ((autodetect_str != NULL) && 430 if ((autodetect_str != NULL) &&
431 (strcmp(autodetect_str, "yes") == 0)) { 431 (strcmp(autodetect_str, "yes") == 0)) {
432 return 1; 432 return 1;
433 } 433 }
434 434
435 return 0; 435 return 0;
436 } 436 }
437 437
438 void board_late_mmc_env_init(void) 438 void board_late_mmc_env_init(void)
439 { 439 {
440 char cmd[32]; 440 char cmd[32];
441 char mmcblk[32]; 441 char mmcblk[32];
442 u32 dev_no = mmc_get_env_devno(); 442 u32 dev_no = mmc_get_env_devno();
443 443
444 if (!check_mmc_autodetect()) 444 if (!check_mmc_autodetect())
445 return; 445 return;
446 446
447 setenv_ulong("mmcdev", dev_no); 447 setenv_ulong("mmcdev", dev_no);
448 448
449 /* Set mmcblk env */ 449 /* Set mmcblk env */
450 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", 450 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
451 mmc_map_to_kernel_blk(dev_no)); 451 mmc_map_to_kernel_blk(dev_no));
452 setenv("mmcroot", mmcblk); 452 setenv("mmcroot", mmcblk);
453 453
454 sprintf(cmd, "mmc dev %d", dev_no); 454 sprintf(cmd, "mmc dev %d", dev_no);
455 run_command(cmd, 0); 455 run_command(cmd, 0);
456 } 456 }
457 457
458 #endif 458 #endif
459 459
460 #ifdef CONFIG_SYS_USE_SPINOR 460 #ifdef CONFIG_SYS_USE_SPINOR
461 iomux_v3_cfg_t const ecspi1_pads[] = { 461 iomux_v3_cfg_t const ecspi1_pads[] = {
462 MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL), 462 MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
463 MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL), 463 MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
464 MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL), 464 MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
465 MX6_PAD_EIM_D19__GPIO3_IO19 | MUX_PAD_CTRL(NO_PAD_CTRL), 465 MX6_PAD_EIM_D19__GPIO3_IO19 | MUX_PAD_CTRL(NO_PAD_CTRL),
466 /* Steer logic */ 466 /* Steer logic */
467 MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), 467 MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL),
468 }; 468 };
469 469
470 void setup_spinor(void) 470 void setup_spinor(void)
471 { 471 {
472 imx_iomux_v3_setup_multiple_pads(ecspi1_pads, 472 imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
473 ARRAY_SIZE(ecspi1_pads)); 473 ARRAY_SIZE(ecspi1_pads));
474 gpio_direction_output(IMX_GPIO_NR(5, 4), 0); 474 gpio_direction_output(IMX_GPIO_NR(5, 4), 0);
475 gpio_direction_output(IMX_GPIO_NR(3, 19), 0); 475 gpio_direction_output(IMX_GPIO_NR(3, 19), 0);
476 } 476 }
477 #endif 477 #endif
478 478
479 #ifdef CONFIG_SYS_USE_EIMNOR 479 #ifdef CONFIG_SYS_USE_EIMNOR
480 iomux_v3_cfg_t eimnor_pads[] = { 480 iomux_v3_cfg_t eimnor_pads[] = {
481 MX6_PAD_EIM_D16__EIM_DATA16 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 481 MX6_PAD_EIM_D16__EIM_DATA16 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
482 MX6_PAD_EIM_D17__EIM_DATA17 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 482 MX6_PAD_EIM_D17__EIM_DATA17 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
483 MX6_PAD_EIM_D18__EIM_DATA18 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 483 MX6_PAD_EIM_D18__EIM_DATA18 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
484 MX6_PAD_EIM_D19__EIM_DATA19 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 484 MX6_PAD_EIM_D19__EIM_DATA19 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
485 MX6_PAD_EIM_D20__EIM_DATA20 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 485 MX6_PAD_EIM_D20__EIM_DATA20 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
486 MX6_PAD_EIM_D21__EIM_DATA21 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 486 MX6_PAD_EIM_D21__EIM_DATA21 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
487 MX6_PAD_EIM_D22__EIM_DATA22 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 487 MX6_PAD_EIM_D22__EIM_DATA22 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
488 MX6_PAD_EIM_D23__EIM_DATA23 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 488 MX6_PAD_EIM_D23__EIM_DATA23 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
489 MX6_PAD_EIM_D24__EIM_DATA24 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 489 MX6_PAD_EIM_D24__EIM_DATA24 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
490 MX6_PAD_EIM_D25__EIM_DATA25 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 490 MX6_PAD_EIM_D25__EIM_DATA25 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
491 MX6_PAD_EIM_D26__EIM_DATA26 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 491 MX6_PAD_EIM_D26__EIM_DATA26 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
492 MX6_PAD_EIM_D27__EIM_DATA27 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 492 MX6_PAD_EIM_D27__EIM_DATA27 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
493 MX6_PAD_EIM_D28__EIM_DATA28 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 493 MX6_PAD_EIM_D28__EIM_DATA28 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
494 MX6_PAD_EIM_D29__EIM_DATA29 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 494 MX6_PAD_EIM_D29__EIM_DATA29 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
495 MX6_PAD_EIM_D30__EIM_DATA30 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 495 MX6_PAD_EIM_D30__EIM_DATA30 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
496 MX6_PAD_EIM_D31__EIM_DATA31 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 496 MX6_PAD_EIM_D31__EIM_DATA31 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
497 MX6_PAD_EIM_DA0__EIM_AD00 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 497 MX6_PAD_EIM_DA0__EIM_AD00 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
498 MX6_PAD_EIM_DA1__EIM_AD01 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 498 MX6_PAD_EIM_DA1__EIM_AD01 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
499 MX6_PAD_EIM_DA2__EIM_AD02 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 499 MX6_PAD_EIM_DA2__EIM_AD02 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
500 MX6_PAD_EIM_DA3__EIM_AD03 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 500 MX6_PAD_EIM_DA3__EIM_AD03 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
501 MX6_PAD_EIM_DA4__EIM_AD04 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 501 MX6_PAD_EIM_DA4__EIM_AD04 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
502 MX6_PAD_EIM_DA5__EIM_AD05 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 502 MX6_PAD_EIM_DA5__EIM_AD05 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
503 MX6_PAD_EIM_DA6__EIM_AD06 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 503 MX6_PAD_EIM_DA6__EIM_AD06 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
504 MX6_PAD_EIM_DA7__EIM_AD07 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 504 MX6_PAD_EIM_DA7__EIM_AD07 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
505 MX6_PAD_EIM_DA8__EIM_AD08 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 505 MX6_PAD_EIM_DA8__EIM_AD08 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
506 MX6_PAD_EIM_DA9__EIM_AD09 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 506 MX6_PAD_EIM_DA9__EIM_AD09 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
507 MX6_PAD_EIM_DA10__EIM_AD10 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 507 MX6_PAD_EIM_DA10__EIM_AD10 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
508 MX6_PAD_EIM_DA11__EIM_AD11 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL) , 508 MX6_PAD_EIM_DA11__EIM_AD11 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL) ,
509 MX6_PAD_EIM_DA12__EIM_AD12 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 509 MX6_PAD_EIM_DA12__EIM_AD12 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
510 MX6_PAD_EIM_DA13__EIM_AD13 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 510 MX6_PAD_EIM_DA13__EIM_AD13 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
511 MX6_PAD_EIM_DA14__EIM_AD14 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 511 MX6_PAD_EIM_DA14__EIM_AD14 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
512 MX6_PAD_EIM_DA15__EIM_AD15 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 512 MX6_PAD_EIM_DA15__EIM_AD15 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
513 MX6_PAD_EIM_A16__EIM_ADDR16 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 513 MX6_PAD_EIM_A16__EIM_ADDR16 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
514 MX6_PAD_EIM_A17__EIM_ADDR17 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 514 MX6_PAD_EIM_A17__EIM_ADDR17 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
515 MX6_PAD_EIM_A18__EIM_ADDR18 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 515 MX6_PAD_EIM_A18__EIM_ADDR18 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
516 MX6_PAD_EIM_A19__EIM_ADDR19 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 516 MX6_PAD_EIM_A19__EIM_ADDR19 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
517 MX6_PAD_EIM_A20__EIM_ADDR20 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 517 MX6_PAD_EIM_A20__EIM_ADDR20 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
518 MX6_PAD_EIM_A21__EIM_ADDR21 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 518 MX6_PAD_EIM_A21__EIM_ADDR21 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
519 MX6_PAD_EIM_A22__EIM_ADDR22 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 519 MX6_PAD_EIM_A22__EIM_ADDR22 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
520 MX6_PAD_EIM_A23__EIM_ADDR23 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL), 520 MX6_PAD_EIM_A23__EIM_ADDR23 | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL),
521 MX6_PAD_EIM_OE__EIM_OE_B | MUX_PAD_CTRL(NO_PAD_CTRL), 521 MX6_PAD_EIM_OE__EIM_OE_B | MUX_PAD_CTRL(NO_PAD_CTRL),
522 MX6_PAD_EIM_RW__EIM_RW | MUX_PAD_CTRL(NO_PAD_CTRL), 522 MX6_PAD_EIM_RW__EIM_RW | MUX_PAD_CTRL(NO_PAD_CTRL),
523 MX6_PAD_EIM_CS0__EIM_CS0_B | MUX_PAD_CTRL(NO_PAD_CTRL), 523 MX6_PAD_EIM_CS0__EIM_CS0_B | MUX_PAD_CTRL(NO_PAD_CTRL),
524 /* Steer logic */ 524 /* Steer logic */
525 MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), 525 MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL),
526 }; 526 };
527 static void eimnor_cs_setup(void) 527 static void eimnor_cs_setup(void)
528 { 528 {
529 writel(0x00000120, WEIM_BASE_ADDR + 0x090); 529 writel(0x00000120, WEIM_BASE_ADDR + 0x090);
530 writel(0x00020181, WEIM_BASE_ADDR + 0x000); 530 writel(0x00020181, WEIM_BASE_ADDR + 0x000);
531 writel(0x00000001, WEIM_BASE_ADDR + 0x004); 531 writel(0x00000001, WEIM_BASE_ADDR + 0x004);
532 writel(0x0a020000, WEIM_BASE_ADDR + 0x008); 532 writel(0x0a020000, WEIM_BASE_ADDR + 0x008);
533 writel(0x0000c000, WEIM_BASE_ADDR + 0x00c); 533 writel(0x0000c000, WEIM_BASE_ADDR + 0x00c);
534 writel(0x0804a240, WEIM_BASE_ADDR + 0x010); 534 writel(0x0804a240, WEIM_BASE_ADDR + 0x010);
535 } 535 }
536 536
537 static void setup_eimnor(void) 537 static void setup_eimnor(void)
538 { 538 {
539 imx_iomux_v3_setup_multiple_pads(eimnor_pads, 539 imx_iomux_v3_setup_multiple_pads(eimnor_pads,
540 ARRAY_SIZE(eimnor_pads)); 540 ARRAY_SIZE(eimnor_pads));
541 541
542 gpio_direction_output(IMX_GPIO_NR(5, 4), 0); 542 gpio_direction_output(IMX_GPIO_NR(5, 4), 0);
543 543
544 eimnor_cs_setup(); 544 eimnor_cs_setup();
545 } 545 }
546 #endif 546 #endif
547 547
548 #ifdef CONFIG_SYS_USE_NAND 548 #ifdef CONFIG_SYS_USE_NAND
549 iomux_v3_cfg_t gpmi_pads[] = { 549 iomux_v3_cfg_t gpmi_pads[] = {
550 MX6_PAD_NANDF_CLE__NAND_CLE | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 550 MX6_PAD_NANDF_CLE__NAND_CLE | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
551 MX6_PAD_NANDF_ALE__NAND_ALE | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 551 MX6_PAD_NANDF_ALE__NAND_ALE | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
552 MX6_PAD_NANDF_WP_B__NAND_WP_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 552 MX6_PAD_NANDF_WP_B__NAND_WP_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
553 MX6_PAD_NANDF_RB0__NAND_READY_B | MUX_PAD_CTRL(GPMI_PAD_CTRL0), 553 MX6_PAD_NANDF_RB0__NAND_READY_B | MUX_PAD_CTRL(GPMI_PAD_CTRL0),
554 MX6_PAD_NANDF_CS0__NAND_CE0_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 554 MX6_PAD_NANDF_CS0__NAND_CE0_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
555 MX6_PAD_SD4_CMD__NAND_RE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 555 MX6_PAD_SD4_CMD__NAND_RE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
556 MX6_PAD_SD4_CLK__NAND_WE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 556 MX6_PAD_SD4_CLK__NAND_WE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
557 MX6_PAD_NANDF_D0__NAND_DATA00 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 557 MX6_PAD_NANDF_D0__NAND_DATA00 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
558 MX6_PAD_NANDF_D1__NAND_DATA01 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 558 MX6_PAD_NANDF_D1__NAND_DATA01 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
559 MX6_PAD_NANDF_D2__NAND_DATA02 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 559 MX6_PAD_NANDF_D2__NAND_DATA02 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
560 MX6_PAD_NANDF_D3__NAND_DATA03 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 560 MX6_PAD_NANDF_D3__NAND_DATA03 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
561 MX6_PAD_NANDF_D4__NAND_DATA04 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 561 MX6_PAD_NANDF_D4__NAND_DATA04 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
562 MX6_PAD_NANDF_D5__NAND_DATA05 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 562 MX6_PAD_NANDF_D5__NAND_DATA05 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
563 MX6_PAD_NANDF_D6__NAND_DATA06 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 563 MX6_PAD_NANDF_D6__NAND_DATA06 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
564 MX6_PAD_NANDF_D7__NAND_DATA07 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 564 MX6_PAD_NANDF_D7__NAND_DATA07 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
565 MX6_PAD_SD4_DAT0__NAND_DQS | MUX_PAD_CTRL(GPMI_PAD_CTRL1), 565 MX6_PAD_SD4_DAT0__NAND_DQS | MUX_PAD_CTRL(GPMI_PAD_CTRL1),
566 }; 566 };
567 567
568 static void setup_gpmi_nand(void) 568 static void setup_gpmi_nand(void)
569 { 569 {
570 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; 570 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
571 571
572 /* config gpmi nand iomux */ 572 /* config gpmi nand iomux */
573 imx_iomux_v3_setup_multiple_pads(gpmi_pads, ARRAY_SIZE(gpmi_pads)); 573 imx_iomux_v3_setup_multiple_pads(gpmi_pads, ARRAY_SIZE(gpmi_pads));
574 574
575 /* gate ENFC_CLK_ROOT clock first,before clk source switch */ 575 /* gate ENFC_CLK_ROOT clock first,before clk source switch */
576 clrbits_le32(&mxc_ccm->CCGR2, MXC_CCM_CCGR2_IOMUX_IPT_CLK_IO_MASK); 576 clrbits_le32(&mxc_ccm->CCGR2, MXC_CCM_CCGR2_IOMUX_IPT_CLK_IO_MASK);
577 577
578 /* config gpmi and bch clock to 100 MHz */ 578 /* config gpmi and bch clock to 100 MHz */
579 clrsetbits_le32(&mxc_ccm->cs2cdr, 579 clrsetbits_le32(&mxc_ccm->cs2cdr,
580 MXC_CCM_CS2CDR_ENFC_CLK_PODF_MASK | 580 MXC_CCM_CS2CDR_ENFC_CLK_PODF_MASK |
581 MXC_CCM_CS2CDR_ENFC_CLK_PRED_MASK | 581 MXC_CCM_CS2CDR_ENFC_CLK_PRED_MASK |
582 MXC_CCM_CS2CDR_ENFC_CLK_SEL_MASK, 582 MXC_CCM_CS2CDR_ENFC_CLK_SEL_MASK,
583 MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) | 583 MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) |
584 MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) | 584 MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) |
585 MXC_CCM_CS2CDR_ENFC_CLK_SEL(3)); 585 MXC_CCM_CS2CDR_ENFC_CLK_SEL(3));
586 586
587 /* enable ENFC_CLK_ROOT clock */ 587 /* enable ENFC_CLK_ROOT clock */
588 setbits_le32(&mxc_ccm->CCGR2, MXC_CCM_CCGR2_IOMUX_IPT_CLK_IO_MASK); 588 setbits_le32(&mxc_ccm->CCGR2, MXC_CCM_CCGR2_IOMUX_IPT_CLK_IO_MASK);
589 589
590 /* enable gpmi and bch clock gating */ 590 /* enable gpmi and bch clock gating */
591 setbits_le32(&mxc_ccm->CCGR4, 591 setbits_le32(&mxc_ccm->CCGR4,
592 MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK | 592 MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK |
593 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK | 593 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK |
594 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK | 594 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK |
595 MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK | 595 MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK |
596 MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_OFFSET); 596 MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_OFFSET);
597 597
598 /* enable apbh clock gating */ 598 /* enable apbh clock gating */
599 setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK); 599 setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK);
600 } 600 }
601 #endif 601 #endif
602 602
603 #ifdef CONFIG_MAX7310_IOEXP 603 #ifdef CONFIG_MAX7310_IOEXP
604 void reset_max7310(void) 604 void reset_max7310(void)
605 { 605 {
606 gpio_direction_output(I2C_EXP_RST, 1); 606 gpio_direction_output(I2C_EXP_RST, 1);
607 imx_iomux_v3_setup_multiple_pads(port_exp, 607 imx_iomux_v3_setup_multiple_pads(port_exp,
608 ARRAY_SIZE(port_exp)); 608 ARRAY_SIZE(port_exp));
609 } 609 }
610 610
611 int setup_max7310(void) 611 int setup_max7310(void)
612 { 612 {
613 #ifdef CONFIG_SYS_I2C_MXC 613 #ifdef CONFIG_SYS_I2C_MXC
614 /* set steering config to i2c, 614 /* set steering config to i2c,
615 * note: this causes pin conflicts with eimnor and spinor 615 * note: this causes pin conflicts with eimnor and spinor
616 */ 616 */
617 gpio_direction_output(IMX_GPIO_NR(5, 4), 1); 617 gpio_direction_output(IMX_GPIO_NR(5, 4), 1);
618 imx_iomux_v3_setup_multiple_pads(i2c3_pads, 618 imx_iomux_v3_setup_multiple_pads(i2c3_pads,
619 ARRAY_SIZE(i2c3_pads)); 619 ARRAY_SIZE(i2c3_pads));
620 620
621 /*setup i2c info 2*/ 621 /*setup i2c info 2*/
622 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); 622 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
623 623
624 gpio_exp_setup_port(1, 2, 0x30); 624 gpio_exp_setup_port(1, 2, 0x30);
625 gpio_exp_setup_port(2, 2, 0x32); 625 gpio_exp_setup_port(2, 2, 0x32);
626 gpio_exp_setup_port(3, 2, 0x34); 626 gpio_exp_setup_port(3, 2, 0x34);
627 627
628 return 0; 628 return 0;
629 #else 629 #else
630 return -EPERM; 630 return -EPERM;
631 #endif 631 #endif
632 } 632 }
633 #endif 633 #endif
634 int mx6_rgmii_rework(struct phy_device *phydev) 634 int mx6_rgmii_rework(struct phy_device *phydev)
635 { 635 {
636 unsigned short val; 636 unsigned short val;
637 637
638 /* To enable AR8031 ouput a 125MHz clk from CLK_25M */ 638 /* To enable AR8031 ouput a 125MHz clk from CLK_25M */
639 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7); 639 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);
640 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016); 640 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);
641 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007); 641 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);
642 642
643 val = phy_read(phydev, MDIO_DEVAD_NONE, 0xe); 643 val = phy_read(phydev, MDIO_DEVAD_NONE, 0xe);
644 val &= 0xffe3; 644 val &= 0xffe3;
645 val |= 0x18; 645 val |= 0x18;
646 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, val); 646 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, val);
647 647
648 /* introduce tx clock delay */ 648 /* introduce tx clock delay */
649 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x5); 649 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x5);
650 val = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e); 650 val = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);
651 val |= 0x0100; 651 val |= 0x0100;
652 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, val); 652 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, val);
653 653
654 return 0; 654 return 0;
655 } 655 }
656 656
657 int board_phy_config(struct phy_device *phydev) 657 int board_phy_config(struct phy_device *phydev)
658 { 658 {
659 mx6_rgmii_rework(phydev); 659 mx6_rgmii_rework(phydev);
660 660
661 if (phydev->drv->config) 661 if (phydev->drv->config)
662 phydev->drv->config(phydev); 662 phydev->drv->config(phydev);
663 663
664 return 0; 664 return 0;
665 } 665 }
666 666
667 #if defined(CONFIG_VIDEO_IPUV3) 667 #if defined(CONFIG_VIDEO_IPUV3)
668 struct display_info_t { 668 struct display_info_t {
669 int bus; 669 int bus;
670 int addr; 670 int addr;
671 int pixfmt; 671 int pixfmt;
672 int (*detect)(struct display_info_t const *dev); 672 int (*detect)(struct display_info_t const *dev);
673 void (*enable)(struct display_info_t const *dev); 673 void (*enable)(struct display_info_t const *dev);
674 struct fb_videomode mode; 674 struct fb_videomode mode;
675 }; 675 };
676 676
677 static void disable_lvds(struct display_info_t const *dev) 677 static void disable_lvds(struct display_info_t const *dev)
678 { 678 {
679 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; 679 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
680 680
681 int reg = readl(&iomux->gpr[2]); 681 int reg = readl(&iomux->gpr[2]);
682 682
683 reg &= ~(IOMUXC_GPR2_LVDS_CH0_MODE_MASK | 683 reg &= ~(IOMUXC_GPR2_LVDS_CH0_MODE_MASK |
684 IOMUXC_GPR2_LVDS_CH1_MODE_MASK); 684 IOMUXC_GPR2_LVDS_CH1_MODE_MASK);
685 685
686 writel(reg, &iomux->gpr[2]); 686 writel(reg, &iomux->gpr[2]);
687 } 687 }
688 688
689 static void do_enable_hdmi(struct display_info_t const *dev) 689 static void do_enable_hdmi(struct display_info_t const *dev)
690 { 690 {
691 disable_lvds(dev); 691 disable_lvds(dev);
692 imx_enable_hdmi_phy(); 692 imx_enable_hdmi_phy();
693 } 693 }
694 694
695 static struct display_info_t const displays[] = {{ 695 static struct display_info_t const displays[] = {{
696 .bus = -1, 696 .bus = -1,
697 .addr = 0, 697 .addr = 0,
698 .pixfmt = IPU_PIX_FMT_RGB666, 698 .pixfmt = IPU_PIX_FMT_RGB666,
699 .detect = NULL, 699 .detect = NULL,
700 .enable = NULL, 700 .enable = NULL,
701 .mode = { 701 .mode = {
702 .name = "Hannstar-XGA", 702 .name = "Hannstar-XGA",
703 .refresh = 60, 703 .refresh = 60,
704 .xres = 1024, 704 .xres = 1024,
705 .yres = 768, 705 .yres = 768,
706 .pixclock = 15385, 706 .pixclock = 15385,
707 .left_margin = 220, 707 .left_margin = 220,
708 .right_margin = 40, 708 .right_margin = 40,
709 .upper_margin = 21, 709 .upper_margin = 21,
710 .lower_margin = 7, 710 .lower_margin = 7,
711 .hsync_len = 60, 711 .hsync_len = 60,
712 .vsync_len = 10, 712 .vsync_len = 10,
713 .sync = FB_SYNC_EXT, 713 .sync = FB_SYNC_EXT,
714 .vmode = FB_VMODE_NONINTERLACED 714 .vmode = FB_VMODE_NONINTERLACED
715 } }, { 715 } }, {
716 .bus = -1, 716 .bus = -1,
717 .addr = 0, 717 .addr = 0,
718 .pixfmt = IPU_PIX_FMT_RGB24, 718 .pixfmt = IPU_PIX_FMT_RGB24,
719 .detect = NULL, 719 .detect = NULL,
720 .enable = do_enable_hdmi, 720 .enable = do_enable_hdmi,
721 .mode = { 721 .mode = {
722 .name = "HDMI", 722 .name = "HDMI",
723 .refresh = 60, 723 .refresh = 60,
724 .xres = 640, 724 .xres = 640,
725 .yres = 480, 725 .yres = 480,
726 .pixclock = 39721, 726 .pixclock = 39721,
727 .left_margin = 48, 727 .left_margin = 48,
728 .right_margin = 16, 728 .right_margin = 16,
729 .upper_margin = 33, 729 .upper_margin = 33,
730 .lower_margin = 10, 730 .lower_margin = 10,
731 .hsync_len = 96, 731 .hsync_len = 96,
732 .vsync_len = 2, 732 .vsync_len = 2,
733 .sync = 0, 733 .sync = 0,
734 .vmode = FB_VMODE_NONINTERLACED 734 .vmode = FB_VMODE_NONINTERLACED
735 } } }; 735 } } };
736 736
737 int board_video_skip(void) 737 int board_video_skip(void)
738 { 738 {
739 int i; 739 int i;
740 int ret; 740 int ret;
741 char const *panel = getenv("panel"); 741 char const *panel = getenv("panel");
742 742
743 if (!panel) { 743 if (!panel) {
744 for (i = 0; i < ARRAY_SIZE(displays); i++) { 744 for (i = 0; i < ARRAY_SIZE(displays); i++) {
745 struct display_info_t const *dev = displays+i; 745 struct display_info_t const *dev = displays+i;
746 if (dev->detect && dev->detect(dev)) { 746 if (dev->detect && dev->detect(dev)) {
747 panel = dev->mode.name; 747 panel = dev->mode.name;
748 printf("auto-detected panel %s\n", panel); 748 printf("auto-detected panel %s\n", panel);
749 break; 749 break;
750 } 750 }
751 } 751 }
752 if (!panel) { 752 if (!panel) {
753 panel = displays[0].mode.name; 753 panel = displays[0].mode.name;
754 printf("No panel detected: default to %s\n", panel); 754 printf("No panel detected: default to %s\n", panel);
755 i = 0; 755 i = 0;
756 } 756 }
757 } else { 757 } else {
758 for (i = 0; i < ARRAY_SIZE(displays); i++) { 758 for (i = 0; i < ARRAY_SIZE(displays); i++) {
759 if (!strcmp(panel, displays[i].mode.name)) 759 if (!strcmp(panel, displays[i].mode.name))
760 break; 760 break;
761 } 761 }
762 } 762 }
763 763
764 if (i < ARRAY_SIZE(displays)) { 764 if (i < ARRAY_SIZE(displays)) {
765 ret = ipuv3_fb_init(&displays[i].mode, 0, 765 ret = ipuv3_fb_init(&displays[i].mode, 0,
766 displays[i].pixfmt); 766 displays[i].pixfmt);
767 if (!ret) { 767 if (!ret) {
768 if (displays[i].enable) 768 if (displays[i].enable)
769 displays[i].enable(displays+i); 769 displays[i].enable(displays+i);
770 printf("Display: %s (%ux%u)\n", 770 printf("Display: %s (%ux%u)\n",
771 displays[i].mode.name, 771 displays[i].mode.name,
772 displays[i].mode.xres, 772 displays[i].mode.xres,
773 displays[i].mode.yres); 773 displays[i].mode.yres);
774 } else 774 } else
775 printf("LCD %s cannot be configured: %d\n", 775 printf("LCD %s cannot be configured: %d\n",
776 displays[i].mode.name, ret); 776 displays[i].mode.name, ret);
777 } else { 777 } else {
778 printf("unsupported panel %s\n", panel); 778 printf("unsupported panel %s\n", panel);
779 return -EINVAL; 779 return -EINVAL;
780 } 780 }
781 781
782 return 0; 782 return 0;
783 } 783 }
784 784
785 iomux_v3_cfg_t const backlight_pads[] = { 785 iomux_v3_cfg_t const backlight_pads[] = {
786 MX6_PAD_SD4_DAT1__GPIO2_IO09 | MUX_PAD_CTRL(ENET_PAD_CTRL), 786 MX6_PAD_SD4_DAT1__GPIO2_IO09 | MUX_PAD_CTRL(ENET_PAD_CTRL),
787 }; 787 };
788 788
789 static void setup_iomux_backlight(void) 789 static void setup_iomux_backlight(void)
790 { 790 {
791 gpio_direction_output(IMX_GPIO_NR(2, 9), 1); 791 gpio_direction_output(IMX_GPIO_NR(2, 9), 1);
792 imx_iomux_v3_setup_multiple_pads(backlight_pads, 792 imx_iomux_v3_setup_multiple_pads(backlight_pads,
793 ARRAY_SIZE(backlight_pads)); 793 ARRAY_SIZE(backlight_pads));
794 } 794 }
795 795
796 static void setup_display(void) 796 static void setup_display(void)
797 { 797 {
798 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; 798 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
799 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; 799 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
800 int reg; 800 int reg;
801 801
802 setup_iomux_backlight(); 802 setup_iomux_backlight();
803 enable_ipu_clock(); 803 enable_ipu_clock();
804 imx_setup_hdmi(); 804 imx_setup_hdmi();
805 805
806 /* Turn on LDB_DI0 and LDB_DI1 clocks */ 806 /* Turn on LDB_DI0 and LDB_DI1 clocks */
807 reg = readl(&mxc_ccm->CCGR3); 807 reg = readl(&mxc_ccm->CCGR3);
808 reg |= MXC_CCM_CCGR3_LDB_DI0_MASK | MXC_CCM_CCGR3_LDB_DI1_MASK; 808 reg |= MXC_CCM_CCGR3_LDB_DI0_MASK | MXC_CCM_CCGR3_LDB_DI1_MASK;
809 writel(reg, &mxc_ccm->CCGR3); 809 writel(reg, &mxc_ccm->CCGR3);
810 810
811 /* Set LDB_DI0 and LDB_DI1 clk select to 3b'011 */ 811 /* Set LDB_DI0 and LDB_DI1 clk select to 3b'011 */
812 reg = readl(&mxc_ccm->cs2cdr); 812 reg = readl(&mxc_ccm->cs2cdr);
813 reg &= ~(MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_MASK | 813 reg &= ~(MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_MASK |
814 MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_MASK); 814 MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_MASK);
815 reg |= (3 << MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_OFFSET) | 815 reg |= (3 << MXC_CCM_CS2CDR_LDB_DI0_CLK_SEL_OFFSET) |
816 (3 << MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_OFFSET); 816 (3 << MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_OFFSET);
817 writel(reg, &mxc_ccm->cs2cdr); 817 writel(reg, &mxc_ccm->cs2cdr);
818 818
819 reg = readl(&mxc_ccm->cscmr2); 819 reg = readl(&mxc_ccm->cscmr2);
820 reg |= MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV | MXC_CCM_CSCMR2_LDB_DI1_IPU_DIV; 820 reg |= MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV | MXC_CCM_CSCMR2_LDB_DI1_IPU_DIV;
821 writel(reg, &mxc_ccm->cscmr2); 821 writel(reg, &mxc_ccm->cscmr2);
822 822
823 reg = readl(&mxc_ccm->chsccdr); 823 reg = readl(&mxc_ccm->chsccdr);
824 reg |= (CHSCCDR_CLK_SEL_LDB_DI0 << 824 reg |= (CHSCCDR_CLK_SEL_LDB_DI0 <<
825 MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET); 825 MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET);
826 reg |= (CHSCCDR_CLK_SEL_LDB_DI0 << 826 reg |= (CHSCCDR_CLK_SEL_LDB_DI0 <<
827 MXC_CCM_CHSCCDR_IPU1_DI1_CLK_SEL_OFFSET); 827 MXC_CCM_CHSCCDR_IPU1_DI1_CLK_SEL_OFFSET);
828 writel(reg, &mxc_ccm->chsccdr); 828 writel(reg, &mxc_ccm->chsccdr);
829 829
830 reg = IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_LOW | 830 reg = IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_LOW |
831 IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW | 831 IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW |
832 IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG | 832 IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG |
833 IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT | 833 IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT |
834 IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG | 834 IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG |
835 IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT | 835 IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT |
836 IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0 | 836 IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0 |
837 IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED; 837 IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED;
838 writel(reg, &iomux->gpr[2]); 838 writel(reg, &iomux->gpr[2]);
839 839
840 reg = readl(&iomux->gpr[3]); 840 reg = readl(&iomux->gpr[3]);
841 reg &= ~(IOMUXC_GPR3_LVDS0_MUX_CTL_MASK | 841 reg &= ~(IOMUXC_GPR3_LVDS0_MUX_CTL_MASK |
842 IOMUXC_GPR3_HDMI_MUX_CTL_MASK); 842 IOMUXC_GPR3_HDMI_MUX_CTL_MASK);
843 reg |= (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 << 843 reg |= (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 <<
844 IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET) | 844 IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET) |
845 (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 << 845 (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 <<
846 IOMUXC_GPR3_HDMI_MUX_CTL_OFFSET); 846 IOMUXC_GPR3_HDMI_MUX_CTL_OFFSET);
847 writel(reg, &iomux->gpr[3]); 847 writel(reg, &iomux->gpr[3]);
848 } 848 }
849 #endif /* CONFIG_VIDEO_IPUV3 */ 849 #endif /* CONFIG_VIDEO_IPUV3 */
850 850
851 /* 851 /*
852 * Do not overwrite the console 852 * Do not overwrite the console
853 * Use always serial for U-Boot console 853 * Use always serial for U-Boot console
854 */ 854 */
855 int overwrite_console(void) 855 int overwrite_console(void)
856 { 856 {
857 return 1; 857 return 1;
858 } 858 }
859 859
860 int board_eth_init(bd_t *bis) 860 int board_eth_init(bd_t *bis)
861 { 861 {
862 setup_iomux_enet(); 862 setup_iomux_enet();
863 863
864 return cpu_eth_init(bis); 864 return cpu_eth_init(bis);
865 } 865 }
866 866
867 #define BOARD_REV_B 0x200 867 #define BOARD_REV_B 0x200
868 #define BOARD_REV_A 0x100 868 #define BOARD_REV_A 0x100
869 869
870 static int mx6sabre_rev(void) 870 static int mx6sabre_rev(void)
871 { 871 {
872 /* 872 /*
873 * Get Board ID information from OCOTP_GP1[15:8] 873 * Get Board ID information from OCOTP_GP1[15:8]
874 * i.MX6Q ARD RevA: 0x01 874 * i.MX6Q ARD RevA: 0x01
875 * i.MX6Q ARD RevB: 0x02 875 * i.MX6Q ARD RevB: 0x02
876 */ 876 */
877 struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR; 877 struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
878 struct fuse_bank *bank = &ocotp->bank[4]; 878 struct fuse_bank *bank = &ocotp->bank[4];
879 struct fuse_bank4_regs *fuse = 879 struct fuse_bank4_regs *fuse =
880 (struct fuse_bank4_regs *)bank->fuse_regs; 880 (struct fuse_bank4_regs *)bank->fuse_regs;
881 int reg = readl(&fuse->gp1); 881 int reg = readl(&fuse->gp1);
882 int ret; 882 int ret;
883 883
884 switch (reg >> 8 & 0x0F) { 884 switch (reg >> 8 & 0x0F) {
885 case 0x02: 885 case 0x02:
886 ret = BOARD_REV_B; 886 ret = BOARD_REV_B;
887 break; 887 break;
888 case 0x01: 888 case 0x01:
889 default: 889 default:
890 ret = BOARD_REV_A; 890 ret = BOARD_REV_A;
891 break; 891 break;
892 } 892 }
893 893
894 return ret; 894 return ret;
895 } 895 }
896 896
897 u32 get_board_rev(void) 897 u32 get_board_rev(void)
898 { 898 {
899 int rev = mx6sabre_rev(); 899 int rev = mx6sabre_rev();
900 900
901 return (get_cpu_rev() & ~(0xF << 8)) | rev; 901 return (get_cpu_rev() & ~(0xF << 8)) | rev;
902 } 902 }
903 903
904 int board_early_init_f(void) 904 int board_early_init_f(void)
905 { 905 {
906 setup_iomux_uart(); 906 setup_iomux_uart();
907 907
908 #ifdef CONFIG_MAX7310_IOEXP 908 #ifdef CONFIG_MAX7310_IOEXP
909 /*Reset gpio expander at early stage*/ 909 /*Reset gpio expander at early stage*/
910 reset_max7310(); 910 reset_max7310();
911 #endif 911 #endif
912 912
913 #if defined(CONFIG_VIDEO_IPUV3) 913 #if defined(CONFIG_VIDEO_IPUV3)
914 setup_display(); 914 setup_display();
915 #endif 915 #endif
916 916
917 #ifdef CONFIG_SYS_USE_SPINOR 917 #ifdef CONFIG_SYS_USE_SPINOR
918 setup_spinor(); 918 setup_spinor();
919 #endif 919 #endif
920 920
921 #ifdef CONFIG_SYS_USE_EIMNOR 921 #ifdef CONFIG_SYS_USE_EIMNOR
922 setup_eimnor(); 922 setup_eimnor();
923 #endif 923 #endif
924 924
925 #ifdef CONFIG_SYS_USE_NAND 925 #ifdef CONFIG_SYS_USE_NAND
926 setup_gpmi_nand(); 926 setup_gpmi_nand();
927 #endif 927 #endif
928 928
929 #ifdef CONFIG_CMD_SATA 929 #ifdef CONFIG_CMD_SATA
930 setup_sata(); 930 setup_sata();
931 #endif 931 #endif
932 return 0; 932 return 0;
933 } 933 }
934 934
935 int board_init(void) 935 int board_init(void)
936 { 936 {
937 /* address of boot parameters */ 937 /* address of boot parameters */
938 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; 938 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
939 939
940 return 0; 940 return 0;
941 } 941 }
942 942
943 #ifdef CONFIG_CMD_BMODE 943 #ifdef CONFIG_CMD_BMODE
944 static const struct boot_mode board_boot_modes[] = { 944 static const struct boot_mode board_boot_modes[] = {
945 /* 4 bit bus width */ 945 /* 4 bit bus width */
946 {"mmc0", MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)}, 946 {"mmc0", MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)},
947 {NULL, 0}, 947 {NULL, 0},
948 }; 948 };
949 #endif 949 #endif
950 950
951 int board_late_init(void) 951 int board_late_init(void)
952 { 952 {
953 int ret; 953 int ret;
954 #ifdef CONFIG_CMD_BMODE 954 #ifdef CONFIG_CMD_BMODE
955 add_board_boot_modes(board_boot_modes); 955 add_board_boot_modes(board_boot_modes);
956 #endif 956 #endif
957 957
958 #ifdef CONFIG_SYS_I2C_MXC 958 #ifdef CONFIG_SYS_I2C_MXC
959 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); 959 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
960 ret = setup_pmic_voltages(); 960 ret = setup_pmic_voltages();
961 if (ret) 961 if (ret)
962 return -1; 962 return -1;
963 #endif 963 #endif
964 964
965 #ifdef CONFIG_MAX7310_IOEXP 965 #ifdef CONFIG_MAX7310_IOEXP
966 setup_max7310(); 966 setup_max7310();
967 #endif 967 #endif
968 968
969 #ifdef CONFIG_ENV_IS_IN_MMC 969 #ifdef CONFIG_ENV_IS_IN_MMC
970 board_late_mmc_env_init(); 970 board_late_mmc_env_init();
971 #endif 971 #endif
972 972
973 return 0; 973 return 0;
974 } 974 }
975 975
976 #ifdef CONFIG_FASTBOOT 976 #ifdef CONFIG_FASTBOOT
977 977
978 void board_fastboot_setup(void) 978 void board_fastboot_setup(void)
979 { 979 {
980 switch (get_boot_device()) { 980 switch (get_boot_device()) {
981 #if defined(CONFIG_FASTBOOT_STORAGE_SATA) 981 #if defined(CONFIG_FASTBOOT_STORAGE_SATA)
982 case SATA_BOOT: 982 case SATA_BOOT:
983 if (!getenv("fastboot_dev")) 983 if (!getenv("fastboot_dev"))
984 setenv("fastboot_dev", "sata"); 984 setenv("fastboot_dev", "sata");
985 if (!getenv("bootcmd")) 985 if (!getenv("bootcmd"))
986 setenv("bootcmd", "booti sata"); 986 setenv("bootcmd", "booti sata");
987 break; 987 break;
988 #endif /*CONFIG_FASTBOOT_STORAGE_SATA*/ 988 #endif /*CONFIG_FASTBOOT_STORAGE_SATA*/
989 #if defined(CONFIG_FASTBOOT_STORAGE_MMC) 989 #if defined(CONFIG_FASTBOOT_STORAGE_MMC)
990 case SD1_BOOT: 990 case SD1_BOOT:
991 case MMC1_BOOT: 991 case MMC1_BOOT:
992 if (!getenv("fastboot_dev")) 992 if (!getenv("fastboot_dev"))
993 setenv("fastboot_dev", "mmc0"); 993 setenv("fastboot_dev", "mmc0");
994 if (!getenv("bootcmd")) 994 if (!getenv("bootcmd"))
995 setenv("bootcmd", "booti mmc0"); 995 setenv("bootcmd", "booti mmc0");
996 break; 996 break;
997 case SD3_BOOT: 997 case SD3_BOOT:
998 case MMC3_BOOT: 998 case MMC3_BOOT:
999 if (!getenv("fastboot_dev")) 999 if (!getenv("fastboot_dev"))
1000 setenv("fastboot_dev", "mmc1"); 1000 setenv("fastboot_dev", "mmc1");
1001 if (!getenv("bootcmd")) 1001 if (!getenv("bootcmd"))
1002 setenv("bootcmd", "booti mmc1"); 1002 setenv("bootcmd", "booti mmc1");
1003 break; 1003 break;
1004 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ 1004 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/
1005 #if defined(CONFIG_FASTBOOT_STORAGE_NAND) 1005 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
1006 case NAND_BOOT: 1006 case NAND_BOOT:
1007 if (!getenv("fastboot_dev")) 1007 if (!getenv("fastboot_dev"))
1008 setenv("fastboot_dev", "nand"); 1008 setenv("fastboot_dev", "nand");
1009 if (!getenv("fbparts")) 1009 if (!getenv("fbparts"))
1010 setenv("fbparts", 1010 setenv("fbparts", ANDROID_FASTBOOT_NAND_PARTS);
1011 "16m@16m(boot) 16m@32m(recovery) 810m@48m(android_root)ubifs");
1012 if (!getenv("bootcmd")) 1011 if (!getenv("bootcmd"))
1013 setenv("bootcmd", 1012 setenv("bootcmd",
1014 "nand read ${loadaddr} ${boot_nand_offset} " 1013 "nand read ${loadaddr} ${boot_nand_offset} "
1015 "${boot_nand_size};booti ${loadaddr}"); 1014 "${boot_nand_size};booti ${loadaddr}");
1016 break; 1015 break;
1017 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ 1016 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/
1018 default: 1017 default:
1019 printf("unsupported boot devices\n"); 1018 printf("unsupported boot devices\n");
1020 break; 1019 break;
1021 } 1020 }
1022 } 1021 }
1023 1022
1024 #ifdef CONFIG_ANDROID_RECOVERY 1023 #ifdef CONFIG_ANDROID_RECOVERY
1025 1024
1026 #define GPIO_VOL_DN_KEY IMX_GPIO_NR(5, 14) 1025 #define GPIO_VOL_DN_KEY IMX_GPIO_NR(5, 14)
1027 iomux_v3_cfg_t const recovery_key_pads[] = { 1026 iomux_v3_cfg_t const recovery_key_pads[] = {
1028 (MX6_PAD_DISP0_DAT20__GPIO5_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL)), 1027 (MX6_PAD_DISP0_DAT20__GPIO5_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL)),
1029 }; 1028 };
1030 1029
1031 int check_recovery_cmd_file(void) 1030 int check_recovery_cmd_file(void)
1032 { 1031 {
1033 int button_pressed = 0; 1032 int button_pressed = 0;
1034 int recovery_mode = 0; 1033 int recovery_mode = 0;
1035 1034
1036 recovery_mode = recovery_check_and_clean_flag(); 1035 recovery_mode = recovery_check_and_clean_flag();
1037 1036
1038 /* Check Recovery Combo Button press or not. */ 1037 /* Check Recovery Combo Button press or not. */
1039 imx_iomux_v3_setup_multiple_pads(recovery_key_pads, 1038 imx_iomux_v3_setup_multiple_pads(recovery_key_pads,
1040 ARRAY_SIZE(recovery_key_pads)); 1039 ARRAY_SIZE(recovery_key_pads));
1041 1040
1042 gpio_direction_input(GPIO_VOL_DN_KEY); 1041 gpio_direction_input(GPIO_VOL_DN_KEY);
1043 1042
1044 if (gpio_get_value(GPIO_VOL_DN_KEY) == 0) { /* VOL_DN key is low assert */ 1043 if (gpio_get_value(GPIO_VOL_DN_KEY) == 0) { /* VOL_DN key is low assert */
1045 button_pressed = 1; 1044 button_pressed = 1;
1046 printf("Recovery key pressed\n"); 1045 printf("Recovery key pressed\n");
1047 } 1046 }
1048 1047
1049 return recovery_mode || button_pressed; 1048 return recovery_mode || button_pressed;
1050 } 1049 }
1051 1050
1052 void board_recovery_setup(void) 1051 void board_recovery_setup(void)
1053 { 1052 {
1054 int bootdev = get_boot_device(); 1053 int bootdev = get_boot_device();
1055 1054
1056 switch (bootdev) { 1055 switch (bootdev) {
1057 #if defined(CONFIG_FASTBOOT_STORAGE_SATA) 1056 #if defined(CONFIG_FASTBOOT_STORAGE_SATA)
1058 case SATA_BOOT: 1057 case SATA_BOOT:
1059 if (!getenv("bootcmd_android_recovery")) 1058 if (!getenv("bootcmd_android_recovery"))
1060 setenv("bootcmd_android_recovery", "booti sata recovery"); 1059 setenv("bootcmd_android_recovery", "booti sata recovery");
1061 break; 1060 break;
1062 #endif /*CONFIG_FASTBOOT_STORAGE_SATA*/ 1061 #endif /*CONFIG_FASTBOOT_STORAGE_SATA*/
1063 #if defined(CONFIG_FASTBOOT_STORAGE_MMC) 1062 #if defined(CONFIG_FASTBOOT_STORAGE_MMC)
1064 case SD1_BOOT: 1063 case SD1_BOOT:
1065 case MMC1_BOOT: 1064 case MMC1_BOOT:
1066 if (!getenv("bootcmd_android_recovery")) 1065 if (!getenv("bootcmd_android_recovery"))
1067 setenv("bootcmd_android_recovery", "booti mmc0 recovery"); 1066 setenv("bootcmd_android_recovery", "booti mmc0 recovery");
1068 break; 1067 break;
1069 case SD3_BOOT: 1068 case SD3_BOOT:
1070 case MMC3_BOOT: 1069 case MMC3_BOOT:
1071 if (!getenv("bootcmd_android_recovery")) 1070 if (!getenv("bootcmd_android_recovery"))
1072 setenv("bootcmd_android_recovery", "booti mmc1 recovery"); 1071 setenv("bootcmd_android_recovery", "booti mmc1 recovery");
1073 break; 1072 break;
1074 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ 1073 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/
1075 #if defined(CONFIG_FASTBOOT_STORAGE_NAND) 1074 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
1076 case NAND_BOOT: 1075 case NAND_BOOT:
1077 if (!getenv("bootcmd_android_recovery")) 1076 if (!getenv("bootcmd_android_recovery"))
1078 setenv("bootcmd_android_recovery", 1077 setenv("bootcmd_android_recovery",
1079 "nand read ${loadaddr} ${recovery_nand_offset} " 1078 "nand read ${loadaddr} ${recovery_nand_offset} "
1080 "${recovery_nand_size};booti ${loadaddr}"); 1079 "${recovery_nand_size};booti ${loadaddr}");
1081 break; 1080 break;
1082 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ 1081 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/
1083 default: 1082 default:
1084 printf("Unsupported bootup device for recovery: dev: %d\n", 1083 printf("Unsupported bootup device for recovery: dev: %d\n",
1085 bootdev); 1084 bootdev);
1086 return; 1085 return;
1087 } 1086 }
1088 1087
1089 printf("setup env for recovery..\n"); 1088 printf("setup env for recovery..\n");
1090 setenv("bootcmd", "run bootcmd_android_recovery"); 1089 setenv("bootcmd", "run bootcmd_android_recovery");
1091 } 1090 }
1092 #endif /*CONFIG_ANDROID_RECOVERY*/ 1091 #endif /*CONFIG_ANDROID_RECOVERY*/
1093 1092
1094 #endif /*CONFIG_FASTBOOT*/ 1093 #endif /*CONFIG_FASTBOOT*/
1095 1094
1096 int checkboard(void) 1095 int checkboard(void)
1097 { 1096 {
1098 int rev = mx6sabre_rev(); 1097 int rev = mx6sabre_rev();
1099 char *revname; 1098 char *revname;
1100 1099
1101 switch (rev) { 1100 switch (rev) {
1102 case BOARD_REV_B: 1101 case BOARD_REV_B:
1103 revname = "B"; 1102 revname = "B";
1104 break; 1103 break;
1105 case BOARD_REV_A: 1104 case BOARD_REV_A:
1106 default: 1105 default:
1107 revname = "A"; 1106 revname = "A";
1108 break; 1107 break;
1109 } 1108 }
1110 1109
1111 printf("Board: MX6-Sabreauto rev%s\n", revname); 1110 printf("Board: MX6-Sabreauto rev%s\n", revname);
1112 1111
1113 return 0; 1112 return 0;
1114 } 1113 }
1115 1114
1116 #ifdef CONFIG_IMX_UDC 1115 #ifdef CONFIG_IMX_UDC
1117 iomux_v3_cfg_t const otg_udc_pads[] = { 1116 iomux_v3_cfg_t const otg_udc_pads[] = {
1118 (MX6_PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL)), 1117 (MX6_PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL)),
1119 }; 1118 };
1120 void udc_pins_setting(void) 1119 void udc_pins_setting(void)
1121 { 1120 {
1122 imx_iomux_v3_setup_multiple_pads(otg_udc_pads, 1121 imx_iomux_v3_setup_multiple_pads(otg_udc_pads,
1123 ARRAY_SIZE(otg_udc_pads)); 1122 ARRAY_SIZE(otg_udc_pads));
1124 1123
1125 /*set daisy chain for otg_pin_id on 6q. for 6dl, this bit is reserved*/ 1124 /*set daisy chain for otg_pin_id on 6q. for 6dl, this bit is reserved*/
1126 mxc_iomux_set_gpr_register(1, 13, 1, 0); 1125 mxc_iomux_set_gpr_register(1, 13, 1, 0);
1127 } 1126 }
1128 1127
1129 #endif /*CONFIG_IMX_UDC*/ 1128 #endif /*CONFIG_IMX_UDC*/
1130 1129
1131 #ifdef CONFIG_USB_EHCI_MX6 1130 #ifdef CONFIG_USB_EHCI_MX6
1132 #define USB_HOST1_PWR IOEXP_GPIO_NR(2, 7) 1131 #define USB_HOST1_PWR IOEXP_GPIO_NR(2, 7)
1133 #define USB_OTG_PWR IOEXP_GPIO_NR(3, 1) 1132 #define USB_OTG_PWR IOEXP_GPIO_NR(3, 1)
1134 1133
1135 iomux_v3_cfg_t const usb_otg_pads[] = { 1134 iomux_v3_cfg_t const usb_otg_pads[] = {
1136 MX6_PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL), 1135 MX6_PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL),
1137 }; 1136 };
1138 1137
1139 int board_ehci_hcd_init(int port) 1138 int board_ehci_hcd_init(int port)
1140 { 1139 {
1141 switch (port) { 1140 switch (port) {
1142 case 0: 1141 case 0:
1143 imx_iomux_v3_setup_multiple_pads(usb_otg_pads, 1142 imx_iomux_v3_setup_multiple_pads(usb_otg_pads,
1144 ARRAY_SIZE(usb_otg_pads)); 1143 ARRAY_SIZE(usb_otg_pads));
1145 1144
1146 /*set daisy chain for otg_pin_id on 6q. for 6dl, this bit is reserved*/ 1145 /*set daisy chain for otg_pin_id on 6q. for 6dl, this bit is reserved*/
1147 mxc_iomux_set_gpr_register(1, 13, 1, 0); 1146 mxc_iomux_set_gpr_register(1, 13, 1, 0);
1148 break; 1147 break;
1149 case 1: 1148 case 1:
1150 break; 1149 break;
1151 default: 1150 default:
1152 printf("MXC USB port %d not yet supported\n", port); 1151 printf("MXC USB port %d not yet supported\n", port);
1153 return 1; 1152 return 1;
1154 } 1153 }
1155 return 0; 1154 return 0;
1156 } 1155 }
1157 1156
1158 int board_ehci_power(int port, int on) 1157 int board_ehci_power(int port, int on)
1159 { 1158 {
1160 switch (port) { 1159 switch (port) {
1161 case 0: 1160 case 0:
1162 if (on) 1161 if (on)
1163 gpio_exp_direction_output(USB_OTG_PWR, 1); 1162 gpio_exp_direction_output(USB_OTG_PWR, 1);
1164 else 1163 else
1165 gpio_exp_direction_output(USB_OTG_PWR, 0); 1164 gpio_exp_direction_output(USB_OTG_PWR, 0);
1166 break; 1165 break;
1167 case 1: 1166 case 1:
1168 if (on) 1167 if (on)
1169 gpio_exp_direction_output(USB_HOST1_PWR, 1); 1168 gpio_exp_direction_output(USB_HOST1_PWR, 1);
1170 else 1169 else
1171 gpio_exp_direction_output(USB_HOST1_PWR, 0); 1170 gpio_exp_direction_output(USB_HOST1_PWR, 0);
1172 break; 1171 break;
1173 default: 1172 default:
1174 printf("MXC USB port %d not yet supported\n", port); 1173 printf("MXC USB port %d not yet supported\n", port);
1175 return 1; 1174 return 1;
1176 } 1175 }
1177 return 0; 1176 return 0;
1178 } 1177 }
1179 #endif 1178 #endif
1180 1179
board/freescale/mx6sxsabreauto/mx6sxsabreauto.c
1 /* 1 /*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc. 2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
3 * 3 *
4 * SPDX-License-Identifier: GPL-2.0+ 4 * SPDX-License-Identifier: GPL-2.0+
5 */ 5 */
6 6
7 #include <asm/arch/clock.h> 7 #include <asm/arch/clock.h>
8 #include <asm/arch/iomux.h> 8 #include <asm/arch/iomux.h>
9 #include <asm/arch/imx-regs.h> 9 #include <asm/arch/imx-regs.h>
10 #include <asm/arch/mx6-pins.h> 10 #include <asm/arch/mx6-pins.h>
11 #include <asm/arch/sys_proto.h> 11 #include <asm/arch/sys_proto.h>
12 #include <asm/gpio.h> 12 #include <asm/gpio.h>
13 #include <asm/imx-common/iomux-v3.h> 13 #include <asm/imx-common/iomux-v3.h>
14 #include <asm/imx-common/boot_mode.h> 14 #include <asm/imx-common/boot_mode.h>
15 #include <asm/io.h> 15 #include <asm/io.h>
16 #include <linux/sizes.h> 16 #include <linux/sizes.h>
17 #include <common.h> 17 #include <common.h>
18 #include <fsl_esdhc.h> 18 #include <fsl_esdhc.h>
19 #include <mmc.h> 19 #include <mmc.h>
20 #include <miiphy.h> 20 #include <miiphy.h>
21 #include <netdev.h> 21 #include <netdev.h>
22 #include <asm/arch/crm_regs.h> 22 #include <asm/arch/crm_regs.h>
23 #ifdef CONFIG_SYS_I2C_MXC 23 #ifdef CONFIG_SYS_I2C_MXC
24 #include <i2c.h> 24 #include <i2c.h>
25 #include <asm/imx-common/mxc_i2c.h> 25 #include <asm/imx-common/mxc_i2c.h>
26 #endif 26 #endif
27 #ifdef CONFIG_MXC_RDC 27 #ifdef CONFIG_MXC_RDC
28 #include <asm/imx-common/rdc-sema.h> 28 #include <asm/imx-common/rdc-sema.h>
29 #include <asm/arch/imx-rdc.h> 29 #include <asm/arch/imx-rdc.h>
30 #endif 30 #endif
31 31
32 #ifdef CONFIG_VIDEO_MXS 32 #ifdef CONFIG_VIDEO_MXS
33 #include <linux/fb.h> 33 #include <linux/fb.h>
34 #include <mxsfb.h> 34 #include <mxsfb.h>
35 #endif 35 #endif
36 36
37 #ifdef CONFIG_MAX7310_IOEXP 37 #ifdef CONFIG_MAX7310_IOEXP
38 #include <gpio_exp.h> 38 #include <gpio_exp.h>
39 #endif 39 #endif
40 40
41 #ifdef CONFIG_FASTBOOT 41 #ifdef CONFIG_FASTBOOT
42 #include <fastboot.h> 42 #include <fastboot.h>
43 #ifdef CONFIG_ANDROID_RECOVERY 43 #ifdef CONFIG_ANDROID_RECOVERY
44 #include <recovery.h> 44 #include <recovery.h>
45 #endif 45 #endif
46 #endif /*CONFIG_FASTBOOT*/ 46 #endif /*CONFIG_FASTBOOT*/
47 47
48 DECLARE_GLOBAL_DATA_PTR; 48 DECLARE_GLOBAL_DATA_PTR;
49 49
50 #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 50 #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
51 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ 51 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
52 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) 52 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
53 53
54 #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 54 #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
55 PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_LOW | \ 55 PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_LOW | \
56 PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) 56 PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
57 57
58 #define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \ 58 #define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
59 PAD_CTL_SPEED_HIGH | \ 59 PAD_CTL_SPEED_HIGH | \
60 PAD_CTL_DSE_48ohm | PAD_CTL_SRE_FAST) 60 PAD_CTL_DSE_48ohm | PAD_CTL_SRE_FAST)
61 61
62 #define ENET_CLK_PAD_CTRL (PAD_CTL_SPEED_MED | \ 62 #define ENET_CLK_PAD_CTRL (PAD_CTL_SPEED_MED | \
63 PAD_CTL_DSE_120ohm | PAD_CTL_SRE_FAST) 63 PAD_CTL_DSE_120ohm | PAD_CTL_SRE_FAST)
64 64
65 #define ENET_RX_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 65 #define ENET_RX_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
66 PAD_CTL_SPEED_HIGH | PAD_CTL_SRE_FAST) 66 PAD_CTL_SPEED_HIGH | PAD_CTL_SRE_FAST)
67 67
68 #define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 68 #define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
69 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ 69 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
70 PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ 70 PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
71 PAD_CTL_ODE | PAD_CTL_SRE_FAST) 71 PAD_CTL_ODE | PAD_CTL_SRE_FAST)
72 72
73 #define LCD_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \ 73 #define LCD_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
74 PAD_CTL_PKE | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm) 74 PAD_CTL_PKE | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm)
75 75
76 #define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ 76 #define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
77 PAD_CTL_PUS_22K_UP | PAD_CTL_DSE_40ohm) 77 PAD_CTL_PUS_22K_UP | PAD_CTL_DSE_40ohm)
78 78
79 #define GPMI_PAD_CTRL0 (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP) 79 #define GPMI_PAD_CTRL0 (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP)
80 #define GPMI_PAD_CTRL1 (PAD_CTL_DSE_40ohm | PAD_CTL_SPEED_MED | \ 80 #define GPMI_PAD_CTRL1 (PAD_CTL_DSE_40ohm | PAD_CTL_SPEED_MED | \
81 PAD_CTL_SRE_FAST) 81 PAD_CTL_SRE_FAST)
82 #define GPMI_PAD_CTRL2 (GPMI_PAD_CTRL0 | GPMI_PAD_CTRL1) 82 #define GPMI_PAD_CTRL2 (GPMI_PAD_CTRL0 | GPMI_PAD_CTRL1)
83 83
84 84
85 #ifdef CONFIG_SYS_I2C_MXC 85 #ifdef CONFIG_SYS_I2C_MXC
86 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL) 86 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
87 /* I2C2 for PMIC */ 87 /* I2C2 for PMIC */
88 struct i2c_pads_info i2c_pad_info2 = { 88 struct i2c_pads_info i2c_pad_info2 = {
89 .scl = { 89 .scl = {
90 .i2c_mode = MX6SX_PAD_GPIO1_IO02__I2C2_SCL | PC, 90 .i2c_mode = MX6SX_PAD_GPIO1_IO02__I2C2_SCL | PC,
91 .gpio_mode = MX6SX_PAD_GPIO1_IO02__GPIO1_IO_2 | PC, 91 .gpio_mode = MX6SX_PAD_GPIO1_IO02__GPIO1_IO_2 | PC,
92 .gp = IMX_GPIO_NR(1, 2), 92 .gp = IMX_GPIO_NR(1, 2),
93 }, 93 },
94 .sda = { 94 .sda = {
95 .i2c_mode = MX6SX_PAD_GPIO1_IO03__I2C2_SDA | PC, 95 .i2c_mode = MX6SX_PAD_GPIO1_IO03__I2C2_SDA | PC,
96 .gpio_mode = MX6SX_PAD_GPIO1_IO03__GPIO1_IO_3 | PC, 96 .gpio_mode = MX6SX_PAD_GPIO1_IO03__GPIO1_IO_3 | PC,
97 .gp = IMX_GPIO_NR(1, 3), 97 .gp = IMX_GPIO_NR(1, 3),
98 }, 98 },
99 }; 99 };
100 100
101 /* I2C3 */ 101 /* I2C3 */
102 struct i2c_pads_info i2c_pad_info3 = { 102 struct i2c_pads_info i2c_pad_info3 = {
103 .scl = { 103 .scl = {
104 .i2c_mode = MX6SX_PAD_KEY_COL4__I2C3_SCL | PC, 104 .i2c_mode = MX6SX_PAD_KEY_COL4__I2C3_SCL | PC,
105 .gpio_mode = MX6SX_PAD_KEY_COL4__GPIO2_IO_14 | PC, 105 .gpio_mode = MX6SX_PAD_KEY_COL4__GPIO2_IO_14 | PC,
106 .gp = IMX_GPIO_NR(2, 14), 106 .gp = IMX_GPIO_NR(2, 14),
107 }, 107 },
108 .sda = { 108 .sda = {
109 .i2c_mode = MX6SX_PAD_KEY_ROW4__I2C3_SDA | PC, 109 .i2c_mode = MX6SX_PAD_KEY_ROW4__I2C3_SDA | PC,
110 .gpio_mode = MX6SX_PAD_KEY_ROW4__GPIO2_IO_19 | PC, 110 .gpio_mode = MX6SX_PAD_KEY_ROW4__GPIO2_IO_19 | PC,
111 .gp = IMX_GPIO_NR(2, 19), 111 .gp = IMX_GPIO_NR(2, 19),
112 }, 112 },
113 }; 113 };
114 #endif 114 #endif
115 115
116 int dram_init(void) 116 int dram_init(void)
117 { 117 {
118 gd->ram_size = PHYS_SDRAM_SIZE; 118 gd->ram_size = PHYS_SDRAM_SIZE;
119 119
120 return 0; 120 return 0;
121 } 121 }
122 122
123 static iomux_v3_cfg_t const uart1_pads[] = { 123 static iomux_v3_cfg_t const uart1_pads[] = {
124 MX6SX_PAD_GPIO1_IO04__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL), 124 MX6SX_PAD_GPIO1_IO04__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
125 MX6SX_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL), 125 MX6SX_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
126 }; 126 };
127 127
128 static iomux_v3_cfg_t const usdhc3_pads[] = { 128 static iomux_v3_cfg_t const usdhc3_pads[] = {
129 MX6SX_PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), 129 MX6SX_PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
130 MX6SX_PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), 130 MX6SX_PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
131 MX6SX_PAD_SD3_DATA0__USDHC3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 131 MX6SX_PAD_SD3_DATA0__USDHC3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
132 MX6SX_PAD_SD3_DATA1__USDHC3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 132 MX6SX_PAD_SD3_DATA1__USDHC3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
133 MX6SX_PAD_SD3_DATA2__USDHC3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 133 MX6SX_PAD_SD3_DATA2__USDHC3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
134 MX6SX_PAD_SD3_DATA3__USDHC3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 134 MX6SX_PAD_SD3_DATA3__USDHC3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
135 MX6SX_PAD_SD3_DATA4__USDHC3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 135 MX6SX_PAD_SD3_DATA4__USDHC3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
136 MX6SX_PAD_SD3_DATA5__USDHC3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 136 MX6SX_PAD_SD3_DATA5__USDHC3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
137 MX6SX_PAD_SD3_DATA6__USDHC3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 137 MX6SX_PAD_SD3_DATA6__USDHC3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
138 MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 138 MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
139 139
140 /* CD pin */ 140 /* CD pin */
141 MX6SX_PAD_USB_H_DATA__GPIO7_IO_10 | MUX_PAD_CTRL(NO_PAD_CTRL), 141 MX6SX_PAD_USB_H_DATA__GPIO7_IO_10 | MUX_PAD_CTRL(NO_PAD_CTRL),
142 142
143 /* RST_B, used for power reset cycle */ 143 /* RST_B, used for power reset cycle */
144 MX6SX_PAD_KEY_COL1__GPIO2_IO_11 | MUX_PAD_CTRL(NO_PAD_CTRL), 144 MX6SX_PAD_KEY_COL1__GPIO2_IO_11 | MUX_PAD_CTRL(NO_PAD_CTRL),
145 }; 145 };
146 146
147 static iomux_v3_cfg_t const usdhc4_pads[] = { 147 static iomux_v3_cfg_t const usdhc4_pads[] = {
148 MX6SX_PAD_SD4_CLK__USDHC4_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), 148 MX6SX_PAD_SD4_CLK__USDHC4_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
149 MX6SX_PAD_SD4_CMD__USDHC4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), 149 MX6SX_PAD_SD4_CMD__USDHC4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
150 MX6SX_PAD_SD4_DATA0__USDHC4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 150 MX6SX_PAD_SD4_DATA0__USDHC4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
151 MX6SX_PAD_SD4_DATA1__USDHC4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 151 MX6SX_PAD_SD4_DATA1__USDHC4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
152 MX6SX_PAD_SD4_DATA2__USDHC4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 152 MX6SX_PAD_SD4_DATA2__USDHC4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
153 MX6SX_PAD_SD4_DATA3__USDHC4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 153 MX6SX_PAD_SD4_DATA3__USDHC4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
154 MX6SX_PAD_SD4_DATA4__USDHC4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 154 MX6SX_PAD_SD4_DATA4__USDHC4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
155 MX6SX_PAD_SD4_DATA5__USDHC4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 155 MX6SX_PAD_SD4_DATA5__USDHC4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
156 MX6SX_PAD_SD4_DATA6__USDHC4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 156 MX6SX_PAD_SD4_DATA6__USDHC4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
157 MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), 157 MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
158 158
159 /* CD pin */ 159 /* CD pin */
160 MX6SX_PAD_USB_H_STROBE__GPIO7_IO_11 | MUX_PAD_CTRL(NO_PAD_CTRL), 160 MX6SX_PAD_USB_H_STROBE__GPIO7_IO_11 | MUX_PAD_CTRL(NO_PAD_CTRL),
161 }; 161 };
162 162
163 #ifdef CONFIG_FEC_MXC 163 #ifdef CONFIG_FEC_MXC
164 static iomux_v3_cfg_t const fec1_pads[] = { 164 static iomux_v3_cfg_t const fec1_pads[] = {
165 MX6SX_PAD_ENET1_MDC__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL), 165 MX6SX_PAD_ENET1_MDC__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
166 MX6SX_PAD_ENET1_MDIO__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL), 166 MX6SX_PAD_ENET1_MDIO__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
167 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 167 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
168 MX6SX_PAD_RGMII1_RD0__ENET1_RX_DATA_0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 168 MX6SX_PAD_RGMII1_RD0__ENET1_RX_DATA_0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
169 MX6SX_PAD_RGMII1_RD1__ENET1_RX_DATA_1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 169 MX6SX_PAD_RGMII1_RD1__ENET1_RX_DATA_1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
170 MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 170 MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
171 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 171 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
172 MX6SX_PAD_RGMII1_RXC__ENET1_RX_CLK | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 172 MX6SX_PAD_RGMII1_RXC__ENET1_RX_CLK | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
173 MX6SX_PAD_RGMII1_TX_CTL__ENET1_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL), 173 MX6SX_PAD_RGMII1_TX_CTL__ENET1_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
174 MX6SX_PAD_RGMII1_TD0__ENET1_TX_DATA_0 | MUX_PAD_CTRL(ENET_PAD_CTRL), 174 MX6SX_PAD_RGMII1_TD0__ENET1_TX_DATA_0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
175 MX6SX_PAD_RGMII1_TD1__ENET1_TX_DATA_1 | MUX_PAD_CTRL(ENET_PAD_CTRL), 175 MX6SX_PAD_RGMII1_TD1__ENET1_TX_DATA_1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
176 MX6SX_PAD_RGMII1_TD2__ENET1_TX_DATA_2 | MUX_PAD_CTRL(ENET_PAD_CTRL), 176 MX6SX_PAD_RGMII1_TD2__ENET1_TX_DATA_2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
177 MX6SX_PAD_RGMII1_TD3__ENET1_TX_DATA_3 | MUX_PAD_CTRL(ENET_PAD_CTRL), 177 MX6SX_PAD_RGMII1_TD3__ENET1_TX_DATA_3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
178 MX6SX_PAD_RGMII1_TXC__ENET1_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL), 178 MX6SX_PAD_RGMII1_TXC__ENET1_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
179 }; 179 };
180 180
181 static iomux_v3_cfg_t const fec2_pads[] = { 181 static iomux_v3_cfg_t const fec2_pads[] = {
182 MX6SX_PAD_ENET1_MDC__ENET2_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL), 182 MX6SX_PAD_ENET1_MDC__ENET2_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
183 MX6SX_PAD_ENET1_MDIO__ENET2_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL), 183 MX6SX_PAD_ENET1_MDIO__ENET2_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
184 MX6SX_PAD_RGMII2_RX_CTL__ENET2_RX_EN | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 184 MX6SX_PAD_RGMII2_RX_CTL__ENET2_RX_EN | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
185 MX6SX_PAD_RGMII2_RD0__ENET2_RX_DATA_0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 185 MX6SX_PAD_RGMII2_RD0__ENET2_RX_DATA_0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
186 MX6SX_PAD_RGMII2_RD1__ENET2_RX_DATA_1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 186 MX6SX_PAD_RGMII2_RD1__ENET2_RX_DATA_1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
187 MX6SX_PAD_RGMII2_RD2__ENET2_RX_DATA_2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 187 MX6SX_PAD_RGMII2_RD2__ENET2_RX_DATA_2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
188 MX6SX_PAD_RGMII2_RD3__ENET2_RX_DATA_3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 188 MX6SX_PAD_RGMII2_RD3__ENET2_RX_DATA_3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
189 MX6SX_PAD_RGMII2_RXC__ENET2_RX_CLK | MUX_PAD_CTRL(ENET_RX_PAD_CTRL), 189 MX6SX_PAD_RGMII2_RXC__ENET2_RX_CLK | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
190 MX6SX_PAD_RGMII2_TX_CTL__ENET2_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL), 190 MX6SX_PAD_RGMII2_TX_CTL__ENET2_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
191 MX6SX_PAD_RGMII2_TD0__ENET2_TX_DATA_0 | MUX_PAD_CTRL(ENET_PAD_CTRL), 191 MX6SX_PAD_RGMII2_TD0__ENET2_TX_DATA_0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
192 MX6SX_PAD_RGMII2_TD1__ENET2_TX_DATA_1 | MUX_PAD_CTRL(ENET_PAD_CTRL), 192 MX6SX_PAD_RGMII2_TD1__ENET2_TX_DATA_1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
193 MX6SX_PAD_RGMII2_TD2__ENET2_TX_DATA_2 | MUX_PAD_CTRL(ENET_PAD_CTRL), 193 MX6SX_PAD_RGMII2_TD2__ENET2_TX_DATA_2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
194 MX6SX_PAD_RGMII2_TD3__ENET2_TX_DATA_3 | MUX_PAD_CTRL(ENET_PAD_CTRL), 194 MX6SX_PAD_RGMII2_TD3__ENET2_TX_DATA_3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
195 MX6SX_PAD_RGMII2_TXC__ENET2_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL), 195 MX6SX_PAD_RGMII2_TXC__ENET2_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
196 }; 196 };
197 197
198 static void setup_iomux_fec(int fec_id) 198 static void setup_iomux_fec(int fec_id)
199 { 199 {
200 if (0 == fec_id) 200 if (0 == fec_id)
201 imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads)); 201 imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
202 else 202 else
203 imx_iomux_v3_setup_multiple_pads(fec2_pads, ARRAY_SIZE(fec2_pads)); 203 imx_iomux_v3_setup_multiple_pads(fec2_pads, ARRAY_SIZE(fec2_pads));
204 } 204 }
205 #endif 205 #endif
206 206
207 #ifdef CONFIG_MAX7310_IOEXP 207 #ifdef CONFIG_MAX7310_IOEXP
208 208
209 #define CPU_PER_RST_B IOEXP_GPIO_NR(1, 4) 209 #define CPU_PER_RST_B IOEXP_GPIO_NR(1, 4)
210 #define LVDS_EN_PIN IOEXP_GPIO_NR(1, 7) 210 #define LVDS_EN_PIN IOEXP_GPIO_NR(1, 7)
211 #define STEER_ENET IOEXP_GPIO_NR(2, 2) 211 #define STEER_ENET IOEXP_GPIO_NR(2, 2)
212 212
213 int setup_max7310(void) 213 int setup_max7310(void)
214 { 214 {
215 /* Must call this function after i2c has setup */ 215 /* Must call this function after i2c has setup */
216 #ifdef CONFIG_SYS_I2C_MXC 216 #ifdef CONFIG_SYS_I2C_MXC
217 gpio_exp_setup_port(1, 2, 0x30); 217 gpio_exp_setup_port(1, 2, 0x30);
218 gpio_exp_setup_port(2, 2, 0x32); 218 gpio_exp_setup_port(2, 2, 0x32);
219 219
220 return 0; 220 return 0;
221 #else 221 #else
222 return -EPERM; 222 return -EPERM;
223 #endif 223 #endif
224 } 224 }
225 #endif 225 #endif
226 226
227 static void setup_iomux_uart(void) 227 static void setup_iomux_uart(void)
228 { 228 {
229 imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); 229 imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
230 } 230 }
231 231
232 #ifdef CONFIG_QSPI 232 #ifdef CONFIG_QSPI
233 233
234 #define QSPI_PAD_CTRL1 \ 234 #define QSPI_PAD_CTRL1 \
235 (PAD_CTL_SRE_FAST | PAD_CTL_SPEED_MED | \ 235 (PAD_CTL_SRE_FAST | PAD_CTL_SPEED_MED | \
236 PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_60ohm) 236 PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_60ohm)
237 237
238 static iomux_v3_cfg_t const quadspi_pads[] = { 238 static iomux_v3_cfg_t const quadspi_pads[] = {
239 MX6SX_PAD_QSPI1A_SS0_B__QSPI1_A_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 239 MX6SX_PAD_QSPI1A_SS0_B__QSPI1_A_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
240 MX6SX_PAD_QSPI1A_SCLK__QSPI1_A_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 240 MX6SX_PAD_QSPI1A_SCLK__QSPI1_A_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
241 MX6SX_PAD_QSPI1A_DATA0__QSPI1_A_DATA_0 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 241 MX6SX_PAD_QSPI1A_DATA0__QSPI1_A_DATA_0 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
242 MX6SX_PAD_QSPI1A_DATA1__QSPI1_A_DATA_1 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 242 MX6SX_PAD_QSPI1A_DATA1__QSPI1_A_DATA_1 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
243 MX6SX_PAD_QSPI1A_DATA2__QSPI1_A_DATA_2 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 243 MX6SX_PAD_QSPI1A_DATA2__QSPI1_A_DATA_2 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
244 MX6SX_PAD_QSPI1A_DATA3__QSPI1_A_DATA_3 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 244 MX6SX_PAD_QSPI1A_DATA3__QSPI1_A_DATA_3 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
245 MX6SX_PAD_QSPI1B_SS0_B__QSPI1_B_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 245 MX6SX_PAD_QSPI1B_SS0_B__QSPI1_B_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
246 MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 246 MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
247 MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 247 MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
248 MX6SX_PAD_QSPI1B_DATA1__QSPI1_B_DATA_1 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 248 MX6SX_PAD_QSPI1B_DATA1__QSPI1_B_DATA_1 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
249 MX6SX_PAD_QSPI1B_DATA2__QSPI1_B_DATA_2 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 249 MX6SX_PAD_QSPI1B_DATA2__QSPI1_B_DATA_2 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
250 MX6SX_PAD_QSPI1B_DATA3__QSPI1_B_DATA_3 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), 250 MX6SX_PAD_QSPI1B_DATA3__QSPI1_B_DATA_3 | MUX_PAD_CTRL(QSPI_PAD_CTRL1),
251 }; 251 };
252 252
253 int board_qspi_init(void) 253 int board_qspi_init(void)
254 { 254 {
255 /* Set the iomux */ 255 /* Set the iomux */
256 imx_iomux_v3_setup_multiple_pads(quadspi_pads, ARRAY_SIZE(quadspi_pads)); 256 imx_iomux_v3_setup_multiple_pads(quadspi_pads, ARRAY_SIZE(quadspi_pads));
257 257
258 /* Set the clock */ 258 /* Set the clock */
259 enable_qspi_clk(0); 259 enable_qspi_clk(0);
260 260
261 return 0; 261 return 0;
262 } 262 }
263 #endif 263 #endif
264 264
265 #ifdef CONFIG_SYS_USE_NAND 265 #ifdef CONFIG_SYS_USE_NAND
266 iomux_v3_cfg_t gpmi_pads[] = { 266 iomux_v3_cfg_t gpmi_pads[] = {
267 MX6SX_PAD_NAND_CLE__RAWNAND_CLE | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 267 MX6SX_PAD_NAND_CLE__RAWNAND_CLE | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
268 MX6SX_PAD_NAND_ALE__RAWNAND_ALE | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 268 MX6SX_PAD_NAND_ALE__RAWNAND_ALE | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
269 MX6SX_PAD_NAND_WP_B__RAWNAND_WP_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 269 MX6SX_PAD_NAND_WP_B__RAWNAND_WP_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
270 MX6SX_PAD_NAND_READY_B__RAWNAND_READY_B | MUX_PAD_CTRL(GPMI_PAD_CTRL0), 270 MX6SX_PAD_NAND_READY_B__RAWNAND_READY_B | MUX_PAD_CTRL(GPMI_PAD_CTRL0),
271 MX6SX_PAD_NAND_CE0_B__RAWNAND_CE0_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 271 MX6SX_PAD_NAND_CE0_B__RAWNAND_CE0_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
272 MX6SX_PAD_NAND_RE_B__RAWNAND_RE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 272 MX6SX_PAD_NAND_RE_B__RAWNAND_RE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
273 MX6SX_PAD_NAND_WE_B__RAWNAND_WE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 273 MX6SX_PAD_NAND_WE_B__RAWNAND_WE_B | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
274 MX6SX_PAD_NAND_DATA00__RAWNAND_DATA00 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 274 MX6SX_PAD_NAND_DATA00__RAWNAND_DATA00 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
275 MX6SX_PAD_NAND_DATA01__RAWNAND_DATA01 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 275 MX6SX_PAD_NAND_DATA01__RAWNAND_DATA01 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
276 MX6SX_PAD_NAND_DATA02__RAWNAND_DATA02 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 276 MX6SX_PAD_NAND_DATA02__RAWNAND_DATA02 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
277 MX6SX_PAD_NAND_DATA03__RAWNAND_DATA03 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 277 MX6SX_PAD_NAND_DATA03__RAWNAND_DATA03 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
278 MX6SX_PAD_NAND_DATA04__RAWNAND_DATA04 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 278 MX6SX_PAD_NAND_DATA04__RAWNAND_DATA04 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
279 MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 279 MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
280 MX6SX_PAD_NAND_DATA06__RAWNAND_DATA06 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 280 MX6SX_PAD_NAND_DATA06__RAWNAND_DATA06 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
281 MX6SX_PAD_NAND_DATA07__RAWNAND_DATA07 | MUX_PAD_CTRL(GPMI_PAD_CTRL2), 281 MX6SX_PAD_NAND_DATA07__RAWNAND_DATA07 | MUX_PAD_CTRL(GPMI_PAD_CTRL2),
282 }; 282 };
283 283
284 static void setup_gpmi_nand(void) 284 static void setup_gpmi_nand(void)
285 { 285 {
286 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; 286 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
287 287
288 /* config gpmi nand iomux */ 288 /* config gpmi nand iomux */
289 imx_iomux_v3_setup_multiple_pads(gpmi_pads, ARRAY_SIZE(gpmi_pads)); 289 imx_iomux_v3_setup_multiple_pads(gpmi_pads, ARRAY_SIZE(gpmi_pads));
290 290
291 /* Disable the QSPI2 root clock */ 291 /* Disable the QSPI2 root clock */
292 clrbits_le32(&mxc_ccm->CCGR4, MXC_CCM_CCGR4_QSPI2_ENFC_MASK 292 clrbits_le32(&mxc_ccm->CCGR4, MXC_CCM_CCGR4_QSPI2_ENFC_MASK
293 | MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK); 293 | MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK);
294 294
295 /* config gpmi and bch clock to 100 MHz */ 295 /* config gpmi and bch clock to 100 MHz */
296 clrsetbits_le32(&mxc_ccm->cs2cdr, 296 clrsetbits_le32(&mxc_ccm->cs2cdr,
297 MXC_CCM_CS2CDR_QSPI2_CLK_PODF_MASK | 297 MXC_CCM_CS2CDR_QSPI2_CLK_PODF_MASK |
298 MXC_CCM_CS2CDR_QSPI2_CLK_PRED_MASK | 298 MXC_CCM_CS2CDR_QSPI2_CLK_PRED_MASK |
299 MXC_CCM_CS2CDR_QSPI2_CLK_SEL_MASK, 299 MXC_CCM_CS2CDR_QSPI2_CLK_SEL_MASK,
300 MXC_CCM_CS2CDR_QSPI2_CLK_PODF(0) | 300 MXC_CCM_CS2CDR_QSPI2_CLK_PODF(0) |
301 MXC_CCM_CS2CDR_QSPI2_CLK_PRED(3) | 301 MXC_CCM_CS2CDR_QSPI2_CLK_PRED(3) |
302 MXC_CCM_CS2CDR_QSPI2_CLK_SEL(3)); 302 MXC_CCM_CS2CDR_QSPI2_CLK_SEL(3));
303 303
304 /* enable gpmi and bch clock gating */ 304 /* enable gpmi and bch clock gating */
305 setbits_le32(&mxc_ccm->CCGR4, 305 setbits_le32(&mxc_ccm->CCGR4,
306 MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK | 306 MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK |
307 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK | 307 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK |
308 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK | 308 MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK |
309 MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK | 309 MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK |
310 MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_MASK | 310 MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_MASK |
311 MXC_CCM_CCGR4_QSPI2_ENFC_MASK); 311 MXC_CCM_CCGR4_QSPI2_ENFC_MASK);
312 312
313 /* enable apbh clock gating */ 313 /* enable apbh clock gating */
314 setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK); 314 setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK);
315 } 315 }
316 #endif 316 #endif
317 317
318 318
319 #ifdef CONFIG_FSL_ESDHC 319 #ifdef CONFIG_FSL_ESDHC
320 static struct fsl_esdhc_cfg usdhc_cfg[3] = { 320 static struct fsl_esdhc_cfg usdhc_cfg[3] = {
321 {USDHC3_BASE_ADDR}, 321 {USDHC3_BASE_ADDR},
322 {USDHC4_BASE_ADDR}, 322 {USDHC4_BASE_ADDR},
323 }; 323 };
324 324
325 #define USDHC3_CD_GPIO IMX_GPIO_NR(7, 10) 325 #define USDHC3_CD_GPIO IMX_GPIO_NR(7, 10)
326 #define USDHC3_RST_GPIO IMX_GPIO_NR(2, 11) 326 #define USDHC3_RST_GPIO IMX_GPIO_NR(2, 11)
327 #define USDHC4_CD_GPIO IMX_GPIO_NR(7, 11) 327 #define USDHC4_CD_GPIO IMX_GPIO_NR(7, 11)
328 328
329 int mmc_get_env_devno(void) 329 int mmc_get_env_devno(void)
330 { 330 {
331 u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4); 331 u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
332 int dev_no; 332 int dev_no;
333 u32 bootsel; 333 u32 bootsel;
334 334
335 bootsel = (soc_sbmr & 0x000000FF) >> 6 ; 335 bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
336 336
337 /* If not boot from sd/mmc, use default value */ 337 /* If not boot from sd/mmc, use default value */
338 if (bootsel != 1) 338 if (bootsel != 1)
339 return CONFIG_SYS_MMC_ENV_DEV; 339 return CONFIG_SYS_MMC_ENV_DEV;
340 340
341 /* BOOT_CFG2[3] and BOOT_CFG2[4] */ 341 /* BOOT_CFG2[3] and BOOT_CFG2[4] */
342 dev_no = (soc_sbmr & 0x00001800) >> 11; 342 dev_no = (soc_sbmr & 0x00001800) >> 11;
343 343
344 /* need ubstract 1 to map to the mmc device id 344 /* need ubstract 1 to map to the mmc device id
345 * see the comments in board_mmc_init function 345 * see the comments in board_mmc_init function
346 */ 346 */
347 347
348 dev_no -= 2; 348 dev_no -= 2;
349 349
350 return dev_no; 350 return dev_no;
351 } 351 }
352 352
353 int mmc_map_to_kernel_blk(int dev_no) 353 int mmc_map_to_kernel_blk(int dev_no)
354 { 354 {
355 return dev_no + 2; 355 return dev_no + 2;
356 } 356 }
357 357
358 int board_mmc_getcd(struct mmc *mmc) 358 int board_mmc_getcd(struct mmc *mmc)
359 { 359 {
360 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; 360 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
361 int ret = 0; 361 int ret = 0;
362 362
363 switch (cfg->esdhc_base) { 363 switch (cfg->esdhc_base) {
364 case USDHC3_BASE_ADDR: 364 case USDHC3_BASE_ADDR:
365 ret = !gpio_get_value(USDHC3_CD_GPIO); 365 ret = !gpio_get_value(USDHC3_CD_GPIO);
366 break; 366 break;
367 case USDHC4_BASE_ADDR: 367 case USDHC4_BASE_ADDR:
368 ret = !gpio_get_value(USDHC4_CD_GPIO); 368 ret = !gpio_get_value(USDHC4_CD_GPIO);
369 break; 369 break;
370 } 370 }
371 371
372 return ret; 372 return ret;
373 373
374 } 374 }
375 375
376 int board_mmc_init(bd_t *bis) 376 int board_mmc_init(bd_t *bis)
377 { 377 {
378 int i; 378 int i;
379 379
380 /* 380 /*
381 * According to the board_mmc_init() the following map is done: 381 * According to the board_mmc_init() the following map is done:
382 * (U-boot device node) (Physical Port) 382 * (U-boot device node) (Physical Port)
383 * mmc0 USDHC3 383 * mmc0 USDHC3
384 * mmc1 USDHC4 384 * mmc1 USDHC4
385 */ 385 */
386 for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) { 386 for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
387 switch (i) { 387 switch (i) {
388 case 0: 388 case 0:
389 imx_iomux_v3_setup_multiple_pads( 389 imx_iomux_v3_setup_multiple_pads(
390 usdhc3_pads, ARRAY_SIZE(usdhc3_pads)); 390 usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
391 gpio_direction_input(USDHC3_CD_GPIO); 391 gpio_direction_input(USDHC3_CD_GPIO);
392 392
393 /* Need to set steer to B0 to A*/ 393 /* Need to set steer to B0 to A*/
394 gpio_direction_output(USDHC3_RST_GPIO, 1); 394 gpio_direction_output(USDHC3_RST_GPIO, 1);
395 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); 395 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
396 break; 396 break;
397 case 1: 397 case 1:
398 imx_iomux_v3_setup_multiple_pads( 398 imx_iomux_v3_setup_multiple_pads(
399 usdhc4_pads, ARRAY_SIZE(usdhc4_pads)); 399 usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
400 gpio_direction_input(USDHC4_CD_GPIO); 400 gpio_direction_input(USDHC4_CD_GPIO);
401 usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); 401 usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
402 break; 402 break;
403 default: 403 default:
404 printf("Warning: you configured more USDHC controllers" 404 printf("Warning: you configured more USDHC controllers"
405 "(%d) than supported by the board\n", i + 1); 405 "(%d) than supported by the board\n", i + 1);
406 return 0; 406 return 0;
407 } 407 }
408 408
409 if (fsl_esdhc_initialize(bis, &usdhc_cfg[i])) 409 if (fsl_esdhc_initialize(bis, &usdhc_cfg[i]))
410 printf("Warning: failed to initialize mmc dev %d\n", i); 410 printf("Warning: failed to initialize mmc dev %d\n", i);
411 } 411 }
412 412
413 return 0; 413 return 0;
414 } 414 }
415 415
416 int check_mmc_autodetect(void) 416 int check_mmc_autodetect(void)
417 { 417 {
418 char *autodetect_str = getenv("mmcautodetect"); 418 char *autodetect_str = getenv("mmcautodetect");
419 419
420 if ((autodetect_str != NULL) && 420 if ((autodetect_str != NULL) &&
421 (strcmp(autodetect_str, "yes") == 0)) { 421 (strcmp(autodetect_str, "yes") == 0)) {
422 return 1; 422 return 1;
423 } 423 }
424 424
425 return 0; 425 return 0;
426 } 426 }
427 427
428 void board_late_mmc_init(void) 428 void board_late_mmc_init(void)
429 { 429 {
430 char cmd[32]; 430 char cmd[32];
431 char mmcblk[32]; 431 char mmcblk[32];
432 u32 dev_no = mmc_get_env_devno(); 432 u32 dev_no = mmc_get_env_devno();
433 433
434 if (!check_mmc_autodetect()) 434 if (!check_mmc_autodetect())
435 return; 435 return;
436 436
437 setenv_ulong("mmcdev", dev_no); 437 setenv_ulong("mmcdev", dev_no);
438 438
439 /* Set mmcblk env */ 439 /* Set mmcblk env */
440 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", 440 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
441 mmc_map_to_kernel_blk(dev_no)); 441 mmc_map_to_kernel_blk(dev_no));
442 setenv("mmcroot", mmcblk); 442 setenv("mmcroot", mmcblk);
443 443
444 sprintf(cmd, "mmc dev %d", dev_no); 444 sprintf(cmd, "mmc dev %d", dev_no);
445 run_command(cmd, 0); 445 run_command(cmd, 0);
446 } 446 }
447 447
448 #endif 448 #endif
449 449
450 #ifdef CONFIG_VIDEO_MXS 450 #ifdef CONFIG_VIDEO_MXS
451 static iomux_v3_cfg_t const lvds_ctrl_pads[] = { 451 static iomux_v3_cfg_t const lvds_ctrl_pads[] = {
452 /* Use GPIO for Brightness adjustment, duty cycle = period */ 452 /* Use GPIO for Brightness adjustment, duty cycle = period */
453 MX6SX_PAD_SD1_DATA1__GPIO6_IO_3 | MUX_PAD_CTRL(NO_PAD_CTRL), 453 MX6SX_PAD_SD1_DATA1__GPIO6_IO_3 | MUX_PAD_CTRL(NO_PAD_CTRL),
454 }; 454 };
455 455
456 static iomux_v3_cfg_t const lcd_pads[] = { 456 static iomux_v3_cfg_t const lcd_pads[] = {
457 MX6SX_PAD_LCD1_CLK__LCDIF1_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL), 457 MX6SX_PAD_LCD1_CLK__LCDIF1_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL),
458 MX6SX_PAD_LCD1_ENABLE__LCDIF1_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL), 458 MX6SX_PAD_LCD1_ENABLE__LCDIF1_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL),
459 MX6SX_PAD_LCD1_HSYNC__LCDIF1_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL), 459 MX6SX_PAD_LCD1_HSYNC__LCDIF1_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
460 MX6SX_PAD_LCD1_VSYNC__LCDIF1_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL), 460 MX6SX_PAD_LCD1_VSYNC__LCDIF1_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
461 MX6SX_PAD_LCD1_DATA00__LCDIF1_DATA_0 | MUX_PAD_CTRL(LCD_PAD_CTRL), 461 MX6SX_PAD_LCD1_DATA00__LCDIF1_DATA_0 | MUX_PAD_CTRL(LCD_PAD_CTRL),
462 MX6SX_PAD_LCD1_DATA01__LCDIF1_DATA_1 | MUX_PAD_CTRL(LCD_PAD_CTRL), 462 MX6SX_PAD_LCD1_DATA01__LCDIF1_DATA_1 | MUX_PAD_CTRL(LCD_PAD_CTRL),
463 MX6SX_PAD_LCD1_DATA02__LCDIF1_DATA_2 | MUX_PAD_CTRL(LCD_PAD_CTRL), 463 MX6SX_PAD_LCD1_DATA02__LCDIF1_DATA_2 | MUX_PAD_CTRL(LCD_PAD_CTRL),
464 MX6SX_PAD_LCD1_DATA03__LCDIF1_DATA_3 | MUX_PAD_CTRL(LCD_PAD_CTRL), 464 MX6SX_PAD_LCD1_DATA03__LCDIF1_DATA_3 | MUX_PAD_CTRL(LCD_PAD_CTRL),
465 MX6SX_PAD_LCD1_DATA04__LCDIF1_DATA_4 | MUX_PAD_CTRL(LCD_PAD_CTRL), 465 MX6SX_PAD_LCD1_DATA04__LCDIF1_DATA_4 | MUX_PAD_CTRL(LCD_PAD_CTRL),
466 MX6SX_PAD_LCD1_DATA05__LCDIF1_DATA_5 | MUX_PAD_CTRL(LCD_PAD_CTRL), 466 MX6SX_PAD_LCD1_DATA05__LCDIF1_DATA_5 | MUX_PAD_CTRL(LCD_PAD_CTRL),
467 MX6SX_PAD_LCD1_DATA06__LCDIF1_DATA_6 | MUX_PAD_CTRL(LCD_PAD_CTRL), 467 MX6SX_PAD_LCD1_DATA06__LCDIF1_DATA_6 | MUX_PAD_CTRL(LCD_PAD_CTRL),
468 MX6SX_PAD_LCD1_DATA07__LCDIF1_DATA_7 | MUX_PAD_CTRL(LCD_PAD_CTRL), 468 MX6SX_PAD_LCD1_DATA07__LCDIF1_DATA_7 | MUX_PAD_CTRL(LCD_PAD_CTRL),
469 MX6SX_PAD_LCD1_DATA08__LCDIF1_DATA_8 | MUX_PAD_CTRL(LCD_PAD_CTRL), 469 MX6SX_PAD_LCD1_DATA08__LCDIF1_DATA_8 | MUX_PAD_CTRL(LCD_PAD_CTRL),
470 MX6SX_PAD_LCD1_DATA09__LCDIF1_DATA_9 | MUX_PAD_CTRL(LCD_PAD_CTRL), 470 MX6SX_PAD_LCD1_DATA09__LCDIF1_DATA_9 | MUX_PAD_CTRL(LCD_PAD_CTRL),
471 MX6SX_PAD_LCD1_DATA10__LCDIF1_DATA_10 | MUX_PAD_CTRL(LCD_PAD_CTRL), 471 MX6SX_PAD_LCD1_DATA10__LCDIF1_DATA_10 | MUX_PAD_CTRL(LCD_PAD_CTRL),
472 MX6SX_PAD_LCD1_DATA11__LCDIF1_DATA_11 | MUX_PAD_CTRL(LCD_PAD_CTRL), 472 MX6SX_PAD_LCD1_DATA11__LCDIF1_DATA_11 | MUX_PAD_CTRL(LCD_PAD_CTRL),
473 MX6SX_PAD_LCD1_DATA12__LCDIF1_DATA_12 | MUX_PAD_CTRL(LCD_PAD_CTRL), 473 MX6SX_PAD_LCD1_DATA12__LCDIF1_DATA_12 | MUX_PAD_CTRL(LCD_PAD_CTRL),
474 MX6SX_PAD_LCD1_DATA13__LCDIF1_DATA_13 | MUX_PAD_CTRL(LCD_PAD_CTRL), 474 MX6SX_PAD_LCD1_DATA13__LCDIF1_DATA_13 | MUX_PAD_CTRL(LCD_PAD_CTRL),
475 MX6SX_PAD_LCD1_DATA14__LCDIF1_DATA_14 | MUX_PAD_CTRL(LCD_PAD_CTRL), 475 MX6SX_PAD_LCD1_DATA14__LCDIF1_DATA_14 | MUX_PAD_CTRL(LCD_PAD_CTRL),
476 MX6SX_PAD_LCD1_DATA15__LCDIF1_DATA_15 | MUX_PAD_CTRL(LCD_PAD_CTRL), 476 MX6SX_PAD_LCD1_DATA15__LCDIF1_DATA_15 | MUX_PAD_CTRL(LCD_PAD_CTRL),
477 MX6SX_PAD_LCD1_DATA16__LCDIF1_DATA_16 | MUX_PAD_CTRL(LCD_PAD_CTRL), 477 MX6SX_PAD_LCD1_DATA16__LCDIF1_DATA_16 | MUX_PAD_CTRL(LCD_PAD_CTRL),
478 MX6SX_PAD_LCD1_DATA17__LCDIF1_DATA_17 | MUX_PAD_CTRL(LCD_PAD_CTRL), 478 MX6SX_PAD_LCD1_DATA17__LCDIF1_DATA_17 | MUX_PAD_CTRL(LCD_PAD_CTRL),
479 MX6SX_PAD_LCD1_RESET__GPIO3_IO_27 | MUX_PAD_CTRL(NO_PAD_CTRL), 479 MX6SX_PAD_LCD1_RESET__GPIO3_IO_27 | MUX_PAD_CTRL(NO_PAD_CTRL),
480 }; 480 };
481 481
482 482
483 struct lcd_panel_info_t { 483 struct lcd_panel_info_t {
484 unsigned int lcdif_base_addr; 484 unsigned int lcdif_base_addr;
485 int depth; 485 int depth;
486 void (*enable)(struct lcd_panel_info_t const *dev); 486 void (*enable)(struct lcd_panel_info_t const *dev);
487 struct fb_videomode mode; 487 struct fb_videomode mode;
488 }; 488 };
489 489
490 void do_enable_lvds(struct lcd_panel_info_t const *dev) 490 void do_enable_lvds(struct lcd_panel_info_t const *dev)
491 { 491 {
492 enable_lcdif_clock(dev->lcdif_base_addr); 492 enable_lcdif_clock(dev->lcdif_base_addr);
493 enable_lvds(dev->lcdif_base_addr); 493 enable_lvds(dev->lcdif_base_addr);
494 494
495 imx_iomux_v3_setup_multiple_pads(lvds_ctrl_pads, 495 imx_iomux_v3_setup_multiple_pads(lvds_ctrl_pads,
496 ARRAY_SIZE(lvds_ctrl_pads)); 496 ARRAY_SIZE(lvds_ctrl_pads));
497 497
498 #ifdef CONFIG_MAX7310_IOEXP 498 #ifdef CONFIG_MAX7310_IOEXP
499 /* LVDS Enable pin */ 499 /* LVDS Enable pin */
500 gpio_exp_direction_output(LVDS_EN_PIN , 1); 500 gpio_exp_direction_output(LVDS_EN_PIN , 1);
501 #endif 501 #endif
502 502
503 /* Set Brightness to high */ 503 /* Set Brightness to high */
504 gpio_direction_output(IMX_GPIO_NR(6, 3) , 1); 504 gpio_direction_output(IMX_GPIO_NR(6, 3) , 1);
505 } 505 }
506 506
507 void do_enable_parallel_lcd(struct lcd_panel_info_t const *dev) 507 void do_enable_parallel_lcd(struct lcd_panel_info_t const *dev)
508 { 508 {
509 enable_lcdif_clock(dev->lcdif_base_addr); 509 enable_lcdif_clock(dev->lcdif_base_addr);
510 510
511 imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads)); 511 imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
512 512
513 /* Power up the LCD */ 513 /* Power up the LCD */
514 gpio_direction_output(IMX_GPIO_NR(3, 27) , 1); 514 gpio_direction_output(IMX_GPIO_NR(3, 27) , 1);
515 } 515 }
516 516
517 static struct lcd_panel_info_t const displays[] = {{ 517 static struct lcd_panel_info_t const displays[] = {{
518 .lcdif_base_addr = LCDIF2_BASE_ADDR, 518 .lcdif_base_addr = LCDIF2_BASE_ADDR,
519 .depth = 18, 519 .depth = 18,
520 .enable = do_enable_lvds, 520 .enable = do_enable_lvds,
521 .mode = { 521 .mode = {
522 .name = "Hannstar-XGA", 522 .name = "Hannstar-XGA",
523 .xres = 1024, 523 .xres = 1024,
524 .yres = 768, 524 .yres = 768,
525 .pixclock = 15385, 525 .pixclock = 15385,
526 .left_margin = 220, 526 .left_margin = 220,
527 .right_margin = 40, 527 .right_margin = 40,
528 .upper_margin = 21, 528 .upper_margin = 21,
529 .lower_margin = 7, 529 .lower_margin = 7,
530 .hsync_len = 60, 530 .hsync_len = 60,
531 .vsync_len = 10, 531 .vsync_len = 10,
532 .sync = 0, 532 .sync = 0,
533 .vmode = FB_VMODE_NONINTERLACED 533 .vmode = FB_VMODE_NONINTERLACED
534 } }, { 534 } }, {
535 .lcdif_base_addr = LCDIF1_BASE_ADDR, 535 .lcdif_base_addr = LCDIF1_BASE_ADDR,
536 .depth = 18, 536 .depth = 18,
537 .enable = do_enable_parallel_lcd, 537 .enable = do_enable_parallel_lcd,
538 .mode = { 538 .mode = {
539 .name = "Boundary-LCD", 539 .name = "Boundary-LCD",
540 .xres = 800, 540 .xres = 800,
541 .yres = 480, 541 .yres = 480,
542 .pixclock = 29850, 542 .pixclock = 29850,
543 .left_margin = 89, 543 .left_margin = 89,
544 .right_margin = 164, 544 .right_margin = 164,
545 .upper_margin = 23, 545 .upper_margin = 23,
546 .lower_margin = 10, 546 .lower_margin = 10,
547 .hsync_len = 10, 547 .hsync_len = 10,
548 .vsync_len = 10, 548 .vsync_len = 10,
549 .sync = 0, 549 .sync = 0,
550 .vmode = FB_VMODE_NONINTERLACED 550 .vmode = FB_VMODE_NONINTERLACED
551 } } }; 551 } } };
552 552
553 int board_video_skip(void) 553 int board_video_skip(void)
554 { 554 {
555 int i; 555 int i;
556 int ret; 556 int ret;
557 char const *panel = getenv("panel"); 557 char const *panel = getenv("panel");
558 if (!panel) { 558 if (!panel) {
559 panel = displays[0].mode.name; 559 panel = displays[0].mode.name;
560 printf("No panel detected: default to %s\n", panel); 560 printf("No panel detected: default to %s\n", panel);
561 i = 0; 561 i = 0;
562 } else { 562 } else {
563 for (i = 0; i < ARRAY_SIZE(displays); i++) { 563 for (i = 0; i < ARRAY_SIZE(displays); i++) {
564 if (!strcmp(panel, displays[i].mode.name)) 564 if (!strcmp(panel, displays[i].mode.name))
565 break; 565 break;
566 } 566 }
567 } 567 }
568 if (i < ARRAY_SIZE(displays)) { 568 if (i < ARRAY_SIZE(displays)) {
569 ret = mxs_lcd_panel_setup(displays[i].mode, displays[i].depth, 569 ret = mxs_lcd_panel_setup(displays[i].mode, displays[i].depth,
570 displays[i].lcdif_base_addr); 570 displays[i].lcdif_base_addr);
571 if (!ret) { 571 if (!ret) {
572 if (displays[i].enable) 572 if (displays[i].enable)
573 displays[i].enable(displays+i); 573 displays[i].enable(displays+i);
574 printf("Display: %s (%ux%u)\n", 574 printf("Display: %s (%ux%u)\n",
575 displays[i].mode.name, 575 displays[i].mode.name,
576 displays[i].mode.xres, 576 displays[i].mode.xres,
577 displays[i].mode.yres); 577 displays[i].mode.yres);
578 } else 578 } else
579 printf("LCD %s cannot be configured: %d\n", 579 printf("LCD %s cannot be configured: %d\n",
580 displays[i].mode.name, ret); 580 displays[i].mode.name, ret);
581 } else { 581 } else {
582 printf("unsupported panel %s\n", panel); 582 printf("unsupported panel %s\n", panel);
583 return -EINVAL; 583 return -EINVAL;
584 } 584 }
585 585
586 return 0; 586 return 0;
587 } 587 }
588 #endif 588 #endif
589 589
590 #ifdef CONFIG_FEC_MXC 590 #ifdef CONFIG_FEC_MXC
591 int board_eth_init(bd_t *bis) 591 int board_eth_init(bd_t *bis)
592 { 592 {
593 int ret; 593 int ret;
594 594
595 setup_iomux_fec(CONFIG_FEC_ENET_DEV); 595 setup_iomux_fec(CONFIG_FEC_ENET_DEV);
596 596
597 ret = fecmxc_initialize_multi(bis, CONFIG_FEC_ENET_DEV, 597 ret = fecmxc_initialize_multi(bis, CONFIG_FEC_ENET_DEV,
598 CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE); 598 CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE);
599 if (ret) 599 if (ret)
600 printf("FEC%d MXC: %s:failed\n", CONFIG_FEC_ENET_DEV, __func__); 600 printf("FEC%d MXC: %s:failed\n", CONFIG_FEC_ENET_DEV, __func__);
601 601
602 return 0; 602 return 0;
603 } 603 }
604 604
605 static int setup_fec(int fec_id) 605 static int setup_fec(int fec_id)
606 { 606 {
607 struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs 607 struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs
608 = (struct iomuxc_gpr_base_regs *) IOMUXC_GPR_BASE_ADDR; 608 = (struct iomuxc_gpr_base_regs *) IOMUXC_GPR_BASE_ADDR;
609 int ret; 609 int ret;
610 610
611 if (0 == fec_id) 611 if (0 == fec_id)
612 /* Use 125M anatop REF_CLK1 for ENET1, clear gpr1[13], gpr1[17]*/ 612 /* Use 125M anatop REF_CLK1 for ENET1, clear gpr1[13], gpr1[17]*/
613 clrsetbits_le32(&iomuxc_gpr_regs->gpr[1], IOMUX_GPR1_FEC1_MASK, 0); 613 clrsetbits_le32(&iomuxc_gpr_regs->gpr[1], IOMUX_GPR1_FEC1_MASK, 0);
614 else 614 else
615 /* Use 125M anatop REF_CLK1 for ENET2, clear gpr1[14], gpr1[18]*/ 615 /* Use 125M anatop REF_CLK1 for ENET2, clear gpr1[14], gpr1[18]*/
616 clrsetbits_le32(&iomuxc_gpr_regs->gpr[1], IOMUX_GPR1_FEC2_MASK, 0); 616 clrsetbits_le32(&iomuxc_gpr_regs->gpr[1], IOMUX_GPR1_FEC2_MASK, 0);
617 617
618 ret = enable_fec_anatop_clock(fec_id, ENET_125MHz); 618 ret = enable_fec_anatop_clock(fec_id, ENET_125MHz);
619 if (ret) 619 if (ret)
620 return ret; 620 return ret;
621 621
622 enable_enet_clock(); 622 enable_enet_clock();
623 623
624 return 0; 624 return 0;
625 } 625 }
626 626
627 int board_phy_config(struct phy_device *phydev) 627 int board_phy_config(struct phy_device *phydev)
628 { 628 {
629 /* Enable 1.8V(SEL_1P5_1P8_POS_REG) on Phy control debug reg 0 */ 629 /* Enable 1.8V(SEL_1P5_1P8_POS_REG) on Phy control debug reg 0 */
630 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f); 630 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
631 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8); 631 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
632 632
633 /* rgmii tx clock delay enable */ 633 /* rgmii tx clock delay enable */
634 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); 634 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
635 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); 635 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);
636 636
637 if (phydev->drv->config) 637 if (phydev->drv->config)
638 phydev->drv->config(phydev); 638 phydev->drv->config(phydev);
639 639
640 return 0; 640 return 0;
641 } 641 }
642 #endif 642 #endif
643 643
644 #ifdef CONFIG_PFUZE100_PMIC_I2C 644 #ifdef CONFIG_PFUZE100_PMIC_I2C
645 #define PFUZE100_DEVICEID 0x0 645 #define PFUZE100_DEVICEID 0x0
646 #define PFUZE100_REVID 0x3 646 #define PFUZE100_REVID 0x3
647 #define PFUZE100_FABID 0x4 647 #define PFUZE100_FABID 0x4
648 648
649 #define PFUZE100_SW1ABVOL 0x20 649 #define PFUZE100_SW1ABVOL 0x20
650 #define PFUZE100_SW1ABSTBY 0x21 650 #define PFUZE100_SW1ABSTBY 0x21
651 #define PFUZE100_SW1ABCONF 0x24 651 #define PFUZE100_SW1ABCONF 0x24
652 #define PFUZE100_SW1CVOL 0x2e 652 #define PFUZE100_SW1CVOL 0x2e
653 #define PFUZE100_SW1CSTBY 0x2f 653 #define PFUZE100_SW1CSTBY 0x2f
654 #define PFUZE100_SW1CCONF 0x32 654 #define PFUZE100_SW1CCONF 0x32
655 #define PFUZE100_SW1ABC_SETP(x) ((x - 3000) / 250) 655 #define PFUZE100_SW1ABC_SETP(x) ((x - 3000) / 250)
656 #define PFUZE100_VGEN5CTL 0x70 656 #define PFUZE100_VGEN5CTL 0x70
657 657
658 /* set all switches APS in normal and PFM mode in standby */ 658 /* set all switches APS in normal and PFM mode in standby */
659 static int setup_pmic_mode(int chip) 659 static int setup_pmic_mode(int chip)
660 { 660 {
661 unsigned char offset, i, switch_num, value; 661 unsigned char offset, i, switch_num, value;
662 662
663 if (!chip) { 663 if (!chip) {
664 /* pfuze100 */ 664 /* pfuze100 */
665 switch_num = 6; 665 switch_num = 6;
666 offset = 0x31; 666 offset = 0x31;
667 } else { 667 } else {
668 /* pfuze200 */ 668 /* pfuze200 */
669 switch_num = 4; 669 switch_num = 4;
670 offset = 0x38; 670 offset = 0x38;
671 } 671 }
672 672
673 value = 0xc; 673 value = 0xc;
674 if (i2c_write(0x8, 0x23, 1, &value, 1)) { 674 if (i2c_write(0x8, 0x23, 1, &value, 1)) {
675 printf("Set SW1AB mode error!\n"); 675 printf("Set SW1AB mode error!\n");
676 return -1; 676 return -1;
677 } 677 }
678 678
679 for (i = 0; i < switch_num - 1; i++) { 679 for (i = 0; i < switch_num - 1; i++) {
680 if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) { 680 if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
681 printf("Set switch%x mode error!\n", offset); 681 printf("Set switch%x mode error!\n", offset);
682 return -1; 682 return -1;
683 } 683 }
684 } 684 }
685 685
686 return 0; 686 return 0;
687 } 687 }
688 688
689 static int setup_pmic_voltages(void) 689 static int setup_pmic_voltages(void)
690 { 690 {
691 unsigned char value, rev_id = 0; 691 unsigned char value, rev_id = 0;
692 692
693 i2c_set_bus_num(CONFIG_PMIC_I2C_BUS); 693 i2c_set_bus_num(CONFIG_PMIC_I2C_BUS);
694 694
695 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_PMIC_I2C_SLAVE); 695 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_PMIC_I2C_SLAVE);
696 if (!i2c_probe(CONFIG_PMIC_I2C_SLAVE)) { 696 if (!i2c_probe(CONFIG_PMIC_I2C_SLAVE)) {
697 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_DEVICEID, 1, &value, 1)) { 697 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_DEVICEID, 1, &value, 1)) {
698 printf("Read device ID error!\n"); 698 printf("Read device ID error!\n");
699 return -1; 699 return -1;
700 } 700 }
701 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_REVID, 1, &rev_id, 1)) { 701 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_REVID, 1, &rev_id, 1)) {
702 printf("Read Rev ID error!\n"); 702 printf("Read Rev ID error!\n");
703 return -1; 703 return -1;
704 } 704 }
705 printf("Found PFUZE100! deviceid 0x%x, revid 0x%x\n", value, rev_id); 705 printf("Found PFUZE100! deviceid 0x%x, revid 0x%x\n", value, rev_id);
706 706
707 if (setup_pmic_mode(value & 0xf)) { 707 if (setup_pmic_mode(value & 0xf)) {
708 printf("setup pmic mode error!\n"); 708 printf("setup pmic mode error!\n");
709 return -1; 709 return -1;
710 } 710 }
711 /* set SW1AB standby volatage 0.975V */ 711 /* set SW1AB standby volatage 0.975V */
712 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) { 712 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) {
713 printf("Read SW1ABSTBY error!\n"); 713 printf("Read SW1ABSTBY error!\n");
714 return -1; 714 return -1;
715 } 715 }
716 value &= ~0x3f; 716 value &= ~0x3f;
717 value |= PFUZE100_SW1ABC_SETP(9750); 717 value |= PFUZE100_SW1ABC_SETP(9750);
718 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) { 718 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) {
719 printf("Set SW1ABSTBY error!\n"); 719 printf("Set SW1ABSTBY error!\n");
720 return -1; 720 return -1;
721 } 721 }
722 722
723 /* set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */ 723 /* set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */
724 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABCONF, 1, &value, 1)) { 724 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABCONF, 1, &value, 1)) {
725 printf("Read SW1ABCONFIG error!\n"); 725 printf("Read SW1ABCONFIG error!\n");
726 return -1; 726 return -1;
727 } 727 }
728 value &= ~0xc0; 728 value &= ~0xc0;
729 value |= 0x40; 729 value |= 0x40;
730 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABCONF, 1, &value, 1)) { 730 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABCONF, 1, &value, 1)) {
731 printf("Set SW1ABCONFIG error!\n"); 731 printf("Set SW1ABCONFIG error!\n");
732 return -1; 732 return -1;
733 } 733 }
734 734
735 /* set SW1C standby volatage 0.975V */ 735 /* set SW1C standby volatage 0.975V */
736 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CSTBY, 1, &value, 1)) { 736 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CSTBY, 1, &value, 1)) {
737 printf("Read SW1CSTBY error!\n"); 737 printf("Read SW1CSTBY error!\n");
738 return -1; 738 return -1;
739 } 739 }
740 value &= ~0x3f; 740 value &= ~0x3f;
741 value |= PFUZE100_SW1ABC_SETP(9750); 741 value |= PFUZE100_SW1ABC_SETP(9750);
742 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CSTBY, 1, &value, 1)) { 742 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CSTBY, 1, &value, 1)) {
743 printf("Set SW1CSTBY error!\n"); 743 printf("Set SW1CSTBY error!\n");
744 return -1; 744 return -1;
745 } 745 }
746 746
747 /* set SW1C/VDDSOC step ramp up time to from 16us to 4us/25mV */ 747 /* set SW1C/VDDSOC step ramp up time to from 16us to 4us/25mV */
748 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CCONF, 1, &value, 1)) { 748 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CCONF, 1, &value, 1)) {
749 printf("Read SW1CCONFIG error!\n"); 749 printf("Read SW1CCONFIG error!\n");
750 return -1; 750 return -1;
751 } 751 }
752 value &= ~0xc0; 752 value &= ~0xc0;
753 value |= 0x40; 753 value |= 0x40;
754 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CCONF, 1, &value, 1)) { 754 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CCONF, 1, &value, 1)) {
755 printf("Set SW1CCONFIG error!\n"); 755 printf("Set SW1CCONFIG error!\n");
756 return -1; 756 return -1;
757 } 757 }
758 758
759 /* Enable power of VGEN5 3V3, needed for SD3 */ 759 /* Enable power of VGEN5 3V3, needed for SD3 */
760 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_VGEN5CTL, 1, &value, 1)) { 760 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_VGEN5CTL, 1, &value, 1)) {
761 printf("Read VGEN5CTL error!\n"); 761 printf("Read VGEN5CTL error!\n");
762 return -1; 762 return -1;
763 } 763 }
764 value &= ~0x1F; 764 value &= ~0x1F;
765 value |= 0x1F; 765 value |= 0x1F;
766 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_VGEN5CTL, 1, &value, 1)) { 766 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_VGEN5CTL, 1, &value, 1)) {
767 printf("Set VGEN5CTL error!\n"); 767 printf("Set VGEN5CTL error!\n");
768 return -1; 768 return -1;
769 } 769 }
770 } 770 }
771 771
772 return 0; 772 return 0;
773 } 773 }
774 774
775 #ifdef CONFIG_LDO_BYPASS_CHECK 775 #ifdef CONFIG_LDO_BYPASS_CHECK
776 void ldo_mode_set(int ldo_bypass) 776 void ldo_mode_set(int ldo_bypass)
777 { 777 {
778 unsigned char value; 778 unsigned char value;
779 /* switch to ldo_bypass mode */ 779 /* switch to ldo_bypass mode */
780 if (ldo_bypass) { 780 if (ldo_bypass) {
781 /* decrease VDDARM to 1.15V */ 781 /* decrease VDDARM to 1.15V */
782 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { 782 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) {
783 printf("Read SW1AB error!\n"); 783 printf("Read SW1AB error!\n");
784 return; 784 return;
785 } 785 }
786 value &= ~0x3f; 786 value &= ~0x3f;
787 value |= PFUZE100_SW1ABC_SETP(11500); 787 value |= PFUZE100_SW1ABC_SETP(11500);
788 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { 788 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) {
789 printf("Set SW1AB error!\n"); 789 printf("Set SW1AB error!\n");
790 return; 790 return;
791 } 791 }
792 /* increase VDDSOC to 1.15V */ 792 /* increase VDDSOC to 1.15V */
793 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { 793 if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) {
794 printf("Read SW1C error!\n"); 794 printf("Read SW1C error!\n");
795 return; 795 return;
796 } 796 }
797 value &= ~0x3f; 797 value &= ~0x3f;
798 value |= PFUZE100_SW1ABC_SETP(11500); 798 value |= PFUZE100_SW1ABC_SETP(11500);
799 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { 799 if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) {
800 printf("Set SW1C error!\n"); 800 printf("Set SW1C error!\n");
801 return; 801 return;
802 } 802 }
803 803
804 set_anatop_bypass(1); 804 set_anatop_bypass(1);
805 printf("switch to ldo_bypass mode!\n"); 805 printf("switch to ldo_bypass mode!\n");
806 } 806 }
807 807
808 } 808 }
809 #endif 809 #endif
810 #endif 810 #endif
811 811
812 #ifdef CONFIG_MXC_RDC 812 #ifdef CONFIG_MXC_RDC
813 static rdc_peri_cfg_t const shared_resources[] = { 813 static rdc_peri_cfg_t const shared_resources[] = {
814 (RDC_PER_GPIO1 | RDC_DOMAIN(0) | RDC_DOMAIN(1)), 814 (RDC_PER_GPIO1 | RDC_DOMAIN(0) | RDC_DOMAIN(1)),
815 }; 815 };
816 #endif 816 #endif
817 817
818 int board_early_init_f(void) 818 int board_early_init_f(void)
819 { 819 {
820 #ifdef CONFIG_MXC_RDC 820 #ifdef CONFIG_MXC_RDC
821 imx_rdc_setup_peripherals(shared_resources, ARRAY_SIZE(shared_resources)); 821 imx_rdc_setup_peripherals(shared_resources, ARRAY_SIZE(shared_resources));
822 #endif 822 #endif
823 823
824 #ifdef CONFIG_SYS_AUXCORE_FASTUP 824 #ifdef CONFIG_SYS_AUXCORE_FASTUP
825 arch_auxiliary_core_up(0, CONFIG_SYS_AUXCORE_BOOTDATA); 825 arch_auxiliary_core_up(0, CONFIG_SYS_AUXCORE_BOOTDATA);
826 #endif 826 #endif
827 827
828 setup_iomux_uart(); 828 setup_iomux_uart();
829 return 0; 829 return 0;
830 } 830 }
831 831
832 int board_init(void) 832 int board_init(void)
833 { 833 {
834 /* Address of boot parameters */ 834 /* Address of boot parameters */
835 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; 835 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
836 836
837 #ifdef CONFIG_SYS_I2C_MXC 837 #ifdef CONFIG_SYS_I2C_MXC
838 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); 838 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
839 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3); 839 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3);
840 #endif 840 #endif
841 841
842 #ifdef CONFIG_MAX7310_IOEXP 842 #ifdef CONFIG_MAX7310_IOEXP
843 setup_max7310(); 843 setup_max7310();
844 844
845 /* Reset CPU_PER_RST_B signal for enet phy and PCIE */ 845 /* Reset CPU_PER_RST_B signal for enet phy and PCIE */
846 gpio_exp_direction_output(CPU_PER_RST_B, 0); 846 gpio_exp_direction_output(CPU_PER_RST_B, 0);
847 udelay(500); 847 udelay(500);
848 gpio_exp_direction_output(CPU_PER_RST_B, 1); 848 gpio_exp_direction_output(CPU_PER_RST_B, 1);
849 849
850 /* Set steering signal to L for selecting B0 */ 850 /* Set steering signal to L for selecting B0 */
851 gpio_exp_direction_output(STEER_ENET, 0); 851 gpio_exp_direction_output(STEER_ENET, 0);
852 #endif 852 #endif
853 853
854 #ifdef CONFIG_FEC_MXC 854 #ifdef CONFIG_FEC_MXC
855 setup_fec(CONFIG_FEC_ENET_DEV); 855 setup_fec(CONFIG_FEC_ENET_DEV);
856 #endif 856 #endif
857 857
858 #ifdef CONFIG_SYS_USE_NAND 858 #ifdef CONFIG_SYS_USE_NAND
859 setup_gpmi_nand(); 859 setup_gpmi_nand();
860 #endif 860 #endif
861 861
862 #ifdef CONFIG_QSPI 862 #ifdef CONFIG_QSPI
863 board_qspi_init(); 863 board_qspi_init();
864 #endif 864 #endif
865 865
866 return 0; 866 return 0;
867 } 867 }
868 868
869 #ifdef CONFIG_CMD_BMODE 869 #ifdef CONFIG_CMD_BMODE
870 static const struct boot_mode board_boot_modes[] = { 870 static const struct boot_mode board_boot_modes[] = {
871 {"sda", MAKE_CFGVAL(0x42, 0x30, 0x00, 0x00)}, 871 {"sda", MAKE_CFGVAL(0x42, 0x30, 0x00, 0x00)},
872 {"sdb", MAKE_CFGVAL(0x40, 0x38, 0x00, 0x00)}, 872 {"sdb", MAKE_CFGVAL(0x40, 0x38, 0x00, 0x00)},
873 {"qspi1", MAKE_CFGVAL(0x10, 0x00, 0x00, 0x00)}, 873 {"qspi1", MAKE_CFGVAL(0x10, 0x00, 0x00, 0x00)},
874 {"nand", MAKE_CFGVAL(0x82, 0x00, 0x00, 0x00)}, 874 {"nand", MAKE_CFGVAL(0x82, 0x00, 0x00, 0x00)},
875 {NULL, 0}, 875 {NULL, 0},
876 }; 876 };
877 #endif 877 #endif
878 878
879 int board_late_init(void) 879 int board_late_init(void)
880 { 880 {
881 #ifdef CONFIG_CMD_BMODE 881 #ifdef CONFIG_CMD_BMODE
882 add_board_boot_modes(board_boot_modes); 882 add_board_boot_modes(board_boot_modes);
883 #endif 883 #endif
884 884
885 #ifdef CONFIG_PFUZE100_PMIC_I2C 885 #ifdef CONFIG_PFUZE100_PMIC_I2C
886 int ret = 0; 886 int ret = 0;
887 887
888 ret = setup_pmic_voltages(); 888 ret = setup_pmic_voltages();
889 if (ret) 889 if (ret)
890 return -1; 890 return -1;
891 #endif 891 #endif
892 892
893 #ifdef CONFIG_ENV_IS_IN_MMC 893 #ifdef CONFIG_ENV_IS_IN_MMC
894 board_late_mmc_init(); 894 board_late_mmc_init();
895 #endif 895 #endif
896 896
897 return 0; 897 return 0;
898 } 898 }
899 899
900 u32 get_board_rev(void) 900 u32 get_board_rev(void)
901 { 901 {
902 return get_cpu_rev(); 902 return get_cpu_rev();
903 } 903 }
904 904
905 int checkboard(void) 905 int checkboard(void)
906 { 906 {
907 puts("Board: MX6SX SABRE AUTO\n"); 907 puts("Board: MX6SX SABRE AUTO\n");
908 908
909 return 0; 909 return 0;
910 } 910 }
911 911
912 #ifdef CONFIG_USB_EHCI_MX6 912 #ifdef CONFIG_USB_EHCI_MX6
913 iomux_v3_cfg_t const usb_otg1_pads[] = { 913 iomux_v3_cfg_t const usb_otg1_pads[] = {
914 MX6SX_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL), 914 MX6SX_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
915 MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL) 915 MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
916 }; 916 };
917 917
918 iomux_v3_cfg_t const usb_host2_pads[] = { 918 iomux_v3_cfg_t const usb_host2_pads[] = {
919 MX6SX_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL), 919 MX6SX_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
920 }; 920 };
921 921
922 int board_ehci_hcd_init(int port) 922 int board_ehci_hcd_init(int port)
923 { 923 {
924 switch (port) { 924 switch (port) {
925 case 0: 925 case 0:
926 imx_iomux_v3_setup_multiple_pads(usb_otg1_pads, 926 imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
927 ARRAY_SIZE(usb_otg1_pads)); 927 ARRAY_SIZE(usb_otg1_pads));
928 break; 928 break;
929 case 1: 929 case 1:
930 imx_iomux_v3_setup_multiple_pads(usb_host2_pads, 930 imx_iomux_v3_setup_multiple_pads(usb_host2_pads,
931 ARRAY_SIZE(usb_host2_pads)); 931 ARRAY_SIZE(usb_host2_pads));
932 break; 932 break;
933 default: 933 default:
934 printf("MXC USB port %d not yet supported\n", port); 934 printf("MXC USB port %d not yet supported\n", port);
935 return 1; 935 return 1;
936 } 936 }
937 return 0; 937 return 0;
938 } 938 }
939 #endif 939 #endif
940 940
941 #ifdef CONFIG_FASTBOOT 941 #ifdef CONFIG_FASTBOOT
942 942
943 void board_fastboot_setup(void) 943 void board_fastboot_setup(void)
944 { 944 {
945 switch (get_boot_device()) { 945 switch (get_boot_device()) {
946 #if defined(CONFIG_FASTBOOT_STORAGE_MMC) 946 #if defined(CONFIG_FASTBOOT_STORAGE_MMC)
947 case SD3_BOOT: 947 case SD3_BOOT:
948 case MMC3_BOOT: 948 case MMC3_BOOT:
949 if (!getenv("fastboot_dev")) 949 if (!getenv("fastboot_dev"))
950 setenv("fastboot_dev", "mmc0"); 950 setenv("fastboot_dev", "mmc0");
951 if (!getenv("bootcmd")) 951 if (!getenv("bootcmd"))
952 setenv("bootcmd", "booti mmc0"); 952 setenv("bootcmd", "booti mmc0");
953 break; 953 break;
954 case SD4_BOOT: 954 case SD4_BOOT:
955 case MMC4_BOOT: 955 case MMC4_BOOT:
956 if (!getenv("fastboot_dev")) 956 if (!getenv("fastboot_dev"))
957 setenv("fastboot_dev", "mmc1"); 957 setenv("fastboot_dev", "mmc1");
958 if (!getenv("bootcmd")) 958 if (!getenv("bootcmd"))
959 setenv("bootcmd", "booti mmc1"); 959 setenv("bootcmd", "booti mmc1");
960 break; 960 break;
961 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ 961 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/
962 #if defined(CONFIG_FASTBOOT_STORAGE_NAND) 962 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
963 case NAND_BOOT: 963 case NAND_BOOT:
964 if (!getenv("fastboot_dev")) 964 if (!getenv("fastboot_dev"))
965 setenv("fastboot_dev", "nand"); 965 setenv("fastboot_dev", "nand");
966 if (!getenv("fbparts")) 966 if (!getenv("fbparts"))
967 setenv("fbparts", 967 setenv("fbparts", ANDROID_FASTBOOT_NAND_PARTS);
968 "16m@16m(boot) 16m@32m(recovery) 810m@48m(android_root)ubifs");
969 if (!getenv("bootcmd")) 968 if (!getenv("bootcmd"))
970 setenv("bootcmd", 969 setenv("bootcmd",
971 "nand read ${loadaddr} ${boot_nand_offset} " 970 "nand read ${loadaddr} ${boot_nand_offset} "
972 "${boot_nand_size};booti ${loadaddr}"); 971 "${boot_nand_size};booti ${loadaddr}");
973 break; 972 break;
974 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ 973 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/
975 974
976 default: 975 default:
977 printf("unsupported boot devices\n"); 976 printf("unsupported boot devices\n");
978 break; 977 break;
979 } 978 }
980 } 979 }
981 980
982 #ifdef CONFIG_ANDROID_RECOVERY 981 #ifdef CONFIG_ANDROID_RECOVERY
983 int check_recovery_cmd_file(void) 982 int check_recovery_cmd_file(void)
984 { 983 {
985 int recovery_mode = 0; 984 int recovery_mode = 0;
986 985
987 recovery_mode = recovery_check_and_clean_flag(); 986 recovery_mode = recovery_check_and_clean_flag();
988 987
989 return recovery_mode; 988 return recovery_mode;
990 } 989 }
991 990
992 void board_recovery_setup(void) 991 void board_recovery_setup(void)
993 { 992 {
994 int bootdev = get_boot_device(); 993 int bootdev = get_boot_device();
995 994
996 switch (bootdev) { 995 switch (bootdev) {
997 #if defined(CONFIG_FASTBOOT_STORAGE_MMC) 996 #if defined(CONFIG_FASTBOOT_STORAGE_MMC)
998 case SD3_BOOT: 997 case SD3_BOOT:
999 case MMC3_BOOT: 998 case MMC3_BOOT:
1000 if (!getenv("bootcmd_android_recovery")) 999 if (!getenv("bootcmd_android_recovery"))
1001 setenv("bootcmd_android_recovery", "booti mmc0 recovery"); 1000 setenv("bootcmd_android_recovery", "booti mmc0 recovery");
1002 break; 1001 break;
1003 case SD4_BOOT: 1002 case SD4_BOOT:
1004 case MMC4_BOOT: 1003 case MMC4_BOOT:
1005 if (!getenv("bootcmd_android_recovery")) 1004 if (!getenv("bootcmd_android_recovery"))
1006 setenv("bootcmd_android_recovery", "booti mmc1 recovery"); 1005 setenv("bootcmd_android_recovery", "booti mmc1 recovery");
1007 break; 1006 break;
1008 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ 1007 #endif /*CONFIG_FASTBOOT_STORAGE_MMC*/
1009 #if defined(CONFIG_FASTBOOT_STORAGE_NAND) 1008 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
1010 case NAND_BOOT: 1009 case NAND_BOOT:
1011 if (!getenv("bootcmd_android_recovery")) 1010 if (!getenv("bootcmd_android_recovery"))
1012 setenv("bootcmd_android_recovery", 1011 setenv("bootcmd_android_recovery",
1013 "nand read ${loadaddr} ${recovery_nand_offset} " 1012 "nand read ${loadaddr} ${recovery_nand_offset} "
1014 "${recovery_nand_size};booti ${loadaddr}"); 1013 "${recovery_nand_size};booti ${loadaddr}");
1015 break; 1014 break;
1016 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ 1015 #endif /*CONFIG_FASTBOOT_STORAGE_NAND*/
1017 default: 1016 default:
1018 printf("Unsupported bootup device for recovery: dev: %d\n", 1017 printf("Unsupported bootup device for recovery: dev: %d\n",
1019 bootdev); 1018 bootdev);
1020 return; 1019 return;
1021 } 1020 }
1022 1021
1023 printf("setup env for recovery..\n"); 1022 printf("setup env for recovery..\n");
1024 setenv("bootcmd", "run bootcmd_android_recovery"); 1023 setenv("bootcmd", "run bootcmd_android_recovery");
1025 } 1024 }
1026 #endif /*CONFIG_ANDROID_RECOVERY*/ 1025 #endif /*CONFIG_ANDROID_RECOVERY*/
1027 1026
1028 #endif /*CONFIG_FASTBOOT*/ 1027 #endif /*CONFIG_FASTBOOT*/
1029 1028
1030 #ifdef CONFIG_IMX_UDC 1029 #ifdef CONFIG_IMX_UDC
1031 iomux_v3_cfg_t const otg_udc_pads[] = { 1030 iomux_v3_cfg_t const otg_udc_pads[] = {
1032 (MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)), 1031 (MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)),
1033 }; 1032 };
1034 void udc_pins_setting(void) 1033 void udc_pins_setting(void)
1035 { 1034 {
1036 imx_iomux_v3_setup_multiple_pads(otg_udc_pads, 1035 imx_iomux_v3_setup_multiple_pads(otg_udc_pads,
1037 ARRAY_SIZE(otg_udc_pads)); 1036 ARRAY_SIZE(otg_udc_pads));
1038 } 1037 }
1039 1038
1040 #endif /*CONFIG_IMX_UDC*/ 1039 #endif /*CONFIG_IMX_UDC*/
1041 1040
include/configs/mx6sabreandroid_common.h
1 /* 1 /*
2 * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. All Rights Reserved.
3 * 3 *
4 * SPDX-License-Identifier: GPL-2.0+ 4 * SPDX-License-Identifier: GPL-2.0+
5 */ 5 */
6 6
7 #ifndef MX6_SABRE_ANDROID_COMMON_H 7 #ifndef MX6_SABRE_ANDROID_COMMON_H
8 #define MX6_SABRE_ANDROID_COMMON_H 8 #define MX6_SABRE_ANDROID_COMMON_H
9 9
10 #define CONFIG_SERIAL_TAG 10 #define CONFIG_SERIAL_TAG
11 11
12 #define CONFIG_USB_DEVICE 12 #define CONFIG_USB_DEVICE
13 #define CONFIG_IMX_UDC 1 13 #define CONFIG_IMX_UDC 1
14 14
15 #define CONFIG_FASTBOOT 1 15 #define CONFIG_FASTBOOT 1
16 #define CONFIG_FASTBOOT_VENDOR_ID 0x18d1 16 #define CONFIG_FASTBOOT_VENDOR_ID 0x18d1
17 #define CONFIG_FASTBOOT_PRODUCT_ID 0x0d02 17 #define CONFIG_FASTBOOT_PRODUCT_ID 0x0d02
18 #define CONFIG_FASTBOOT_BCD_DEVICE 0x311 18 #define CONFIG_FASTBOOT_BCD_DEVICE 0x311
19 #define CONFIG_FASTBOOT_MANUFACTURER_STR "Freescale" 19 #define CONFIG_FASTBOOT_MANUFACTURER_STR "Freescale"
20 #define CONFIG_FASTBOOT_PRODUCT_NAME_STR "i.mx6 Sabre Board" 20 #define CONFIG_FASTBOOT_PRODUCT_NAME_STR "i.mx6 Sabre Board"
21 #define CONFIG_FASTBOOT_INTERFACE_STR "Android fastboot" 21 #define CONFIG_FASTBOOT_INTERFACE_STR "Android fastboot"
22 #define CONFIG_FASTBOOT_CONFIGURATION_STR "Android fastboot" 22 #define CONFIG_FASTBOOT_CONFIGURATION_STR "Android fastboot"
23 #define CONFIG_FASTBOOT_SERIAL_NUM "12345" 23 #define CONFIG_FASTBOOT_SERIAL_NUM "12345"
24 #define CONFIG_FASTBOOT_SATA_NO 0 24 #define CONFIG_FASTBOOT_SATA_NO 0
25 25
26 #if defined CONFIG_SYS_BOOT_NAND 26 #if defined CONFIG_SYS_BOOT_NAND
27 #define CONFIG_FASTBOOT_STORAGE_NAND 27 #define CONFIG_FASTBOOT_STORAGE_NAND
28 #elif defined CONFIG_SYS_BOOT_SATA 28 #elif defined CONFIG_SYS_BOOT_SATA
29 #define CONFIG_FASTBOOT_STORAGE_SATA 29 #define CONFIG_FASTBOOT_STORAGE_SATA
30 #else 30 #else
31 #define CONFIG_FASTBOOT_STORAGE_MMC 31 #define CONFIG_FASTBOOT_STORAGE_MMC
32 #endif 32 #endif
33 33
34 /* For system.img growing up more than 256MB, more buffer needs 34 /* For system.img growing up more than 256MB, more buffer needs
35 * to receive the system.img*/ 35 * to receive the system.img*/
36 #define CONFIG_FASTBOOT_TRANSFER_BUF 0x2c000000 36 #define CONFIG_FASTBOOT_TRANSFER_BUF 0x2c000000
37 #define CONFIG_FASTBOOT_TRANSFER_BUF_SIZE 0x19000000 /* 400M byte */ 37 #define CONFIG_FASTBOOT_TRANSFER_BUF_SIZE 0x19000000 /* 400M byte */
38 38
39 39
40 #define CONFIG_CMD_BOOTI 40 #define CONFIG_CMD_BOOTI
41 #define CONFIG_ANDROID_RECOVERY 41 #define CONFIG_ANDROID_RECOVERY
42 /* which mmc bus is your main storage ? */ 42 /* which mmc bus is your main storage ? */
43 #define CONFIG_ANDROID_MAIN_MMC_BUS 2 43 #define CONFIG_ANDROID_MAIN_MMC_BUS 2
44 #define CONFIG_ANDROID_BOOT_PARTITION_MMC 1 44 #define CONFIG_ANDROID_BOOT_PARTITION_MMC 1
45 #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 45 #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5
46 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 46 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
47 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 47 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
48 48
49 #undef CONFIG_EXTRA_ENV_SETTINGS 49 #undef CONFIG_EXTRA_ENV_SETTINGS
50 #undef CONFIG_BOOTCOMMAND 50 #undef CONFIG_BOOTCOMMAND
51 51
52 #define CONFIG_EXTRA_ENV_SETTINGS \ 52 #define CONFIG_EXTRA_ENV_SETTINGS \
53 "splashpos=m,m\0" \ 53 "splashpos=m,m\0" \
54 "fdt_high=0xffffffff\0" \ 54 "fdt_high=0xffffffff\0" \
55 "initrd_high=0xffffffff\0" \ 55 "initrd_high=0xffffffff\0" \
56 56
57 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
58 #define ANDROID_FASTBOOT_NAND_PARTS "16m@64m(boot) 16m@80m(recovery) 810m@96m(android_root)ubifs"
59 #endif
60
57 #endif /* MX6_SABRE_ANDROID_COMMON_H */ 61 #endif /* MX6_SABRE_ANDROID_COMMON_H */
58 62
include/configs/mx6sxsabreautoandroid.h
1 1
2 /* 2 /*
3 * Copyright (C) 2014 Freescale Semiconductor, Inc. 3 * Copyright (C) 2014 Freescale Semiconductor, Inc.
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #ifndef __MX6SX_SABREAUTO_ANDROID_H 8 #ifndef __MX6SX_SABREAUTO_ANDROID_H
9 #define __MX6SX_SABREAUTO_ANDROID_H 9 #define __MX6SX_SABREAUTO_ANDROID_H
10 10
11 #define CONFIG_SERIAL_TAG 11 #define CONFIG_SERIAL_TAG
12 12
13 #define CONFIG_USB_DEVICE 13 #define CONFIG_USB_DEVICE
14 #define CONFIG_IMX_UDC 1 14 #define CONFIG_IMX_UDC 1
15 15
16 #define CONFIG_FASTBOOT 1 16 #define CONFIG_FASTBOOT 1
17 #define CONFIG_FASTBOOT_VENDOR_ID 0x18d1 17 #define CONFIG_FASTBOOT_VENDOR_ID 0x18d1
18 #define CONFIG_FASTBOOT_PRODUCT_ID 0x0d02 18 #define CONFIG_FASTBOOT_PRODUCT_ID 0x0d02
19 #define CONFIG_FASTBOOT_BCD_DEVICE 0x311 19 #define CONFIG_FASTBOOT_BCD_DEVICE 0x311
20 #define CONFIG_FASTBOOT_MANUFACTURER_STR "Freescale" 20 #define CONFIG_FASTBOOT_MANUFACTURER_STR "Freescale"
21 #define CONFIG_FASTBOOT_PRODUCT_NAME_STR "i.mx6sx SABRE-AUTO Board" 21 #define CONFIG_FASTBOOT_PRODUCT_NAME_STR "i.mx6sx SABRE-AUTO Board"
22 #define CONFIG_FASTBOOT_INTERFACE_STR "Android fastboot" 22 #define CONFIG_FASTBOOT_INTERFACE_STR "Android fastboot"
23 #define CONFIG_FASTBOOT_CONFIGURATION_STR "Android fastboot" 23 #define CONFIG_FASTBOOT_CONFIGURATION_STR "Android fastboot"
24 #define CONFIG_FASTBOOT_SERIAL_NUM "12345" 24 #define CONFIG_FASTBOOT_SERIAL_NUM "12345"
25 #define CONFIG_FASTBOOT_SATA_NO 0 25 #define CONFIG_FASTBOOT_SATA_NO 0
26 26
27 #if defined CONFIG_SYS_BOOT_NAND 27 #if defined CONFIG_SYS_BOOT_NAND
28 #define CONFIG_FASTBOOT_STORAGE_NAND 28 #define CONFIG_FASTBOOT_STORAGE_NAND
29 #else 29 #else
30 #define CONFIG_FASTBOOT_STORAGE_MMC 30 #define CONFIG_FASTBOOT_STORAGE_MMC
31 #endif 31 #endif
32 32
33 /* For system.img growing up more than 256MB, more buffer needs 33 /* For system.img growing up more than 256MB, more buffer needs
34 * to receive the system.img*/ 34 * to receive the system.img*/
35 #define CONFIG_FASTBOOT_TRANSFER_BUF 0x8c000000 35 #define CONFIG_FASTBOOT_TRANSFER_BUF 0x8c000000
36 #define CONFIG_FASTBOOT_TRANSFER_BUF_SIZE 0x19000000 /* 400M byte */ 36 #define CONFIG_FASTBOOT_TRANSFER_BUF_SIZE 0x19000000 /* 400M byte */
37 37
38 38
39 #define CONFIG_CMD_BOOTI 39 #define CONFIG_CMD_BOOTI
40 #define CONFIG_ANDROID_RECOVERY 40 #define CONFIG_ANDROID_RECOVERY
41 /* which mmc bus is your main storage ? */ 41 /* which mmc bus is your main storage ? */
42 #define CONFIG_ANDROID_MAIN_MMC_BUS 2 42 #define CONFIG_ANDROID_MAIN_MMC_BUS 2
43 #define CONFIG_ANDROID_BOOT_PARTITION_MMC 1 43 #define CONFIG_ANDROID_BOOT_PARTITION_MMC 1
44 #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 44 #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5
45 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 45 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
46 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 46 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
47 47
48 #undef CONFIG_EXTRA_ENV_SETTINGS 48 #undef CONFIG_EXTRA_ENV_SETTINGS
49 #undef CONFIG_BOOTCOMMAND 49 #undef CONFIG_BOOTCOMMAND
50 50
51 #define CONFIG_EXTRA_ENV_SETTINGS \ 51 #define CONFIG_EXTRA_ENV_SETTINGS \
52 "splashpos=m,m\0" \ 52 "splashpos=m,m\0" \
53 "fdt_high=0xffffffff\0" \ 53 "fdt_high=0xffffffff\0" \
54 "initrd_high=0xffffffff\0" \ 54 "initrd_high=0xffffffff\0" \
55 55
56 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
57 #define ANDROID_FASTBOOT_NAND_PARTS "16m@64m(boot) 16m@80m(recovery) 810m@96m(android_root)ubifs"
58 #endif
59
56 #endif 60 #endif
57 61