OSDN Git Service

usb: dwc2: gadget: reset fifo_map when initializing fifos
authorGregory Herrero <gregory.herrero@intel.com>
Fri, 9 Jan 2015 12:39:06 +0000 (13:39 +0100)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Jan 2015 21:34:41 +0000 (15:34 -0600)
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 <r.baldyga@samsung.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/gadget.c

index de5da92..a1fd86f 100644 (file)
@@ -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) |