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> |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 9 | #include <errno.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 10 | #include <asm/io.h> |
Simon Glass | 37f1162 | 2014-10-20 19:48:37 -0600 | [diff] [blame] | 11 | #include <asm/gpio.h> |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 12 | #include <asm/arch/cpu.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 13 | #include <asm/arch/board.h> |
| 14 | #include <asm/arch/power.h> |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 15 | #include <asm/arch/system.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 16 | #include <asm/arch/pinmux.h> |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 17 | #include <asm/arch/dp_info.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 18 | #include <asm/arch/xhci-exynos.h> |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 19 | #include <power/tps65090_pmic.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 20 | #include <i2c.h> |
| 21 | #include <lcd.h> |
Inha Song | 4416481 | 2015-05-22 18:14:25 +0200 | [diff] [blame] | 22 | #include <mmc.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 23 | #include <parade.h> |
| 24 | #include <spi.h> |
| 25 | #include <usb.h> |
| 26 | #include <dwc3-uboot.h> |
| 27 | #include <samsung-usb-phy-uboot.h> |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 28 | |
| 29 | DECLARE_GLOBAL_DATA_PTR; |
| 30 | |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 31 | int exynos_init(void) |
| 32 | { |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | #ifdef CONFIG_LCD |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 37 | static int has_edp_bridge(void) |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 38 | { |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 39 | int node; |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 40 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 41 | node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625); |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 42 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 43 | /* No node for bridge in device tree. */ |
| 44 | if (node <= 0) |
| 45 | return 0; |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 46 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 47 | /* Default is with bridge ic */ |
| 48 | return 1; |
| 49 | } |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 50 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 51 | void exynos_lcd_power_on(void) |
| 52 | { |
| 53 | int ret; |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 54 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 55 | #ifdef CONFIG_POWER_TPS65090 |
| 56 | ret = tps65090_init(); |
| 57 | if (ret < 0) { |
| 58 | printf("%s: tps65090_init() failed\n", __func__); |
| 59 | return; |
| 60 | } |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 61 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 62 | tps65090_fet_enable(6); |
| 63 | #endif |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 64 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 65 | mdelay(5); |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 66 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 67 | if (has_edp_bridge()) |
| 68 | if (parade_init(gd->fdt_blob)) |
| 69 | printf("%s: ps8625_init() failed\n", __func__); |
| 70 | } |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 71 | |
Ajay Kumar | 222e144 | 2014-09-05 16:53:36 +0530 | [diff] [blame] | 72 | void exynos_backlight_on(unsigned int onoff) |
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 | #ifdef CONFIG_POWER_TPS65090 |
| 75 | tps65090_fet_enable(1); |
| 76 | #endif |
Rajeshwari Birje | 5b475ae | 2013-12-26 09:44:24 +0530 | [diff] [blame] | 77 | } |
| 78 | #endif |
| 79 | |
| 80 | int board_get_revision(void) |
| 81 | { |
| 82 | return 0; |
| 83 | } |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 84 | |
| 85 | #ifdef CONFIG_USB_DWC3 |
| 86 | static struct dwc3_device dwc3_device_data = { |
| 87 | .maximum_speed = USB_SPEED_SUPER, |
| 88 | .base = 0x12400000, |
| 89 | .dr_mode = USB_DR_MODE_PERIPHERAL, |
| 90 | .index = 0, |
| 91 | }; |
| 92 | |
| 93 | int usb_gadget_handle_interrupts(void) |
| 94 | { |
| 95 | dwc3_uboot_handle_interrupt(0); |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | int board_usb_init(int index, enum usb_init_type init) |
| 100 | { |
| 101 | struct exynos_usb3_phy *phy = (struct exynos_usb3_phy *) |
| 102 | samsung_get_base_usb3_phy(); |
| 103 | |
| 104 | if (!phy) { |
| 105 | error("usb3 phy not supported"); |
| 106 | return -ENODEV; |
| 107 | } |
| 108 | |
| 109 | set_usbdrd_phy_ctrl(POWER_USB_DRD_PHY_CTRL_EN); |
| 110 | exynos5_usb3_phy_init(phy); |
| 111 | |
| 112 | return dwc3_uboot_init(&dwc3_device_data); |
| 113 | } |
| 114 | #endif |
Inha Song | 4416481 | 2015-05-22 18:14:25 +0200 | [diff] [blame] | 115 | #ifdef CONFIG_SET_DFU_ALT_INFO |
| 116 | char *get_dfu_alt_system(char *interface, char *devstr) |
| 117 | { |
| 118 | return getenv("dfu_alt_system"); |
| 119 | } |
| 120 | |
| 121 | char *get_dfu_alt_boot(char *interface, char *devstr) |
| 122 | { |
| 123 | struct mmc *mmc; |
| 124 | char *alt_boot; |
| 125 | int dev_num; |
| 126 | |
| 127 | dev_num = simple_strtoul(devstr, NULL, 10); |
| 128 | |
| 129 | mmc = find_mmc_device(dev_num); |
| 130 | if (!mmc) |
| 131 | return NULL; |
| 132 | |
| 133 | if (mmc_init(mmc)) |
| 134 | return NULL; |
| 135 | |
| 136 | if (IS_SD(mmc)) |
| 137 | alt_boot = CONFIG_DFU_ALT_BOOT_SD; |
| 138 | else |
| 139 | alt_boot = CONFIG_DFU_ALT_BOOT_EMMC; |
| 140 | |
| 141 | return alt_boot; |
| 142 | } |
| 143 | #endif |