|
@@ -203,13 +203,10 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
|
|
|
static void dwc3_free_event_buffers(struct dwc3 *dwc)
|
|
|
{
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
- int i;
|
|
|
|
|
|
- for (i = 0; i < dwc->num_event_buffers; i++) {
|
|
|
- evt = dwc->ev_buffs[i];
|
|
|
- if (evt)
|
|
|
- dwc3_free_one_event_buffer(dwc, evt);
|
|
|
- }
|
|
|
+ evt = dwc->ev_buffs[0];
|
|
|
+ if (evt)
|
|
|
+ dwc3_free_one_event_buffer(dwc, evt);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -222,27 +219,19 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
|
|
|
*/
|
|
|
static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length)
|
|
|
{
|
|
|
- int num;
|
|
|
- int i;
|
|
|
-
|
|
|
- num = DWC3_NUM_INT(dwc->hwparams.hwparams1);
|
|
|
- dwc->num_event_buffers = num;
|
|
|
+ struct dwc3_event_buffer *evt;
|
|
|
|
|
|
- dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs) * num,
|
|
|
+ dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs),
|
|
|
GFP_KERNEL);
|
|
|
if (!dwc->ev_buffs)
|
|
|
return -ENOMEM;
|
|
|
|
|
|
- for (i = 0; i < num; i++) {
|
|
|
- struct dwc3_event_buffer *evt;
|
|
|
-
|
|
|
- evt = dwc3_alloc_one_event_buffer(dwc, length);
|
|
|
- if (IS_ERR(evt)) {
|
|
|
- dev_err(dwc->dev, "can't allocate event buffer\n");
|
|
|
- return PTR_ERR(evt);
|
|
|
- }
|
|
|
- dwc->ev_buffs[i] = evt;
|
|
|
+ evt = dwc3_alloc_one_event_buffer(dwc, length);
|
|
|
+ if (IS_ERR(evt)) {
|
|
|
+ dev_err(dwc->dev, "can't allocate event buffer\n");
|
|
|
+ return PTR_ERR(evt);
|
|
|
}
|
|
|
+ dwc->ev_buffs[0] = evt;
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -256,25 +245,22 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length)
|
|
|
static int dwc3_event_buffers_setup(struct dwc3 *dwc)
|
|
|
{
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
- int n;
|
|
|
|
|
|
- for (n = 0; n < dwc->num_event_buffers; n++) {
|
|
|
- evt = dwc->ev_buffs[n];
|
|
|
- dwc3_trace(trace_dwc3_core,
|
|
|
- "Event buf %p dma %08llx length %d\n",
|
|
|
- evt->buf, (unsigned long long) evt->dma,
|
|
|
- evt->length);
|
|
|
-
|
|
|
- evt->lpos = 0;
|
|
|
-
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(n),
|
|
|
- lower_32_bits(evt->dma));
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(n),
|
|
|
- upper_32_bits(evt->dma));
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(n),
|
|
|
- DWC3_GEVNTSIZ_SIZE(evt->length));
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(n), 0);
|
|
|
- }
|
|
|
+ evt = dwc->ev_buffs[0];
|
|
|
+ dwc3_trace(trace_dwc3_core,
|
|
|
+ "Event buf %p dma %08llx length %d\n",
|
|
|
+ evt->buf, (unsigned long long) evt->dma,
|
|
|
+ evt->length);
|
|
|
+
|
|
|
+ evt->lpos = 0;
|
|
|
+
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0),
|
|
|
+ lower_32_bits(evt->dma));
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0),
|
|
|
+ upper_32_bits(evt->dma));
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0),
|
|
|
+ DWC3_GEVNTSIZ_SIZE(evt->length));
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -282,19 +268,16 @@ static int dwc3_event_buffers_setup(struct dwc3 *dwc)
|
|
|
static void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
|
|
|
{
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
- int n;
|
|
|
|
|
|
- for (n = 0; n < dwc->num_event_buffers; n++) {
|
|
|
- evt = dwc->ev_buffs[n];
|
|
|
+ evt = dwc->ev_buffs[0];
|
|
|
|
|
|
- evt->lpos = 0;
|
|
|
+ evt->lpos = 0;
|
|
|
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(n), 0);
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(n), 0);
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(n), DWC3_GEVNTSIZ_INTMASK
|
|
|
- | DWC3_GEVNTSIZ_SIZE(0));
|
|
|
- dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(n), 0);
|
|
|
- }
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0), 0);
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), 0);
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK
|
|
|
+ | DWC3_GEVNTSIZ_SIZE(0));
|
|
|
+ dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0);
|
|
|
}
|
|
|
|
|
|
static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc)
|