u-boot-brain/board/intel/minnowmax/minnowmax.c
Bin Meng 5d89b37f71 x86: kconfig: Select ARCH_EARLY_INIT_R in the platform Kconfig
This is architecture-dependent early initialization hence should
be put in the platform Kconfig.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-01 20:17:02 +08:00

62 lines
1.1 KiB
C

/*
* Copyright (C) 2015, Google, Inc
*
* SPDX-License-Identifier: GPL-2.0+
*/
#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 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;
}