blob: 3de958e6283543fcd6672c4aaadee5d14de8199a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Akshay Bhat197f9872016-01-29 15:16:40 -05002/*
3 * Copyright 2015 Timesys Corporation
4 * Copyright 2015 General Electric Company
5 * Copyright 2012 Freescale Semiconductor, Inc.
Akshay Bhat197f9872016-01-29 15:16:40 -05006 */
7
8#include <asm/arch/clock.h>
9#include <asm/arch/imx-regs.h>
10#include <asm/arch/iomux.h>
11#include <asm/arch/mx6-pins.h>
Masahiro Yamada56a931c2016-09-21 11:28:55 +090012#include <linux/errno.h>
Akshay Bhat197f9872016-01-29 15:16:40 -050013#include <asm/gpio.h>
Stefano Babic33731bc2017-06-29 10:16:06 +020014#include <asm/mach-imx/mxc_i2c.h>
15#include <asm/mach-imx/iomux-v3.h>
16#include <asm/mach-imx/boot_mode.h>
17#include <asm/mach-imx/video.h>
Akshay Bhat197f9872016-01-29 15:16:40 -050018#include <mmc.h>
19#include <fsl_esdhc.h>
20#include <miiphy.h>
Martyn Welch18c31ea2018-01-10 20:31:30 +010021#include <net.h>
Akshay Bhat197f9872016-01-29 15:16:40 -050022#include <netdev.h>
23#include <asm/arch/mxc_hdmi.h>
24#include <asm/arch/crm_regs.h>
25#include <asm/io.h>
26#include <asm/arch/sys_proto.h>
27#include <i2c.h>
Diego Dorta2661c9c2017-09-22 12:12:18 -030028#include <input.h>
Akshay Bhat5d643622016-04-12 18:13:59 -040029#include <pwm.h>
Ian Rayc0293da2017-08-22 09:03:54 +030030#include <stdlib.h>
Nandor Hanae3c6d22018-01-10 20:31:38 +010031#include "../common/ge_common.h"
Martyn Welch66697ce2017-11-08 15:35:15 +000032#include "../common/vpd_reader.h"
Hannu Lounento37879682018-01-10 20:31:31 +010033#include "../../../drivers/net/e1000.h"
Akshay Bhat197f9872016-01-29 15:16:40 -050034DECLARE_GLOBAL_DATA_PTR;
35
Nandor Han7a9bb302018-04-25 16:57:01 +020036struct vpd_cache;
37
38static int confidx = 3; /* Default to b850v3. */
39static struct vpd_cache vpd;
40
Ian Rayc0293da2017-08-22 09:03:54 +030041#ifndef CONFIG_SYS_I2C_EEPROM_ADDR
42# define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
43# define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
44#endif
45
46#ifndef CONFIG_SYS_I2C_EEPROM_BUS
Martyn Welch59be7892018-01-10 20:31:28 +010047#define CONFIG_SYS_I2C_EEPROM_BUS 4
Ian Rayc0293da2017-08-22 09:03:54 +030048#endif
49
Justin Watersef93fc22016-04-13 17:03:18 -040050#define NC_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
51 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
52 PAD_CTL_HYS)
53
Akshay Bhat197f9872016-01-29 15:16:40 -050054#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
55 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
56 PAD_CTL_SRE_FAST | PAD_CTL_HYS)
57
58#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \
59 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
60 PAD_CTL_SRE_FAST | PAD_CTL_HYS)
61
62#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
63 PAD_CTL_SPEED_HIGH | PAD_CTL_DSE_48ohm | PAD_CTL_SRE_FAST)
64
65#define ENET_CLK_PAD_CTRL (PAD_CTL_SPEED_MED | \
66 PAD_CTL_DSE_120ohm | PAD_CTL_SRE_FAST)
67
68#define ENET_RX_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
69 PAD_CTL_SPEED_HIGH | PAD_CTL_SRE_FAST)
70
71#define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \
72 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
73
74#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
75 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
76 PAD_CTL_ODE | PAD_CTL_SRE_FAST)
77
78#define I2C_PAD MUX_PAD_CTRL(I2C_PAD_CTRL)
79
80int dram_init(void)
81{
Fabio Estevamdd5d4e42016-07-23 13:23:40 -030082 gd->ram_size = imx_ddr_size();
Akshay Bhat197f9872016-01-29 15:16:40 -050083
84 return 0;
85}
86
87static iomux_v3_cfg_t const uart3_pads[] = {
88 MX6_PAD_EIM_D31__UART3_RTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
89 MX6_PAD_EIM_D23__UART3_CTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
90 MX6_PAD_EIM_D24__UART3_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
91 MX6_PAD_EIM_D25__UART3_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
92};
93
94static iomux_v3_cfg_t const uart4_pads[] = {
95 MX6_PAD_KEY_COL0__UART4_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
96 MX6_PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
97};
98
99static iomux_v3_cfg_t const enet_pads[] = {
100 MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
101 MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
102 MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
103 MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
104 MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
105 MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
106 MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
107 MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
108 MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
109 MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
110 MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
111 MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
112 MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
113 MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
114 MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
115 /* AR8033 PHY Reset */
116 MX6_PAD_ENET_TX_EN__GPIO1_IO28 | MUX_PAD_CTRL(NO_PAD_CTRL),
117};
118
119static void setup_iomux_enet(void)
120{
121 imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
122
123 /* Reset AR8033 PHY */
124 gpio_direction_output(IMX_GPIO_NR(1, 28), 0);
Yung-Ching LINca3d01c2017-02-21 09:56:55 +0800125 mdelay(10);
Akshay Bhat197f9872016-01-29 15:16:40 -0500126 gpio_set_value(IMX_GPIO_NR(1, 28), 1);
Yung-Ching LINca3d01c2017-02-21 09:56:55 +0800127 mdelay(1);
Akshay Bhat197f9872016-01-29 15:16:40 -0500128}
129
130static iomux_v3_cfg_t const usdhc2_pads[] = {
131 MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
132 MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
133 MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
134 MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
135 MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
136 MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
137 MX6_PAD_GPIO_4__GPIO1_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL),
138};
139
140static iomux_v3_cfg_t const usdhc3_pads[] = {
141 MX6_PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
142 MX6_PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
143 MX6_PAD_SD3_RST__SD3_RESET | MUX_PAD_CTRL(USDHC_PAD_CTRL),
144 MX6_PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
145 MX6_PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
146 MX6_PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
147 MX6_PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
148 MX6_PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
149 MX6_PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
150 MX6_PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
151 MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
152};
153
154static iomux_v3_cfg_t const usdhc4_pads[] = {
155 MX6_PAD_SD4_CLK__SD4_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
156 MX6_PAD_SD4_CMD__SD4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
157 MX6_PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
158 MX6_PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
159 MX6_PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
160 MX6_PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
161 MX6_PAD_SD4_DAT4__SD4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
162 MX6_PAD_SD4_DAT5__SD4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
163 MX6_PAD_SD4_DAT6__SD4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
164 MX6_PAD_SD4_DAT7__SD4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
165 MX6_PAD_NANDF_CS0__GPIO6_IO11 | MUX_PAD_CTRL(NO_PAD_CTRL),
166 MX6_PAD_NANDF_CS1__GPIO6_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL),
167};
168
169static iomux_v3_cfg_t const ecspi1_pads[] = {
170 MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
171 MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
172 MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
173 MX6_PAD_EIM_EB2__GPIO2_IO30 | MUX_PAD_CTRL(NO_PAD_CTRL),
174};
175
176static struct i2c_pads_info i2c_pad_info1 = {
177 .scl = {
178 .i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL | I2C_PAD,
179 .gpio_mode = MX6_PAD_CSI0_DAT9__GPIO5_IO27 | I2C_PAD,
180 .gp = IMX_GPIO_NR(5, 27)
181 },
182 .sda = {
183 .i2c_mode = MX6_PAD_CSI0_DAT8__I2C1_SDA | I2C_PAD,
184 .gpio_mode = MX6_PAD_CSI0_DAT8__GPIO5_IO26 | I2C_PAD,
185 .gp = IMX_GPIO_NR(5, 26)
186 }
187};
188
189static struct i2c_pads_info i2c_pad_info2 = {
190 .scl = {
191 .i2c_mode = MX6_PAD_KEY_COL3__I2C2_SCL | I2C_PAD,
192 .gpio_mode = MX6_PAD_KEY_COL3__GPIO4_IO12 | I2C_PAD,
193 .gp = IMX_GPIO_NR(4, 12)
194 },
195 .sda = {
196 .i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA | I2C_PAD,
197 .gpio_mode = MX6_PAD_KEY_ROW3__GPIO4_IO13 | I2C_PAD,
198 .gp = IMX_GPIO_NR(4, 13)
199 }
200};
201
202static struct i2c_pads_info i2c_pad_info3 = {
203 .scl = {
204 .i2c_mode = MX6_PAD_GPIO_3__I2C3_SCL | I2C_PAD,
205 .gpio_mode = MX6_PAD_GPIO_3__GPIO1_IO03 | I2C_PAD,
206 .gp = IMX_GPIO_NR(1, 3)
207 },
208 .sda = {
209 .i2c_mode = MX6_PAD_GPIO_6__I2C3_SDA | I2C_PAD,
210 .gpio_mode = MX6_PAD_GPIO_6__GPIO1_IO06 | I2C_PAD,
211 .gp = IMX_GPIO_NR(1, 6)
212 }
213};
214
215#ifdef CONFIG_MXC_SPI
216int board_spi_cs_gpio(unsigned bus, unsigned cs)
217{
218 return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(2, 30)) : -1;
219}
220
221static void setup_spi(void)
222{
223 imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
224}
225#endif
226
227static iomux_v3_cfg_t const pcie_pads[] = {
228 MX6_PAD_GPIO_5__GPIO1_IO05 | MUX_PAD_CTRL(NO_PAD_CTRL),
229 MX6_PAD_GPIO_17__GPIO7_IO12 | MUX_PAD_CTRL(NO_PAD_CTRL),
230};
231
232static void setup_pcie(void)
233{
234 imx_iomux_v3_setup_multiple_pads(pcie_pads, ARRAY_SIZE(pcie_pads));
235}
236
237static void setup_iomux_uart(void)
238{
239 imx_iomux_v3_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_pads));
240 imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
241}
242
243#ifdef CONFIG_FSL_ESDHC
244struct fsl_esdhc_cfg usdhc_cfg[3] = {
245 {USDHC2_BASE_ADDR},
246 {USDHC3_BASE_ADDR},
247 {USDHC4_BASE_ADDR},
248};
249
250#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
251#define USDHC4_CD_GPIO IMX_GPIO_NR(6, 11)
252
253int board_mmc_getcd(struct mmc *mmc)
254{
255 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
256 int ret = 0;
257
258 switch (cfg->esdhc_base) {
259 case USDHC2_BASE_ADDR:
260 ret = !gpio_get_value(USDHC2_CD_GPIO);
261 break;
262 case USDHC3_BASE_ADDR:
263 ret = 1; /* eMMC is always present */
264 break;
265 case USDHC4_BASE_ADDR:
266 ret = !gpio_get_value(USDHC4_CD_GPIO);
267 break;
268 }
269
270 return ret;
271}
272
273int board_mmc_init(bd_t *bis)
274{
275 int ret;
276 int i;
277
278 for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
279 switch (i) {
280 case 0:
281 imx_iomux_v3_setup_multiple_pads(
282 usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
283 gpio_direction_input(USDHC2_CD_GPIO);
284 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
285 break;
286 case 1:
287 imx_iomux_v3_setup_multiple_pads(
288 usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
289 usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
290 break;
291 case 2:
292 imx_iomux_v3_setup_multiple_pads(
293 usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
294 gpio_direction_input(USDHC4_CD_GPIO);
295 usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
296 break;
297 default:
298 printf("Warning: you configured more USDHC controllers\n"
299 "(%d) then supported by the board (%d)\n",
300 i + 1, CONFIG_SYS_FSL_USDHC_NUM);
301 return -EINVAL;
302 }
303
304 ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
305 if (ret)
306 return ret;
307 }
308
309 return 0;
310}
311#endif
312
313static int mx6_rgmii_rework(struct phy_device *phydev)
314{
315 /* Configure AR8033 to ouput a 125MHz clk from CLK_25M */
316 /* set device address 0x7 */
317 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);
318 /* offset 0x8016: CLK_25M Clock Select */
319 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);
320 /* enable register write, no post increment, address 0x7 */
321 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);
322 /* set to 125 MHz from local PLL source */
323 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x18);
324
325 /* rgmii tx clock delay enable */
326 /* set debug port address: SerDes Test and System Mode Control */
327 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
328 /* enable rgmii tx clock delay */
Yung-Ching LIN48652c82017-02-21 09:56:56 +0800329 /* set the reserved bits to avoid board specific voltage peak issue*/
330 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x3D47);
Akshay Bhat197f9872016-01-29 15:16:40 -0500331
332 return 0;
333}
334
335int board_phy_config(struct phy_device *phydev)
336{
337 mx6_rgmii_rework(phydev);
338
339 if (phydev->drv->config)
340 phydev->drv->config(phydev);
341
342 return 0;
343}
344
345#if defined(CONFIG_VIDEO_IPUV3)
346static iomux_v3_cfg_t const backlight_pads[] = {
347 /* Power for LVDS Display */
348 MX6_PAD_EIM_D22__GPIO3_IO22 | MUX_PAD_CTRL(NO_PAD_CTRL),
349#define LVDS_POWER_GP IMX_GPIO_NR(3, 22)
350 /* Backlight enable for LVDS display */
351 MX6_PAD_GPIO_0__GPIO1_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL),
352#define LVDS_BACKLIGHT_GP IMX_GPIO_NR(1, 0)
Akshay Bhat5d643622016-04-12 18:13:59 -0400353 /* backlight PWM brightness control */
354 MX6_PAD_SD1_DAT3__PWM1_OUT | MUX_PAD_CTRL(NO_PAD_CTRL),
Akshay Bhat197f9872016-01-29 15:16:40 -0500355};
356
357static void do_enable_hdmi(struct display_info_t const *dev)
358{
359 imx_enable_hdmi_phy();
360}
361
362int board_cfb_skip(void)
363{
364 gpio_direction_output(LVDS_POWER_GP, 1);
365
366 return 0;
367}
368
Ian Rayf8e4fab2018-04-25 16:56:58 +0200369static int detect_lcd(struct display_info_t const *dev)
Akshay Bhat197f9872016-01-29 15:16:40 -0500370{
371 if (IS_ENABLED(CONFIG_TARGET_GE_B450V3) ||
372 IS_ENABLED(CONFIG_TARGET_GE_B650V3))
373 return 1;
374
375 return 0;
376}
377
378struct display_info_t const displays[] = {{
379 .bus = -1,
380 .addr = -1,
381 .pixfmt = IPU_PIX_FMT_RGB24,
Ian Rayf8e4fab2018-04-25 16:56:58 +0200382 .detect = detect_lcd,
Akshay Bhat197f9872016-01-29 15:16:40 -0500383 .enable = NULL,
384 .mode = {
385 .name = "G121X1-L03",
386 .refresh = 60,
387 .xres = 1024,
388 .yres = 768,
389 .pixclock = 15385,
390 .left_margin = 20,
391 .right_margin = 300,
392 .upper_margin = 30,
393 .lower_margin = 8,
394 .hsync_len = 1,
395 .vsync_len = 1,
396 .sync = FB_SYNC_EXT,
397 .vmode = FB_VMODE_NONINTERLACED
398} }, {
399 .bus = -1,
400 .addr = 3,
401 .pixfmt = IPU_PIX_FMT_RGB24,
402 .detect = detect_hdmi,
403 .enable = do_enable_hdmi,
404 .mode = {
405 .name = "HDMI",
406 .refresh = 60,
407 .xres = 1024,
408 .yres = 768,
409 .pixclock = 15385,
410 .left_margin = 220,
411 .right_margin = 40,
412 .upper_margin = 21,
413 .lower_margin = 7,
414 .hsync_len = 60,
415 .vsync_len = 10,
416 .sync = FB_SYNC_EXT,
417 .vmode = FB_VMODE_NONINTERLACED
418} } };
419size_t display_count = ARRAY_SIZE(displays);
420
Akshay Bhat3a5b15a2016-04-12 18:13:58 -0400421static void enable_videopll(void)
422{
423 struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
424 s32 timeout = 100000;
425
426 setbits_le32(&ccm->analog_pll_video, BM_ANADIG_PLL_VIDEO_POWERDOWN);
427
428 /* set video pll to 910MHz (24MHz * (37+11/12))
429 * video pll post div to 910/4 = 227.5MHz
430 */
431 clrsetbits_le32(&ccm->analog_pll_video,
432 BM_ANADIG_PLL_VIDEO_DIV_SELECT |
433 BM_ANADIG_PLL_VIDEO_POST_DIV_SELECT,
434 BF_ANADIG_PLL_VIDEO_DIV_SELECT(37) |
435 BF_ANADIG_PLL_VIDEO_POST_DIV_SELECT(0));
436
437 writel(BF_ANADIG_PLL_VIDEO_NUM_A(11), &ccm->analog_pll_video_num);
438 writel(BF_ANADIG_PLL_VIDEO_DENOM_B(12), &ccm->analog_pll_video_denom);
439
440 clrbits_le32(&ccm->analog_pll_video, BM_ANADIG_PLL_VIDEO_POWERDOWN);
441
442 while (timeout--)
443 if (readl(&ccm->analog_pll_video) & BM_ANADIG_PLL_VIDEO_LOCK)
444 break;
445
446 if (timeout < 0)
447 printf("Warning: video pll lock timeout!\n");
448
449 clrsetbits_le32(&ccm->analog_pll_video,
450 BM_ANADIG_PLL_VIDEO_BYPASS,
451 BM_ANADIG_PLL_VIDEO_ENABLE);
452}
453
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400454static void setup_display_b850v3(void)
Akshay Bhat197f9872016-01-29 15:16:40 -0500455{
456 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
457 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
Akshay Bhat197f9872016-01-29 15:16:40 -0500458
Akshay Bhat3a5b15a2016-04-12 18:13:58 -0400459 enable_videopll();
460
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400461 /* IPU1 D0 clock is 227.5 / 3.5 = 65MHz */
462 clrbits_le32(&mxc_ccm->cscmr2, MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV);
463
Akshay Bhat197f9872016-01-29 15:16:40 -0500464 imx_setup_hdmi();
465
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400466 /* Set LDB_DI0 as clock source for IPU_DI0 */
467 clrsetbits_le32(&mxc_ccm->chsccdr,
468 MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_MASK,
469 (CHSCCDR_CLK_SEL_LDB_DI0 <<
470 MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET));
Akshay Bhat197f9872016-01-29 15:16:40 -0500471
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400472 /* Turn on IPU LDB DI0 clocks */
473 setbits_le32(&mxc_ccm->CCGR3, MXC_CCM_CCGR3_LDB_DI0_MASK);
474
475 enable_ipu_clock();
Akshay Bhat197f9872016-01-29 15:16:40 -0500476
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400477 writel(IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES |
478 IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_LOW |
479 IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW |
480 IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG |
481 IOMUXC_GPR2_DATA_WIDTH_CH1_24BIT |
482 IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG |
483 IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT |
484 IOMUXC_GPR2_SPLIT_MODE_EN_MASK |
485 IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0 |
486 IOMUXC_GPR2_LVDS_CH1_MODE_ENABLED_DI0,
487 &iomux->gpr[2]);
Akshay Bhat197f9872016-01-29 15:16:40 -0500488
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400489 clrbits_le32(&iomux->gpr[3],
490 IOMUXC_GPR3_LVDS0_MUX_CTL_MASK |
491 IOMUXC_GPR3_LVDS1_MUX_CTL_MASK |
492 IOMUXC_GPR3_HDMI_MUX_CTL_MASK);
493}
Akshay Bhat197f9872016-01-29 15:16:40 -0500494
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400495static void setup_display_bx50v3(void)
496{
497 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
498 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
Akshay Bhat197f9872016-01-29 15:16:40 -0500499
Ian Ray66395e82018-04-25 16:57:00 +0200500 enable_videopll();
501
Akshay Bhat66027fe2016-04-12 18:14:00 -0400502 /* When a reset/reboot is performed the display power needs to be turned
503 * off for atleast 500ms. The boot time is ~300ms, we need to wait for
504 * an additional 200ms here. Unfortunately we use external PMIC for
505 * doing the reset, so can not differentiate between POR vs soft reset
506 */
507 mdelay(200);
508
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400509 /* IPU1 DI0 clock is 480/7 = 68.5 MHz */
510 setbits_le32(&mxc_ccm->cscmr2, MXC_CCM_CSCMR2_LDB_DI0_IPU_DIV);
511
512 /* Set LDB_DI0 as clock source for IPU_DI0 */
513 clrsetbits_le32(&mxc_ccm->chsccdr,
514 MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_MASK,
515 (CHSCCDR_CLK_SEL_LDB_DI0 <<
516 MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET));
517
518 /* Turn on IPU LDB DI0 clocks */
519 setbits_le32(&mxc_ccm->CCGR3, MXC_CCM_CCGR3_LDB_DI0_MASK);
520
521 enable_ipu_clock();
522
523 writel(IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES |
524 IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW |
525 IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG |
526 IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT |
527 IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0,
528 &iomux->gpr[2]);
529
530 clrsetbits_le32(&iomux->gpr[3],
531 IOMUXC_GPR3_LVDS0_MUX_CTL_MASK,
532 (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 <<
533 IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET));
Akshay Bhat197f9872016-01-29 15:16:40 -0500534
535 /* backlights off until needed */
536 imx_iomux_v3_setup_multiple_pads(backlight_pads,
537 ARRAY_SIZE(backlight_pads));
538 gpio_direction_input(LVDS_POWER_GP);
539 gpio_direction_input(LVDS_BACKLIGHT_GP);
540}
541#endif /* CONFIG_VIDEO_IPUV3 */
542
543/*
544 * Do not overwrite the console
545 * Use always serial for U-Boot console
546 */
547int overwrite_console(void)
548{
549 return 1;
550}
551
Ian Rayc0293da2017-08-22 09:03:54 +0300552#define VPD_TYPE_INVALID 0x00
553#define VPD_BLOCK_NETWORK 0x20
554#define VPD_BLOCK_HWID 0x44
555#define VPD_PRODUCT_B850 1
556#define VPD_PRODUCT_B650 2
557#define VPD_PRODUCT_B450 3
Martyn Welch18c31ea2018-01-10 20:31:30 +0100558#define VPD_HAS_MAC1 0x1
Hannu Lounento37879682018-01-10 20:31:31 +0100559#define VPD_HAS_MAC2 0x2
Martyn Welch18c31ea2018-01-10 20:31:30 +0100560#define VPD_MAC_ADDRESS_LENGTH 6
Ian Rayc0293da2017-08-22 09:03:54 +0300561
562struct vpd_cache {
Martyn Welch18c31ea2018-01-10 20:31:30 +0100563 u8 product_id;
564 u8 has;
565 unsigned char mac1[VPD_MAC_ADDRESS_LENGTH];
Hannu Lounento37879682018-01-10 20:31:31 +0100566 unsigned char mac2[VPD_MAC_ADDRESS_LENGTH];
Ian Rayc0293da2017-08-22 09:03:54 +0300567};
568
569/*
570 * Extracts MAC and product information from the VPD.
571 */
Martyn Welch18c31ea2018-01-10 20:31:30 +0100572static int vpd_callback(void *userdata, u8 id, u8 version, u8 type,
573 size_t size, u8 const *data)
Ian Rayc0293da2017-08-22 09:03:54 +0300574{
575 struct vpd_cache *vpd = (struct vpd_cache *)userdata;
576
Martyn Welch18c31ea2018-01-10 20:31:30 +0100577 if (id == VPD_BLOCK_HWID && version == 1 && type != VPD_TYPE_INVALID &&
578 size >= 1) {
Ian Rayc0293da2017-08-22 09:03:54 +0300579 vpd->product_id = data[0];
Martyn Welch18c31ea2018-01-10 20:31:30 +0100580 } else if (id == VPD_BLOCK_NETWORK && version == 1 &&
581 type != VPD_TYPE_INVALID) {
582 if (size >= 6) {
583 vpd->has |= VPD_HAS_MAC1;
584 memcpy(vpd->mac1, data, VPD_MAC_ADDRESS_LENGTH);
585 }
Hannu Lounento37879682018-01-10 20:31:31 +0100586 if (size >= 12) {
587 vpd->has |= VPD_HAS_MAC2;
588 memcpy(vpd->mac2, data + 6, VPD_MAC_ADDRESS_LENGTH);
589 }
Ian Rayc0293da2017-08-22 09:03:54 +0300590 }
591
592 return 0;
593}
594
Ian Rayc0293da2017-08-22 09:03:54 +0300595static void process_vpd(struct vpd_cache *vpd)
596{
Martyn Welch18c31ea2018-01-10 20:31:30 +0100597 int fec_index = -1;
Hannu Lounento37879682018-01-10 20:31:31 +0100598 int i210_index = -1;
Martyn Welch18c31ea2018-01-10 20:31:30 +0100599
600 switch (vpd->product_id) {
601 case VPD_PRODUCT_B450:
Ian Rayb52e2522018-01-10 20:31:33 +0100602 env_set("confidx", "1");
Nandor Hanf335ae92018-04-25 16:56:59 +0200603 i210_index = 0;
604 fec_index = 1;
Ian Rayb52e2522018-01-10 20:31:33 +0100605 break;
606 case VPD_PRODUCT_B650:
607 env_set("confidx", "2");
Hannu Lounento37879682018-01-10 20:31:31 +0100608 i210_index = 0;
Martyn Welch18c31ea2018-01-10 20:31:30 +0100609 fec_index = 1;
610 break;
611 case VPD_PRODUCT_B850:
Nandor Hanf335ae92018-04-25 16:56:59 +0200612 env_set("confidx", "3");
Hannu Lounento37879682018-01-10 20:31:31 +0100613 i210_index = 1;
Martyn Welch18c31ea2018-01-10 20:31:30 +0100614 fec_index = 2;
615 break;
Ian Rayc0293da2017-08-22 09:03:54 +0300616 }
Martyn Welch18c31ea2018-01-10 20:31:30 +0100617
618 if (fec_index >= 0 && (vpd->has & VPD_HAS_MAC1))
619 eth_env_set_enetaddr_by_index("eth", fec_index, vpd->mac1);
Hannu Lounento37879682018-01-10 20:31:31 +0100620
621 if (i210_index >= 0 && (vpd->has & VPD_HAS_MAC2))
622 eth_env_set_enetaddr_by_index("eth", i210_index, vpd->mac2);
Ian Rayc0293da2017-08-22 09:03:54 +0300623}
624
625static int read_vpd(uint eeprom_bus)
626{
Ian Rayc0293da2017-08-22 09:03:54 +0300627 int res;
628 int size = 1024;
629 uint8_t *data;
630 unsigned int current_i2c_bus = i2c_get_bus_num();
631
632 res = i2c_set_bus_num(eeprom_bus);
633 if (res < 0)
634 return res;
635
636 data = (uint8_t *)malloc(size);
637 if (!data)
638 return -ENOMEM;
639
640 res = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0,
641 CONFIG_SYS_I2C_EEPROM_ADDR_LEN, data, size);
642
643 if (res == 0) {
644 memset(&vpd, 0, sizeof(vpd));
645 vpd_reader(size, data, &vpd, vpd_callback);
Ian Rayc0293da2017-08-22 09:03:54 +0300646 }
647
648 free(data);
649
650 i2c_set_bus_num(current_i2c_bus);
651 return res;
652}
653
Akshay Bhat197f9872016-01-29 15:16:40 -0500654int board_eth_init(bd_t *bis)
655{
656 setup_iomux_enet();
657 setup_pcie();
658
Hannu Lounento37879682018-01-10 20:31:31 +0100659 e1000_initialize(bis);
660
Akshay Bhat197f9872016-01-29 15:16:40 -0500661 return cpu_eth_init(bis);
662}
663
664static iomux_v3_cfg_t const misc_pads[] = {
665 MX6_PAD_KEY_ROW2__GPIO4_IO11 | MUX_PAD_CTRL(NO_PAD_CTRL),
Justin Watersef93fc22016-04-13 17:03:18 -0400666 MX6_PAD_EIM_A25__GPIO5_IO02 | MUX_PAD_CTRL(NC_PAD_CTRL),
667 MX6_PAD_EIM_CS0__GPIO2_IO23 | MUX_PAD_CTRL(NC_PAD_CTRL),
668 MX6_PAD_EIM_CS1__GPIO2_IO24 | MUX_PAD_CTRL(NC_PAD_CTRL),
669 MX6_PAD_EIM_OE__GPIO2_IO25 | MUX_PAD_CTRL(NC_PAD_CTRL),
670 MX6_PAD_EIM_BCLK__GPIO6_IO31 | MUX_PAD_CTRL(NC_PAD_CTRL),
671 MX6_PAD_GPIO_1__GPIO1_IO01 | MUX_PAD_CTRL(NC_PAD_CTRL),
Martyn Welch110f5d92018-01-10 20:31:32 +0100672 MX6_PAD_GPIO_9__WDOG1_B | MUX_PAD_CTRL(NC_PAD_CTRL),
Akshay Bhat197f9872016-01-29 15:16:40 -0500673};
674#define SUS_S3_OUT IMX_GPIO_NR(4, 11)
675#define WIFI_EN IMX_GPIO_NR(6, 14)
676
677int board_early_init_f(void)
678{
679 imx_iomux_v3_setup_multiple_pads(misc_pads,
680 ARRAY_SIZE(misc_pads));
681
682 setup_iomux_uart();
683
Akshay Bhat3a5b15a2016-04-12 18:13:58 -0400684#if defined(CONFIG_VIDEO_IPUV3)
685 if (IS_ENABLED(CONFIG_TARGET_GE_B850V3))
686 /* Set LDB clock to Video PLL */
687 select_ldb_di_clock_source(MXC_PLL5_CLK);
688 else
689 /* Set LDB clock to USB PLL */
690 select_ldb_di_clock_source(MXC_PLL3_SW_CLK);
691#endif
Akshay Bhat197f9872016-01-29 15:16:40 -0500692 return 0;
693}
694
Nandor Han7a9bb302018-04-25 16:57:01 +0200695static void set_confidx(const struct vpd_cache* vpd)
696{
697 switch (vpd->product_id) {
698 case VPD_PRODUCT_B450:
699 confidx = 1;
700 break;
701 case VPD_PRODUCT_B650:
702 confidx = 2;
703 break;
704 case VPD_PRODUCT_B850:
705 confidx = 3;
706 break;
707 }
708}
709
Akshay Bhat197f9872016-01-29 15:16:40 -0500710int board_init(void)
711{
Nandor Han7a9bb302018-04-25 16:57:01 +0200712 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
713 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
714 setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3);
715
716 read_vpd(CONFIG_SYS_I2C_EEPROM_BUS);
717
718 set_confidx(&vpd);
719
Akshay Bhat197f9872016-01-29 15:16:40 -0500720 gpio_direction_output(SUS_S3_OUT, 1);
721 gpio_direction_output(WIFI_EN, 1);
722#if defined(CONFIG_VIDEO_IPUV3)
Akshay Bhatcc4e4b62016-04-12 18:13:57 -0400723 if (IS_ENABLED(CONFIG_TARGET_GE_B850V3))
724 setup_display_b850v3();
725 else
726 setup_display_bx50v3();
Akshay Bhat197f9872016-01-29 15:16:40 -0500727#endif
728 /* address of boot parameters */
729 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
730
731#ifdef CONFIG_MXC_SPI
732 setup_spi();
733#endif
Akshay Bhat197f9872016-01-29 15:16:40 -0500734 return 0;
735}
736
737#ifdef CONFIG_CMD_BMODE
738static const struct boot_mode board_boot_modes[] = {
739 /* 4 bit bus width */
740 {"sd2", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
741 {"sd3", MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)},
742 {NULL, 0},
743};
744#endif
745
Ken Linc7219fc2016-11-18 12:20:54 -0500746void pmic_init(void)
747{
748#define I2C_PMIC 0x2
749#define DA9063_I2C_ADDR 0x58
750#define DA9063_REG_BCORE2_CFG 0x9D
751#define DA9063_REG_BCORE1_CFG 0x9E
752#define DA9063_REG_BPRO_CFG 0x9F
753#define DA9063_REG_BIO_CFG 0xA0
754#define DA9063_REG_BMEM_CFG 0xA1
755#define DA9063_REG_BPERI_CFG 0xA2
756#define DA9063_BUCK_MODE_MASK 0xC0
757#define DA9063_BUCK_MODE_MANUAL 0x00
758#define DA9063_BUCK_MODE_SLEEP 0x40
759#define DA9063_BUCK_MODE_SYNC 0x80
760#define DA9063_BUCK_MODE_AUTO 0xC0
761
762 uchar val;
763
764 i2c_set_bus_num(I2C_PMIC);
765
766 i2c_read(DA9063_I2C_ADDR, DA9063_REG_BCORE2_CFG, 1, &val, 1);
767 val &= ~DA9063_BUCK_MODE_MASK;
768 val |= DA9063_BUCK_MODE_SYNC;
769 i2c_write(DA9063_I2C_ADDR, DA9063_REG_BCORE2_CFG, 1, &val, 1);
770
771 i2c_read(DA9063_I2C_ADDR, DA9063_REG_BCORE1_CFG, 1, &val, 1);
772 val &= ~DA9063_BUCK_MODE_MASK;
773 val |= DA9063_BUCK_MODE_SYNC;
774 i2c_write(DA9063_I2C_ADDR, DA9063_REG_BCORE1_CFG, 1, &val, 1);
775
776 i2c_read(DA9063_I2C_ADDR, DA9063_REG_BPRO_CFG, 1, &val, 1);
777 val &= ~DA9063_BUCK_MODE_MASK;
778 val |= DA9063_BUCK_MODE_SYNC;
779 i2c_write(DA9063_I2C_ADDR, DA9063_REG_BPRO_CFG, 1, &val, 1);
780
781 i2c_read(DA9063_I2C_ADDR, DA9063_REG_BIO_CFG, 1, &val, 1);
782 val &= ~DA9063_BUCK_MODE_MASK;
783 val |= DA9063_BUCK_MODE_SYNC;
784 i2c_write(DA9063_I2C_ADDR, DA9063_REG_BIO_CFG, 1, &val, 1);
785
786 i2c_read(DA9063_I2C_ADDR, DA9063_REG_BMEM_CFG, 1, &val, 1);
787 val &= ~DA9063_BUCK_MODE_MASK;
788 val |= DA9063_BUCK_MODE_SYNC;
789 i2c_write(DA9063_I2C_ADDR, DA9063_REG_BMEM_CFG, 1, &val, 1);
790
791 i2c_read(DA9063_I2C_ADDR, DA9063_REG_BPERI_CFG, 1, &val, 1);
792 val &= ~DA9063_BUCK_MODE_MASK;
793 val |= DA9063_BUCK_MODE_SYNC;
794 i2c_write(DA9063_I2C_ADDR, DA9063_REG_BPERI_CFG, 1, &val, 1);
795}
796
Akshay Bhat197f9872016-01-29 15:16:40 -0500797int board_late_init(void)
798{
Nandor Han7a9bb302018-04-25 16:57:01 +0200799 process_vpd(&vpd);
Martyn Welch18c31ea2018-01-10 20:31:30 +0100800
Akshay Bhat197f9872016-01-29 15:16:40 -0500801#ifdef CONFIG_CMD_BMODE
802 add_board_boot_modes(board_boot_modes);
803#endif
Andrew Shadurac26583d2016-05-24 15:56:17 +0200804
Ken Linc7219fc2016-11-18 12:20:54 -0500805 /* board specific pmic init */
806 pmic_init();
807
Nandor Hanae3c6d22018-01-10 20:31:38 +0100808 check_time();
809
Akshay Bhat197f9872016-01-29 15:16:40 -0500810 return 0;
811}
812
Hannu Lounento37879682018-01-10 20:31:31 +0100813/*
814 * Removes the 'eth[0-9]*addr' environment variable with the given index
815 *
816 * @param index [in] the index of the eth_device whose variable is to be removed
817 */
818static void remove_ethaddr_env_var(int index)
819{
820 char env_var_name[9];
821
822 sprintf(env_var_name, index == 0 ? "ethaddr" : "eth%daddr", index);
823 env_set(env_var_name, NULL);
824}
825
Martyn Welch18c31ea2018-01-10 20:31:30 +0100826int last_stage_init(void)
827{
Hannu Lounento37879682018-01-10 20:31:31 +0100828 int i;
829
830 /*
831 * Remove first three ethaddr which may have been created by
832 * function process_vpd().
833 */
834 for (i = 0; i < 3; ++i)
835 remove_ethaddr_env_var(i);
Martyn Welch18c31ea2018-01-10 20:31:30 +0100836
837 return 0;
838}
839
Akshay Bhat197f9872016-01-29 15:16:40 -0500840int checkboard(void)
841{
842 printf("BOARD: %s\n", CONFIG_BOARD_NAME);
843 return 0;
844}
Ian Ray40133682018-04-04 10:50:17 +0200845
846static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
847{
848#ifdef CONFIG_VIDEO_IPUV3
849 /* We need at least 200ms between power on and backlight on
850 * as per specifications from CHI MEI */
851 mdelay(250);
852
853 /* enable backlight PWM 1 */
854 pwm_init(0, 0, 0);
855
856 /* duty cycle 5000000ns, period: 5000000ns */
857 pwm_config(0, 5000000, 5000000);
858
859 /* Backlight Power */
860 gpio_direction_output(LVDS_BACKLIGHT_GP, 1);
861
862 pwm_enable(0);
863#endif
864
865 return 0;
866}
867
868U_BOOT_CMD(
869 bx50_backlight_enable, 1, 1, do_backlight_enable,
870 "enable Bx50 backlight",
871 ""
872);