]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/samsung/smdk5420/smdk5420.c
Merge git://git.denx.de/u-boot-samsung
[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>
a99cea03 9#include <errno.h>
302a7d00 10#include <asm/io.h>
903fd795 11#include <asm/gpio.h>
e106bd9b 12#include <asm/arch/cpu.h>
302a7d00
JS
13#include <asm/arch/board.h>
14#include <asm/arch/power.h>
a99cea03 15#include <asm/arch/system.h>
302a7d00 16#include <asm/arch/pinmux.h>
e106bd9b 17#include <asm/arch/dp_info.h>
302a7d00 18#include <asm/arch/xhci-exynos.h>
a99cea03 19#include <power/tps65090_pmic.h>
302a7d00
JS
20#include <i2c.h>
21#include <lcd.h>
cac17878 22#include <mmc.h>
302a7d00
JS
23#include <parade.h>
24#include <spi.h>
25#include <usb.h>
26#include <dwc3-uboot.h>
27#include <samsung-usb-phy-uboot.h>
e106bd9b
RS
28
29DECLARE_GLOBAL_DATA_PTR;
30
e106bd9b
RS
31int exynos_init(void)
32{
e106bd9b
RS
33 return 0;
34}
35
36#ifdef CONFIG_LCD
a99cea03 37static int has_edp_bridge(void)
e106bd9b 38{
a99cea03
AK
39 int node;
40
41 node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625);
e106bd9b 42
a99cea03
AK
43 /* No node for bridge in device tree. */
44 if (node <= 0)
45 return 0;
e106bd9b 46
a99cea03
AK
47 /* Default is with bridge ic */
48 return 1;
e106bd9b
RS
49}
50
a99cea03 51void exynos_lcd_power_on(void)
e106bd9b 52{
a99cea03
AK
53 int ret;
54
55#ifdef CONFIG_POWER_TPS65090
56 ret = tps65090_init();
57 if (ret < 0) {
58 printf("%s: tps65090_init() failed\n", __func__);
59 return;
60 }
61
62 tps65090_fet_enable(6);
63#endif
64
65 mdelay(5);
66
a99cea03
AK
67 if (has_edp_bridge())
68 if (parade_init(gd->fdt_blob))
69 printf("%s: ps8625_init() failed\n", __func__);
70}
71
72void exynos_backlight_on(unsigned int onoff)
73{
a99cea03
AK
74#ifdef CONFIG_POWER_TPS65090
75 tps65090_fet_enable(1);
76#endif
e106bd9b
RS
77}
78#endif
79
80int board_get_revision(void)
81{
82 return 0;
83}
302a7d00
JS
84
85#ifdef CONFIG_USB_DWC3
86static 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
93int usb_gadget_handle_interrupts(void)
94{
95 dwc3_uboot_handle_interrupt(0);
96 return 0;
97}
98
99int 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
cac17878
IS
115#ifdef CONFIG_SET_DFU_ALT_INFO
116char *get_dfu_alt_system(char *interface, char *devstr)
117{
118 return getenv("dfu_alt_system");
119}
120
121char *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