]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: dwc3: core: add a event buffer cache
authorJohn Youn <johnyoun@synopsys.com>
Tue, 15 Nov 2016 10:54:15 +0000 (12:54 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 18 Nov 2016 11:54:42 +0000 (13:54 +0200)
This extra buffer will be used so we can copy
triggered events from our event buffer to this cache
and process all of them later in bottom half
handler.

We need this in order to implement a workaround for
a known erratum in recent DWC3 release.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h

index d024d47c86d1024191809d9252390c69e3c35b3d..87d0cfb7b29e273b9695e1b0816828fab6143f41 100644 (file)
@@ -224,6 +224,10 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
 
        evt->dwc        = dwc;
        evt->length     = length;
+       evt->cache      = devm_kzalloc(dwc->dev, length, GFP_KERNEL);
+       if (!evt->cache)
+               return ERR_PTR(-ENOMEM);
+
        evt->buf        = dma_alloc_coherent(dwc->dev, length,
                        &evt->dma, GFP_KERNEL);
        if (!evt->buf)
index 354de247356a15ffcf07511b0eac78a78413293d..bf63756bc176c2d7c5668583d3133554a808cae3 100644 (file)
@@ -472,6 +472,7 @@ struct dwc3_trb;
 /**
  * struct dwc3_event_buffer - Software event buffer representation
  * @buf: _THE_ buffer
+ * @cache: The buffer cache used in the threaded interrupt
  * @length: size of this buffer
  * @lpos: event offset
  * @count: cache of last read event count register
@@ -481,6 +482,7 @@ struct dwc3_trb;
  */
 struct dwc3_event_buffer {
        void                    *buf;
+       void                    *cache;
        unsigned                length;
        unsigned int            lpos;
        unsigned int            count;