From 7fcbc95c1fa4d6e3f4645f9552d358f07ab93ad1 Mon Sep 17 00:00:00 2001 From: Gregory Herrero Date: Fri, 9 Jan 2015 13:39:06 +0100 Subject: [PATCH] usb: dwc2: gadget: reset fifo_map when initializing fifos After all endpoints are disabled, fifo_map should have reached 0. Its a bug if if didn't, so warn about it and reset it to 0 so that driver can continue using all the fifos. Tested-by: Robert Baldyga Acked-by: Paul Zimmerman Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Felipe Balbi --- drivers/usb/dwc2/gadget.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index de5da92a8537..a1fd86febe98 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -177,6 +177,10 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg) int timeout; u32 val; + /* Reset fifo map if not correctly cleared during previous session */ + WARN_ON(hsotg->fifo_map); + hsotg->fifo_map = 0; + /* set RX/NPTX FIFO sizes */ writel(hsotg->g_rx_fifo_sz, hsotg->regs + GRXFSIZ); writel((hsotg->g_rx_fifo_sz << FIFOSIZE_STARTADDR_SHIFT) |