blob: 270ee834e65695210c88668f2beab5e06ac4a304 [file] [log] [blame]
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +05301/*
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>
Ajay Kumar222e1442014-09-05 16:53:36 +053013#include <errno.h>
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053014#include <asm/arch/board.h>
15#include <asm/arch/cpu.h>
16#include <asm/arch/gpio.h>
17#include <asm/arch/pinmux.h>
Ajay Kumar222e1442014-09-05 16:53:36 +053018#include <asm/arch/system.h>
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053019#include <asm/arch/dp_info.h>
Ajay Kumar222e1442014-09-05 16:53:36 +053020#include <power/tps65090_pmic.h>
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053021
22DECLARE_GLOBAL_DATA_PTR;
23
24#ifdef CONFIG_USB_EHCI_EXYNOS
25static int board_usb_vbus_init(void)
26{
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053027 /* Enable VBUS power switch */
Akshay Saraswat1376cdd2014-05-13 10:30:14 +053028 gpio_direction_output(EXYNOS5420_GPIO_X26, 1);
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053029
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
Ajay Kumar222e1442014-09-05 16:53:36 +053046static int has_edp_bridge(void)
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053047{
Ajay Kumar222e1442014-09-05 16:53:36 +053048 int node;
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053049
Ajay Kumar222e1442014-09-05 16:53:36 +053050 node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625);
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053051
Ajay Kumar222e1442014-09-05 16:53:36 +053052 /* No node for bridge in device tree. */
53 if (node <= 0)
54 return 0;
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053055
Ajay Kumar222e1442014-09-05 16:53:36 +053056 /* Default is with bridge ic */
57 return 1;
58}
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053059
Ajay Kumar222e1442014-09-05 16:53:36 +053060void exynos_lcd_power_on(void)
61{
62 int ret;
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053063
Ajay Kumar222e1442014-09-05 16:53:36 +053064#ifdef CONFIG_POWER_TPS65090
65 ret = tps65090_init();
66 if (ret < 0) {
67 printf("%s: tps65090_init() failed\n", __func__);
68 return;
69 }
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053070
Ajay Kumar222e1442014-09-05 16:53:36 +053071 tps65090_fet_enable(6);
72#endif
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053073
Ajay Kumar222e1442014-09-05 16:53:36 +053074 mdelay(5);
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053075
Ajay Kumar222e1442014-09-05 16:53:36 +053076 /* TODO(ajaykumar.rs@samsung.com): Use device tree */
77 gpio_direction_output(EXYNOS5420_GPIO_X35, 1); /* EDP_SLP# */
78 mdelay(10);
79 gpio_direction_output(EXYNOS5420_GPIO_Y77, 1); /* EDP_RST# */
80 gpio_direction_input(EXYNOS5420_GPIO_X26); /* EDP_HPD */
81 gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053082
Ajay Kumar222e1442014-09-05 16:53:36 +053083 if (has_edp_bridge())
84 if (parade_init(gd->fdt_blob))
85 printf("%s: ps8625_init() failed\n", __func__);
86}
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053087
Ajay Kumar222e1442014-09-05 16:53:36 +053088void exynos_backlight_on(unsigned int onoff)
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053089{
Ajay Kumar222e1442014-09-05 16:53:36 +053090 /* For PWM */
91 gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(0x1));
92 gpio_set_value(EXYNOS5420_GPIO_B20, 1);
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053093
Ajay Kumar222e1442014-09-05 16:53:36 +053094#ifdef CONFIG_POWER_TPS65090
95 tps65090_fet_enable(1);
96#endif
Rajeshwari Birje5b475ae2013-12-26 09:44:24 +053097}
98#endif
99
100int board_get_revision(void)
101{
102 return 0;
103}