linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] phy: omap-usb2: add quirk to disable charger detection
@ 2020-07-16  8:22 Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Roger Quadros @ 2020-07-16  8:22 UTC (permalink / raw)
  To: kishon
  Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree, Roger Quadros

Hi,

- convert DT binding to YAML
- add DT property to disable charger detection
  (Errata i2075 for AM65 SR1.0)

Changelog:
v4
- fix example to fix dt_binding_check warnings
- '#phy-cells' -> "#phy-cells"
- Add 'oneOf' to compatible logic to allow just "ti,omap-usb2" as valid

v3
- Removed quotes from compatibles
- changed property to "ti,disable-charger-det"

v2
- Address Rob's comments on YAML schema.

cheers,
-roger

Roger Quadros (3):
  dt-binding: phy: convert ti,omap-usb2 to YAML
  dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection
  phy: omap-usb2-phy: disable PHY charger detect

 .../devicetree/bindings/phy/ti,omap-usb2.yaml | 77 +++++++++++++++++++
 .../devicetree/bindings/phy/ti-phy.txt        | 37 ---------
 drivers/phy/ti/phy-omap-usb2.c                | 35 +++++++--
 3 files changed, 105 insertions(+), 44 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML
  2020-07-16  8:22 [PATCH v4 0/3] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
@ 2020-07-16  8:22 ` Roger Quadros
  2020-08-20 13:40   ` Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 2/3] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect Roger Quadros
  2 siblings, 1 reply; 8+ messages in thread
From: Roger Quadros @ 2020-07-16  8:22 UTC (permalink / raw)
  To: kishon
  Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree, Roger Quadros

Move ti,omap-usb2 to its own YAML schema.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/phy/ti,omap-usb2.yaml | 72 +++++++++++++++++++
 .../devicetree/bindings/phy/ti-phy.txt        | 37 ----------
 2 files changed, 72 insertions(+), 37 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml

diff --git a/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
new file mode 100644
index 000000000000..a05110351814
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/ti,omap-usb2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OMAP USB2 PHY
+
+maintainers:
+ - Kishon Vijay Abraham I <kishon@ti.com>
+ - Roger Quadros <rogerq@ti.com>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+        - enum:
+          - ti,dra7x-usb2
+          - ti,dra7x-usb2-phy2
+          - ti,am654-usb2
+        - enum:
+          - ti,omap-usb2
+      - items:
+        - const: ti,omap-usb2
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 0
+
+  clocks:
+    minItems: 1
+    items:
+      - description: wakeup clock
+      - description: reference clock
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: wkupclk
+      - const: refclk
+
+  syscon-phy-power:
+    $ref: /schemas/types.yaml#definitions/phandle-array
+    description:
+      phandle/offset pair. Phandle to the system control module and
+      register offset to power on/off the PHY.
+
+  ctrl-module:
+    $ref: /schemas/types.yaml#definitions/phandle
+    description:
+      (deprecated) phandle of the control module used by PHY driver
+      to power on the PHY. Use syscon-phy-power instead.
+
+required:
+  - compatible
+  - reg
+  - "#phy-cells"
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    usb0_phy: phy@4100000 {
+      compatible = "ti,am654-usb2", "ti,omap-usb2";
+      reg = <0x4100000 0x54>;
+      syscon-phy-power = <&scm_conf 0x4000>;
+      clocks = <&k3_clks 151 0>, <&k3_clks 151 1>;
+      clock-names = "wkupclk", "refclk";
+      #phy-cells = <0>;
+    };
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 8f93c3b694a7..60c9d0ac75e6 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -27,43 +27,6 @@ omap_control_usb: omap-control-usb@4a002300 {
         reg-names = "otghs_control";
 };
 
