Skip to contentSkip to conversation

Marvell PXA1928 USB support

PATCH Superseded Rob Herring 2 participants 13 messages May 20, 2015 – May 22, 2015

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

v2 cover Marvell PXA1928 USB support

This series adds USB PHYs and EHCI host drivers for the Marvell PXA1928 SOC.

The OTG block is based on ChipIdea and works with the "chipidea,usb2" compatible driver as is just by adding the PHY driver. Yay! After more testing it turns out the EHCI host is also based on ChipIdea too. So this version uses the ChipIdea driver for both. A couple of fixes are needed to make the ChipIdea driver work with the PXA1928 EHCI host.

I don't think the work-around in patch 6 should affect other platforms, but testing would be nice.

Rob

v2:
- Use ChipIdea driver for EHCI host, dropping the Marvell specific EHCI driver
- Consolidate ChipIdea bindings to single common doc.
- rename phy driver files to phy-pxa-28nm-{usb2,hsic}.c
- Simplified work-around for HSIC phy/controller handshake.

Rob Herring (6):
dt-bindings: Add Marvell PXA1928 USB and HSIC PHY bindings
phy: Add Marvell USB 2.0 OTG 28nm PHY
phy: add Marvell HSIC 28nm PHY
dt-bindings: Consolidate ChipIdea USB ci13xxx bindings
usb: chipidea: allow multiple instances to use default
ci_default_pdata
usb: chipidea: add work-around for Marvell HSIC PHY startup

 .../devicetree/bindings/phy/pxa1928-usb-phy.txt    |  18 ++
 .../devicetree/bindings/usb/ci-hdrc-imx.txt        |  35 ---
 .../devicetree/bindings/usb/ci-hdrc-qcom.txt       |  17 --
 .../devicetree/bindings/usb/ci-hdrc-usb2.txt       |  22 +-
 .../devicetree/bindings/usb/ci-hdrc-zevio.txt      |  17 --
 drivers/phy/Kconfig                                |  20 ++
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-pxa-28nm-hsic.c                    | 193 ++++++++++++
 drivers/phy/phy-pxa-28nm-usb2.c                    | 329 +++++++++++++++++++++
 drivers/usb/chipidea/ci_hdrc_usb2.c                |  10 +-
 drivers/usb/chipidea/host.c                        |  12 +
 11 files changed, 602 insertions(+), 73 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-zevio.txt
 create mode 100644 drivers/phy/phy-pxa-28nm-hsic.c
 create mode 100644 drivers/phy/phy-pxa-28nm-usb2.c
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#1 lore raw

PATCH v2 1/6 dt-bindings: Add Marvell PXA1928 USB and HSIC PHY bindings

Add PHY binding for Marvell PXA1928 SOC's USB and HSIC PHYs.

Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
---
 .../devicetree/bindings/phy/pxa1928-usb-phy.txt        | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt
Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt new file +18 -0
new file mode 100644
index 0000000..660a13c
@@ -0,0 +1,18 @@
+* Marvell PXA1928 USB and HSIC PHYs
+
+Required properties:
+- compatible: "marvell,pxa1928-usb-phy" or "marvell,pxa1928-hsic-phy"
+- reg: base address and length of the registers
+- clocks - A single clock. From common clock binding.
+- #phys-cells: should be 0. From commmon phy binding.
+- resets: reference to the reset controller
+
+Example:
+
+	usbphy: phy@7000 {
+		compatible = "marvell,pxa1928-usb-phy";
+		reg = <0x7000 0xe0>;
+		clocks = <&apmu_clocks PXA1928_CLK_USB>;
+		#phy-cells = <0>;
+	};
+
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#2 lore raw

PATCH v2 2/6 phy: Add Marvell USB 2.0 OTG 28nm PHY

In reply to Rob Herring

Add driver for USB 28nm PHY found in Marvell PXA1928 SOC.

Cc Kishon Vijay Abraham I <[email protected]>
---
 drivers/phy/Kconfig             |  10 ++
 drivers/phy/Makefile            |   1 +
 drivers/phy/phy-pxa-28nm-usb2.c | 329 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 340 insertions(+)
 create mode 100644 drivers/phy/phy-pxa-28nm-usb2.c
drivers/phy/Kconfig +10 -0
index a53bd5b..71409a1 100644
@@ -52,6 +52,16 @@ config PHY_EXYNOS_MIPI_VIDEO
 	  Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P
 	  and EXYNOS SoCs.
 
