Commit d9fa4c63 authored by John Youn's avatar John Youn Committed by Felipe Balbi

usb: dwc3: core: add a event buffer cache

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: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent a0fe0415
...@@ -224,6 +224,10 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, ...@@ -224,6 +224,10 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
evt->dwc = dwc; evt->dwc = dwc;
evt->length = length; 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->buf = dma_alloc_coherent(dwc->dev, length,
&evt->dma, GFP_KERNEL); &evt->dma, GFP_KERNEL);
if (!evt->buf) if (!evt->buf)
......
...@@ -472,6 +472,7 @@ struct dwc3_trb; ...@@ -472,6 +472,7 @@ struct dwc3_trb;
/** /**
* struct dwc3_event_buffer - Software event buffer representation * struct dwc3_event_buffer - Software event buffer representation
* @buf: _THE_ buffer * @buf: _THE_ buffer
* @cache: The buffer cache used in the threaded interrupt
* @length: size of this buffer * @length: size of this buffer
* @lpos: event offset * @lpos: event offset
* @count: cache of last read event count register * @count: cache of last read event count register
...@@ -481,6 +482,7 @@ struct dwc3_trb; ...@@ -481,6 +482,7 @@ struct dwc3_trb;
*/ */
struct dwc3_event_buffer { struct dwc3_event_buffer {
void *buf; void *buf;
void *cache;
unsigned length; unsigned length;
unsigned int lpos; unsigned int lpos;
unsigned int count; unsigned int count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment