* [PATCH 1/4] phy: omap-usb2: Clean up exported header
2020-05-15 8:05 [PATCH 0/4] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
@ 2020-05-15 8:05 ` Roger Quadros
2020-05-15 8:05 ` [PATCH 2/4] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2020-05-15 8:05 UTC (permalink / raw)
To: kishon; +Cc: robh+dt, b-liu, devicetree, vigneshr, nsekhar, Roger Quadros
Move private definitions from header to phy-omap-usb2.c file.
Get rid of unused data structures usb_dpll_params and omap_usb_phy_type.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/phy/ti/phy-omap-usb2.c | 60 +++++++++++++++++++++++++++--
include/linux/phy/omap_usb.h | 69 +---------------------------------
2 files changed, 58 insertions(+), 71 deletions(-)
diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index 3d74629d7423..cb2dd3230fa7 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * omap-usb2.c - USB PHY, talking to musb controller in OMAP.
+ * omap-usb2.c - USB PHY, talking to USB controller on TI SoCs.
*
- * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2012-2020 Texas Instruments Incorporated - http://www.ti.com
* Author: Kishon Vijay Abraham I <kishon@ti.com>
*/
@@ -23,13 +23,65 @@
#include <linux/regmap.h>
#include <linux/of_platform.h>
-#define USB2PHY_DISCON_BYP_LATCH (1 << 31)
-#define USB2PHY_ANA_CONFIG1 0x4c
+#define USB2PHY_ANA_CONFIG1 0x4c
+#define USB2PHY_DISCON_BYP_LATCH BIT(31)
+/* SoC Specific USB2_OTG register definitions */
#define AM654_USB2_OTG_PD BIT(8)
#define AM654_USB2_VBUS_DET_EN BIT(5)
#define AM654_USB2_VBUSVALID_DET_EN BIT(4)
+#define OMAP_DEV_PHY_PD BIT(0)
+#define OMAP_USB2_PHY_PD BIT(28)
+
+#define AM437X_USB2_PHY_PD BIT(0)
+#define AM437X_USB2_OTG_PD BIT(1)
+#define AM437X_USB2_OTGVDET_EN BIT(19)
+#define AM437X_USB2_OTGSESSEND_EN BIT(20)
+
+/* Driver Flags */
+#define OMAP_USB2_HAS_START_SRP BIT(0)
+#define OMAP_USB2_HAS_SET_VBUS BIT(1)
+#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2)
+
+struct omap_usb {
+ struct usb_phy phy;
+ struct phy_companion *comparator;
+ void __iomem *pll_ctrl_base;
+ void __iomem *phy_base;
+ struct device *dev;
+ struct device *control_dev;
+ struct clk *wkupclk;
+ struct clk *optclk;
+ u8 flags;
+ struct regmap *syscon_phy_power; /* ctrl. reg. acces */
+ unsigned int power_reg; /* power reg. index within syscon */
+ u32 mask;
+ u32 power_on;
+ u32 power_off;
+};
+
+#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
+
+struct usb_phy_data {
+ const char *label;
+ u8 flags;
+ u32 mask;
+ u32 power_on;
+ u32 power_off;
+};
+
+static inline u32 omap_usb_readl(void __iomem *addr, unsigned int offset)
+{
+ return __raw_readl(addr + offset);
+}
+
+static inline void omap_usb_writel(void __iomem *addr, unsigned int offset,
+ u32 data)
+{
+ __raw_writel(data, addr + offset);
+}
+
/**
* omap_usb2_set_comparator - links the comparator present in the sytem with
* this phy
diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
index 5973a6313529..e23b52df93ec 100644
--- a/include/linux/phy/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -2,68 +2,14 @@
/*
* omap_usb.h -- omap usb2 phy header file
*
- * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2012-2020 Texas Instruments Incorporated - http://www.ti.com
* Author: Kishon Vijay Abraham I <kishon@ti.com>
*/
#ifndef __DRIVERS_OMAP_USB2_H
#define __DRIVERS_OMAP_USB2_H
-#include <linux/io.h>
-#include <linux/usb/otg.h>
-
-struct usb_dpll_params {
- u16 m;
- u8 n;
- u8 freq:3;
- u8 sd;
- u32 mf;
-};
-
-enum omap_usb_phy_type {
- TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
- TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
- TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
-};
-
-struct omap_usb {
- struct usb_phy phy;
- struct phy_companion *comparator;
- void __iomem *pll_ctrl_base;
- void __iomem *phy_base;
- struct device *dev;
- struct device *control_dev;
- struct clk *wkupclk;
- struct clk *optclk;
- u8 flags;
- enum omap_usb_phy_type type;
- struct regmap *syscon_phy_power; /* ctrl. reg. acces */
- unsigned int power_reg; /* power reg. index within syscon */
- u32 mask;
- u32 power_on;
- u32 power_off;
-};
-
-struct usb_phy_data {
- const char *label;
- u8 flags;
- u32 mask;
- u32 power_on;
- u32 power_off;
-};
-
-/* Driver Flags */
-#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_DEV_PHY_PD BIT(0)
-#define OMAP_USB2_PHY_PD BIT(28)
-
-#define AM437X_USB2_PHY_PD BIT(0)
-#define AM437X_USB2_OTG_PD BIT(1)
-#define AM437X_USB2_OTGVDET_EN BIT(19)
-#define AM437X_USB2_OTGSESSEND_EN BIT(20)
+#include <linux/usb/phy_companion.h>
#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
@@ -76,15 +22,4 @@ static inline int omap_usb2_set_comparator(struct phy_companion *comparator)
}
#endif
-static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset)
-{
- return __raw_readl(addr + offset);
-}
-
-static inline void omap_usb_writel(void __iomem *addr, unsigned offset,
- u32 data)
-{
- __raw_writel(data, addr + offset);
-}
-
#endif /* __DRIVERS_OMAP_USB_H */
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] dt-binding: phy: convert ti,omap-usb2 to YAML
2020-05-15 8:05 [PATCH 0/4] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
2020-05-15 8:05 ` [PATCH 1/4] phy: omap-usb2: Clean up exported header Roger Quadros
@ 2020-05-15 8:05 ` Roger Quadros
2020-05-28 19:24 ` Rob Herring
2020-05-15 8:05 ` [PATCH 3/4] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection Roger Quadros
2020-05-15 8:05 ` [PATCH 4/4] phy: omap-usb2-phy: disable PHY charger detect Roger Quadros
3 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2020-05-15 8:05 UTC (permalink / raw)
To: kishon; +Cc: robh+dt, b-liu, devicetree, vigneshr, nsekhar, Roger Quadros
Move ti,omap-usb2 to its own YAML schema.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
.../devicetree/bindings/phy/ti,omap-usb2.yaml | 73 +++++++++++++++++++
.../devicetree/bindings/phy/ti-phy.txt | 37 ----------
2 files changed, 73 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..ecfb28f714ea
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
@@ -0,0 +1,73 @@
+# 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:
+ anyOf:
+ - items:
+ - enum:
+ - "ti,dra7x-usb2"
+ - "ti,dra7x-usb2-phy2"
+ - "ti,am654-usb2"
+ - enum:
+ - "ti,omap-usb2"
+
+ reg:
+ maxItems: 1
+ description: address and length of the register set for the device.
+
+ '#phy-cells':
+ description:
+ Number of cells in a PHY specifier. The meaning of all those
+ cells is defined by the binding for the phy node. The PHY
+ provider can use the values in cells to find the appropriate PHY.
+ $ref: /schemas/types.yaml#/definitions/uint32
+
+ clocks:
+ minItems: 1
+ items:
+ - description: wakeup clock
+ - description: reference clock
+
+ clock-names:
+ minItems: 1
+ items:
+ - const: "wkupclk"
+ - const: "refclk"
+
+ syscon-phy-power:
+ description:
+ phandle/offset pair. Phandle to the system control module
+ register offset to power on/off the PHY.
+
+ ctrl-module:
+ 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 = <0x0 0x4100000 0x0 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] 7+ messages in thread
* Re: [PATCH 2/4] dt-binding: phy: convert ti,omap-usb2 to YAML
2020-05-15 8:05 ` [PATCH 2/4] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
@ 2020-05-28 19:24 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-05-28 19:24 UTC (permalink / raw)
To: Roger Quadros; +Cc: kishon, b-liu, devicetree, vigneshr, nsekhar
On Fri, May 15, 2020 at 11:05:16AM +0300, Roger Quadros wrote:
> Move ti,omap-usb2 to its own YAML schema.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> .../devicetree/bindings/phy/ti,omap-usb2.yaml | 73 +++++++++++++++++++
> .../devicetree/bindings/phy/ti-phy.txt | 37 ----------
> 2 files changed, 73 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..ecfb28f714ea
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
> @@ -0,0 +1,73 @@
> +# 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:
> + anyOf:
Only 1 entry, don't need anyOf.
> + - items:
> + - enum:
> + - "ti,dra7x-usb2"
> + - "ti,dra7x-usb2-phy2"
> + - "ti,am654-usb2"
> + - enum:
> + - "ti,omap-usb2"
> +
> + reg:
> + maxItems: 1
> + description: address and length of the register set for the device.
Drop. That's every 'reg'.
> +
> + '#phy-cells':
> + description:
> + Number of cells in a PHY specifier. The meaning of all those
> + cells is defined by the binding for the phy node. The PHY
> + provider can use the values in cells to find the appropriate PHY.
Yes, and this is a phy bindings, so you need to define the value.
> + $ref: /schemas/types.yaml#/definitions/uint32
#*-cells already has a type.
> +
> + clocks:
> + minItems: 1
> + items:
> + - description: wakeup clock
> + - description: reference clock
> +
> + clock-names:
> + minItems: 1
> + items:
> + - const: "wkupclk"
> + - const: "refclk"
Don't need quotes.
> +
> + syscon-phy-power:
> + description:
> + phandle/offset pair. Phandle to the system control module
> + register offset to power on/off the PHY.
> +
> + ctrl-module:
> + description:
> + (deprecated) phandle of the control module used by PHY driver
> + to power on the PHY. Use syscon-phy-power instead.
These 2 need a type reference.
> +
> +required:
> + - compatible
> + - reg
> + - '#phy-cells'
> + - clocks
> + - clock-names
> +
> +examples:
> + - |
> + usb0_phy: phy@4100000 {
> + compatible = "ti,am654-usb2", "ti,omap-usb2";
> + reg = <0x0 0x4100000 0x0 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] 7+ messages in thread
* [PATCH 3/4] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection
2020-05-15 8:05 [PATCH 0/4] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
2020-05-15 8:05 ` [PATCH 1/4] phy: omap-usb2: Clean up exported header Roger Quadros
2020-05-15 8:05 ` [PATCH 2/4] dt-binding: phy: convert ti,omap-usb2 to YAML Roger Quadros
@ 2020-05-15 8:05 ` Roger Quadros
2020-05-15 8:30 ` Roger Quadros
2020-05-15 8:05 ` [PATCH 4/4] phy: omap-usb2-phy: disable PHY charger detect Roger Quadros
3 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2020-05-15 8:05 UTC (permalink / raw)
To: kishon; +Cc: robh+dt, b-liu, devicetree, vigneshr, nsekhar, Roger Quadros
Add "ti,dis-chg-det-quirk" property to disable the USB2_PHY Charger Detect
logic.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
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 ecfb28f714ea..ec3e85a17bfa 100644
--- a/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
+++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
@@ -54,6 +54,11 @@ properties:
(deprecated) phandle of the control module used by PHY driver
to power on the PHY. Use syscon-phy-power instead.
+ ti,dis-chg-det-quirk:
+ 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] 7+ messages in thread
* Re: [PATCH 3/4] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection
2020-05-15 8:05 ` [PATCH 3/4] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection Roger Quadros
@ 2020-05-15 8:30 ` Roger Quadros
0 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2020-05-15 8:30 UTC (permalink / raw)
To: kishon; +Cc: robh+dt, b-liu, devicetree, vigneshr, nsekhar
Hi,
On 15/05/2020 11:05, Roger Quadros wrote:
> Add "ti,dis-chg-det-quirk" property to disable the USB2_PHY Charger Detect
> logic.
On second thoughts I think it is better to use soc_device_match instead of DT property
as we are not going to have separate DT for SR1.0 vs SR2.0.
cheers,
-roger
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> 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 ecfb28f714ea..ec3e85a17bfa 100644
> --- a/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
> +++ b/Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
> @@ -54,6 +54,11 @@ properties:
> (deprecated) phandle of the control module used by PHY driver
> to power on the PHY. Use syscon-phy-power instead.
>
> + ti,dis-chg-det-quirk:
> + 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 [flat|nested] 7+ messages in thread
* [PATCH 4/4] phy: omap-usb2-phy: disable PHY charger detect
2020-05-15 8:05 [PATCH 0/4] phy: omap-usb2: add quirk to disable charger detection Roger Quadros
` (2 preceding siblings ...)
2020-05-15 8:05 ` [PATCH 3/4] dt-binding: phy: ti,omap-usb2: Add quirk to disable charger detection Roger Quadros
@ 2020-05-15 8:05 ` Roger Quadros
3 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2020-05-15 8:05 UTC (permalink / raw)
To: kishon; +Cc: robh+dt, b-liu, devicetree, vigneshr, nsekhar, Roger Quadros
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.
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..8ab8b94511d4 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,dis-chg-det-quirk"))
+ 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] 7+ messages in thread