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