usb: dwc3: add dis_u2_freeclk_exists_quirk
authorWu Liang feng <wulf@rock-chips.com>
Thu, 24 Mar 2016 05:00:48 +0000 (13:00 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Thu, 24 Mar 2016 08:37:38 +0000 (16:37 +0800)
Add a quirk to clear the GUSB2PHYCFG.U2_FREECLK_EXISTS bit,
which specifies whether the USB2.0 PHY provides a free-running
PHY clock, which is active when the clock control input is active.

Change-Id: I84ea6eeccb9fc2ea6d13ef586f1166d5fa132606
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
Documentation/devicetree/bindings/usb/dwc3.txt
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/platform_data.h

index fb2ad0acedbdbe0db4253b0fe4c2818f13f8ef71..c005ada1fa81cf6141a88613a1fb2086df26f962 100644 (file)
@@ -38,6 +38,9 @@ Optional properties:
  - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy.
  - snps,dis_enblslpm_quirk: when set clears the enblslpm in GUSB2PHYCFG,
                        disabling the suspend signal to the PHY.
+ - snps,dis_u2_freeclk_exists_quirk: when set, clear the u2_freeclk_exists
+                       in GUSB2PHYCFG, specify that USB2 PHY doesn't provide
+                       a free-running PHY clock.
  - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal
                        utmi_l1_suspend_n, false when asserts utmi_sleep_n
  - snps,hird-threshold: HIRD threshold
index 2479c241945c3c3a3f825723df171090cfa74df4..47f3ab7e45a5eac8593236c966c982fc15b72a13 100644 (file)
@@ -519,6 +519,9 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
        if (dwc->dis_enblslpm_quirk)
                reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
 
+       if (dwc->dis_u2_freeclk_exists_quirk)
+               reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS;
+
        dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
 
        return 0;
@@ -934,6 +937,8 @@ static int dwc3_probe(struct platform_device *pdev)
                                "snps,dis_u2_susphy_quirk");
        dwc->dis_enblslpm_quirk = device_property_read_bool(dev,
                                "snps,dis_enblslpm_quirk");
+       dwc->dis_u2_freeclk_exists_quirk = device_property_read_bool(dev,
+                               "snps,dis_u2_freeclk_exists_quirk");
 
        dwc->tx_de_emphasis_quirk = device_property_read_bool(dev,
                                "snps,tx_de_emphasis_quirk");
@@ -968,6 +973,8 @@ static int dwc3_probe(struct platform_device *pdev)
                dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk;
                dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk;
                dwc->dis_enblslpm_quirk = pdata->dis_enblslpm_quirk;
+               dwc->dis_u2_freeclk_exists_quirk =
+                                       pdata->dis_u2_freeclk_exists_quirk;
 
                dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;
                if (pdata->tx_de_emphasis)
index e4f8b90d9627f9baed5fe4f7fd6dcac7963f49f5..8e57ea6148ec2394956dbd9b406dfff1e3cd6f75 100644 (file)
 
 /* Global USB2 PHY Configuration Register */
 #define DWC3_GUSB2PHYCFG_PHYSOFTRST    (1 << 31)
+#define DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS     (1 << 30)
 #define DWC3_GUSB2PHYCFG_SUSPHY                (1 << 6)
 #define DWC3_GUSB2PHYCFG_ULPI_UTMI     (1 << 4)
 #define DWC3_GUSB2PHYCFG_ENBLSLPM      (1 << 8)
@@ -725,6 +726,9 @@ struct dwc3_scratchpad_array {
  * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy
  * @dis_enblslpm_quirk: set if we clear enblslpm in GUSB2PHYCFG,
  *                      disabling the suspend signal to the PHY.
+ * @dis_u2_freeclk_exists_quirk : set if we clear u2_freeclk_exists
+ *                     in GUSB2PHYCFG, specify that USB2 PHY doesn't
+ *                     provide a free-running PHY clock.
  * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
  * @tx_de_emphasis: Tx de-emphasis value
  *     0       - -6dB de-emphasis
@@ -870,6 +874,7 @@ struct dwc3 {
        unsigned                dis_u3_susphy_quirk:1;
        unsigned                dis_u2_susphy_quirk:1;
        unsigned                dis_enblslpm_quirk:1;
+       unsigned                dis_u2_freeclk_exists_quirk:1;
 
        unsigned                tx_de_emphasis_quirk:1;
        unsigned                tx_de_emphasis:2;
index 2bb4d3ad0e6b724d71ceae0261955a2551c6859b..5e1209817ce0aed7765097dee25120e0f3d6ffb2 100644 (file)
@@ -43,6 +43,7 @@ struct dwc3_platform_data {
        unsigned dis_u3_susphy_quirk:1;
        unsigned dis_u2_susphy_quirk:1;
        unsigned dis_enblslpm_quirk:1;
+       unsigned dis_u2_freeclk_exists_quirk:1;
 
        unsigned tx_de_emphasis_quirk:1;
        unsigned tx_de_emphasis:2;