diff options
| -rw-r--r-- | drivers/usb/musb/musb_dsps.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index e3935f18dd56..efd1f0dbb926 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -618,6 +618,29 @@ static int dsps_musb_recover(struct musb *musb) return session_restart ? 0 : -EPIPE; } +static int dsps_musb_vbus_status(struct musb *musb) +{ + u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); + + return (devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS; +} + +static void dsps_musb_set_vbus(struct musb *musb, int is_on) +{ + u8 devctl; + + devctl = musb_readb(musb->mregs, MUSB_DEVCTL); + + if (is_on) { + devctl |= MUSB_DEVCTL_SESSION; + } else { + musb_root_disconnect(musb); + devctl &= ~MUSB_DEVCTL_SESSION; + } + + musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); +} + /* Similar to am35x, dm81xx support only 32-bit read operation */ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) { @@ -702,6 +725,8 @@ static struct musb_platform_ops dsps_ops = { .set_mode = dsps_musb_set_mode, .recover = dsps_musb_recover, + .vbus_status = dsps_musb_vbus_status, + .set_vbus = dsps_musb_set_vbus, .clear_ep_rxintr = dsps_musb_clear_ep_rxintr, }; |
