summaryrefslogtreecommitdiff
path: root/drivers/usb/musb-new/sunxi.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-06-14 16:48:56 +0200
committerHans de Goede <hdegoede@redhat.com>2015-07-25 11:22:54 +0200
commitb41972e7d17fb920cc50db5b363209685b1251e5 (patch)
tree3a856fd40ec2d912cdf8d2d92064d65d9ab71101 /drivers/usb/musb-new/sunxi.c
parent48c06c98ecd99b2a4752461b6cc5c4a05d2f616a (diff)
sunxi: musb: Move vbus check to sunxi_musb_enable
This way it can be re-checked on "usb reset". Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'drivers/usb/musb-new/sunxi.c')
-rw-r--r--drivers/usb/musb-new/sunxi.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index c123d61af2..ee018c7e6e 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -201,6 +201,8 @@ static bool enabled = false;
static int sunxi_musb_enable(struct musb *musb)
{
+ int ret;
+
pr_debug("%s():\n", __func__);
if (enabled)
@@ -209,8 +211,14 @@ static int sunxi_musb_enable(struct musb *musb)
/* select PIO mode */
musb_writeb(musb->mregs, USBC_REG_o_VEND0, 0);
- if (is_host_enabled(musb))
+ if (is_host_enabled(musb)) {
+ ret = sunxi_usb_phy_vbus_detect(0);
+ if (ret) {
+ printf("A charger is plugged into the OTG: ");
+ return -ENODEV;
+ }
sunxi_usb_phy_power_on(0); /* port power on */
+ }
USBC_ForceVbusValidToHigh(musb->mregs);
@@ -237,18 +245,9 @@ static void sunxi_musb_disable(struct musb *musb)
static int sunxi_musb_init(struct musb *musb)
{
struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
- int err;
pr_debug("%s():\n", __func__);
- if (is_host_enabled(musb)) {
- err = sunxi_usb_phy_vbus_detect(0);
- if (err) {
- eprintf("Error: A charger is plugged into the OTG\n");
- return -EIO;
- }
- }
-
musb->isr = sunxi_musb_interrupt;
setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0);