[U-Boot] [PATCH 08/11] usb: dwc3: optimize interrupt loop
Lukasz Majewski
l.majewski at samsung.com
Mon Feb 23 15:02:29 CET 2015
From: Marek Szyprowski <m.szyprowski at samsung.com>
There is no point in calling dwc3_thread_interrupt() if no event is
pending. There is also no point in flushing event cache in EVERY loop
iteration.
Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
---
drivers/usb/dwc3/core.c | 7 -------
drivers/usb/dwc3/gadget.c | 15 +++++++++++++--
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index fc3b0d9..846475a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -844,18 +844,11 @@ void dwc3_uboot_exit(int index)
void dwc3_uboot_handle_interrupt(int index)
{
struct dwc3 *dwc = NULL;
- int i;
- struct dwc3_event_buffer *evt;
list_for_each_entry(dwc, &dwc3_list, list) {
if (dwc->index != index)
continue;
- for (i = 0; i < dwc->num_event_buffers; i++) {
- evt = dwc->ev_buffs[i];
- dwc3_flush_cache((int)evt->buf, evt->length);
- }
-
dwc3_gadget_uboot_handle_interrupt(dwc);
break;
}
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index f8a75d3..4a4923f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2680,6 +2680,17 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
*/
void dwc3_gadget_uboot_handle_interrupt(struct dwc3 *dwc)
{
- dwc3_interrupt(0, dwc);
- dwc3_thread_interrupt(0, dwc);
+ int ret = dwc3_interrupt(0, dwc);
+
+ if (ret == IRQ_WAKE_THREAD) {
+ int i;
+ struct dwc3_event_buffer *evt;
+
+ for (i = 0; i < dwc->num_event_buffers; i++) {
+ evt = dwc->ev_buffs[i];
+ dwc3_flush_cache((int)evt->buf, evt->length);
+ }
+
+ dwc3_thread_interrupt(0, dwc);
+ }
}
--
2.0.0.rc2
More information about the U-Boot
mailing list