|
|
@@ -34,8 +34,12 @@
|
|
|
#include <linux/of_platform.h>
|
|
|
|
|
|
#define USB2PHY_DISCON_BYP_LATCH (1 << 31)
|
|
|
+#define USB2PHY_CHRG_DET 0x14
|
|
|
#define USB2PHY_ANA_CONFIG1 0x4c
|
|
|
|
|
|
+#define USB2PHY_USE_CHG_DET_REG BIT(29)
|
|
|
+#define USB2PHY_DIS_CHG_DET BIT(28)
|
|
|
+
|
|
|
#define AM654_USB2_OTG_PD BIT(8)
|
|
|
#define AM654_USB2_VBUS_DET_EN BIT(5)
|
|
|
#define AM654_USB2_VBUSVALID_DET_EN BIT(4)
|
|
|
@@ -194,6 +198,12 @@ static int omap_usb_init(struct phy *x)
|
|
|
omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
|
|
|
}
|
|
|
|
|
|
+ if (phy->flags & OMAP_USB2_DISABLE_CHG_DET) {
|
|
|
+ val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
|
|
|
+ val |= USB2PHY_USE_CHG_DET_REG | USB2PHY_DIS_CHG_DET;
|
|
|
+ omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -325,13 +335,25 @@ static int omap_usb2_probe(struct platform_device *pdev)
|
|
|
phy->power_on = phy_data->power_on;
|
|
|
phy->power_off = phy_data->power_off;
|
|
|
|
|
|
- if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
|
|
|
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
- phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
|
|
|
- if (IS_ERR(phy->phy_base))
|
|
|
- return PTR_ERR(phy->phy_base);
|
|
|
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
+ phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
|
|
|
+ if (IS_ERR(phy->phy_base))
|
|
|
+ return PTR_ERR(phy->phy_base);
|
|
|
+
|
|
|
+ if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT)
|
|
|
phy->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 (device_property_read_bool(phy->dev, "ti,dis-chg-det-quirk"))
|
|
|
+ phy->flags |= OMAP_USB2_DISABLE_CHG_DET;
|
|
|
|
|
|
phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
|
|
|
"syscon-phy-power");
|