Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 SAMSUNG Electronics |
| 4 | * Rajeshwari Shinde <rajeshwari.s@samsung.com> |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <cros_ec.h> |
| 9 | #include <errno.h> |
| 10 | #include <fdtdec.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 11 | #include <hang.h> |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 12 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame^] | 13 | #include <net.h> |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 14 | #include <spi.h> |
| 15 | #include <tmu.h> |
| 16 | #include <netdev.h> |
| 17 | #include <asm/io.h> |
Simon Glass | 37f1162 | 2014-10-20 19:48:37 -0600 | [diff] [blame] | 18 | #include <asm/gpio.h> |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 19 | #include <asm/arch/board.h> |
| 20 | #include <asm/arch/cpu.h> |
| 21 | #include <asm/arch/dwmmc.h> |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 22 | #include <asm/arch/mmc.h> |
| 23 | #include <asm/arch/pinmux.h> |
| 24 | #include <asm/arch/power.h> |
Ajay Kumar | 1176348 | 2014-09-05 16:53:30 +0530 | [diff] [blame] | 25 | #include <asm/arch/system.h> |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 26 | #include <asm/arch/sromc.h> |
Piotr Wilczek | 2c3eed5 | 2014-03-07 14:59:45 +0100 | [diff] [blame] | 27 | #include <lcd.h> |
Przemyslaw Marczak | 110aa29 | 2015-04-20 20:07:50 +0200 | [diff] [blame] | 28 | #include <i2c.h> |
Marek Szyprowski | bc4a2e3 | 2020-01-17 14:02:44 +0100 | [diff] [blame] | 29 | #include <mmc.h> |
| 30 | #include <stdio_dev.h> |
Lukasz Majewski | 7573b96 | 2015-03-03 17:32:03 +0100 | [diff] [blame] | 31 | #include <usb.h> |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 32 | #include <dwc3-uboot.h> |
| 33 | #include <samsung/misc.h> |
Thomas Abraham | 8d84faa | 2016-04-23 22:18:14 +0530 | [diff] [blame] | 34 | #include <dm/pinctrl.h> |
| 35 | #include <dm.h> |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 36 | |
| 37 | DECLARE_GLOBAL_DATA_PTR; |
| 38 | |
Jeroen Hofstee | 5cd8294 | 2014-10-08 22:57:28 +0200 | [diff] [blame] | 39 | __weak int exynos_early_init_f(void) |
Piotr Wilczek | 942d0a9 | 2014-03-07 14:59:43 +0100 | [diff] [blame] | 40 | { |
| 41 | return 0; |
| 42 | } |
Piotr Wilczek | 942d0a9 | 2014-03-07 14:59:43 +0100 | [diff] [blame] | 43 | |
Jeroen Hofstee | 5cd8294 | 2014-10-08 22:57:28 +0200 | [diff] [blame] | 44 | __weak int exynos_power_init(void) |
Piotr Wilczek | 942d0a9 | 2014-03-07 14:59:43 +0100 | [diff] [blame] | 45 | { |
| 46 | return 0; |
| 47 | } |
Piotr Wilczek | 942d0a9 | 2014-03-07 14:59:43 +0100 | [diff] [blame] | 48 | |
Marek Szyprowski | bc4a2e3 | 2020-01-17 14:02:44 +0100 | [diff] [blame] | 49 | /** |
| 50 | * get_boot_mmc_dev() - read boot MMC device id from XOM[7:5] pins. |
| 51 | */ |
| 52 | static int get_boot_mmc_dev(void) |
| 53 | { |
| 54 | u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C; |
| 55 | |
| 56 | if (mode == 0x04) |
| 57 | return 2; /* MMC2: SD */ |
| 58 | |
| 59 | /* MMC0: eMMC or unknown */ |
| 60 | return 0; |
| 61 | } |
| 62 | |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 63 | #if defined CONFIG_EXYNOS_TMU |
| 64 | /* Boot Time Thermal Analysis for SoC temperature threshold breach */ |
| 65 | static void boot_temp_check(void) |
| 66 | { |
| 67 | int temp; |
| 68 | |
| 69 | switch (tmu_monitor(&temp)) { |
| 70 | case TMU_STATUS_NORMAL: |
| 71 | break; |
| 72 | case TMU_STATUS_TRIPPED: |
| 73 | /* |
| 74 | * Status TRIPPED ans WARNING means corresponding threshold |
| 75 | * breach |
| 76 | */ |
| 77 | puts("EXYNOS_TMU: TRIPPING! Device power going down ...\n"); |
| 78 | set_ps_hold_ctrl(); |
| 79 | hang(); |
| 80 | break; |
| 81 | case TMU_STATUS_WARNING: |
| 82 | puts("EXYNOS_TMU: WARNING! Temperature very high\n"); |
| 83 | break; |
| 84 | case TMU_STATUS_INIT: |
| 85 | /* |
| 86 | * TMU_STATUS_INIT means something is wrong with temperature |
| 87 | * sensing and TMU status was changed back from NORMAL to INIT. |
| 88 | */ |
| 89 | puts("EXYNOS_TMU: WARNING! Temperature sensing not done\n"); |
| 90 | break; |
| 91 | default: |
| 92 | debug("EXYNOS_TMU: Unknown TMU state\n"); |
| 93 | } |
| 94 | } |
| 95 | #endif |
| 96 | |
| 97 | int board_init(void) |
| 98 | { |
| 99 | gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); |
| 100 | #if defined CONFIG_EXYNOS_TMU |
| 101 | if (tmu_init(gd->fdt_blob) != TMU_STATUS_NORMAL) { |
| 102 | debug("%s: Failed to init TMU\n", __func__); |
| 103 | return -1; |
| 104 | } |
| 105 | boot_temp_check(); |
| 106 | #endif |
Przemyslaw Marczak | c32a04c | 2015-02-17 14:50:25 +0100 | [diff] [blame] | 107 | #ifdef CONFIG_TZSW_RESERVED_DRAM_SIZE |
| 108 | /* The last few MB of memory can be reserved for secure firmware */ |
| 109 | ulong size = CONFIG_TZSW_RESERVED_DRAM_SIZE; |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 110 | |
Przemyslaw Marczak | c32a04c | 2015-02-17 14:50:25 +0100 | [diff] [blame] | 111 | gd->ram_size -= size; |
| 112 | gd->bd->bi_dram[CONFIG_NR_DRAM_BANKS - 1].size -= size; |
| 113 | #endif |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 114 | return exynos_init(); |
| 115 | } |
| 116 | |
| 117 | int dram_init(void) |
| 118 | { |
Łukasz Majewski | 33d7a19 | 2015-03-04 10:54:48 +0100 | [diff] [blame] | 119 | unsigned int i; |
Thomas Abraham | 8d84faa | 2016-04-23 22:18:14 +0530 | [diff] [blame] | 120 | unsigned long addr; |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 121 | |
| 122 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 123 | addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); |
| 124 | gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE); |
| 125 | } |
| 126 | return 0; |
| 127 | } |
| 128 | |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 129 | int dram_init_banksize(void) |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 130 | { |
Łukasz Majewski | 33d7a19 | 2015-03-04 10:54:48 +0100 | [diff] [blame] | 131 | unsigned int i; |
Thomas Abraham | 8d84faa | 2016-04-23 22:18:14 +0530 | [diff] [blame] | 132 | unsigned long addr, size; |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 133 | |
| 134 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 135 | addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); |
| 136 | size = get_ram_size((long *)addr, SDRAM_BANK_SIZE); |
| 137 | |
| 138 | gd->bd->bi_dram[i].start = addr; |
| 139 | gd->bd->bi_dram[i].size = size; |
| 140 | } |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 141 | |
| 142 | return 0; |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | static int board_uart_init(void) |
| 146 | { |
Thomas Abraham | 8d84faa | 2016-04-23 22:18:14 +0530 | [diff] [blame] | 147 | #ifndef CONFIG_PINCTRL_EXYNOS |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 148 | int err, uart_id, ret = 0; |
| 149 | |
| 150 | for (uart_id = PERIPH_ID_UART0; uart_id <= PERIPH_ID_UART3; uart_id++) { |
| 151 | err = exynos_pinmux_config(uart_id, PINMUX_FLAG_NONE); |
| 152 | if (err) { |
| 153 | debug("UART%d not configured\n", |
| 154 | (uart_id - PERIPH_ID_UART0)); |
| 155 | ret |= err; |
| 156 | } |
| 157 | } |
| 158 | return ret; |
Thomas Abraham | 8d84faa | 2016-04-23 22:18:14 +0530 | [diff] [blame] | 159 | #else |
| 160 | return 0; |
| 161 | #endif |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | #ifdef CONFIG_BOARD_EARLY_INIT_F |
| 165 | int board_early_init_f(void) |
| 166 | { |
| 167 | int err; |
Przemyslaw Marczak | 4d2a92c | 2014-09-01 13:50:49 +0200 | [diff] [blame] | 168 | #ifdef CONFIG_BOARD_TYPES |
| 169 | set_board_type(); |
| 170 | #endif |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 171 | err = board_uart_init(); |
| 172 | if (err) { |
| 173 | debug("UART init failed\n"); |
| 174 | return err; |
| 175 | } |
| 176 | |
| 177 | #ifdef CONFIG_SYS_I2C_INIT_BOARD |
| 178 | board_i2c_init(gd->fdt_blob); |
| 179 | #endif |
Ajay Kumar | 1176348 | 2014-09-05 16:53:30 +0530 | [diff] [blame] | 180 | |
Piotr Wilczek | 942d0a9 | 2014-03-07 14:59:43 +0100 | [diff] [blame] | 181 | return exynos_early_init_f(); |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 182 | } |
| 183 | #endif |
| 184 | |
Przemyslaw Marczak | 110aa29 | 2015-04-20 20:07:50 +0200 | [diff] [blame] | 185 | #if defined(CONFIG_POWER) || defined(CONFIG_DM_PMIC) |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 186 | int power_init_board(void) |
| 187 | { |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 188 | set_ps_hold_ctrl(); |
| 189 | |
Piotr Wilczek | 942d0a9 | 2014-03-07 14:59:43 +0100 | [diff] [blame] | 190 | return exynos_power_init(); |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 191 | } |
| 192 | #endif |
| 193 | |
Piotr Wilczek | 2c3eed5 | 2014-03-07 14:59:45 +0100 | [diff] [blame] | 194 | #ifdef CONFIG_SMC911X |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 195 | static int decode_sromc(const void *blob, struct fdt_sromc *config) |
| 196 | { |
| 197 | int err; |
| 198 | int node; |
| 199 | |
| 200 | node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SROMC); |
| 201 | if (node < 0) { |
| 202 | debug("Could not find SROMC node\n"); |
| 203 | return node; |
| 204 | } |
| 205 | |
| 206 | config->bank = fdtdec_get_int(blob, node, "bank", 0); |
| 207 | config->width = fdtdec_get_int(blob, node, "width", 2); |
| 208 | |
| 209 | err = fdtdec_get_int_array(blob, node, "srom-timing", config->timing, |
| 210 | FDT_SROM_TIMING_COUNT); |
| 211 | if (err < 0) { |
| 212 | debug("Could not decode SROMC configuration Error: %s\n", |
| 213 | fdt_strerror(err)); |
| 214 | return -FDT_ERR_NOTFOUND; |
| 215 | } |
| 216 | return 0; |
| 217 | } |
Piotr Wilczek | 2c3eed5 | 2014-03-07 14:59:45 +0100 | [diff] [blame] | 218 | #endif |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 219 | |
| 220 | int board_eth_init(bd_t *bis) |
| 221 | { |
| 222 | #ifdef CONFIG_SMC911X |
| 223 | u32 smc_bw_conf, smc_bc_conf; |
| 224 | struct fdt_sromc config; |
| 225 | fdt_addr_t base_addr; |
| 226 | int node; |
| 227 | |
| 228 | node = decode_sromc(gd->fdt_blob, &config); |
| 229 | if (node < 0) { |
| 230 | debug("%s: Could not find sromc configuration\n", __func__); |
| 231 | return 0; |
| 232 | } |
| 233 | node = fdtdec_next_compatible(gd->fdt_blob, node, COMPAT_SMSC_LAN9215); |
| 234 | if (node < 0) { |
| 235 | debug("%s: Could not find lan9215 configuration\n", __func__); |
| 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | /* We now have a node, so any problems from now on are errors */ |
| 240 | base_addr = fdtdec_get_addr(gd->fdt_blob, node, "reg"); |
| 241 | if (base_addr == FDT_ADDR_T_NONE) { |
| 242 | debug("%s: Could not find lan9215 address\n", __func__); |
| 243 | return -1; |
| 244 | } |
| 245 | |
| 246 | /* Ethernet needs data bus width of 16 bits */ |
| 247 | if (config.width != 2) { |
| 248 | debug("%s: Unsupported bus width %d\n", __func__, |
| 249 | config.width); |
| 250 | return -1; |
| 251 | } |
| 252 | smc_bw_conf = SROMC_DATA16_WIDTH(config.bank) |
| 253 | | SROMC_BYTE_ENABLE(config.bank); |
| 254 | |
| 255 | smc_bc_conf = SROMC_BC_TACS(config.timing[FDT_SROM_TACS]) | |
| 256 | SROMC_BC_TCOS(config.timing[FDT_SROM_TCOS]) | |
| 257 | SROMC_BC_TACC(config.timing[FDT_SROM_TACC]) | |
| 258 | SROMC_BC_TCOH(config.timing[FDT_SROM_TCOH]) | |
| 259 | SROMC_BC_TAH(config.timing[FDT_SROM_TAH]) | |
| 260 | SROMC_BC_TACP(config.timing[FDT_SROM_TACP]) | |
| 261 | SROMC_BC_PMC(config.timing[FDT_SROM_PMC]); |
| 262 | |
| 263 | /* Select and configure the SROMC bank */ |
| 264 | exynos_pinmux_config(PERIPH_ID_SROMC, config.bank); |
| 265 | s5p_config_sromc(config.bank, smc_bw_conf, smc_bc_conf); |
| 266 | return smc911x_initialize(0, base_addr); |
| 267 | #endif |
| 268 | return 0; |
| 269 | } |
| 270 | |
Krzysztof Kozlowski | c51bd0b | 2019-03-06 19:37:52 +0100 | [diff] [blame] | 271 | #if defined(CONFIG_DISPLAY_BOARDINFO) || defined(CONFIG_DISPLAY_BOARDINFO_LATE) |
Piotr Wilczek | 3df7aff | 2014-03-07 14:59:42 +0100 | [diff] [blame] | 272 | int checkboard(void) |
| 273 | { |
Simon Glass | 6ceeff4 | 2019-01-11 18:37:07 -0700 | [diff] [blame] | 274 | if (IS_ENABLED(CONFIG_BOARD_TYPES)) { |
Krzysztof Kozlowski | 36476ee | 2019-03-06 19:37:51 +0100 | [diff] [blame] | 275 | const char *board_info; |
| 276 | |
| 277 | if (IS_ENABLED(CONFIG_DISPLAY_BOARDINFO_LATE)) { |
| 278 | /* |
| 279 | * Printing type requires having revision, although |
| 280 | * this will succeed only if done late. |
| 281 | * Otherwise revision will be set in misc_init_r(). |
| 282 | */ |
| 283 | set_board_revision(); |
| 284 | } |
| 285 | |
| 286 | board_info = get_board_type(); |
Simon Glass | 6ceeff4 | 2019-01-11 18:37:07 -0700 | [diff] [blame] | 287 | |
| 288 | if (board_info) |
| 289 | printf("Type: %s\n", board_info); |
| 290 | } |
Piotr Wilczek | 3df7aff | 2014-03-07 14:59:42 +0100 | [diff] [blame] | 291 | |
Piotr Wilczek | 3df7aff | 2014-03-07 14:59:42 +0100 | [diff] [blame] | 292 | return 0; |
| 293 | } |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 294 | #endif |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 295 | |
| 296 | #ifdef CONFIG_BOARD_LATE_INIT |
| 297 | int board_late_init(void) |
| 298 | { |
Simon Glass | fe3f643 | 2018-11-06 15:21:26 -0700 | [diff] [blame] | 299 | struct udevice *dev; |
| 300 | int ret; |
Marek Szyprowski | bc4a2e3 | 2020-01-17 14:02:44 +0100 | [diff] [blame] | 301 | int mmcbootdev = get_boot_mmc_dev(); |
| 302 | char mmcbootdev_str[16]; |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 303 | |
Simon Glass | fe3f643 | 2018-11-06 15:21:26 -0700 | [diff] [blame] | 304 | stdio_print_current_devices(); |
| 305 | ret = uclass_first_device_err(UCLASS_CROS_EC, &dev); |
| 306 | if (ret && ret != -ENODEV) { |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 307 | /* Force console on */ |
| 308 | gd->flags &= ~GD_FLG_SILENT; |
| 309 | |
Simon Glass | fe3f643 | 2018-11-06 15:21:26 -0700 | [diff] [blame] | 310 | printf("cros-ec communications failure %d\n", ret); |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 311 | puts("\nPlease reset with Power+Refresh\n\n"); |
| 312 | panic("Cannot init cros-ec device"); |
| 313 | return -1; |
| 314 | } |
Marek Szyprowski | bc4a2e3 | 2020-01-17 14:02:44 +0100 | [diff] [blame] | 315 | |
| 316 | printf("Boot device: MMC(%u)\n", mmcbootdev); |
| 317 | sprintf(mmcbootdev_str, "%u", mmcbootdev); |
| 318 | env_set("mmcbootdev", mmcbootdev_str); |
| 319 | |
Rajeshwari Birje | 987b0dd | 2013-12-26 09:44:17 +0530 | [diff] [blame] | 320 | return 0; |
| 321 | } |
| 322 | #endif |
| 323 | |
Piotr Wilczek | 2c3eed5 | 2014-03-07 14:59:45 +0100 | [diff] [blame] | 324 | #ifdef CONFIG_MISC_INIT_R |
| 325 | int misc_init_r(void) |
| 326 | { |
Krzysztof Kozlowski | 36476ee | 2019-03-06 19:37:51 +0100 | [diff] [blame] | 327 | if (IS_ENABLED(CONFIG_BOARD_TYPES) && |
| 328 | !IS_ENABLED(CONFIG_DISPLAY_BOARDINFO_LATE)) { |
| 329 | /* |
| 330 | * If revision was not set by late display boardinfo, |
| 331 | * set it here. At this point regulators should be already |
| 332 | * available. |
| 333 | */ |
| 334 | set_board_revision(); |
| 335 | } |
| 336 | |
Piotr Wilczek | 2c3eed5 | 2014-03-07 14:59:45 +0100 | [diff] [blame] | 337 | #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG |
| 338 | set_board_info(); |
| 339 | #endif |
| 340 | #ifdef CONFIG_LCD_MENU |
| 341 | keys_init(); |
| 342 | check_boot_mode(); |
| 343 | #endif |
| 344 | #ifdef CONFIG_CMD_BMP |
| 345 | if (panel_info.logo_on) |
| 346 | draw_logo(); |
| 347 | #endif |
| 348 | return 0; |
| 349 | } |
| 350 | #endif |
Joonyoung Shim | 7a3e806 | 2015-01-15 11:45:56 +0900 | [diff] [blame] | 351 | |
| 352 | void reset_misc(void) |
| 353 | { |
| 354 | struct gpio_desc gpio = {}; |
| 355 | int node; |
| 356 | |
| 357 | node = fdt_node_offset_by_compatible(gd->fdt_blob, 0, |
| 358 | "samsung,emmc-reset"); |
| 359 | if (node < 0) |
| 360 | return; |
| 361 | |
Simon Glass | 1d9af1f | 2017-05-30 21:47:09 -0600 | [diff] [blame] | 362 | gpio_request_by_name_nodev(offset_to_ofnode(node), "reset-gpio", 0, |
| 363 | &gpio, GPIOD_IS_OUT); |
Joonyoung Shim | 7a3e806 | 2015-01-15 11:45:56 +0900 | [diff] [blame] | 364 | |
| 365 | if (dm_gpio_is_valid(&gpio)) { |
| 366 | /* |
| 367 | * Reset eMMC |
| 368 | * |
| 369 | * FIXME: Need to optimize delay time. Minimum 1usec pulse is |
| 370 | * required by 'JEDEC Standard No.84-A441' (eMMC) |
| 371 | * document but real delay time is expected to greater |
| 372 | * than 1usec. |
| 373 | */ |
| 374 | dm_gpio_set_value(&gpio, 0); |
| 375 | mdelay(10); |
| 376 | dm_gpio_set_value(&gpio, 1); |
| 377 | } |
| 378 | } |
Lukasz Majewski | 7573b96 | 2015-03-03 17:32:03 +0100 | [diff] [blame] | 379 | |
| 380 | int board_usb_cleanup(int index, enum usb_init_type init) |
| 381 | { |
Joonyoung Shim | 95d3a1d | 2015-05-22 18:14:24 +0200 | [diff] [blame] | 382 | #ifdef CONFIG_USB_DWC3 |
| 383 | dwc3_uboot_exit(index); |
| 384 | #endif |
Lukasz Majewski | 7573b96 | 2015-03-03 17:32:03 +0100 | [diff] [blame] | 385 | return 0; |
| 386 | } |
Marek Szyprowski | bc4a2e3 | 2020-01-17 14:02:44 +0100 | [diff] [blame] | 387 | |
| 388 | int mmc_get_env_dev(void) |
| 389 | { |
| 390 | return get_boot_mmc_dev(); |
| 391 | } |