Commit b4dc38fd authored by Felipe Balbi's avatar Felipe Balbi

usb: musb: core: simplify musb_recover_work()

we're not resetting musb at all, just restarting
the session. This means we don't need to touch PHYs
or VBUS or anything like that. Just make sure session
bit is reenabled after MUSB dropped it.

while at that, make sure to tell usbcore that we're
dropping the session and, thus, disconnecting the
device.
Tested-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 011d0dd5
...@@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data) ...@@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data)
static void musb_recover_work(struct work_struct *data) static void musb_recover_work(struct work_struct *data)
{ {
struct musb *musb = container_of(data, struct musb, recover_work.work); struct musb *musb = container_of(data, struct musb, recover_work.work);
int status, ret; int ret;
u8 devctl;
ret = musb_platform_reset(musb); ret = musb_platform_reset(musb);
if (ret) { if (ret) {
...@@ -1843,23 +1844,25 @@ static void musb_recover_work(struct work_struct *data) ...@@ -1843,23 +1844,25 @@ static void musb_recover_work(struct work_struct *data)
return; return;
} }
usb_phy_vbus_off(musb->xceiv); /* drop session bit */
usleep_range(100, 200); devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
devctl &= ~MUSB_DEVCTL_SESSION;
musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
usb_phy_vbus_on(musb->xceiv); /* tell usbcore about it */
usleep_range(100, 200); musb_root_disconnect(musb);
/* /*
* When a babble condition occurs, the musb controller * When a babble condition occurs, the musb controller
* removes the session bit and the endpoint config is lost. * removes the session bit and the endpoint config is lost.
*/ */
if (musb->dyn_fifo) if (musb->dyn_fifo)
status = ep_config_from_table(musb); ret = ep_config_from_table(musb);
else else
status = ep_config_from_hw(musb); ret = ep_config_from_hw(musb);
/* start the session again */ /* restart session */
if (status == 0) if (ret == 0)
musb_start(musb); musb_start(musb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment