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