+config PHY_PXA_28NM_USB2
+	tristate "Marvell USB 2.0 28nm PHY Driver"
+	select GENERIC_PHY
+	help
+	  Enable this to support Marvell USB 2.0 PHY driver for Marvell
+	  SoC. This driver will do the PHY initialization and shutdown.
+	  The PHY driver will be used by Marvell udc/ehci/otg driver.
+
+	  To compile this driver as a module, choose M here.
+
 config PHY_MVEBU_SATA
 	def_bool y
 	depends on ARCH_DOVE || MACH_DOVE || MACH_KIRKWOOD
drivers/phy/Makefile +1 -0
index f126251..8524307 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY)	+= phy-armada375-usb2.o
 obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
 obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)	+= phy-exynos-dp-video.o
 obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)	+= phy-exynos-mipi-video.o
+obj-$(CONFIG_PHY_PXA_28NM_USB2)		+= phy-pxa-28nm-usb2.o
 obj-$(CONFIG_PHY_MVEBU_SATA)		+= phy-mvebu-sata.o
 obj-$(CONFIG_PHY_MIPHY28LP) 		+= phy-miphy28lp.o
 obj-$(CONFIG_PHY_MIPHY365X)		+= phy-miphy365x.o
drivers/phy/phy-pxa-28nm-usb2.c new file +329 -0

329 lines not on this page · raw message

Signature · 1 line
2.1.0
author maintainer
#3 lore raw

PATCH v2 3/6 phy: add Marvell HSIC 28nm PHY

In reply to Rob Herring

Add PHY driver for the Marvell HSIC 28nm PHY. This PHY is found in PXA1928 SOC.

Cc Kishon Vijay Abraham I <[email protected]>
---
 drivers/phy/Kconfig             |  10 +++
 drivers/phy/Makefile            |   1 +
 drivers/phy/phy-pxa-28nm-hsic.c | 193 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 204 insertions(+)
 create mode 100644 drivers/phy/phy-pxa-28nm-hsic.c
drivers/phy/Kconfig +10 -0
index 71409a1..7d56c44 100644
@@ -52,6 +52,16 @@ config PHY_EXYNOS_MIPI_VIDEO
 	  Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P
 	  and EXYNOS SoCs.
 
+config PHY_PXA_28NM_HSIC
+	tristate "Marvell USB HSIC 28nm PHY Driver"
+	select GENERIC_PHY
+	help
+	  Enable this to support Marvell USB HSIC PHY driver for Marvell
+	  SoC. This driver will do the PHY initialization and shutdown.
+	  The PHY driver will be used by Marvell ehci driver.
+
+	  To compile this driver as a module, choose M here.
+
 config PHY_PXA_28NM_USB2
 	tristate "Marvell USB 2.0 28nm PHY Driver"
 	select GENERIC_PHY
drivers/phy/Makefile +1 -0
index 8524307..2c16963 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
 obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)	+= phy-exynos-dp-video.o
 obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)	+= phy-exynos-mipi-video.o
 obj-$(CONFIG_PHY_PXA_28NM_USB2)		+= phy-pxa-28nm-usb2.o
+obj-$(CONFIG_PHY_PXA_28NM_HSIC)		+= phy-pxa-28nm-hsic.o
 obj-$(CONFIG_PHY_MVEBU_SATA)		+= phy-mvebu-sata.o
 obj-$(CONFIG_PHY_MIPHY28LP) 		+= phy-miphy28lp.o
 obj-$(CONFIG_PHY_MIPHY365X)		+= phy-miphy365x.o
drivers/phy/phy-pxa-28nm-hsic.c new file +193 -0

193 lines not on this page · raw message

Signature · 1 line
2.1.0
author maintainer
#4 lore raw

PATCH v2 4/6 dt-bindings: Consolidate ChipIdea USB ci13xxx bindings

In reply to Rob Herring

Combine the ChipIdea USB binding into a single document to reduce duplication and fragmentation. This marks use of the old PHY bindings as deprecated. Future compatible bindings should use generic PHY binding.

