usb: musb: Return error value from musb_mailbox
At least on n900 we have phy-twl4030-usb only generating cable interrupts, and then have a separate USB PHY. In order for musb to know the real cable status, we need to clear any cached state until musb is ready. Otherwise the cable status interrupts will get just ignored if the status does not change from the initial state. To do this, let's add a return value to musb_mailbox(), and reset cached linkstat to MUSB_UNKNOWN on error. Sorry to cause a bit of churn here, I should have added that already last time patching musb_mailbox(). Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a118df07f5
commit
12b7db2bf8
@@ -227,12 +227,16 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
|
||||
twl->asleep = 1;
|
||||
status = MUSB_VBUS_VALID;
|
||||
twl->linkstat = status;
|
||||
musb_mailbox(status);
|
||||
ret = musb_mailbox(status);
|
||||
if (ret)
|
||||
twl->linkstat = MUSB_UNKNOWN;
|
||||
} else {
|
||||
if (twl->linkstat != MUSB_UNKNOWN) {
|
||||
status = MUSB_VBUS_OFF;
|
||||
twl->linkstat = status;
|
||||
musb_mailbox(status);
|
||||
ret = musb_mailbox(status);
|
||||
if (ret)
|
||||
twl->linkstat = MUSB_UNKNOWN;
|
||||
if (twl->asleep) {
|
||||
regulator_disable(twl->usb3v3);
|
||||
twl->asleep = 0;
|
||||
@@ -264,7 +268,9 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
|
||||
twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET);
|
||||
status = MUSB_ID_GROUND;
|
||||
twl->linkstat = status;
|
||||
musb_mailbox(status);
|
||||
ret = musb_mailbox(status);
|
||||
if (ret)
|
||||
twl->linkstat = MUSB_UNKNOWN;
|
||||
} else {
|
||||
twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR);
|
||||
twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
|
||||
|
Reference in New Issue
Block a user