> -----Original Message----- > From: Sebastian Andrzej Siewior [mailto:bigeasy@xxxxxxxxxxxxx] > Sent: Tuesday, September 20, 2011 6:54 PM > To: Neil Zhang > Cc: linux-usb@xxxxxxxxxxxxxxx; Chao Xie; Haojian Zhuang > Subject: Re: [PATCH 02/15] USB: mv_udc: fix kernel panic on some > platform > > * Neil Zhang | 2011-09-19 16:15:03 [+0800]: > > >some platform will use usb to download image, it may not disconnect > >usb gadget in uboot before loading kernel. So first stop udc here to > >ensure that udc is stopped before we probe the device in kernel. > > > >Change-Id: I498a093d7c8dadb58c0d8fa7991ab4c567c76911 > >Signed-off-by: Neil Zhang <zhangwm@xxxxxxxxxxx> > >--- > > drivers/usb/gadget/mv_udc_core.c | 7 +++++++ > > 1 files changed, 7 insertions(+), 0 deletions(-) > > > >diff --git a/drivers/usb/gadget/mv_udc_core.c > b/drivers/usb/gadget/mv_udc_core.c > >index dcd9352..54ea824 100644 > >--- a/drivers/usb/gadget/mv_udc_core.c > >+++ b/drivers/usb/gadget/mv_udc_core.c > >@@ -2043,6 +2043,13 @@ static int __devinit mv_udc_probe(struct > platform_device *dev) > > & CAPLENGTH_MASK)); > > udc->max_eps = readl(&udc->cap_regs->dccparams) & > DCCPARAMS_DEN_MASK; > > > >+ /* > >+ * some platform will use usb to download image, it may not > disconnect > >+ * usb gadget before loading kernel. So first stop udc here. > >+ */ > >+ udc_stop(udc); > >+ writel(0xFFFFFFFF, &udc->op_regs->usbsts); > > This is not limited to this usecae. Once could use it in one kernel and > kexec into another. You don't provide a shutdown hook so it is likely > to > happen in this case as well :) This sounds like a good thing to do but > I'm curious now, why did it crash? > Can you issue a softreset to bring into its poweron-state? If we use usb to download image, it may not disconnect usb gadget in uboot before loading kernel. In some cases, it may pending an interrupt there, and it will be triggered immediately when we finish request irq. But we haven't finished init the device at this time. > Sebastian Best Regards, Neil Zhang -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html