]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/samsung/smdk5420/smdk5420.c
57cc92c50b9729ea746b40cbedb928aa7ddac277
[karo-tx-uboot.git] / board / samsung / smdk5420 / smdk5420.c
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 <errno.h>
10 #include <asm/io.h>
11 #include <asm/gpio.h>
12 #include <asm/arch/cpu.h>
13 #include <asm/arch/board.h>
14 #include <asm/arch/power.h>
15 #include <asm/arch/system.h>
16 #include <asm/arch/pinmux.h>
17 #include <asm/arch/dp_info.h>
18 #include <asm/arch/xhci-exynos.h>
19 #include <power/tps65090_pmic.h>
20 #include <i2c.h>
21 #include <lcd.h>
22 #include <mmc.h>
23 #include <parade.h>
24 #include <spi.h>
25 #include <usb.h>
26 #include <dwc3-uboot.h>
27 #include <samsung-usb-phy-uboot.h>
28
29 DECLARE_GLOBAL_DATA_PTR;
30
31 int exynos_init(void)
32 {
33         return 0;
34 }
35
36 #ifdef CONFIG_LCD
37 static int has_edp_bridge(void)
38 {
39         int node;
40
41         node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625);
42
43         /* No node for bridge in device tree. */
44         if (node <= 0)
45                 return 0;
46
47         /* Default is with bridge ic */
48         return 1;
49 }
50
51 void exynos_lcd_power_on(void)
52 {
53 #ifdef CONFIG_POWER_TPS65090
54         int ret;
55
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
67         if (has_edp_bridge())
68                 if (parade_init(gd->fdt_blob))
69                         printf("%s: ps8625_init() failed\n", __func__);
70 }
71
72 void exynos_backlight_on(unsigned int onoff)
73 {
74 #ifdef CONFIG_POWER_TPS65090
75         tps65090_fet_enable(1);
76 #endif
77 }
78 #endif
79
80 int board_get_revision(void)
81 {
82         return 0;
83 }
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
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