-OMAP USB2 PHY
-
-Required properties:
- - compatible: Should be "ti,omap-usb2"
-	       Should be "ti,dra7x-usb2" for the 1st instance of USB2 PHY on
-	       DRA7x
-	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
-	       in DRA7x
-	       Should be "ti,am654-usb2" for the USB2 PHYs on AM654.
- - reg : Address and length of the register set for the device.
- - #phy-cells: determine the number of cells that should be given in the
-   phandle while referencing this phy.
- - clocks: a list of phandles and clock-specifier pairs, one for each entry in
-   clock-names.
- - clock-names: should include:
-   * "wkupclk" - wakeup clock.
-   * "refclk" - reference clock (optional).
-
-Deprecated properties:
- - ctrl-module : phandle of the control module used by PHY driver to power on
-   the PHY.
-
-Recommended properies:
-- syscon-phy-power : phandle/offset pair. Phandle to the system control
-  module and the register offset to power on/off the PHY.
-
-This is usually a subnode of ocp2scp to which it is connected.
-
-usb2phy@4a0ad080 {
-	compatible = "ti,omap-usb2";
-	reg = <0x4a0ad080 0x58>;
-	ctrl-module = <&omap_control_usb>;
-	#phy-cells = <0>;
-	clocks = <&usb_phy_cm_clk32k>, <&usb_otg_ss_refclk960m>;
-	clock-names = "wkupclk", "refclk";
-};
-
 TI PIPE3 PHY
 
 Required properties:
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 2/3] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection
  2020-07-16  8:22 [PATCH v4 0/3] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
@ 2020-07-16  8:22 ` Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect Roger Quadros
  2 siblings, 0 replies; 8+ messages in thread
From: Roger Quadros @ 2020-07-16  8:22 UTC (permalink / raw)
  To: kishon
  Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree, Roger Quadros

Add "ti,disable-charger-det" property to disable the USB2_PHY Charger Detect
logic.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
index a05110351814..7d52c5bf9f21 100644
--- a/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
+++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
@@ -53,6 +53,11 @@ properties:
       (deprecated) phandle of the control module used by PHY driver
       to power on the PHY. Use syscon-phy-power instead.
 
+  ti,disable-charger-det:
+    description:
+      if present, driver will disable charger detection logic.
+    type: boolean
+
 required:
   - compatible
   - reg
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect
  2020-07-16  8:22 [PATCH v4 0/3] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
  2020-07-16  8:22 ` [PATCH v4 2/3] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection Roger Quadros
@ 2020-07-16  8:22 ` Roger Quadros
  2020-08-19  9:02   ` Jan Kiszka
  2 siblings, 1 reply; 8+ messages in thread
From: Roger Quadros @ 2020-07-16  8:22 UTC (permalink / raw)
  To: kishon
  Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree,
	Roger Quadros, Bin Liu

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,disable-charger-det" in the DT usb2-phy node to
enable this workaround for AM654x PG1.0.

This addresses Silicon Errata:
i2075 - "USB2PHY: USB2PHY Charger Detect is Enabled by Default Without VBUS
Presence"

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/phy/ti/phy-omap-usb2.c | 35 +++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index cb2dd3230fa7..21c3904d4efc 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -26,6 +26,10 @@
 #define USB2PHY_ANA_CONFIG1		0x4c
 #define USB2PHY_DISCON_BYP_LATCH	BIT(31)
 
+#define USB2PHY_CHRG_DET			0x14
+#define USB2PHY_CHRG_DET_USE_CHG_DET_REG	BIT(29)
+#define USB2PHY_CHRG_DET_DIS_CHG_DET		BIT(28)
+
 /* SoC Specific USB2_OTG register definitions */
 #define AM654_USB2_OTG_PD		BIT(8)
 #define AM654_USB2_VBUS_DET_EN		BIT(5)
@@ -43,6 +47,7 @@
 #define OMAP_USB2_HAS_START_SRP			BIT(0)
 #define OMAP_USB2_HAS_SET_VBUS			BIT(1)
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT	BIT(2)
+#define OMAP_USB2_DISABLE_CHRG_DET		BIT(3)
 
 struct omap_usb {
 	struct usb_phy		phy;
@@ -236,6 +241,13 @@ static int omap_usb_init(struct phy *x)
 		omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
 	}
 
+	if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) {
+		val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
+		val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG |
+		       USB2PHY_CHRG_DET_DIS_CHG_DET;
+		omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
+	}
+
 	return 0;
 }
 
@@ -366,14 +378,12 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	phy->mask		= phy_data->mask;
 	phy->power_on		= phy_data->power_on;
 	phy->power_off		= phy_data->power_off;
+	phy->flags		= phy_data->flags;
 
-	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);
-		phy->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);
 
 	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
 							"syscon-phy-power");
@@ -405,6 +415,17 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		}
 	}
 
