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

usb: dwc3: gadget: use evt->cache for processing events

Let's start copying events from evt->buf to
evt->cache and use evt->cache for processing events.

A follow-up patch will be added to clear events in
the top-half handler in order to bring IRQ line low
as soon as possible.
Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent caefe6c7
...@@ -2821,7 +2821,7 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3_event_buffer *evt) ...@@ -2821,7 +2821,7 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3_event_buffer *evt)
while (left > 0) { while (left > 0) {
union dwc3_event event; union dwc3_event event;
event.raw = *(u32 *) (evt->buf + evt->lpos); event.raw = *(u32 *) (evt->cache + evt->lpos);
dwc3_process_event_entry(dwc, &event); dwc3_process_event_entry(dwc, &event);
...@@ -2869,6 +2869,7 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt) ...@@ -2869,6 +2869,7 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt)
static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
{ {
struct dwc3 *dwc = evt->dwc; struct dwc3 *dwc = evt->dwc;
u32 amount;
u32 count; u32 count;
u32 reg; u32 reg;
...@@ -2892,6 +2893,12 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) ...@@ -2892,6 +2893,12 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
reg |= DWC3_GEVNTSIZ_INTMASK; reg |= DWC3_GEVNTSIZ_INTMASK;
dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), reg); dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), reg);
amount = min(count, evt->length - evt->lpos);
memcpy(evt->cache + evt->lpos, evt->buf + evt->lpos, amount);
if (amount < count)
memcpy(evt->cache, evt->buf, count - amount);
return IRQ_WAKE_THREAD; return IRQ_WAKE_THREAD;
} }
......
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