Cc Ivan T. Ivanov <[email protected]>
Cc Peter Chen <[email protected]>
Cc Daniel Tang <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
---
 .../devicetree/bindings/usb/ci-hdrc-imx.txt        | 35 ----------------------
 .../devicetree/bindings/usb/ci-hdrc-qcom.txt       | 17 -----------
 .../devicetree/bindings/usb/ci-hdrc-usb2.txt       | 22 +++++++++++++-
 .../devicetree/bindings/usb/ci-hdrc-zevio.txt      | 17 -----------
 4 files changed, 21 insertions(+), 70 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-zevio.txt
Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt deleted +0 -35
deleted file mode 100644
index 38a5480..0000000
@@ -1,35 +0,0 @@
-* Freescale i.MX ci13xxx usb controllers
-
-Required properties:
-- compatible: Should be "fsl,imx27-usb"
-- reg: Should contain registers location and length
-- interrupts: Should contain controller interrupt
-- fsl,usbphy: phandle of usb phy that connects to the port
-
-Recommended properies:
-- phy_type: the type of the phy connected to the core. Should be one
-  of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
-  property the PORTSC register won't be touched
-- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
-
-Optional properties:
-- fsl,usbmisc: phandler of non-core register device, with one argument
-  that indicate usb controller index
-- vbus-supply: regulator for vbus
-- disable-over-current: disable over current detect
-- external-vbus-divider: enables off-chip resistor divider for Vbus
-- maximum-speed: limit the maximum connection speed to "full-speed".
-- tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts
-
-Examples:
-usb@02184000 { /* USB OTG */
-	compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
-	reg = <0x02184000 0x200>;
-	interrupts = <0 43 0x04>;
-	fsl,usbphy = <&usbphy1>;
-	fsl,usbmisc = <&usbmisc 0>;
-	disable-over-current;
-	external-vbus-divider;
-	maximum-speed = "full-speed";
-	tpl-support;
-};
Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt deleted +0 -17
deleted file mode 100644
index f2899b5..0000000
@@ -1,17 +0,0 @@
-Qualcomm CI13xxx (Chipidea) USB controllers
-
-Required properties:
-- compatible:   should contain "qcom,ci-hdrc"
-- reg:          offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the controller interrupt.
-- usb-phy:      phandle for the PHY device
-- dr_mode:      Should be "peripheral"
-
-Examples:
-	gadget@f9a55000 {
-		compatible = "qcom,ci-hdrc";
-		reg = <0xf9a55000 0x400>;
-		dr_mode = "peripheral";
-		interrupts = <0 134 0>;
-		usb-phy = <&usbphy0>;
-	};
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +21 -1
index 27f8b1e..f074827 100644
@@ -1,15 +1,35 @@
 * USB2 ChipIdea USB controller for ci13xxx
 
 Required properties:
-- compatible: should be "chipidea,usb2"
+- compatible: should be one of:
+	"fsl,imx27-usb"
+	"lsi,zevio-usb"
+	"qcom,ci-hdrc"
+	"chipidea,usb2"
 - reg: base address and length of the registers
 - interrupts: interrupt for the USB controller
 
+Recommended properies:
+- phy_type: the type of the phy connected to the core. Should be one
+  of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
+  property the PORTSC register won't be touched.
+- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
+
+Deprecated properties:
+- usb-phy:      phandle for the PHY device. Use "phys" instead.
+- fsl,usbphy: phandle of usb phy that connects to the port. Use "phys" instead.
+
 Optional properties:
 - clocks: reference to the USB clock
 - phys: reference to the USB PHY
 - phy-names: should be "usb-phy"
 - vbus-supply: reference to the VBUS regulator
+- fsl,usbmisc: phandler of non-core register device, with one argument
+  that indicate usb controller index
+- disable-over-current: disable over current detect
+- external-vbus-divider: enables off-chip resistor divider for Vbus
+- maximum-speed: limit the maximum connection speed to "full-speed".
+- tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts
 
 Example:
 
Documentation/devicetree/bindings/usb/ci-hdrc-zevio.txt deleted +0 -17
deleted file mode 100644
index abbcb2a..0000000
@@ -1,17 +0,0 @@
-* LSI Zevio USB OTG Controller
-
-Required properties:
-- compatible: Should be "lsi,zevio-usb"
-- reg: Should contain registers location and length
-- interrupts: Should contain controller interrupt
-
-Optional properties:
-- vbus-supply: regulator for vbus
-
-Examples:
-		usb0: usb@b0000000 {
-			reg = <0xb0000000 0x1000>;
-			compatible = "lsi,zevio-usb";
-			interrupts = <8>;
-			vbus-supply = <&vbus_reg>;
-		};
Signature · 1 line
2.1.0
#5 lore raw

