Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 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> |
Sjoerd Simons | a7b9920 | 2014-12-05 18:12:22 +0100 | [diff] [blame^] | 12 | #include <parade.h> |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 13 | #include <spi.h> |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 14 | #include <errno.h> |
Simon Glass | 903fd79 | 2014-10-20 19:48:37 -0600 | [diff] [blame] | 15 | #include <asm/gpio.h> |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 16 | #include <asm/arch/board.h> |
| 17 | #include <asm/arch/cpu.h> |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 18 | #include <asm/arch/pinmux.h> |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 19 | #include <asm/arch/system.h> |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 20 | #include <asm/arch/dp_info.h> |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 21 | #include <power/tps65090_pmic.h> |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 22 | |
| 23 | DECLARE_GLOBAL_DATA_PTR; |
| 24 | |
| 25 | #ifdef CONFIG_USB_EHCI_EXYNOS |
| 26 | static int board_usb_vbus_init(void) |
| 27 | { |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 28 | /* Enable VBUS power switch */ |
Akshay Saraswat | f6ae1ca | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 29 | gpio_direction_output(EXYNOS5420_GPIO_X26, 1); |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 30 | |
| 31 | /* VBUS turn ON time */ |
| 32 | mdelay(3); |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | #endif |
| 37 | |
| 38 | int exynos_init(void) |
| 39 | { |
| 40 | #ifdef CONFIG_USB_EHCI_EXYNOS |
| 41 | board_usb_vbus_init(); |
| 42 | #endif |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | #ifdef CONFIG_LCD |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 47 | static int has_edp_bridge(void) |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 48 | { |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 49 | int node; |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 50 | |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 51 | node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625); |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 52 | |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 53 | /* No node for bridge in device tree. */ |
| 54 | if (node <= 0) |
| 55 | return 0; |
| 56 | |
| 57 | /* Default is with bridge ic */ |
| 58 | return 1; |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 59 | } |
| 60 | |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 61 | void exynos_lcd_power_on(void) |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 62 | { |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 63 | int ret; |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 64 | |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 65 | #ifdef CONFIG_POWER_TPS65090 |
| 66 | ret = tps65090_init(); |
| 67 | if (ret < 0) { |
| 68 | printf("%s: tps65090_init() failed\n", __func__); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | tps65090_fet_enable(6); |
| 73 | #endif |
| 74 | |
| 75 | mdelay(5); |
| 76 | |
| 77 | /* TODO(ajaykumar.rs@samsung.com): Use device tree */ |
Simon Glass | 7f19610 | 2014-10-20 19:48:39 -0600 | [diff] [blame] | 78 | gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#"); |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 79 | gpio_direction_output(EXYNOS5420_GPIO_X35, 1); /* EDP_SLP# */ |
| 80 | mdelay(10); |
Simon Glass | 7f19610 | 2014-10-20 19:48:39 -0600 | [diff] [blame] | 81 | gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#"); |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 82 | gpio_direction_output(EXYNOS5420_GPIO_Y77, 1); /* EDP_RST# */ |
Simon Glass | 7f19610 | 2014-10-20 19:48:39 -0600 | [diff] [blame] | 83 | gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd"); |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 84 | gpio_direction_input(EXYNOS5420_GPIO_X26); /* EDP_HPD */ |
| 85 | gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE); |
| 86 | |
| 87 | if (has_edp_bridge()) |
| 88 | if (parade_init(gd->fdt_blob)) |
| 89 | printf("%s: ps8625_init() failed\n", __func__); |
| 90 | } |
| 91 | |
| 92 | void exynos_backlight_on(unsigned int onoff) |
| 93 | { |
| 94 | /* For PWM */ |
Simon Glass | 7f19610 | 2014-10-20 19:48:39 -0600 | [diff] [blame] | 95 | gpio_request(EXYNOS5420_GPIO_B20, "backlight_on"); |
Ajay Kumar | a99cea0 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 96 | gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(0x1)); |
| 97 | gpio_set_value(EXYNOS5420_GPIO_B20, 1); |
| 98 | |
| 99 | #ifdef CONFIG_POWER_TPS65090 |
| 100 | tps65090_fet_enable(1); |
| 101 | #endif |
Rajeshwari Birje | e106bd9 | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 102 | } |
| 103 | #endif |
| 104 | |
| 105 | int board_get_revision(void) |
| 106 | { |
| 107 | return 0; |
| 108 | } |