From 0d5f648ce9b73e6898eec88db8d38051706063d9 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Tue, 10 Dec 2013 02:02:38 +0200 Subject: [PATCH] usb: musb: omap2430: fix occasional musb breakage on boot This is a hard to reproduce problem which leads to non-functional USB-OTG port in 0.1%-1% of all boots. Tracked it down to commit e25bec160158abe86c "omap2+: save and restore OTG_INTERFSEL", which introduces save/restore of OTG_INTERFSEL over suspend. Since the resume function is also called early in driver init, it uses a non-initialized value (which is 0 and a non-supported setting in DM37xx for INTERFSEL). Shortly after the correct value is set. Apparently this works most time, but not always. Fix it by not writing the value on runtime resume if it is 0 (0 should never be saved in the context as it's invalid value). This issue was originally found by Andreas Naumann: http://marc.info/?l=linux-usb&m=138562574719654&w=2 --- drivers/usb/musb/omap2430.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 55c0b937ef35..58ca5e4a159e 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -513,7 +513,8 @@ static int omap2430_runtime_resume(struct device *dev) struct musb *musb = glue_to_musb(glue); omap2430_low_level_init(musb); - musb_writel(musb->mregs, OTG_INTERFSEL, + if (musb->context.otg_interfsel != 0) + musb_writel(musb->mregs, OTG_INTERFSEL, musb->context.otg_interfsel); otg_set_suspend(musb->xceiv, 0); -- 2.39.2