mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-26 14:40:41 +00:00
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>
This commit is contained in:
parent
940382fe7d
commit
046ea8b390
1 changed files with 8 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue