]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commitdiff
dwc3: core: Enable GUCTL1 chicken bit 9 for correcting Inter Packet Delay(IPD)
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Wed, 10 May 2017 14:12:01 +0000 (19:42 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 20 Jun 2017 12:13:35 +0000 (14:13 +0200)
SNPS controller when configureed in HOST mode maintains Inter Packet
Delay (IPD) of ~380ns which works with most of super-speed hubs except
VIA-LAB hubs. When IPD is ~380ns HOST controller fails to enumerate FS/LS
devices when connected behind VIA-LAB hubs.
Enabling bit 9 of GUCTL1 enables the workaround in HW to reduce the ULPI
clock latency by 1 cycle, thus reducing the IPD (~360ns) and making
controller enumerate FS/LS devices connected behind VIA-LAB.
This patch fixes the same.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Documentation/devicetree/bindings/usb/dwc3.txt
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h

index 6a02c031c611e825da93832194cda15461775707..42b948145bac3477e6b5e6e9ddff69edd060831e 100644 (file)
@@ -57,6 +57,9 @@ Optional properties:
        thus enabling the workaround in HW to fix the issue where the controller
        was not able to generate correct CRC checksum on the very first transfer
        packet after sending resume signal.
+ - snps,enable_guctl1_ipd_quirk: Adding this flag sets bit 9 of GUCTL1
+       enabling the workaround in HW to reduce the Inter Packet Delay (IPD)
+       and making controller enumerate FS/LS devices connected behind VIA-LAB.
 
  - <DEPRECATED> tx-fifo-resize: determines if the FIFO *has* to be reallocated.
 
index f6d4c40975571e681422606eac89b20592dd0ac5..0a41794de7f838b0396909d842177a978fe94a53 100644 (file)
@@ -834,6 +834,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
                dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
        }
 
+       /* SNPS controller when configureed in HOST mode maintains Inter Packet
+        * Delay (IPD) of ~380ns which works with most of the super-speed hubs
+        * except VIA-LAB hubs. When IPD is ~380ns HOST controller fails to
+        * enumerate FS/LS devices when connected behind VIA-LAB hubs.
+        * Enabling bit 9 of GUCTL1 enables the workaround in HW to reduce the
+        * ULPI clock latency by 1 cycle, thus reducing the IPD (~360ns) and
+        * making controller enumerate FS/LS devices connected behind VIA-LAB.
+        */
+       if (dwc->enable_guctl1_ipd_quirk) {
+               reg = dwc3_readl(dwc->regs, DWC3_GUCTL1);
+               reg |= DWC3_GUCTL1_IPD_QUIRK;
+               dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
+       }
+
        return 0;
 
 err4:
@@ -1117,6 +1131,8 @@ static int dwc3_probe(struct platform_device *pdev)
                                                      "snps,refclk_fladj");
        dwc->enable_guctl1_resume_quirk = device_property_read_bool(dev,
                                "snps,enable_guctl1_resume_quirk");
+       dwc->enable_guctl1_ipd_quirk = device_property_read_bool(dev,
+                               "snps,enable_guctl1_ipd_quirk");
 
        dwc->lpm_nyet_threshold = lpm_nyet_threshold;
        dwc->tx_de_emphasis = tx_de_emphasis;
index 65a80fba9a6d7bbd75c3f3f198b475a9bf5afbf9..dac1d6e7c36815a656e77284df445c197f5b91f0 100644 (file)
 
 /* Global User Control Register 1 */
 #define DWC3_GUCTL1_RESUME_QUIRK               (1 << 10)
+#define DWC3_GUCTL1_IPD_QUIRK                  (1 << 9)
 
 /* Global User Control Register 2 */
 #define DWC3_GUCTL2_RST_ACTBITLATER            (1 << 14)
@@ -845,6 +846,8 @@ struct dwc3_scratchpad_array {
  *                     change quirk.
  * @enable_guctl1_resume_quirk: Set if we enable quirk for fixing improper crc
  *                     generation after resume from suspend.
+ * @enable_guctl1_ipd_quirk: set if we enable quirk for reducing timing of inter
+ *                     packet delay(ipd).
  * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
  * @tx_de_emphasis: Tx de-emphasis value
  *     0       - -6dB de-emphasis
@@ -998,6 +1001,7 @@ struct dwc3 {
        unsigned                dis_u2_freeclk_exists_quirk:1;
        unsigned                dis_del_phy_power_chg_quirk:1;
        unsigned                enable_guctl1_resume_quirk:1;
+       unsigned                enable_guctl1_ipd_quirk:1;
 
        unsigned                tx_de_emphasis_quirk:1;
        unsigned                tx_de_emphasis:2;