OSDN Git Service

usb: gadget: s3c-hsotg: fix interrupt configuration in dedicated-fifo mode
authorRobert Baldyga <r.baldyga@samsung.com>
Thu, 19 Sep 2013 09:50:23 +0000 (11:50 +0200)
committerFelipe Balbi <balbi@ti.com>
Tue, 15 Oct 2013 13:45:50 +0000 (08:45 -0500)
In dedicated-fifo mode TxFIFOEmpty interrupt should be asserted when TxFIFO
for this endpoint is completly empty, so NPTxFEmpLvl and PTxFEmpLvl bits are
set in GAHBCFG register.
In DIEPMSK register INTknTXFEmpMsk is set, becouse it's needed to indicate
FIFO Empty state.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/s3c-hsotg.c

index 7061558..a9cae1f 100644 (file)
@@ -2304,15 +2304,19 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
                       GAHBCFG_HBstLen_Incr4,
                       hsotg->regs + GAHBCFG);
        else
-               writel(GAHBCFG_GlblIntrEn, hsotg->regs + GAHBCFG);
+               writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NPTxFEmpLvl |
+                                                   GAHBCFG_PTxFEmpLvl) : 0) |
+                      GAHBCFG_GlblIntrEn,
+                      hsotg->regs + GAHBCFG);
 
        /*
-        * Enabling INTknTXFEmpMsk here seems to be a big mistake, we end
-        * up being flooded with interrupts if the host is polling the
-        * endpoint to try and read data.
+        * If INTknTXFEmpMsk is enabled, it's important to disable ep interrupts
+        * when we have no data to transfer. Otherwise we get being flooded by
+        * interrupts.
         */
 
-       writel(((hsotg->dedicated_fifos) ? DIEPMSK_TxFIFOEmpty : 0) |
+       writel(((hsotg->dedicated_fifos) ? DIEPMSK_TxFIFOEmpty |
+              DIEPMSK_INTknTXFEmpMsk : 0) |
               DIEPMSK_EPDisbldMsk | DIEPMSK_XferComplMsk |
               DIEPMSK_TimeOUTMsk | DIEPMSK_AHBErrMsk |
               DIEPMSK_INTknEPMisMsk,