diff options
-rw-r--r-- | board/intel/minnowmax/minnowmax.c | 53 | ||||
-rw-r--r-- | include/configs/minnowmax.h | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/board/intel/minnowmax/minnowmax.c b/board/intel/minnowmax/minnowmax.c index 94b22edd57f..99aed531006 100644 --- a/board/intel/minnowmax/minnowmax.c +++ b/board/intel/minnowmax/minnowmax.c @@ -5,9 +5,62 @@ */ #include <common.h> +#include <dm.h> #include <asm/gpio.h> +#include <dm/device-internal.h> +#include <dm/uclass-internal.h> + +#define GPIO_BANKE_NAME "gpioe" int arch_early_init_r(void) { return 0; } + +int misc_init_r(void) +{ + struct udevice *dev; + struct gpio_desc desc; + int ret; + + /* + * Turn on USB VBUS for the two USB ports on the board. + * Each port's VBUS is controlled by a GPIO pin. + */ + + ret = uclass_find_device_by_name(UCLASS_GPIO, GPIO_BANKE_NAME, &dev); + if (ret) { + debug("%s: GPIO %s device cannot be not found (ret=%d)\n", + __func__, GPIO_BANKE_NAME, ret); + return ret; + } + + ret = device_probe(dev); + if (ret) { + debug("%s: GPIO %s device probe failed (ret=%d)\n", + __func__, GPIO_BANKE_NAME, ret); + return ret; + } + + desc.dev = dev; + desc.flags = GPIOD_IS_OUT; + + /* GPIO E8 controls the bottom port */ + desc.offset = 8; + + ret = dm_gpio_request(&desc, "usb_host_en0"); + if (ret) + return ret; + dm_gpio_set_value(&desc, 1); + + /* GPIO E9 controls the upper port */ + desc.offset = 9; + + ret = dm_gpio_request(&desc, "usb_host_en1"); + if (ret) + return ret; + + dm_gpio_set_value(&desc, 1); + + return 0; +} diff --git a/include/configs/minnowmax.h b/include/configs/minnowmax.h index 7b9f90c08d8..3744811d96a 100644 --- a/include/configs/minnowmax.h +++ b/include/configs/minnowmax.h @@ -16,6 +16,7 @@ #define CONFIG_SYS_MONITOR_LEN (1 << 20) #define CONFIG_SMSC_LPC47M +#define CONFIG_MISC_INIT_R #define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,serial\0" \ "stdout=vidconsole,serial\0" \ |