Re: [PATCH v2 4/6] dt-bindings: Consolidate ChipIdea USB ci13xxx bindings

Quoted 3 lines · Rob Herring

Combine the ChipIdea USB binding into a single document to reduce duplication and fragmentation. This marks use of the old PHY bindings as deprecated. Future compatible bindings should use generic PHY binding.

Thanks, Rob. These are what I plan to do in future too.

Quoted 26 lines
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +14 -1
index 27f8b1e..f074827 100644
@@ -1,15 +1,35 @@
 * USB2 ChipIdea USB controller for ci13xxx
 
 Required properties:
-- compatible: should be "chipidea,usb2"
+- compatible: should be one of:
+	"fsl,imx27-usb"
+	"lsi,zevio-usb"
+	"qcom,ci-hdrc"
+	"chipidea,usb2"
 - reg: base address and length of the registers
 - interrupts: interrupt for the USB controller
 
+Recommended properies:
+- phy_type: the type of the phy connected to the core. Should be one
+  of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
+  property the PORTSC register won't be touched.
+- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
+
+Deprecated properties:
+- usb-phy:      phandle for the PHY device. Use "phys" instead.
+- fsl,usbphy: phandle of usb phy that connects to the port. Use "phys" instead.

Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt line 30

Quoted 10 lines
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +5 -0
+
 Optional properties:
 - clocks: reference to the USB clock
 - phys: reference to the USB PHY
 - phy-names: should be "usb-phy"
 - vbus-supply: reference to the VBUS regulator
+- fsl,usbmisc: phandler of non-core register device, with one argument
+  that indicate usb controller index
+- disable-over-current: disable over current detect
+- external-vbus-divider: enables off-chip resistor divider for Vbus

The above property is only for fsl, we may need to differentiate generic and vendor properties for reader.

Signature · 6 lines
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#6 lore raw

PATCH v2 5/6 usb: chipidea: allow multiple instances to use default ci_default_pdata

In reply to Rob Herring

Currently, ci_default_pdata is common to all instances of the driver and gets modified by the core driver code. This is bad if there are multiple instances of the device with different settings such as the phy type. Fix this by making a copy of the default platform_data.

---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_usb2.c +7 -3
index 45844c9..73d9906 100644
@@ -25,11 +25,13 @@ struct ci_hdrc_usb2_priv {
 	struct clk		*clk;
 };
 
-static struct ci_hdrc_platform_data ci_default_pdata = {
+static const struct ci_hdrc_platform_data ci_default_pdata = {
 	.capoffset	= DEF_CAPOFFSET,
 	.flags		= CI_HDRC_DISABLE_STREAMING,
 };
 
+static const struct of_device_id ci_hdrc_usb2_of_match[];
+
 static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -37,8 +39,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
 	int ret;
 
-	if (!ci_pdata)
-		ci_pdata = &ci_default_pdata;
+	if (!ci_pdata) {
+		ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL);
+		*ci_pdata = ci_default_pdata;	/* struct copy */
+	}
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

Re: [PATCH v2 5/6] usb: chipidea: allow multiple instances to use default ci_default_pdata

Quoted 19 lines · Rob Herring

Currently, ci_default_pdata is common to all instances of the driver and gets modified by the core driver code. This is bad if there are multiple instances of the device with different settings such as the phy type. Fix this by making a copy of the default platform_data.

