1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2012 Samsung Electronics
8 #include <dwc3-uboot.h>
16 #include <samsung-usb-phy-uboot.h>
19 #include <video_bridge.h>
21 #include <asm/arch/cpu.h>
22 #include <asm/arch/dwmmc.h>
23 #include <asm/arch/mmc.h>
24 #include <asm/arch/pinmux.h>
25 #include <asm/arch/power.h>
26 #include <asm/arch/sromc.h>
27 #include <power/pmic.h>
28 #include <power/max77686_pmic.h>
29 #include <power/regulator.h>
30 #include <power/s2mps11.h>
31 #include <power/s5m8767.h>
32 #include <samsung/exynos5-dt-types.h>
33 #include <samsung/misc.h>
36 DECLARE_GLOBAL_DATA_PTR;
43 static int exynos_set_regulator(const char *name, uint uv)
48 ret = regulator_get_by_platname(name, &dev);
50 debug("%s: Cannot find regulator %s\n", __func__, name);
53 ret = regulator_set_value(dev, uv);
55 debug("%s: Cannot set regulator %s\n", __func__, name);
62 int exynos_power_init(void)
67 #ifdef CONFIG_PMIC_S2MPS11
68 ret = pmic_get("s2mps11_pmic", &dev);
70 ret = pmic_get("max77686", &dev);
72 /* TODO(sjg@chromium.org): Move into the clock/pmic API */
73 ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_32KHZ, 0,
77 ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_BBAT, 0,
78 MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V);
82 ret = pmic_get("s5m8767-pmic", &dev);
83 /* TODO(sjg@chromium.org): Use driver model to access clock */
84 #ifdef CONFIG_PMIC_S5M8767
86 s5m8767_enable_32khz_cp(dev);
89 #endif /* CONFIG_PMIC_S2MPS11 */
93 ret = regulators_enable_boot_on(false);
97 ret = exynos_set_regulator("vdd_mif", 1100000);
101 ret = exynos_set_regulator("vdd_arm", 1300000);
104 ret = exynos_set_regulator("vdd_int", 1012500);
107 ret = exynos_set_regulator("vdd_g3d", 1200000);
114 int board_get_revision(void)
119 #ifdef CONFIG_USB_DWC3
120 static struct dwc3_device dwc3_device_data = {
121 .maximum_speed = USB_SPEED_SUPER,
123 .dr_mode = USB_DR_MODE_PERIPHERAL,
127 int usb_gadget_handle_interrupts(void)
129 dwc3_uboot_handle_interrupt(0);
133 int board_usb_init(int index, enum usb_init_type init)
135 struct exynos_usb3_phy *phy = (struct exynos_usb3_phy *)
136 samsung_get_base_usb3_phy();
139 pr_err("usb3 phy not supported\n");
143 set_usbdrd_phy_ctrl(POWER_USB_DRD_PHY_CTRL_EN);
144 exynos5_usb3_phy_init(phy);
146 return dwc3_uboot_init(&dwc3_device_data);
149 #ifdef CONFIG_SET_DFU_ALT_INFO
150 char *get_dfu_alt_system(char *interface, char *devstr)
152 char *info = "Not supported!";
154 if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
157 return env_get("dfu_alt_system");
160 char *get_dfu_alt_boot(char *interface, char *devstr)
162 char *info = "Not supported!";
167 if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
170 dev_num = simple_strtoul(devstr, NULL, 10);
172 mmc = find_mmc_device(dev_num);
180 alt_boot = CONFIG_DFU_ALT_BOOT_SD;
182 alt_boot = CONFIG_DFU_ALT_BOOT_EMMC;