summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorBin Liu <b-liu@ti.com>2020-06-03 14:46:22 +0300
committerLokesh Vutla <lokeshvutla@ti.com>2020-06-16 14:30:02 +0300
commit5b9ee0fc6f9adb05eefa457a752626cb22cca958 (patch)
tree0100d63897f6c34f250f97ff6ca974ea973068a1 /drivers/phy
parent94e837b6fc4194c61ec12fd087c2ed26f94a50d3 (diff)
downloadu-boot-5b9ee0fc6f9adb05eefa457a752626cb22cca958.tar.xz
phy: omap-usb2-phy: disable phy charger detect
AM654x PG1.0 has a silicon bug that D+ is pulled high after POR, which could cause enumeration failure with some USB hubs. Disabling the USB2_PHY Charger Detect function will put D+ into the normal state. Using property "ti,dis-chg-det-quirk" in the DT usb2-phy node to enable this workaround for AM654x PG1.0. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/omap-usb2-phy.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/drivers/phy/omap-usb2-phy.c b/drivers/phy/omap-usb2-phy.c
index 0793b97dd5..adc454ddd4 100644
--- a/drivers/phy/omap-usb2-phy.c
+++ b/drivers/phy/omap-usb2-phy.c
@@ -17,6 +17,7 @@
#include <linux/err.h>
#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(0)
+#define OMAP_USB2_DISABLE_CHG_DET BIT(1)
#define OMAP_DEV_PHY_PD BIT(0)
#define OMAP_USB2_PHY_PD BIT(28)
@@ -33,6 +34,10 @@
#define AM654_USB2_VBUS_DET_EN BIT(5)
#define AM654_USB2_VBUSVALID_DET_EN BIT(4)
+#define USB2PHY_CHRG_DET 0x14
+#define USB2PHY_USE_CHG_DET_REG BIT(29)
+#define USB2PHY_DIS_CHG_DET BIT(28)
+
DECLARE_GLOBAL_DATA_PTR;
struct omap_usb2_phy {
@@ -160,6 +165,12 @@ static int omap_usb2_phy_init(struct phy *usb_phy)
writel(val, priv->phy_base + USB2PHY_ANA_CONFIG1);
}
+ if (priv->flags & OMAP_USB2_DISABLE_CHG_DET) {
+ val = readl(priv->phy_base + USB2PHY_CHRG_DET);
+ val |= USB2PHY_USE_CHG_DET_REG | USB2PHY_DIS_CHG_DET;
+ writel(val, priv->phy_base + USB2PHY_CHRG_DET);
+ }
+
return 0;
}
@@ -197,13 +208,25 @@ int omap_usb2_phy_probe(struct udevice *dev)
if (!data)
return -EINVAL;
- if (data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
- priv->phy_base = dev_read_addr_ptr(dev);
+ priv->phy_base = dev_read_addr_ptr(dev);
- if (!priv->phy_base)
- return -EINVAL;
+ if (!priv->phy_base)
+ return -EINVAL;
+
+ if (data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT)
priv->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
- }
+
+ /*
+ * AM654x PG1.0 has a silicon bug that D+ is pulled high after
+ * POR, which could cause enumeration failure with some USB hubs.
+ * Disabling the USB2_PHY Charger Detect function will put D+
+ * into the normal state.
+ *
+ * Using property "ti,dis-chg-det-quirk" in the DT usb2-phy node
+ * to enable this workaround for AM654x PG1.0.
+ */
+ if (dev_read_bool(dev, "ti,dis-chg-det-quirk"))
+ priv->flags |= OMAP_USB2_DISABLE_CHG_DET;
regmap = syscon_regmap_lookup_by_phandle(dev, "syscon-phy-power");
if (!IS_ERR(regmap)) {