---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_usb2.c +0 -0
index 45844c9..73d9906 100644
@@ -25,11 +25,13 @@ struct ci_hdrc_usb2_priv {
 	struct clk		*clk;

drivers/usb/chipidea/ci_hdrc_usb2.c struct ci_hdrc_usb2_priv { · line 34

Quoted 10 lines
drivers/usb/chipidea/ci_hdrc_usb2.c +3 -1
 };
 
-static struct ci_hdrc_platform_data ci_default_pdata = {
+static const struct ci_hdrc_platform_data ci_default_pdata = {
 	.capoffset	= DEF_CAPOFFSET,
 	.flags		= CI_HDRC_DISABLE_STREAMING,
 };
 
+static const struct of_device_id ci_hdrc_usb2_of_match[];
+

unrelated change?

Others are ok.

Quoted 19 lines
drivers/usb/chipidea/ci_hdrc_usb2.c +4 -2
 static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -37,8 +39,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
 	int ret;
 
-	if (!ci_pdata)
-		ci_pdata = &ci_default_pdata;
+	if (!ci_pdata) {
+		ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL);
+		*ci_pdata = ci_default_pdata;	/* struct copy */
+	}
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
Signature · 1 line
2.1.0
Signature · 2 lines
Best Regards,
Peter Chen
author maintainer
#8 lore raw

PATCH v2 6/6 usb: chipidea: add work-around for Marvell HSIC PHY startup

In reply to Rob Herring

The Marvell 28nm HSIC PHY requires the port to be forced to HS mode after the port power is applied. This is done using the test mode in the PORTSC register.

As HSIC is always HS, this work-around should be safe to do with all HSIC PHYs. If not, a flag can also be added.

---
 drivers/usb/chipidea/host.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/usb/chipidea/host.c +12 -0
index 21fe1a3..6cf87b8 100644
@@ -37,12 +37,14 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd);
 
 struct ehci_ci_priv {
 	struct regulator *reg_vbus;
+	struct ci_hdrc *ci;
 };
 
 static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
 {
 	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 	struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv;
+	struct ci_hdrc *ci = priv->ci;
 	struct device *dev = hcd->self.controller;
 	int ret = 0;
 	int port = HCS_N_PORTS(ehci->hcs_params);
@@ -64,6 +66,15 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
 			return ret;
 		}
 	}
+
+	if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
+		/*
+		 * Marvell 28nm HSIC PHY requires forcing the port to HS mode.
+		 * As HSIC is always HS, this should be safe for others.
+		 */
+		hw_port_test_set(ci, 5);
+		hw_port_test_set(ci, 0);
+	}
 	return 0;
 };
 
@@ -112,6 +123,7 @@ static int host_start(struct ci_hdrc *ci)
 
 	priv = (struct ehci_ci_priv *)ehci->priv;
 	priv->reg_vbus = NULL;
+	priv->ci = ci;
 
 	if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) {
 		if (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON) {
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Re: [PATCH v2 6/6] usb: chipidea: add work-around for Marvell HSIC PHY startup

Quoted 6 lines · Rob Herring

The Marvell 28nm HSIC PHY requires the port to be forced to HS mode after the port power is applied. This is done using the test mode in the PORTSC register.

As HSIC is always HS, this work-around should be safe to do with all HSIC PHYs. If not, a flag can also be added.

I think a flag is needed, not sure all vendors can work well with that.

Quoted 55 lines
---
 drivers/usb/chipidea/host.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/usb/chipidea/host.c +12 -0
index 21fe1a3..6cf87b8 100644
@@ -37,12 +37,14 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd);
 
 struct ehci_ci_priv {
 	struct regulator *reg_vbus;
+	struct ci_hdrc *ci;
 };
 
 static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
 {
 	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 	struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv;
+	struct ci_hdrc *ci = priv->ci;
 	struct device *dev = hcd->self.controller;
 	int ret = 0;
 	int port = HCS_N_PORTS(ehci->hcs_params);
@@ -64,6 +66,15 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
 			return ret;
 		}
 	}
+
+	if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
+		/*
+		 * Marvell 28nm HSIC PHY requires forcing the port to HS mode.
+		 * As HSIC is always HS, this should be safe for others.
+		 */
+		hw_port_test_set(ci, 5);
+		hw_port_test_set(ci, 0);
+	}
 	return 0;
 };
 
@@ -112,6 +123,7 @@ static int host_start(struct ci_hdrc *ci)
 
 	priv = (struct ehci_ci_priv *)ehci->priv;
 	priv->reg_vbus = NULL;
