aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/cdns3/drd.c
diff options
context:
space:
mode:
authorPawel Laszczak <pawell@cadence.com>2020-09-15 14:45:43 +0300
committerFelipe Balbi <balbi@kernel.org>2020-10-02 09:57:39 +0300
commit2eae2dfd581420f94d6041dddc7a88d7ae9ce2ff (patch)
tree01230e0fa5c5bdea716d0b7eab188d3395fb292e /drivers/usb/cdns3/drd.c
parentdt-bindings: usb: cdns,usb3: Add cdns,phyrst-a-enable property (diff)
downloadwireguard-linux-2eae2dfd581420f94d6041dddc7a88d7ae9ce2ff.tar.xz
wireguard-linux-2eae2dfd581420f94d6041dddc7a88d7ae9ce2ff.zip
usb: cdns3: Enable workaround for USB2.0 PHY Rx compliance test PHY lockup
USB2.0 PHY hangs in Rx Compliance test when the incoming packet amplitude is varied below and above the Squelch Level of Receiver during the active packet multiple times. Version 1 of the controller allows PHY to be reset when RX fail condition is detected to work around the above issue. This feature is disabled by default and needs to be enabled using a bit from the newly added PHYRST_CFG register. This patch enables the workaround. There is no way to know controller version before device controller is started and the workaround needs to be applied for both host and device modes, so we rely on a DT property do decide when to apply the workaround. Signed-off-by: Pawel Laszczak <pawell@cadence.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/cdns3/drd.c')
-rw-r--r--drivers/usb/cdns3/drd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c
index 5f2685cadf5e..fcd295f566b2 100644
--- a/drivers/usb/cdns3/drd.c
+++ b/drivers/usb/cdns3/drd.c
@@ -42,6 +42,18 @@ int cdns3_set_mode(struct cdns3 *cdns, enum usb_dr_mode mode)
reg = readl(&cdns->otg_v1_regs->override);
reg |= OVERRIDE_IDPULLUP;
writel(reg, &cdns->otg_v1_regs->override);
+
+ /*
+ * Enable work around feature built into the
+ * controller to address issue with RX Sensitivity
+ * est (EL_17) for USB2 PHY. The issue only occures
+ * for 0x0002450D controller version.
+ */
+ if (cdns->phyrst_a_enable) {
+ reg = readl(&cdns->otg_v1_regs->phyrst_cfg);
+ reg |= PHYRST_CFG_PHYRST_A_ENABLE;
+ writel(reg, &cdns->otg_v1_regs->phyrst_cfg);
+ }
} else {
reg = readl(&cdns->otg_v0_regs->ctrl1);
reg |= OVERRIDE_IDPULLUP_V0;