Browse Source

Merge branch 'ti-linux-4.19.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into processor-sdk-linux-4.19.y

TI-Feature: ti_linux_base-4.19
TI-Tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
TI-Branch: ti-linux-4.19.y

* 'ti-linux-4.19.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel:
  dts: am65: add ti,dis-chg-det-quirk flag to usb phy nodes
  phy: omap-usb2-phy: disable phy charger detect
  dt-bindings: phy: ti: add disabling charger detect quirk

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
Jacob Stiffler 6 years ago
parent
commit
c49dafa497

+ 3 - 0
Documentation/devicetree/bindings/phy/ti-phy.txt

@@ -53,6 +53,9 @@ Recommended properies:
 - syscon-phy-power : phandle/offset pair. Phandle to the system control
   module and the register offset to power on/off the PHY.
 
+Optional properties:
+ - ti,dis-chg-det-quirk : when set the phy will disable CHG_DET logic
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb2phy@4a0ad080 {

+ 2 - 0
arch/arm64/boot/dts/ti/k3-am65-main.dtsi

@@ -1434,6 +1434,7 @@
 		clocks = <&k3_clks 151 0>, <&k3_clks 151 1>;
 		clock-names = "wkupclk", "refclk";
 		#phy-cells = <0>;
+		ti,dis-chg-det-quirk;
 	};
 
 	dwc3_1: dwc3@4020000 {
@@ -1471,6 +1472,7 @@
 		clocks = <&k3_clks 152 0>, <&k3_clks 152 1>;
 		clock-names = "wkupclk", "refclk";
 		#phy-cells = <0>;
+		ti,dis-chg-det-quirk;
 	};
 
 	main_spi0: spi@2100000 {

+ 28 - 6
drivers/phy/ti/phy-omap-usb2.c

@@ -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");

+ 1 - 0
include/linux/phy/omap_usb.h

@@ -66,6 +66,7 @@ struct usb_phy_data {
 #define OMAP_USB2_HAS_START_SRP (1 << 0)
 #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
+#define OMAP_USB2_DISABLE_CHG_DET (1 << 3)
 
 #define OMAP_DEV_PHY_PD		BIT(0)
 #define OMAP_USB2_PHY_PD	BIT(28)