+	priv->ci = ci;
 
 	if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) {
 		if (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON) {
Signature · 1 line
2.1.0
Signature · 2 lines
Best Regards,
Peter Chen
author maintainer
#10 lore raw

Re: [PATCH v2 6/6] usb: chipidea: add work-around for Marvell HSIC PHY startup

Quoted 9 lines · Peter Chen
Quoted 6 lines · Rob Herring

The Marvell 28nm HSIC PHY requires the port to be forced to HS mode after the port power is applied. This is done using the test mode in the PORTSC register.

As HSIC is always HS, this work-around should be safe to do with all HSIC PHYs. If not, a flag can also be added.

I think a flag is needed, not sure all vendors can work well with that.

Only i.MX6Sx uses HSIC in mainline. Is that something you can test? It would be better to not add flags unless they are really needed. Otherwise you end up with dozens of flags like SDHCI drivers have.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

RE: [PATCH v2 6/6] usb: chipidea: add work-around for Marvell HSIC PHY startup

IA0KPiANCj4gT24gV2VkLCBNYXkgMjAsIDIwMTUgYXQgMTA6MTMgUE0sIFBldGVyIENoZW4gPHBl dGVyLmNoZW5AZnJlZXNjYWxlLmNvbT4NCj4gd3JvdGU6DQo+ID4gT24gVHVlLCBNYXkgMTksIDIw MTUgYXQgMDk6MTA6MDVQTSAtMDUwMCwgUm9iIEhlcnJpbmcgd3JvdGU6DQo+ID4+IFRoZSBNYXJ2 ZWxsIDI4bm0gSFNJQyBQSFkgcmVxdWlyZXMgdGhlIHBvcnQgdG8gYmUgZm9yY2VkIHRvIEhTIG1v ZGUNCj4gPj4gYWZ0ZXIgdGhlIHBvcnQgcG93ZXIgaXMgYXBwbGllZC4gVGhpcyBpcyBkb25lIHVz aW5nIHRoZSB0ZXN0IG1vZGUgaW4NCj4gPj4gdGhlIFBPUlRTQyByZWdpc3Rlci4NCj4gPj4NCj4g Pj4gQXMgSFNJQyBpcyBhbHdheXMgSFMsIHRoaXMgd29yay1hcm91bmQgc2hvdWxkIGJlIHNhZmUg dG8gZG8gd2l0aCBhbGwNCj4gPj4gSFNJQyBQSFlzLiBJZiBub3QsIGEgZmxhZyBjYW4gYWxzbyBi ZSBhZGRlZC4NCj4gPg0KPiA+IEkgdGhpbmsgYSBmbGFnIGlzIG5lZWRlZCwgbm90IHN1cmUgYWxs IHZlbmRvcnMgY2FuIHdvcmsgd2VsbCB3aXRoIHRoYXQuDQo+IA0KPiBPbmx5IGkuTVg2U3ggdXNl cyBIU0lDIGluIG1haW5saW5lLiBJcyB0aGF0IHNvbWV0aGluZyB5b3UgY2FuIHRlc3Q/IEl0IHdv dWxkIGJlDQo+IGJldHRlciB0byBub3QgYWRkIGZsYWdzIHVubGVzcyB0aGV5IGFyZSByZWFsbHkg bmVlZGVkLg0KPiBPdGhlcndpc2UgeW91IGVuZCB1cCB3aXRoIGRvemVucyBvZiBmbGFncyBsaWtl IFNESENJIGRyaXZlcnMgaGF2ZS4NCj4gDQoNCkkgd2lsbCBoYXZlIGEgdGVzdCBmb3IgdGhpcywg YW5kIHNob3cgeW91IHRoZSByZXN1bHQgbGF0ZXIuDQoNClBldGVyDQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Tested-by
#12 lore raw

Re: [PATCH v2 6/6] usb: chipidea: add work-around for Marvell HSIC PHY startup

Quoted 12 lines · Peter Chen
Quoted 12 lines
Quoted 8 lines · Peter Chen
Quoted 6 lines · Rob Herring

The Marvell 28nm HSIC PHY requires the port to be forced to HS mode after the port power is applied. This is done using the test mode in the PORTSC register.

As HSIC is always HS, this work-around should be safe to do with all HSIC PHYs. If not, a flag can also be added.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

I think a flag is needed, not sure all vendors can work well with that.

Only i.MX6Sx uses HSIC in mainline. Is that something you can test? It would be better to not add flags unless they are really needed.
Otherwise you end up with dozens of flags like SDHCI drivers have.

I will have a test for this, and show you the result later.

Since imx6sx HSIC support is not supported at mainline, I tested this sequence at internal branch, it does not affect imx6's hsic function, I am ok with this patch.

Quoted 2 lines

Peter ��칻�&�~�&���+-��ݶ��w��˛���m�b��n������ܨ}���Ơz�&j:+v�������zZ+��+zf���h���~����i���z��w���?����&�)ߢf

Signature · 6 lines
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html