summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/sunxi
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-03-27 21:57:54 +0100
committerHans de Goede <hdegoede@redhat.com>2015-04-15 16:17:17 +0200
commit046ea8b390f9c8986f52e4bd2c7bffabd4749330 (patch)
tree22dc5cb6e241393f83271c8b1010dcbd5d050be0 /arch/arm/cpu/armv7/sunxi
parent940382fe7d61d90326e42fe00b976c65b18befa2 (diff)
sunxi: usbc: Initialize vusb value on request_resources
On boards which use the pmic to enable/disable vbus on the otg port, the vbus value is not reset to 0 on reset, as reset only resets the SoC and not the pmic, so explicitly set vbus to 0 on init (request_resources) by moving the gpio_direction_output call into request_resources. For consistency also move the gpio_direction_input call for vbus-detect into request_resources. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'arch/arm/cpu/armv7/sunxi')
-rw-r--r--arch/arm/cpu/armv7/sunxi/usbc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/arm/cpu/armv7/sunxi/usbc.c b/arch/arm/cpu/armv7/sunxi/usbc.c
index 1c777aac49..6285fa5ecb 100644
--- a/arch/arm/cpu/armv7/sunxi/usbc.c
+++ b/arch/arm/cpu/armv7/sunxi/usbc.c
@@ -195,12 +195,16 @@ int sunxi_usbc_request_resources(int index)
int ret = 0;
sunxi_usbc->gpio_vbus = get_vbus_gpio(index);
- if (sunxi_usbc->gpio_vbus != -1)
+ if (sunxi_usbc->gpio_vbus != -1) {
ret |= gpio_request(sunxi_usbc->gpio_vbus, "usbc_vbus");
+ ret |= gpio_direction_output(sunxi_usbc->gpio_vbus, 0);
+ }
sunxi_usbc->gpio_vbus_det = get_vbus_detect_gpio(index);
- if (sunxi_usbc->gpio_vbus_det != -1)
+ if (sunxi_usbc->gpio_vbus_det != -1) {
ret |= gpio_request(sunxi_usbc->gpio_vbus_det, "usbc_vbus_det");
+ ret |= gpio_direction_input(sunxi_usbc->gpio_vbus_det);
+ }
return ret;
}
@@ -268,7 +272,7 @@ void sunxi_usbc_vbus_enable(int index)
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
if (sunxi_usbc->gpio_vbus != -1)
- gpio_direction_output(sunxi_usbc->gpio_vbus, 1);
+ gpio_set_value(sunxi_usbc->gpio_vbus, 1);
}
void sunxi_usbc_vbus_disable(int index)
@@ -276,7 +280,7 @@ void sunxi_usbc_vbus_disable(int index)
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
if (sunxi_usbc->gpio_vbus != -1)
- gpio_direction_output(sunxi_usbc->gpio_vbus, 0);
+ gpio_set_value(sunxi_usbc->gpio_vbus, 0);
}
int sunxi_usbc_vbus_detect(int index)
@@ -289,9 +293,5 @@ int sunxi_usbc_vbus_detect(int index)
return -1;
}
- err = gpio_direction_input(sunxi_usbc->gpio_vbus_det);
- if (err)
- return err;
-
return gpio_get_value(sunxi_usbc->gpio_vbus_det);
}