mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
a118df07f5
commit
12b7db2bf8
6 changed files with 32 additions and 16 deletions
|
|
@ -463,7 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy)
|
|||
twl4030_usb_set_mode(twl, twl->usb_mode);
|
||||
if (twl->usb_mode == T2_USB_MODE_ULPI)
|
||||
twl4030_i2c_access(twl, 0);
|
||||
schedule_delayed_work(&twl->id_workaround_work, 0);
|
||||
twl->linkstat = MUSB_UNKNOWN;
|
||||
schedule_delayed_work(&twl->id_workaround_work, HZ);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -537,6 +538,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
|
|||
struct twl4030_usb *twl = _twl;
|
||||
enum musb_vbus_id_status status;
|
||||
bool status_changed = false;
|
||||
int err;
|
||||
|
||||
status = twl4030_usb_linkstat(twl);
|
||||
|
||||
|
|
@ -567,7 +569,9 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
|
|||
pm_runtime_mark_last_busy(twl->dev);
|
||||
pm_runtime_put_autosuspend(twl->dev);
|
||||
}
|
||||
musb_mailbox(status);
|
||||
err = musb_mailbox(status);
|
||||
if (err)
|
||||
twl->linkstat = MUSB_UNKNOWN;
|
||||
}
|
||||
|
||||
/* don't schedule during sleep - irq works right then */
|
||||
|
|
@ -595,7 +599,8 @@ static int twl4030_phy_init(struct phy *phy)
|
|||
struct twl4030_usb *twl = phy_get_drvdata(phy);
|
||||
|
||||
pm_runtime_get_sync(twl->dev);
|
||||
schedule_delayed_work(&twl->id_workaround_work, 0);
|
||||
twl->linkstat = MUSB_UNKNOWN;
|
||||
schedule_delayed_work(&twl->id_workaround_work, HZ);
|
||||
pm_runtime_mark_last_busy(twl->dev);
|
||||
pm_runtime_put_autosuspend(twl->dev);
|
||||
|
||||
|
|
@ -763,7 +768,8 @@ static int twl4030_usb_remove(struct platform_device *pdev)
|
|||
if (cable_present(twl->linkstat))
|
||||
pm_runtime_put_noidle(twl->dev);
|
||||
pm_runtime_mark_last_busy(twl->dev);
|
||||
pm_runtime_put_sync_suspend(twl->dev);
|
||||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_put_sync(twl->dev);
|
||||
pm_runtime_disable(twl->dev);
|
||||
|
||||
/* autogate 60MHz ULPI clock,
|
||||
|
|
|
|||
Loading…
Reference in a new issue