1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2016 Stefan Roese <sr@denx.de>
9 #include <nuvoton_nct6102d.h>
11 #include <asm/ibmpc.h>
12 #include <asm/pnp_def.h>
14 int board_early_init_f(void)
16 #ifdef CONFIG_INTERNAL_UART
17 /* Disable the legacy UART which is enabled per default */
18 nct6102d_uarta_disable();
21 * The FSP enables the BayTrail internal legacy UART (again).
22 * Disable it again, so that the Nuvoton one can be used.
24 setup_internal_uart(0);
27 /* Disable the watchdog which is enabled per default */
28 nct6102d_wdt_disable();
33 int board_late_init(void)
35 struct gpio_desc desc;
38 ret = dm_gpio_lookup_name("F10", &desc);
40 debug("gpio ret=%d\n", ret);
41 ret = dm_gpio_request(&desc, "xhci_hub_reset");
43 debug("gpio_request ret=%d\n", ret);
44 ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
46 debug("gpio dir ret=%d\n", ret);
48 /* Pull xHCI hub reset to low (active low) */
49 dm_gpio_set_value(&desc, 0);
51 /* Wait at least 5 ms, so lets choose 10 to be safe */
54 /* Pull xHCI hub reset to high (active low) */
55 dm_gpio_set_value(&desc, 1);