aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Youn <John.Youn@synopsys.com>2015-09-04 22:15:10 -0400
committerFelipe Balbi <balbi@ti.com>2015-10-09 17:06:58 -0400
commit690fb3718a70c66004342f6f5e2e8a5f95b977db (patch)
treec157df6a98ce524145fbe0796bef705c18e1149c
parente8095a25364a30216ad40dbe8893ed5c3c235949 (diff)
usb: dwc3: Support Synopsys USB 3.1 IP
This patch allows the dwc3 driver to run on the new Synopsys USB 3.1 IP core, albeit in USB 3.0 mode only. The Synopsys USB 3.1 IP (DWC_usb31) retains mostly the same register interface and programming model as the existing USB 3.0 controller IP (DWC_usb3). However the GSNPSID and version numbers are different. Add checking for the new ID to pass driver probe. Also, since the DWC_usb31 version number is lower in value than the full GSNPSID of the DWC_usb3 IP, we set the high bit to identify DWC_usb31 and to ensure the values are higher. Finally, add a documentation note about the revision numbering scheme. Any future revision checks (for STARS, workarounds, and new features) should take into consideration how it applies to both the 3.1/3.0 IP. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/dwc3/core.c10
-rw-r--r--drivers/usb/dwc3/core.h18
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index c72c8c5c1c5a..1e276d5662f2 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -534,12 +534,18 @@ static int dwc3_core_init(struct dwc3 *dwc)
534 534
535 reg = dwc3_readl(dwc->regs, DWC3_GSNPSID); 535 reg = dwc3_readl(dwc->regs, DWC3_GSNPSID);
536 /* This should read as U3 followed by revision number */ 536 /* This should read as U3 followed by revision number */
537 if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) { 537 if ((reg & DWC3_GSNPSID_MASK) == 0x55330000) {
538 /* Detected DWC_usb3 IP */
539 dwc->revision = reg;
540 } else if ((reg & DWC3_GSNPSID_MASK) == 0x33310000) {
541 /* Detected DWC_usb31 IP */
542 dwc->revision = dwc3_readl(dwc->regs, DWC3_VER_NUMBER);
543 dwc->revision |= DWC3_REVISION_IS_DWC31;
544 } else {
538 dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); 545 dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
539 ret = -ENODEV; 546 ret = -ENODEV;
540 goto err0; 547 goto err0;
541 } 548 }
542 dwc->revision = reg;
543 549
544 /* 550 /*
545 * Write Linux Version Code to our GUID register so it's easy to figure 551 * Write Linux Version Code to our GUID register so it's easy to figure
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 91887455133a..0d65be744552 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -108,6 +108,9 @@
108#define DWC3_GPRTBIMAP_FS0 0xc188 108#define DWC3_GPRTBIMAP_FS0 0xc188
109#define DWC3_GPRTBIMAP_FS1 0xc18c 109#define DWC3_GPRTBIMAP_FS1 0xc18c
110 110
111#define DWC3_VER_NUMBER 0xc1a0
112#define DWC3_VER_TYPE 0xc1a4
113
111#define DWC3_GUSB2PHYCFG(n) (0xc200 + (n * 0x04)) 114#define DWC3_GUSB2PHYCFG(n) (0xc200 + (n * 0x04))
112#define DWC3_GUSB2I2CCTL(n) (0xc240 + (n * 0x04)) 115#define DWC3_GUSB2I2CCTL(n) (0xc240 + (n * 0x04))
113 116
@@ -771,6 +774,14 @@ struct dwc3 {
771 u32 num_event_buffers; 774 u32 num_event_buffers;
772 u32 u1u2; 775 u32 u1u2;
773 u32 maximum_speed; 776 u32 maximum_speed;
777
778 /*
779 * All 3.1 IP version constants are greater than the 3.0 IP
780 * version constants. This works for most version checks in
781 * dwc3. However, in the future, this may not apply as
782 * features may be developed on newer versions of the 3.0 IP
783 * that are not in the 3.1 IP.
784 */
774 u32 revision; 785 u32 revision;
775 786
776#define DWC3_REVISION_173A 0x5533173a 787#define DWC3_REVISION_173A 0x5533173a
@@ -793,6 +804,13 @@ struct dwc3 {
793#define DWC3_REVISION_270A 0x5533270a 804#define DWC3_REVISION_270A 0x5533270a
794#define DWC3_REVISION_280A 0x5533280a 805#define DWC3_REVISION_280A 0x5533280a
795 806
807/*
808 * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really
809 * just so dwc31 revisions are always larger than dwc3.
810 */
811#define DWC3_REVISION_IS_DWC31 0x80000000
812#define DWC3_USB31_REVISION_110A (0x3131302a | DWC3_REVISION_IS_USB31)
813
796 enum dwc3_ep0_next ep0_next_event; 814 enum dwc3_ep0_next ep0_next_event;
797 enum dwc3_ep0_state ep0state; 815 enum dwc3_ep0_state ep0state;
798 enum dwc3_link_state link_state; 816 enum dwc3_link_state link_state;