+	/*
+	 * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
+	 * Default Without VBUS Presence.
+	 *
+	 * AM654x SR1.0 has a silicon bug due to which 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.
+	 */
+	if (of_property_read_bool(node, "ti,disable-charger-det"))
+		phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
 
 	phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
 	if (IS_ERR(phy->wkupclk)) {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect
  2020-07-16  8:22 ` [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect Roger Quadros
@ 2020-08-19  9:02   ` Jan Kiszka
  2020-08-19 14:28     ` Roger Quadros
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2020-08-19  9:02 UTC (permalink / raw)
  To: Roger Quadros, kishon
  Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree, Bin Liu

On 16.07.20 10:22, Roger Quadros wrote:
> 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,disable-charger-det" in the DT usb2-phy node to
> enable this workaround for AM654x PG1.0.
> 
> This addresses Silicon Errata:
> i2075 - "USB2PHY: USB2PHY Charger Detect is Enabled by Default Without VBUS
> Presence"
> 
> Signed-off-by: Bin Liu <b-liu@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/phy/ti/phy-omap-usb2.c | 35 +++++++++++++++++++++++++++-------
>  1 file changed, 28 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
> index cb2dd3230fa7..21c3904d4efc 100644
> --- a/drivers/phy/ti/phy-omap-usb2.c
> +++ b/drivers/phy/ti/phy-omap-usb2.c
> @@ -26,6 +26,10 @@
>  #define USB2PHY_ANA_CONFIG1		0x4c
>  #define USB2PHY_DISCON_BYP_LATCH	BIT(31)
>  
> +#define USB2PHY_CHRG_DET			0x14
> +#define USB2PHY_CHRG_DET_USE_CHG_DET_REG	BIT(29)
> +#define USB2PHY_CHRG_DET_DIS_CHG_DET		BIT(28)
> +
>  /* SoC Specific USB2_OTG register definitions */
>  #define AM654_USB2_OTG_PD		BIT(8)
>  #define AM654_USB2_VBUS_DET_EN		BIT(5)
> @@ -43,6 +47,7 @@
>  #define OMAP_USB2_HAS_START_SRP			BIT(0)
>  #define OMAP_USB2_HAS_SET_VBUS			BIT(1)
>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT	BIT(2)
> +#define OMAP_USB2_DISABLE_CHRG_DET		BIT(3)
>  
>  struct omap_usb {
>  	struct usb_phy		phy;
> @@ -236,6 +241,13 @@ static int omap_usb_init(struct phy *x)
>  		omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
>  	}
>  
> +	if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) {
> +		val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
> +		val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG |
> +		       USB2PHY_CHRG_DET_DIS_CHG_DET;
> +		omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
> +	}
> +
>  	return 0;
>  }
>  
> @@ -366,14 +378,12 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	phy->mask		= phy_data->mask;
>  	phy->power_on		= phy_data->power_on;
>  	phy->power_off		= phy_data->power_off;
> +	phy->flags		= phy_data->flags;
>  
> -	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);
> -		phy->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);
>  
>  	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
>  							"syscon-phy-power");
> @@ -405,6 +415,17 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	/*
> +	 * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
> +	 * Default Without VBUS Presence.
> +	 *
> +	 * AM654x SR1.0 has a silicon bug due to which 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.
> +	 */
> +	if (of_property_read_bool(node, "ti,disable-charger-det"))
> +		phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
>  
>  	phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
>  	if (IS_ERR(phy->wkupclk)) {
> 

Why a property, rather than SoC detection like in [1] and your previous
downstream version?

Jan

[1] https://patchwork.kernel.org/patch/11710643/

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect
  2020-08-19  9:02   ` Jan Kiszka
@ 2020-08-19 14:28     ` Roger Quadros
  0 siblings, 0 replies; 8+ messages in thread
From: Roger Quadros @ 2020-08-19 14:28 UTC (permalink / raw)
  To: Jan Kiszka, kishon
  Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree, Bin Liu

On 19/08/2020 12:02, Jan Kiszka wrote:
> On 16.07.20 10:22, Roger Quadros wrote:
>> 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,disable-charger-det" in the DT usb2-phy node to
>> enable this workaround for AM654x PG1.0.
>>
>> This addresses Silicon Errata:
>> i2075 - "USB2PHY: USB2PHY Charger Detect is Enabled by Default Without VBUS
>> Presence"
>>
>> Signed-off-by: Bin Liu <b-liu@ti.com>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>   drivers/phy/ti/phy-omap-usb2.c | 35 +++++++++++++++++++++++++++-------
>>   1 file changed, 28 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
>> index cb2dd3230fa7..21c3904d4efc 100644
>> --- a/drivers/phy/ti/phy-omap-usb2.c
>> +++ b/drivers/phy/ti/phy-omap-usb2.c
>> @@ -26,6 +26,10 @@
>>   #define USB2PHY_ANA_CONFIG1		0x4c
>>   #define USB2PHY_DISCON_BYP_LATCH	BIT(31)
>>   
>> +#define USB2PHY_CHRG_DET			0x14
>> +#define USB2PHY_CHRG_DET_USE_CHG_DET_REG	BIT(29)
>> +#define USB2PHY_CHRG_DET_DIS_CHG_DET		BIT(28)
>> +
>>   /* SoC Specific USB2_OTG register definitions */
>>   #define AM654_USB2_OTG_PD		BIT(8)
>>   #define AM654_USB2_VBUS_DET_EN		BIT(5)
>> @@ -43,6 +47,7 @@
>>   #define OMAP_USB2_HAS_START_SRP			BIT(0)
>>   #define OMAP_USB2_HAS_SET_VBUS			BIT(1)
>>   #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT	BIT(2)
>> +#define OMAP_USB2_DISABLE_CHRG_DET		BIT(3)
>>   
>>   struct omap_usb {
>>   	struct usb_phy		phy;
>> @@ -236,6 +241,13 @@ static int omap_usb_init(struct phy *x)
>>   		omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
>>   	}
>>   
>> +	if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) {
>> +		val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
>> +		val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG |
>> +		       USB2PHY_CHRG_DET_DIS_CHG_DET;
>> +		omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
>> +	}
>> +
>>   	return 0;
>>   }
>>   
>> @@ -366,14 +378,12 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>   	phy->mask		= phy_data->mask;
>>   	phy->power_on		= phy_data->power_on;
>>   	phy->power_off		= phy_data->power_off;
>> +	phy->flags		= phy_data->flags;
>>   
>> -	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);
>> -		phy->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);
>>   
>>   	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
>>   							"syscon-phy-power");
>> @@ -405,6 +415,17 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>   		}
>>   	}
>>   
>> +	/*
>> +	 * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
>> +	 * Default Without VBUS Presence.
>> +	 *
>> +	 * AM654x SR1.0 has a silicon bug due to which 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.
>> +	 */
>> +	if (of_property_read_bool(node, "ti,disable-charger-det"))
>> +		phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
>>   
>>   	phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
>>   	if (IS_ERR(phy->wkupclk)) {
>>
> 
> Why a property, rather than SoC detection like in [1] and your previous
> downstream version?

I agree, that SoC detection is better way. Will spin a v5.

> 
> Jan
> 
> [1] https://patchwork.kernel.org/patch/11710643/
> 

cheers,
-roger
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML
  2020-07-16  8:22 ` [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
@ 2020-08-20 13:40   ` Roger Quadros
  2020-08-20 14:46     ` Sekhar Nori
  0 siblings, 1 reply; 8+ messages in thread
From: Roger Quadros @ 2020-08-20 13:40 UTC (permalink / raw)
  To: kishon; +Cc: robh+dt, nsekhar, vigneshr, linux-kernel, devicetree

Kishon,

On 16/07/2020 11:22, Roger Quadros wrote:
> Move ti,omap-usb2 to its own YAML schema.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Reviewed-by: Rob Herring <robh@kernel.org>

Can you please pick just this one patch from this series for -next? Thanks.

cheers,
-roger

> ---
>   .../devicetree/bindings/phy/ti,omap-usb2.yaml | 72 +++++++++++++++++++
>   .../devicetree/bindings/phy/ti-phy.txt        | 37 ----------
>   2 files changed, 72 insertions(+), 37 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
> new file mode 100644
> index 000000000000..a05110351814
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
> @@ -0,0 +1,72 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/ti,omap-usb2.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: OMAP USB2 PHY
> +
> +maintainers:
> + - Kishon Vijay Abraham I <kishon@ti.com>
> + - Roger Quadros <rogerq@ti.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +        - enum:
> +          - ti,dra7x-usb2
> +          - ti,dra7x-usb2-phy2
> +          - ti,am654-usb2
> +        - enum:
> +          - ti,omap-usb2
> +      - items:
> +        - const: ti,omap-usb2
> +
> +  reg:
> +    maxItems: 1
> +
> +  "#phy-cells":
> +    const: 0
> +
> +  clocks:
> +    minItems: 1
> +    items:
> +      - description: wakeup clock
> +      - description: reference clock
> +
> +  clock-names:
> +    minItems: 1
> +    items:
> +      - const: wkupclk
> +      - const: refclk
> +
> +  syscon-phy-power:
> +    $ref: /schemas/types.yaml#definitions/phandle-array
> +    description:
> +      phandle/offset pair. Phandle to the system control module and
> +      register offset to power on/off the PHY.
> +
> +  ctrl-module:
> +    $ref: /schemas/types.yaml#definitions/phandle
> +    description:
> +      (deprecated) phandle of the control module used by PHY driver
> +      to power on the PHY. Use syscon-phy-power instead.
> +
> +required:
> +  - compatible
> +  - reg
> +  - "#phy-cells"
> +  - clocks
> +  - clock-names
> +
> +examples:
> +  - |
> +    usb0_phy: phy@4100000 {
> +      compatible = "ti,am654-usb2", "ti,omap-usb2";
> +      reg = <0x4100000 0x54>;
> +      syscon-phy-power = <&scm_conf 0x4000>;
> +      clocks = <&k3_clks 151 0>, <&k3_clks 151 1>;
> +      clock-names = "wkupclk", "refclk";
> +      #phy-cells = <0>;
> +    };
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 8f93c3b694a7..60c9d0ac75e6 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -27,43 +27,6 @@ omap_control_usb: omap-control-usb@4a002300 {
>           reg-names = "otghs_control";
>   };
>   
> -OMAP USB2 PHY
> -
> -Required properties:
> - - compatible: Should be "ti,omap-usb2"
> -	       Should be "ti,dra7x-usb2" for the 1st instance of USB2 PHY on
> -	       DRA7x
> -	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
> -	       in DRA7x
> -	       Should be "ti,am654-usb2" for the USB2 PHYs on AM654.
> - - reg : Address and length of the register set for the device.
> - - #phy-cells: determine the number of cells that should be given in the
> -   phandle while referencing this phy.
> - - clocks: a list of phandles and clock-specifier pairs, one for each entry in
> -   clock-names.
> - - clock-names: should include:
> -   * "wkupclk" - wakeup clock.
> -   * "refclk" - reference clock (optional).
> -
> -Deprecated properties:
> - - ctrl-module : phandle of the control module used by PHY driver to power on
> -   the PHY.
> -
> -Recommended properies:
> -- syscon-phy-power : phandle/offset pair. Phandle to the system control
> -  module and the register offset to power on/off the PHY.
> -
> -This is usually a subnode of ocp2scp to which it is connected.
> -
> -usb2phy@4a0ad080 {
> -	compatible = "ti,omap-usb2";
> -	reg = <0x4a0ad080 0x58>;
> -	ctrl-module = <&omap_control_usb>;
> -	#phy-cells = <0>;
> -	clocks = <&usb_phy_cm_clk32k>, <&usb_otg_ss_refclk960m>;
> -	clock-names = "wkupclk", "refclk";
> -};
> -
>   TI PIPE3 PHY
>   
>   Required properties:
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML
  2020-08-20 13:40   ` Roger Quadros
@ 2020-08-20 14:46     ` Sekhar Nori
  0 siblings, 0 replies; 8+ messages in thread
From: Sekhar Nori @ 2020-08-20 14:46 UTC (permalink / raw)
  To: Roger Quadros, kishon
  Cc: robh+dt, vigneshr, linux-kernel, devicetree, Vinod Koul

On 8/20/20 7:10 PM, Roger Quadros wrote:
> Kishon,
> 
> On 16/07/2020 11:22, Roger Quadros wrote:
>> Move ti,omap-usb2 to its own YAML schema.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Reviewed-by: Rob Herring <robh@kernel.org>
> 
> Can you please pick just this one patch from this series for -next? Thanks.

+ Vinod as well.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-20 14:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  8:22 [PATCH v4 0/3] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
2020-07-16  8:22 ` [PATCH v4 1/3] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
2020-08-20 13:40   ` Roger Quadros
2020-08-20 14:46     ` Sekhar Nori
2020-07-16  8:22 ` [PATCH v4 2/3] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection Roger Quadros
2020-07-16  8:22 ` [PATCH v4 3/3] phy: omap-usb2-phy: disable PHY charger detect Roger Quadros
2020-08-19  9:02   ` Jan Kiszka
2020-08-19 14:28     ` Roger Quadros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).