USB: dwc: Add a warning message about Vendor Device LMP event
The current code is not handling vendor device test LMP event but enables
it in the DEVTEN register. Fix it by not enabling this event in DEVTEN
register.
However controllers prior to 2.30a revision has a bug, due to which a
vendor device test LMP event can not be filtered. But this event is not
handled in the current code. This is a special event and 8 bytes of data
will follow the event. Handling this event is tricky when event buffer
is almost full. Moreover this event will not occur in normal scenario and
can only happen with special hosts in testing scenarios. Add a warning
message to indicate that this event is received which means that event
buffer might have corrupted.
CRs-fixed: 371306
Change-Id: I2858a3f1d90966f168e7e999f613396db7b1a972
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 68d9ca2..98adff7 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -73,6 +73,7 @@
#define DWC3_DEVICE_EVENT_ERRATIC_ERROR 9
#define DWC3_DEVICE_EVENT_CMD_CMPL 10
#define DWC3_DEVICE_EVENT_OVERFLOW 11
+#define DWC3_DEVICE_EVENT_VENDOR_DEV_TEST_LMP 12
#define DWC3_GEVNTCOUNT_MASK 0xfffc
#define DWC3_GSNPSID_MASK 0xffff0000
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index f0fc07b..060144f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2220,6 +2220,21 @@
if (dwc->revision < DWC3_REVISION_230A)
dev_warn(dwc->dev, "Unacknowledged event overwritten\n");
break;
+ case DWC3_DEVICE_EVENT_VENDOR_DEV_TEST_LMP:
+ /*
+ * Controllers prior to 2.30a revision has a bug, due to which
+ * a vendor device test LMP event can not be filtered. But
+ * this event is not handled in the current code. This is a
+ * special event and 8 bytes of data will follow the event.
+ * Handling this event is tricky when event buffer is almost
+ * full. Moreover this event will not occur in normal scenario
+ * and can only happen with special hosts in testing scenarios.
+ * Add a warning message to indicate that this event is received
+ * which means that event buffer might have corrupted.
+ */
+ if (dwc->revision < DWC3_REVISION_230A)
+ dev_warn(dwc->dev, "Vendor Device Test LMP Received\n");
+ break;
default:
dev_dbg(dwc->dev, "UNKNOWN IRQ %d\n", event->type);
}
@@ -2380,8 +2395,7 @@
}
/* Enable all but Start and End of Frame IRQs */
- reg = (DWC3_DEVTEN_VNDRDEVTSTRCVEDEN |
- DWC3_DEVTEN_EVNTOVERFLOWEN |
+ reg = (DWC3_DEVTEN_EVNTOVERFLOWEN |
DWC3_DEVTEN_CMDCMPLTEN |
DWC3_DEVTEN_ERRTICERREN |
DWC3_DEVTEN_WKUPEVTEN |