]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/samsung/smdk5420/smdk5420.c
Merge branch 'master' of git://git.denx.de/u-boot-usb
[people/ms/u-boot.git] / board / samsung / smdk5420 / smdk5420.c
CommitLineData
e106bd9b
RS
1/*
2 * Copyright (C) 2013 Samsung Electronics
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <fdtdec.h>
9#include <asm/io.h>
10#include <i2c.h>
11#include <lcd.h>
12#include <spi.h>
a99cea03 13#include <errno.h>
903fd795 14#include <asm/gpio.h>
e106bd9b
RS
15#include <asm/arch/board.h>
16#include <asm/arch/cpu.h>
e106bd9b 17#include <asm/arch/pinmux.h>
a99cea03 18#include <asm/arch/system.h>
e106bd9b 19#include <asm/arch/dp_info.h>
a99cea03 20#include <power/tps65090_pmic.h>
e106bd9b
RS
21
22DECLARE_GLOBAL_DATA_PTR;
23
24#ifdef CONFIG_USB_EHCI_EXYNOS
25static int board_usb_vbus_init(void)
26{
e106bd9b 27 /* Enable VBUS power switch */
f6ae1ca0 28 gpio_direction_output(EXYNOS5420_GPIO_X26, 1);
e106bd9b
RS
29
30 /* VBUS turn ON time */
31 mdelay(3);
32
33 return 0;
34}
35#endif
36
37int exynos_init(void)
38{
39#ifdef CONFIG_USB_EHCI_EXYNOS
40 board_usb_vbus_init();
41#endif
42 return 0;
43}
44
45#ifdef CONFIG_LCD
a99cea03 46static int has_edp_bridge(void)
e106bd9b 47{
a99cea03
AK
48 int node;
49
50 node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625);
e106bd9b 51
a99cea03
AK
52 /* No node for bridge in device tree. */
53 if (node <= 0)
54 return 0;
e106bd9b 55
a99cea03
AK
56 /* Default is with bridge ic */
57 return 1;
e106bd9b
RS
58}
59
a99cea03 60void exynos_lcd_power_on(void)
e106bd9b 61{
a99cea03
AK
62 int ret;
63
64#ifdef CONFIG_POWER_TPS65090
65 ret = tps65090_init();
66 if (ret < 0) {
67 printf("%s: tps65090_init() failed\n", __func__);
68 return;
69 }
70
71 tps65090_fet_enable(6);
72#endif
73
74 mdelay(5);
75
76 /* TODO(ajaykumar.rs@samsung.com): Use device tree */
7f196101 77 gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
a99cea03
AK
78 gpio_direction_output(EXYNOS5420_GPIO_X35, 1); /* EDP_SLP# */
79 mdelay(10);
7f196101 80 gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
a99cea03 81 gpio_direction_output(EXYNOS5420_GPIO_Y77, 1); /* EDP_RST# */
7f196101 82 gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
a99cea03
AK
83 gpio_direction_input(EXYNOS5420_GPIO_X26); /* EDP_HPD */
84 gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
e106bd9b 85
a99cea03
AK
86 if (has_edp_bridge())
87 if (parade_init(gd->fdt_blob))
88 printf("%s: ps8625_init() failed\n", __func__);
89}
90
91void exynos_backlight_on(unsigned int onoff)
92{
93 /* For PWM */
7f196101 94 gpio_request(EXYNOS5420_GPIO_B20, "backlight_on");
a99cea03
AK
95 gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(0x1));
96 gpio_set_value(EXYNOS5420_GPIO_B20, 1);
97
98#ifdef CONFIG_POWER_TPS65090
99 tps65090_fet_enable(1);
100#endif
e106bd9b
RS
101}
102#endif
103
104int board_get_revision(void)
105{
106 return 0;
107}