When the port does not connect to host, the controller's gadget
mode is enabled, so we need to avoid visiting register at this situation.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
spin_lock_irqsave(&usb_ss->lock, flags);
usb_ss->gadget_driver = NULL;
/* disable interrupt for device */
- gadget_writel(usb_ss, &usb_ss->regs->usb_ien, 0);
+ if (usb_ss->start_gadget)
+ gadget_writel(usb_ss, &usb_ss->regs->usb_ien, 0);
spin_unlock_irqrestore(&usb_ss->lock, flags);
return 0;