diff --git a/drivers/allwinner/axp/common.c b/drivers/allwinner/axp/common.c index 13437fec8..e98b16fdb 100644 --- a/drivers/allwinner/axp/common.c +++ b/drivers/allwinner/axp/common.c @@ -105,6 +105,25 @@ static bool should_enable_regulator(const void *fdt, int node) return false; } +static bool board_uses_usb0_host_mode(const void *fdt) +{ + int node, length; + const char *prop; + + node = fdt_node_offset_by_compatible(fdt, -1, + "allwinner,sun8i-a33-musb"); + if (node < 0) { + return false; + } + + prop = fdt_getprop(fdt, node, "dr_mode", &length); + if (!prop) { + return false; + } + + return !strncmp(prop, "host", length); +} + void axp_setup_regulators(const void *fdt) { int node; @@ -121,7 +140,8 @@ void axp_setup_regulators(const void *fdt) } /* This applies to AXP803 only. */ - if (fdt_getprop(fdt, node, "x-powers,drive-vbus-en", NULL)) { + if (fdt_getprop(fdt, node, "x-powers,drive-vbus-en", NULL) && + board_uses_usb0_host_mode(fdt)) { axp_clrbits(0x8f, BIT(4)); axp_setbits(0x30, BIT(2)); INFO("PMIC: Enabling DRIVEVBUS\n"); diff --git a/plat/allwinner/common/allwinner-common.mk b/plat/allwinner/common/allwinner-common.mk index e60ebc6f2..997aaa6f7 100644 --- a/plat/allwinner/common/allwinner-common.mk +++ b/plat/allwinner/common/allwinner-common.mk @@ -5,6 +5,8 @@ # include lib/xlat_tables_v2/xlat_tables.mk +include lib/libfdt/libfdt.mk +include drivers/arm/gic/v2/gicv2.mk AW_PLAT := plat/allwinner @@ -12,8 +14,6 @@ PLAT_INCLUDES := -Iinclude/plat/arm/common/aarch64 \ -I${AW_PLAT}/common/include \ -I${AW_PLAT}/${PLAT}/include -include lib/libfdt/libfdt.mk - PLAT_BL_COMMON_SOURCES := drivers/ti/uart/${ARCH}/16550_console.S \ ${XLAT_TABLES_LIB_SRCS} \ ${AW_PLAT}/common/plat_helpers.S \ @@ -22,9 +22,7 @@ PLAT_BL_COMMON_SOURCES := drivers/ti/uart/${ARCH}/16550_console.S \ BL31_SOURCES += drivers/allwinner/axp/common.c \ drivers/allwinner/sunxi_msgbox.c \ drivers/arm/css/scpi/css_scpi.c \ - drivers/arm/gic/common/gic_common.c \ - drivers/arm/gic/v2/gicv2_helpers.c \ - drivers/arm/gic/v2/gicv2_main.c \ + ${GICV2_SOURCES} \ drivers/delay_timer/delay_timer.c \ drivers/delay_timer/generic_delay_timer.c \ lib/cpus/${ARCH}/cortex_a53.S \