All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] vf610: Add USB support
@ 2014-07-28 14:57 ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

This patchset adds USB support for Vybrid VF610 SoC. It extends the
clock framework to support the USB PHY cocks, extends the device
tree files and adds support for the non-core registers in the
usbmisc_imx driver.

This patchset needs the eSDHC registers length fix available in
Shawn's for-next branch, since that overlapped by chance the USB
areas.

The whole patchset proved to be working on a Colibri VF61 and
Freescale Tower VF65GS10. The first USB controller runs in
peripheral mode. I could successfully use RNDIS, however with some
stability issues: Suddenly the other side was not reachable anymore
and the interface needed to brought down and back up again. I'm
still investigating this.

The second USB controller, running in USB host mode, showed errors
when connecting devices behind a USB hub:

[  215.163507] usb usb1-port1: cannot reset (err = -32)
[  215.170498] usb usb1-port1: cannot reset (err = -32)
[  215.185120] usb usb1-port1: cannot reset (err = -32)
[  215.191345] usb usb1-port1: cannot reset (err = -32)
[  215.202487] usb usb1-port1: cannot reset (err = -32)
[  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  215.219317] usb usb1-port1: unable to enumerate USB device

By extending the PHY driver with the MXS_PHY_NEED_IP_FIX flag, this
issue is resolved.

Changes in v2:
- Extended usbmisc_imx to support multiple instances
- Update DT documentation and compatible strings where necessary
- Add USB PHY flag MXS_PHY_NEED_IP_FIX
- Added patches to enable USB on Tower

Stefan Agner (7):
  ARM: dts: vf610: Add USB PHY and controller
  ARM: imx: clk-vf610: Add USBPHY clocks
  usb: phy: mxs: Add VF610 USB PHY support
  ARM: dts: vf610: Add usbmisc for non-core registers
  chipidea: usbmisc_imx: Add USB support for VF610 SoCs
  ARM: dts: vf610-colibri: Add USB support
  ARM: dts: vf610-twr: Add USB support

 Documentation/devicetree/bindings/usb/mxs-phy.txt  |  1 +
 .../devicetree/bindings/usb/usbmisc-imx.txt        |  1 +
 arch/arm/boot/dts/vf610-colibri.dts                | 10 ++++
 arch/arm/boot/dts/vf610-twr.dts                    | 10 ++++
 arch/arm/boot/dts/vf610.dtsi                       | 60 ++++++++++++++++++++--
 arch/arm/mach-imx/clk-vf610.c                      | 12 ++++-
 drivers/usb/chipidea/ci_hdrc_imx.c                 |  8 +++
 drivers/usb/chipidea/ci_hdrc_imx.h                 |  1 +
 drivers/usb/chipidea/usbmisc_imx.c                 | 52 +++++++++++++++----
 drivers/usb/phy/phy-mxs-usb.c                      |  6 +++
 include/dt-bindings/clock/vf610-clock.h            |  5 +-
 11 files changed, 149 insertions(+), 17 deletions(-)

-- 
2.0.2


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

* [PATCH v2 0/7] vf610: Add USB support
@ 2014-07-28 14:57 ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset adds USB support for Vybrid VF610 SoC. It extends the
clock framework to support the USB PHY cocks, extends the device
tree files and adds support for the non-core registers in the
usbmisc_imx driver.

This patchset needs the eSDHC registers length fix available in
Shawn's for-next branch, since that overlapped by chance the USB
areas.

The whole patchset proved to be working on a Colibri VF61 and
Freescale Tower VF65GS10. The first USB controller runs in
peripheral mode. I could successfully use RNDIS, however with some
stability issues: Suddenly the other side was not reachable anymore
and the interface needed to brought down and back up again. I'm
still investigating this.

The second USB controller, running in USB host mode, showed errors
when connecting devices behind a USB hub:

[  215.163507] usb usb1-port1: cannot reset (err = -32)
[  215.170498] usb usb1-port1: cannot reset (err = -32)
[  215.185120] usb usb1-port1: cannot reset (err = -32)
[  215.191345] usb usb1-port1: cannot reset (err = -32)
[  215.202487] usb usb1-port1: cannot reset (err = -32)
[  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  215.219317] usb usb1-port1: unable to enumerate USB device

By extending the PHY driver with the MXS_PHY_NEED_IP_FIX flag, this
issue is resolved.

Changes in v2:
- Extended usbmisc_imx to support multiple instances
- Update DT documentation and compatible strings where necessary
- Add USB PHY flag MXS_PHY_NEED_IP_FIX
- Added patches to enable USB on Tower

Stefan Agner (7):
  ARM: dts: vf610: Add USB PHY and controller
  ARM: imx: clk-vf610: Add USBPHY clocks
  usb: phy: mxs: Add VF610 USB PHY support
  ARM: dts: vf610: Add usbmisc for non-core registers
  chipidea: usbmisc_imx: Add USB support for VF610 SoCs
  ARM: dts: vf610-colibri: Add USB support
  ARM: dts: vf610-twr: Add USB support

 Documentation/devicetree/bindings/usb/mxs-phy.txt  |  1 +
 .../devicetree/bindings/usb/usbmisc-imx.txt        |  1 +
 arch/arm/boot/dts/vf610-colibri.dts                | 10 ++++
 arch/arm/boot/dts/vf610-twr.dts                    | 10 ++++
 arch/arm/boot/dts/vf610.dtsi                       | 60 ++++++++++++++++++++--
 arch/arm/mach-imx/clk-vf610.c                      | 12 ++++-
 drivers/usb/chipidea/ci_hdrc_imx.c                 |  8 +++
 drivers/usb/chipidea/ci_hdrc_imx.h                 |  1 +
 drivers/usb/chipidea/usbmisc_imx.c                 | 52 +++++++++++++++----
 drivers/usb/phy/phy-mxs-usb.c                      |  6 +++
 include/dt-bindings/clock/vf610-clock.h            |  5 +-
 11 files changed, 149 insertions(+), 17 deletions(-)

-- 
2.0.2

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

* [PATCH v2 1/7] ARM: dts: vf610: Add USB PHY and controller
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

This adds USB PHY and USB controller nodes. Vybrid SoCs have two
independent USB cores which each supports DR (dual role). However,
real OTG is not supported since the OTG ID pin is not available.

The PHYs are located within the anadig register range, hence we need
to change the length of the anadig registers.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610.dtsi | 46 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index 6a6190c..f36acb5 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -25,6 +25,8 @@
 		gpio2 = &gpio3;
 		gpio3 = &gpio4;
 		gpio4 = &gpio5;
+		usbphy0 = &usbphy0;
+		usbphy1 = &usbphy1;
 	};
 
 	cpus {
@@ -285,9 +287,25 @@
 				gpio-ranges = <&iomuxc 0 128 7>;
 			};
 
-			anatop@40050000 {
-				compatible = "fsl,vf610-anatop";
-				reg = <0x40050000 0x1000>;
+			anatop: anatop@40050000 {
+				compatible = "fsl,vf610-anatop", "syscon";
+				reg = <0x40050000 0x400>;
+			};
+
+			usbphy0: usbphy@40050800 {
+				compatible = "fsl,vf610-usbphy";
+				reg = <0x40050800 0x400>;
+				interrupts = <0 50 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBPHY0>;
+				fsl,anatop = <&anatop>;
+			};
+
+			usbphy1: usbphy@40050c00 {
+				compatible = "fsl,vf610-usbphy";
+				reg = <0x40050c00 0x400>;
+				interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBPHY1>;
+				fsl,anatop = <&anatop>;
 			};
 
 			i2c0: i2c@40066000 {
@@ -309,6 +327,18 @@
 				reg = <0x4006b000 0x1000>;
 				#clock-cells = <1>;
 			};
+
+			usbdev0: usb@40034000 {
+				compatible = "fsl,vf610-usb", "fsl,imx27-usb";
+				reg = <0x40034000 0x800>;
+				interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBC0>;
+				fsl,usbphy = <&usbphy0>;
+				dr_mode = "peripheral";
+				status = "disabled";
+			};
+
+
 		};
 
 		aips1: aips-bus@40080000 {
@@ -371,6 +401,16 @@
 				status = "disabled";
 			};
 
+			usbh1: usb@400b4000 {
+				compatible = "fsl,vf610-usb", "fsl,imx27-usb";
+				reg = <0x400b4000 0x800>;
+				interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBC1>;
+				fsl,usbphy = <&usbphy1>;
+				dr_mode = "host";
+				status = "disabled";
+			};
+
 			ftm: ftm@400b8000 {
 				compatible = "fsl,ftm-timer";
 				reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
-- 
2.0.2


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

* [PATCH v2 1/7] ARM: dts: vf610: Add USB PHY and controller
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

This adds USB PHY and USB controller nodes. Vybrid SoCs have two
independent USB cores which each supports DR (dual role). However,
real OTG is not supported since the OTG ID pin is not available.

The PHYs are located within the anadig register range, hence we need
to change the length of the anadig registers.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610.dtsi | 46 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index 6a6190c..f36acb5 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -25,6 +25,8 @@
 		gpio2 = &gpio3;
 		gpio3 = &gpio4;
 		gpio4 = &gpio5;
+		usbphy0 = &usbphy0;
+		usbphy1 = &usbphy1;
 	};
 
 	cpus {
@@ -285,9 +287,25 @@
 				gpio-ranges = <&iomuxc 0 128 7>;
 			};
 
-			anatop at 40050000 {
-				compatible = "fsl,vf610-anatop";
-				reg = <0x40050000 0x1000>;
+			anatop: anatop at 40050000 {
+				compatible = "fsl,vf610-anatop", "syscon";
+				reg = <0x40050000 0x400>;
+			};
+
+			usbphy0: usbphy at 40050800 {
+				compatible = "fsl,vf610-usbphy";
+				reg = <0x40050800 0x400>;
+				interrupts = <0 50 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBPHY0>;
+				fsl,anatop = <&anatop>;
+			};
+
+			usbphy1: usbphy at 40050c00 {
+				compatible = "fsl,vf610-usbphy";
+				reg = <0x40050c00 0x400>;
+				interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBPHY1>;
+				fsl,anatop = <&anatop>;
 			};
 
 			i2c0: i2c at 40066000 {
@@ -309,6 +327,18 @@
 				reg = <0x4006b000 0x1000>;
 				#clock-cells = <1>;
 			};
+
+			usbdev0: usb at 40034000 {
+				compatible = "fsl,vf610-usb", "fsl,imx27-usb";
+				reg = <0x40034000 0x800>;
+				interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBC0>;
+				fsl,usbphy = <&usbphy0>;
+				dr_mode = "peripheral";
+				status = "disabled";
+			};
+
+
 		};
 
 		aips1: aips-bus at 40080000 {
@@ -371,6 +401,16 @@
 				status = "disabled";
 			};
 
+			usbh1: usb at 400b4000 {
+				compatible = "fsl,vf610-usb", "fsl,imx27-usb";
+				reg = <0x400b4000 0x800>;
+				interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks VF610_CLK_USBC1>;
+				fsl,usbphy = <&usbphy1>;
+				dr_mode = "host";
+				status = "disabled";
+			};
+
 			ftm: ftm at 400b8000 {
 				compatible = "fsl,ftm-timer";
 				reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
-- 
2.0.2

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

* [PATCH v2 2/7] ARM: imx: clk-vf610: Add USBPHY clocks
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

This commit adds PLL7 which is required for USBPHY1. It also adds
the USB PHY and USB Controller clocks and the gates to enable them.

Acked-by: Jingchang Lu <jingchang.lu@freescale.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/mach-imx/clk-vf610.c           | 12 ++++++++++--
 include/dt-bindings/clock/vf610-clock.h |  5 ++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index 22dc3ee..159c5c4 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -58,6 +58,8 @@
 #define PFD_PLL1_BASE		(anatop_base + 0x2b0)
 #define PFD_PLL2_BASE		(anatop_base + 0x100)
 #define PFD_PLL3_BASE		(anatop_base + 0xf0)
+#define PLL3_CTRL		(anatop_base + 0x10)
+#define PLL7_CTRL		(anatop_base + 0x20)
 
 static void __iomem *anatop_base;
 static void __iomem *ccm_base;
@@ -148,6 +150,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
 	clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6);
 	/* pll6: default 960Mhz */
 	clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1);
+	/* pll7: USB1 PLL at 480MHz */
+	clk[VF610_CLK_PLL7_MAIN] = imx_clk_pllv3(IMX_PLLV3_USB,	"pll7_main", "fast_clk_sel", PLL7_CTRL, 0x2);
+
 	clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5);
 	clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5);
 	clk[VF610_CLK_SYS_SEL] = imx_clk_mux("sys_sel", CCM_CCSR, 0, 3, sys_sels, ARRAY_SIZE(sys_sels));
@@ -160,8 +165,11 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
 	clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock);
 	clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1);
 
-	clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "pll3_main", CCM_CCGR1, CCM_CCGRx_CGn(4));
-	clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "pll3_main", CCM_CCGR7, CCM_CCGRx_CGn(4));
+	clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_main", PLL3_CTRL, 6);
+	clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_main", PLL7_CTRL, 6);
+
+	clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4));
+	clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4));
 
 	clk[VF610_CLK_QSPI0_SEL] = imx_clk_mux("qspi0_sel", CCM_CSCMR1, 22, 2, qspi_sels, 4);
 	clk[VF610_CLK_QSPI0_EN] = imx_clk_gate("qspi0_en", "qspi0_sel", CCM_CSCDR3, 4);
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index a916029..6593757 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -164,6 +164,9 @@
 #define VF610_CLK_DMAMUX1		151
 #define VF610_CLK_DMAMUX2		152
 #define VF610_CLK_DMAMUX3		153
-#define VF610_CLK_END			154
+#define VF610_CLK_PLL7_MAIN		154
+#define VF610_CLK_USBPHY0		155
+#define VF610_CLK_USBPHY1		156
+#define VF610_CLK_END			157
 
 #endif /* __DT_BINDINGS_CLOCK_VF610_H */
-- 
2.0.2


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

* [PATCH v2 2/7] ARM: imx: clk-vf610: Add USBPHY clocks
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

This commit adds PLL7 which is required for USBPHY1. It also adds
the USB PHY and USB Controller clocks and the gates to enable them.

Acked-by: Jingchang Lu <jingchang.lu@freescale.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/mach-imx/clk-vf610.c           | 12 ++++++++++--
 include/dt-bindings/clock/vf610-clock.h |  5 ++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index 22dc3ee..159c5c4 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -58,6 +58,8 @@
 #define PFD_PLL1_BASE		(anatop_base + 0x2b0)
 #define PFD_PLL2_BASE		(anatop_base + 0x100)
 #define PFD_PLL3_BASE		(anatop_base + 0xf0)
+#define PLL3_CTRL		(anatop_base + 0x10)
+#define PLL7_CTRL		(anatop_base + 0x20)
 
 static void __iomem *anatop_base;
 static void __iomem *ccm_base;
@@ -148,6 +150,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
 	clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6);
 	/* pll6: default 960Mhz */
 	clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1);
+	/* pll7: USB1 PLL at 480MHz */
+	clk[VF610_CLK_PLL7_MAIN] = imx_clk_pllv3(IMX_PLLV3_USB,	"pll7_main", "fast_clk_sel", PLL7_CTRL, 0x2);
+
 	clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5);
 	clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5);
 	clk[VF610_CLK_SYS_SEL] = imx_clk_mux("sys_sel", CCM_CCSR, 0, 3, sys_sels, ARRAY_SIZE(sys_sels));
@@ -160,8 +165,11 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
 	clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock);
 	clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1);
 
-	clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "pll3_main", CCM_CCGR1, CCM_CCGRx_CGn(4));
-	clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "pll3_main", CCM_CCGR7, CCM_CCGRx_CGn(4));
+	clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_main", PLL3_CTRL, 6);
+	clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_main", PLL7_CTRL, 6);
+
+	clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4));
+	clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4));
 
 	clk[VF610_CLK_QSPI0_SEL] = imx_clk_mux("qspi0_sel", CCM_CSCMR1, 22, 2, qspi_sels, 4);
 	clk[VF610_CLK_QSPI0_EN] = imx_clk_gate("qspi0_en", "qspi0_sel", CCM_CSCDR3, 4);
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index a916029..6593757 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -164,6 +164,9 @@
 #define VF610_CLK_DMAMUX1		151
 #define VF610_CLK_DMAMUX2		152
 #define VF610_CLK_DMAMUX3		153
-#define VF610_CLK_END			154
+#define VF610_CLK_PLL7_MAIN		154
+#define VF610_CLK_USBPHY0		155
+#define VF610_CLK_USBPHY1		156
+#define VF610_CLK_END			157
 
 #endif /* __DT_BINDINGS_CLOCK_VF610_H */
-- 
2.0.2

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

* [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

This adds support for the USB PHY in Vybrid VF610. We assume that
the disconnection without VBUS is also needed for Vybrid.

Tests showed, without MXS_PHY_NEED_IP_FIX, enumeration of devices
behind a USB Hub fails with errors:

[  215.163507] usb usb1-port1: cannot reset (err = -32)
[  215.170498] usb usb1-port1: cannot reset (err = -32)
[  215.185120] usb usb1-port1: cannot reset (err = -32)
[  215.191345] usb usb1-port1: cannot reset (err = -32)
[  215.202487] usb usb1-port1: cannot reset (err = -32)
[  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  215.219317] usb usb1-port1: unable to enumerate USB device

Hence we also enable the MXS_PHY_NEED_IP_FIX flag.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 Documentation/devicetree/bindings/usb/mxs-phy.txt | 1 +
 drivers/usb/phy/phy-mxs-usb.c                     | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt
index cef181a..fe3eed8 100644
--- a/Documentation/devicetree/bindings/usb/mxs-phy.txt
+++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt
@@ -5,6 +5,7 @@ Required properties:
 	* "fsl,imx23-usbphy" for imx23 and imx28
 	* "fsl,imx6q-usbphy" for imx6dq and imx6dl
 	* "fsl,imx6sl-usbphy" for imx6sl
+	* "fsl,vf610-usbphy" for Vybrid vf610
   "fsl,imx23-usbphy" is still a fallback for other strings
 - reg: Should contain registers location and length
 - interrupts: Should contain phy interrupt
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index c42bdf0..8c2f23b 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -125,10 +125,16 @@ static const struct mxs_phy_data imx6sl_phy_data = {
 		MXS_PHY_NEED_IP_FIX,
 };
 
+static const struct mxs_phy_data vf610_phy_data = {
+	.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
+		MXS_PHY_NEED_IP_FIX,
+};
+
 static const struct of_device_id mxs_phy_dt_ids[] = {
 	{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
 	{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
 	{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
+	{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
-- 
2.0.2


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

* [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

This adds support for the USB PHY in Vybrid VF610. We assume that
the disconnection without VBUS is also needed for Vybrid.

Tests showed, without MXS_PHY_NEED_IP_FIX, enumeration of devices
behind a USB Hub fails with errors:

[  215.163507] usb usb1-port1: cannot reset (err = -32)
[  215.170498] usb usb1-port1: cannot reset (err = -32)
[  215.185120] usb usb1-port1: cannot reset (err = -32)
[  215.191345] usb usb1-port1: cannot reset (err = -32)
[  215.202487] usb usb1-port1: cannot reset (err = -32)
[  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  215.219317] usb usb1-port1: unable to enumerate USB device

Hence we also enable the MXS_PHY_NEED_IP_FIX flag.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 Documentation/devicetree/bindings/usb/mxs-phy.txt | 1 +
 drivers/usb/phy/phy-mxs-usb.c                     | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt
index cef181a..fe3eed8 100644
--- a/Documentation/devicetree/bindings/usb/mxs-phy.txt
+++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt
@@ -5,6 +5,7 @@ Required properties:
 	* "fsl,imx23-usbphy" for imx23 and imx28
 	* "fsl,imx6q-usbphy" for imx6dq and imx6dl
 	* "fsl,imx6sl-usbphy" for imx6sl
+	* "fsl,vf610-usbphy" for Vybrid vf610
   "fsl,imx23-usbphy" is still a fallback for other strings
 - reg: Should contain registers location and length
 - interrupts: Should contain phy interrupt
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index c42bdf0..8c2f23b 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -125,10 +125,16 @@ static const struct mxs_phy_data imx6sl_phy_data = {
 		MXS_PHY_NEED_IP_FIX,
 };
 
+static const struct mxs_phy_data vf610_phy_data = {
+	.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
+		MXS_PHY_NEED_IP_FIX,
+};
+
 static const struct of_device_id mxs_phy_dt_ids[] = {
 	{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
 	{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
 	{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
+	{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
-- 
2.0.2

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

* [PATCH v2 4/7] ARM: dts: vf610: Add usbmisc for non-core registers
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

Add device tree node for usbmisc which controls the non-core USB
registers. This is required to use the property to disable the over-
current detection.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610.dtsi | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index f36acb5..a49d739 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -334,11 +334,17 @@
 				interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_USBC0>;
 				fsl,usbphy = <&usbphy0>;
+				fsl,usbmisc = <&usbmisc0 0>;
 				dr_mode = "peripheral";
 				status = "disabled";
 			};
 
-
+			usbmisc0: usb@40034800 {
+				#index-cells = <1>;
+				compatible = "fsl,vf610-usbmisc";
+				reg = <0x40034800 0x200>;
+				clocks = <&clks VF610_CLK_USBC0>;
+			};
 		};
 
 		aips1: aips-bus@40080000 {
@@ -407,10 +413,18 @@
 				interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_USBC1>;
 				fsl,usbphy = <&usbphy1>;
+				fsl,usbmisc = <&usbmisc1 0>;
 				dr_mode = "host";
 				status = "disabled";
 			};
 
+			usbmisc1: usb@400b4800 {
+				#index-cells = <1>;
+				compatible = "fsl,vf610-usbmisc";
+				reg = <0x400b4800 0x200>;
+				clocks = <&clks VF610_CLK_USBC1>;
+			};
+
 			ftm: ftm@400b8000 {
 				compatible = "fsl,ftm-timer";
 				reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
-- 
2.0.2


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

* [PATCH v2 4/7] ARM: dts: vf610: Add usbmisc for non-core registers
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree node for usbmisc which controls the non-core USB
registers. This is required to use the property to disable the over-
current detection.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610.dtsi | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index f36acb5..a49d739 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -334,11 +334,17 @@
 				interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_USBC0>;
 				fsl,usbphy = <&usbphy0>;
+				fsl,usbmisc = <&usbmisc0 0>;
 				dr_mode = "peripheral";
 				status = "disabled";
 			};
 
-
+			usbmisc0: usb at 40034800 {
+				#index-cells = <1>;
+				compatible = "fsl,vf610-usbmisc";
+				reg = <0x40034800 0x200>;
+				clocks = <&clks VF610_CLK_USBC0>;
+			};
 		};
 
 		aips1: aips-bus at 40080000 {
@@ -407,10 +413,18 @@
 				interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_USBC1>;
 				fsl,usbphy = <&usbphy1>;
+				fsl,usbmisc = <&usbmisc1 0>;
 				dr_mode = "host";
 				status = "disabled";
 			};
 
+			usbmisc1: usb at 400b4800 {
+				#index-cells = <1>;
+				compatible = "fsl,vf610-usbmisc";
+				reg = <0x400b4800 0x200>;
+				clocks = <&clks VF610_CLK_USBC1>;
+			};
+
 			ftm: ftm at 400b8000 {
 				compatible = "fsl,ftm-timer";
 				reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
-- 
2.0.2

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

* [PATCH v2 5/7] chipidea: usbmisc_imx: Add USB support for VF610 SoCs
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

This adds Vybrid VF610 SoC support. The IP is very similar to i.MX6,
however, the non-core registers are spread in two different register
areas. Hence we support multiple instances of the USB misc driver
and add the driver instance to the imx_usbmisc_data structure.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
In the end, I decieded against the advice of Peter to integrate the
multi-instance functionality in a second driver. To support multiple
instances, I needed to extend the imx_usbmisc_data to point to the
instance. Since this is part of the ci_hdrc_imx driver, I feel it's
cleaner to extend the current driver rather to add a second driver
and implement two different handlings in the ci_hdrc_imx driver.

Also, the current approach has a slight advantage for current users
too: EPROBE_DEFER is returned earlier, when initializing the
imx_usbmisc_data structure rather than later on, when accessing
the driver by using imx_usbmisc_init/imx_usbmisc_init_post.

As a free bonus, this driver would now also support the mixed case:
multiple non-core registers in different areas which each support
multiple USB controllers...

Tell me if this is ok for you too.

 .../devicetree/bindings/usb/usbmisc-imx.txt        |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c                 |  8 ++++
 drivers/usb/chipidea/ci_hdrc_imx.h                 |  1 +
 drivers/usb/chipidea/usbmisc_imx.c                 | 52 +++++++++++++++++-----
 4 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
index 97ce94e..c101a4b 100644
--- a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
+++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
@@ -4,6 +4,7 @@ Required properties:
 - #index-cells: Cells used to descibe usb controller index. Should be <1>
 - compatible: Should be one of below:
 	"fsl,imx6q-usbmisc" for imx6q
+	"fsl,vf610-usbmisc" for Vybrid vf610
 - reg: Should contain registers location and length
 
 Examples:
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 2e58f8d..9af12b4 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -54,6 +54,7 @@ struct ci_hdrc_imx_data {
 
 static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 {
+	struct platform_device *misc_pdev;
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args args;
 	struct imx_usbmisc_data *data;
@@ -79,8 +80,15 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	}
 
 	data->index = args.args[0];
+
+	misc_pdev = of_find_device_by_node(args.np);
 	of_node_put(args.np);
 
+	if (!misc_pdev)
+		return ERR_PTR(-EPROBE_DEFER);
+
+	data->dev = &misc_pdev->dev;
+
 	if (of_find_property(np, "disable-over-current", NULL))
 		data->disable_oc = 1;
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 996ec93..4ed828f 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -13,6 +13,7 @@
 #define __DRIVER_USB_CHIPIDEA_CI_HDRC_IMX_H
 
 struct imx_usbmisc_data {
+	struct device *dev;
 	int index;
 
 	unsigned int disable_oc:1; /* over current detect disabled */
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 85293b8..926c997 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -57,6 +57,8 @@
 
 #define MX6_BM_OVER_CUR_DIS		BIT(7)
 
+#define VF610_OVER_CUR_DIS		BIT(7)
+
 struct usbmisc_ops {
 	/* It's called once when probe a usb device */
 	int (*init)(struct imx_usbmisc_data *data);
@@ -71,10 +73,9 @@ struct imx_usbmisc {
 	const struct usbmisc_ops *ops;
 };
 
-static struct imx_usbmisc *usbmisc;
-
 static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	unsigned long flags;
 	u32 val = 0;
 
@@ -108,6 +109,7 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	void __iomem *reg;
 	unsigned long flags;
 	u32 val;
@@ -130,6 +132,7 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	unsigned long flags;
 	u32 val;
 
@@ -160,6 +163,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	void __iomem *reg = NULL;
 	unsigned long flags;
 	u32 val = 0;
@@ -204,6 +208,7 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	unsigned long flags;
 	u32 reg;
 
@@ -221,6 +226,26 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 	return 0;
 }
 
+static int usbmisc_vf610_init(struct imx_usbmisc_data *data)
+{
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+	u32 reg;
+
+	/*
+	 * Vybrid only has one misc register set, but in two different
+	 * areas. These is reflected in two instances of this driver.
+	 */
+	if (data->index >= 1)
+		return -EINVAL;
+
+	if (data->disable_oc) {
+		reg = readl(usbmisc->base);
+		writel(reg | VF610_OVER_CUR_DIS, usbmisc->base);
+	}
+
+	return 0;
+}
+
 static const struct usbmisc_ops imx25_usbmisc_ops = {
 	.init = usbmisc_imx25_init,
 	.post = usbmisc_imx25_post,
@@ -238,10 +263,14 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = {
 	.init = usbmisc_imx6q_init,
 };
 
+static const struct usbmisc_ops vf610_usbmisc_ops = {
+	.init = usbmisc_vf610_init,
+};
+
 int imx_usbmisc_init(struct imx_usbmisc_data *data)
 {
-	if (!usbmisc)
-		return -EPROBE_DEFER;
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+
 	if (!usbmisc->ops->init)
 		return 0;
 	return usbmisc->ops->init(data);
@@ -250,8 +279,8 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init);
 
 int imx_usbmisc_init_post(struct imx_usbmisc_data *data)
 {
-	if (!usbmisc)
-		return -EPROBE_DEFER;
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+
 	if (!usbmisc->ops->post)
 		return 0;
 	return usbmisc->ops->post(data);
@@ -283,6 +312,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
 		.compatible = "fsl,imx6q-usbmisc",
 		.data = &imx6q_usbmisc_ops,
 	},
+	{
+		.compatible = "fsl,vf610-usbmisc",
+		.data = &vf610_usbmisc_ops,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
@@ -294,9 +327,6 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
 	int ret;
 	struct of_device_id *tmp_dev;
 
-	if (usbmisc)
-		return -EBUSY;
-
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
@@ -325,15 +355,15 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
 	tmp_dev = (struct of_device_id *)
 		of_match_device(usbmisc_imx_dt_ids, &pdev->dev);
 	data->ops = (const struct usbmisc_ops *)tmp_dev->data;
-	usbmisc = data;
+	platform_set_drvdata(pdev, data);
 
 	return 0;
 }
 
 static int usbmisc_imx_remove(struct platform_device *pdev)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(&pdev->dev);
 	clk_disable_unprepare(usbmisc->clk);
-	usbmisc = NULL;
 	return 0;
 }
 
-- 
2.0.2


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

* [PATCH v2 5/7] chipidea: usbmisc_imx: Add USB support for VF610 SoCs
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

This adds Vybrid VF610 SoC support. The IP is very similar to i.MX6,
however, the non-core registers are spread in two different register
areas. Hence we support multiple instances of the USB misc driver
and add the driver instance to the imx_usbmisc_data structure.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
In the end, I decieded against the advice of Peter to integrate the
multi-instance functionality in a second driver. To support multiple
instances, I needed to extend the imx_usbmisc_data to point to the
instance. Since this is part of the ci_hdrc_imx driver, I feel it's
cleaner to extend the current driver rather to add a second driver
and implement two different handlings in the ci_hdrc_imx driver.

Also, the current approach has a slight advantage for current users
too: EPROBE_DEFER is returned earlier, when initializing the
imx_usbmisc_data structure rather than later on, when accessing
the driver by using imx_usbmisc_init/imx_usbmisc_init_post.

As a free bonus, this driver would now also support the mixed case:
multiple non-core registers in different areas which each support
multiple USB controllers...

Tell me if this is ok for you too.

 .../devicetree/bindings/usb/usbmisc-imx.txt        |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c                 |  8 ++++
 drivers/usb/chipidea/ci_hdrc_imx.h                 |  1 +
 drivers/usb/chipidea/usbmisc_imx.c                 | 52 +++++++++++++++++-----
 4 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
index 97ce94e..c101a4b 100644
--- a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
+++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
@@ -4,6 +4,7 @@ Required properties:
 - #index-cells: Cells used to descibe usb controller index. Should be <1>
 - compatible: Should be one of below:
 	"fsl,imx6q-usbmisc" for imx6q
+	"fsl,vf610-usbmisc" for Vybrid vf610
 - reg: Should contain registers location and length
 
 Examples:
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 2e58f8d..9af12b4 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -54,6 +54,7 @@ struct ci_hdrc_imx_data {
 
 static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 {
+	struct platform_device *misc_pdev;
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args args;
 	struct imx_usbmisc_data *data;
@@ -79,8 +80,15 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	}
 
 	data->index = args.args[0];
+
+	misc_pdev = of_find_device_by_node(args.np);
 	of_node_put(args.np);
 
+	if (!misc_pdev)
+		return ERR_PTR(-EPROBE_DEFER);
+
+	data->dev = &misc_pdev->dev;
+
 	if (of_find_property(np, "disable-over-current", NULL))
 		data->disable_oc = 1;
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 996ec93..4ed828f 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -13,6 +13,7 @@
 #define __DRIVER_USB_CHIPIDEA_CI_HDRC_IMX_H
 
 struct imx_usbmisc_data {
+	struct device *dev;
 	int index;
 
 	unsigned int disable_oc:1; /* over current detect disabled */
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 85293b8..926c997 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -57,6 +57,8 @@
 
 #define MX6_BM_OVER_CUR_DIS		BIT(7)
 
+#define VF610_OVER_CUR_DIS		BIT(7)
+
 struct usbmisc_ops {
 	/* It's called once when probe a usb device */
 	int (*init)(struct imx_usbmisc_data *data);
@@ -71,10 +73,9 @@ struct imx_usbmisc {
 	const struct usbmisc_ops *ops;
 };
 
-static struct imx_usbmisc *usbmisc;
-
 static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	unsigned long flags;
 	u32 val = 0;
 
@@ -108,6 +109,7 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	void __iomem *reg;
 	unsigned long flags;
 	u32 val;
@@ -130,6 +132,7 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	unsigned long flags;
 	u32 val;
 
@@ -160,6 +163,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	void __iomem *reg = NULL;
 	unsigned long flags;
 	u32 val = 0;
@@ -204,6 +208,7 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 
 static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
 	unsigned long flags;
 	u32 reg;
 
@@ -221,6 +226,26 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 	return 0;
 }
 
+static int usbmisc_vf610_init(struct imx_usbmisc_data *data)
+{
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+	u32 reg;
+
+	/*
+	 * Vybrid only has one misc register set, but in two different
+	 * areas. These is reflected in two instances of this driver.
+	 */
+	if (data->index >= 1)
+		return -EINVAL;
+
+	if (data->disable_oc) {
+		reg = readl(usbmisc->base);
+		writel(reg | VF610_OVER_CUR_DIS, usbmisc->base);
+	}
+
+	return 0;
+}
+
 static const struct usbmisc_ops imx25_usbmisc_ops = {
 	.init = usbmisc_imx25_init,
 	.post = usbmisc_imx25_post,
@@ -238,10 +263,14 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = {
 	.init = usbmisc_imx6q_init,
 };
 
+static const struct usbmisc_ops vf610_usbmisc_ops = {
+	.init = usbmisc_vf610_init,
+};
+
 int imx_usbmisc_init(struct imx_usbmisc_data *data)
 {
-	if (!usbmisc)
-		return -EPROBE_DEFER;
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+
 	if (!usbmisc->ops->init)
 		return 0;
 	return usbmisc->ops->init(data);
@@ -250,8 +279,8 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init);
 
 int imx_usbmisc_init_post(struct imx_usbmisc_data *data)
 {
-	if (!usbmisc)
-		return -EPROBE_DEFER;
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+
 	if (!usbmisc->ops->post)
 		return 0;
 	return usbmisc->ops->post(data);
@@ -283,6 +312,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
 		.compatible = "fsl,imx6q-usbmisc",
 		.data = &imx6q_usbmisc_ops,
 	},
+	{
+		.compatible = "fsl,vf610-usbmisc",
+		.data = &vf610_usbmisc_ops,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
@@ -294,9 +327,6 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
 	int ret;
 	struct of_device_id *tmp_dev;
 
-	if (usbmisc)
-		return -EBUSY;
-
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
@@ -325,15 +355,15 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
 	tmp_dev = (struct of_device_id *)
 		of_match_device(usbmisc_imx_dt_ids, &pdev->dev);
 	data->ops = (const struct usbmisc_ops *)tmp_dev->data;
-	usbmisc = data;
+	platform_set_drvdata(pdev, data);
 
 	return 0;
 }
 
 static int usbmisc_imx_remove(struct platform_device *pdev)
 {
+	struct imx_usbmisc *usbmisc = dev_get_drvdata(&pdev->dev);
 	clk_disable_unprepare(usbmisc->clk);
-	usbmisc = NULL;
 	return 0;
 }
 
-- 
2.0.2

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

* [PATCH v2 6/7] ARM: dts: vf610-colibri: Add USB support
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

Add USB support for Colibri VF61 modules. The Colibri standard pinout
defines a pin for USB over-current. However, due to lack of pinmux
options, the USB hosts over-current protection signal of the Colibri
standard could not be connected to the PHY's over-current protection.
Hence we need to disable the over-current functionality of the USB
controller.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610-colibri.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-colibri.dts b/arch/arm/boot/dts/vf610-colibri.dts
index aecc7db..f2a950d 100644
--- a/arch/arm/boot/dts/vf610-colibri.dts
+++ b/arch/arm/boot/dts/vf610-colibri.dts
@@ -69,6 +69,16 @@
 	status = "okay";
 };
 
+&usbdev0 {
+	disable-over-current;
+	status = "okay";
+};
+
+&usbh1 {
+	disable-over-current;
+	status = "okay";
+};
+
 &iomuxc {
 	vf610-colibri {
 		pinctrl_esdhc1: esdhc1grp {
-- 
2.0.2


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

* [PATCH v2 6/7] ARM: dts: vf610-colibri: Add USB support
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add USB support for Colibri VF61 modules. The Colibri standard pinout
defines a pin for USB over-current. However, due to lack of pinmux
options, the USB hosts over-current protection signal of the Colibri
standard could not be connected to the PHY's over-current protection.
Hence we need to disable the over-current functionality of the USB
controller.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610-colibri.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-colibri.dts b/arch/arm/boot/dts/vf610-colibri.dts
index aecc7db..f2a950d 100644
--- a/arch/arm/boot/dts/vf610-colibri.dts
+++ b/arch/arm/boot/dts/vf610-colibri.dts
@@ -69,6 +69,16 @@
 	status = "okay";
 };
 
+&usbdev0 {
+	disable-over-current;
+	status = "okay";
+};
+
+&usbh1 {
+	disable-over-current;
+	status = "okay";
+};
+
 &iomuxc {
 	vf610-colibri {
 		pinctrl_esdhc1: esdhc1grp {
-- 
2.0.2

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

* [PATCH v2 7/7] ARM: dts: vf610-twr: Add USB support
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-28 14:57   ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: peter.chen, s.hauer, shawn.guo
  Cc: b35083, jingchang.lu, linux-arm-kernel, linux-usb, linux-kernel, stefan

Add USB support for Freescale Vybrid tower. The USB hosts over-current
protection signal is not connected is not connected to the PHY's over-
current protection, hence we need to disable it.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610-twr.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index 11d7334..c709dc3 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -265,3 +265,13 @@
 	pinctrl-0 = <&pinctrl_uart1>;
 	status = "okay";
 };
+
+&usbdev0 {
+	disable-over-current;
+	status = "okay";
+};
+
+&usbh1 {
+	disable-over-current;
+	status = "okay";
+};
-- 
2.0.2


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

* [PATCH v2 7/7] ARM: dts: vf610-twr: Add USB support
@ 2014-07-28 14:57   ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-07-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add USB support for Freescale Vybrid tower. The USB hosts over-current
protection signal is not connected is not connected to the PHY's over-
current protection, hence we need to disable it.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/boot/dts/vf610-twr.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index 11d7334..c709dc3 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -265,3 +265,13 @@
 	pinctrl-0 = <&pinctrl_uart1>;
 	status = "okay";
 };
+
+&usbdev0 {
+	disable-over-current;
+	status = "okay";
+};
+
+&usbh1 {
+	disable-over-current;
+	status = "okay";
+};
-- 
2.0.2

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

* Re: [PATCH v2 0/7] vf610: Add USB support
  2014-07-28 14:57 ` Stefan Agner
@ 2014-07-29  9:22   ` Shawn Guo
  -1 siblings, 0 replies; 24+ messages in thread
From: Shawn Guo @ 2014-07-29  9:22 UTC (permalink / raw)
  To: Stefan Agner
  Cc: peter.chen, s.hauer, b35083, jingchang.lu, linux-arm-kernel,
	linux-usb, linux-kernel

On Mon, Jul 28, 2014 at 04:57:26PM +0200, Stefan Agner wrote:
> Stefan Agner (7):
>   ARM: dts: vf610: Add USB PHY and controller
>   ARM: imx: clk-vf610: Add USBPHY clocks
...
>   ARM: dts: vf610: Add usbmisc for non-core registers
...
>   ARM: dts: vf610-colibri: Add USB support
>   ARM: dts: vf610-twr: Add USB support

These 'ARM: ...' patches look fine to me, and I will apply them on IMX
tree once the driver changes are accepted.

Shawn

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

* [PATCH v2 0/7] vf610: Add USB support
@ 2014-07-29  9:22   ` Shawn Guo
  0 siblings, 0 replies; 24+ messages in thread
From: Shawn Guo @ 2014-07-29  9:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 28, 2014 at 04:57:26PM +0200, Stefan Agner wrote:
> Stefan Agner (7):
>   ARM: dts: vf610: Add USB PHY and controller
>   ARM: imx: clk-vf610: Add USBPHY clocks
...
>   ARM: dts: vf610: Add usbmisc for non-core registers
...
>   ARM: dts: vf610-colibri: Add USB support
>   ARM: dts: vf610-twr: Add USB support

These 'ARM: ...' patches look fine to me, and I will apply them on IMX
tree once the driver changes are accepted.

Shawn

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

* Re: [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support
  2014-07-28 14:57   ` Stefan Agner
@ 2014-08-02  0:36     ` Peter Chen
  -1 siblings, 0 replies; 24+ messages in thread
From: Peter Chen @ 2014-08-02  0:36 UTC (permalink / raw)
  To: Stefan Agner
  Cc: s.hauer, shawn.guo, b35083, jingchang.lu, linux-arm-kernel,
	linux-usb, linux-kernel

On Mon, Jul 28, 2014 at 04:57:29PM +0200, Stefan Agner wrote:
> This adds support for the USB PHY in Vybrid VF610. We assume that
> the disconnection without VBUS is also needed for Vybrid.
> 
> Tests showed, without MXS_PHY_NEED_IP_FIX, enumeration of devices
> behind a USB Hub fails with errors:
> 
> [  215.163507] usb usb1-port1: cannot reset (err = -32)
> [  215.170498] usb usb1-port1: cannot reset (err = -32)
> [  215.185120] usb usb1-port1: cannot reset (err = -32)
> [  215.191345] usb usb1-port1: cannot reset (err = -32)
> [  215.202487] usb usb1-port1: cannot reset (err = -32)
> [  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
> [  215.219317] usb usb1-port1: unable to enumerate USB device
> 
> Hence we also enable the MXS_PHY_NEED_IP_FIX flag.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  Documentation/devicetree/bindings/usb/mxs-phy.txt | 1 +
>  drivers/usb/phy/phy-mxs-usb.c                     | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt
> index cef181a..fe3eed8 100644
> --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt
> +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt
> @@ -5,6 +5,7 @@ Required properties:
>  	* "fsl,imx23-usbphy" for imx23 and imx28
>  	* "fsl,imx6q-usbphy" for imx6dq and imx6dl
>  	* "fsl,imx6sl-usbphy" for imx6sl
> +	* "fsl,vf610-usbphy" for Vybrid vf610
>    "fsl,imx23-usbphy" is still a fallback for other strings
>  - reg: Should contain registers location and length
>  - interrupts: Should contain phy interrupt
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index c42bdf0..8c2f23b 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -125,10 +125,16 @@ static const struct mxs_phy_data imx6sl_phy_data = {
>  		MXS_PHY_NEED_IP_FIX,
>  };
>  
> +static const struct mxs_phy_data vf610_phy_data = {
> +	.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
> +		MXS_PHY_NEED_IP_FIX,
> +};
> +
>  static const struct of_device_id mxs_phy_dt_ids[] = {
>  	{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
>  	{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
>  	{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
> +	{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
> -- 
> 2.0.2
> 

Acked-by: Peter Chen <peter.chen@freescale.com>

-- 
Best Regards,
Peter Chen

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

* [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support
@ 2014-08-02  0:36     ` Peter Chen
  0 siblings, 0 replies; 24+ messages in thread
From: Peter Chen @ 2014-08-02  0:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 28, 2014 at 04:57:29PM +0200, Stefan Agner wrote:
> This adds support for the USB PHY in Vybrid VF610. We assume that
> the disconnection without VBUS is also needed for Vybrid.
> 
> Tests showed, without MXS_PHY_NEED_IP_FIX, enumeration of devices
> behind a USB Hub fails with errors:
> 
> [  215.163507] usb usb1-port1: cannot reset (err = -32)
> [  215.170498] usb usb1-port1: cannot reset (err = -32)
> [  215.185120] usb usb1-port1: cannot reset (err = -32)
> [  215.191345] usb usb1-port1: cannot reset (err = -32)
> [  215.202487] usb usb1-port1: cannot reset (err = -32)
> [  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
> [  215.219317] usb usb1-port1: unable to enumerate USB device
> 
> Hence we also enable the MXS_PHY_NEED_IP_FIX flag.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  Documentation/devicetree/bindings/usb/mxs-phy.txt | 1 +
>  drivers/usb/phy/phy-mxs-usb.c                     | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt
> index cef181a..fe3eed8 100644
> --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt
> +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt
> @@ -5,6 +5,7 @@ Required properties:
>  	* "fsl,imx23-usbphy" for imx23 and imx28
>  	* "fsl,imx6q-usbphy" for imx6dq and imx6dl
>  	* "fsl,imx6sl-usbphy" for imx6sl
> +	* "fsl,vf610-usbphy" for Vybrid vf610
>    "fsl,imx23-usbphy" is still a fallback for other strings
>  - reg: Should contain registers location and length
>  - interrupts: Should contain phy interrupt
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index c42bdf0..8c2f23b 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -125,10 +125,16 @@ static const struct mxs_phy_data imx6sl_phy_data = {
>  		MXS_PHY_NEED_IP_FIX,
>  };
>  
> +static const struct mxs_phy_data vf610_phy_data = {
> +	.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
> +		MXS_PHY_NEED_IP_FIX,
> +};
> +
>  static const struct of_device_id mxs_phy_dt_ids[] = {
>  	{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
>  	{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
>  	{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
> +	{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
> -- 
> 2.0.2
> 

Acked-by: Peter Chen <peter.chen@freescale.com>

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v2 5/7] chipidea: usbmisc_imx: Add USB support for VF610 SoCs
  2014-07-28 14:57   ` Stefan Agner
@ 2014-08-02  1:08     ` Peter Chen
  -1 siblings, 0 replies; 24+ messages in thread
From: Peter Chen @ 2014-08-02  1:08 UTC (permalink / raw)
  To: Stefan Agner
  Cc: s.hauer, shawn.guo, b35083, jingchang.lu, linux-arm-kernel,
	linux-usb, linux-kernel

On Mon, Jul 28, 2014 at 04:57:31PM +0200, Stefan Agner wrote:
> This adds Vybrid VF610 SoC support. The IP is very similar to i.MX6,
> however, the non-core registers are spread in two different register
> areas. Hence we support multiple instances of the USB misc driver
> and add the driver instance to the imx_usbmisc_data structure.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> In the end, I decieded against the advice of Peter to integrate the
> multi-instance functionality in a second driver. To support multiple
> instances, I needed to extend the imx_usbmisc_data to point to the
> instance. Since this is part of the ci_hdrc_imx driver, I feel it's
> cleaner to extend the current driver rather to add a second driver
> and implement two different handlings in the ci_hdrc_imx driver.
> 
> Also, the current approach has a slight advantage for current users
> too: EPROBE_DEFER is returned earlier, when initializing the
> imx_usbmisc_data structure rather than later on, when accessing
> the driver by using imx_usbmisc_init/imx_usbmisc_init_post.
> 
> As a free bonus, this driver would now also support the mixed case:
> multiple non-core registers in different areas which each support
> multiple USB controllers...
> 
> Tell me if this is ok for you too.
> 
>  .../devicetree/bindings/usb/usbmisc-imx.txt        |  1 +
>  drivers/usb/chipidea/ci_hdrc_imx.c                 |  8 ++++
>  drivers/usb/chipidea/ci_hdrc_imx.h                 |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c                 | 52 +++++++++++++++++-----
>  4 files changed, 51 insertions(+), 11 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
> index 97ce94e..c101a4b 100644
> --- a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
> +++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
> @@ -4,6 +4,7 @@ Required properties:
>  - #index-cells: Cells used to descibe usb controller index. Should be <1>
>  - compatible: Should be one of below:
>  	"fsl,imx6q-usbmisc" for imx6q
> +	"fsl,vf610-usbmisc" for Vybrid vf610
>  - reg: Should contain registers location and length
>  
>  Examples:
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 2e58f8d..9af12b4 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -54,6 +54,7 @@ struct ci_hdrc_imx_data {
>  
>  static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  {
> +	struct platform_device *misc_pdev;
>  	struct device_node *np = dev->of_node;
>  	struct of_phandle_args args;
>  	struct imx_usbmisc_data *data;
> @@ -79,8 +80,15 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  	}
>  
>  	data->index = args.args[0];
> +
> +	misc_pdev = of_find_device_by_node(args.np);
>  	of_node_put(args.np);
>  
> +	if (!misc_pdev)
> +		return ERR_PTR(-EPROBE_DEFER);
> +
> +	data->dev = &misc_pdev->dev;
> +
>  	if (of_find_property(np, "disable-over-current", NULL))
>  		data->disable_oc = 1;
>  
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
> index 996ec93..4ed828f 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.h
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.h
> @@ -13,6 +13,7 @@
>  #define __DRIVER_USB_CHIPIDEA_CI_HDRC_IMX_H
>  
>  struct imx_usbmisc_data {
> +	struct device *dev;
>  	int index;
>  
>  	unsigned int disable_oc:1; /* over current detect disabled */
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index 85293b8..926c997 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -57,6 +57,8 @@
>  
>  #define MX6_BM_OVER_CUR_DIS		BIT(7)
>  
> +#define VF610_OVER_CUR_DIS		BIT(7)
> +
>  struct usbmisc_ops {
>  	/* It's called once when probe a usb device */
>  	int (*init)(struct imx_usbmisc_data *data);
> @@ -71,10 +73,9 @@ struct imx_usbmisc {
>  	const struct usbmisc_ops *ops;
>  };
>  
> -static struct imx_usbmisc *usbmisc;
> -
>  static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	unsigned long flags;
>  	u32 val = 0;
>  
> @@ -108,6 +109,7 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	void __iomem *reg;
>  	unsigned long flags;
>  	u32 val;
> @@ -130,6 +132,7 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	unsigned long flags;
>  	u32 val;
>  
> @@ -160,6 +163,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	void __iomem *reg = NULL;
>  	unsigned long flags;
>  	u32 val = 0;
> @@ -204,6 +208,7 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	unsigned long flags;
>  	u32 reg;
>  
> @@ -221,6 +226,26 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
>  	return 0;
>  }
>  
> +static int usbmisc_vf610_init(struct imx_usbmisc_data *data)
> +{
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> +	u32 reg;
> +
> +	/*
> +	 * Vybrid only has one misc register set, but in two different
> +	 * areas. These is reflected in two instances of this driver.
> +	 */
> +	if (data->index >= 1)
> +		return -EINVAL;
> +
> +	if (data->disable_oc) {
> +		reg = readl(usbmisc->base);
> +		writel(reg | VF610_OVER_CUR_DIS, usbmisc->base);
> +	}
> +
> +	return 0;
> +}
> +
>  static const struct usbmisc_ops imx25_usbmisc_ops = {
>  	.init = usbmisc_imx25_init,
>  	.post = usbmisc_imx25_post,
> @@ -238,10 +263,14 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = {
>  	.init = usbmisc_imx6q_init,
>  };
>  
> +static const struct usbmisc_ops vf610_usbmisc_ops = {
> +	.init = usbmisc_vf610_init,
> +};
> +
>  int imx_usbmisc_init(struct imx_usbmisc_data *data)
>  {
> -	if (!usbmisc)
> -		return -EPROBE_DEFER;
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> +
>  	if (!usbmisc->ops->init)
>  		return 0;
>  	return usbmisc->ops->init(data);
> @@ -250,8 +279,8 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init);
>  
>  int imx_usbmisc_init_post(struct imx_usbmisc_data *data)
>  {
> -	if (!usbmisc)
> -		return -EPROBE_DEFER;
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> +
>  	if (!usbmisc->ops->post)
>  		return 0;
>  	return usbmisc->ops->post(data);
> @@ -283,6 +312,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
>  		.compatible = "fsl,imx6q-usbmisc",
>  		.data = &imx6q_usbmisc_ops,
>  	},
> +	{
> +		.compatible = "fsl,vf610-usbmisc",
> +		.data = &vf610_usbmisc_ops,
> +	},
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
> @@ -294,9 +327,6 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
>  	int ret;
>  	struct of_device_id *tmp_dev;
>  
> -	if (usbmisc)
> -		return -EBUSY;
> -
>  	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
> @@ -325,15 +355,15 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
>  	tmp_dev = (struct of_device_id *)
>  		of_match_device(usbmisc_imx_dt_ids, &pdev->dev);
>  	data->ops = (const struct usbmisc_ops *)tmp_dev->data;
> -	usbmisc = data;
> +	platform_set_drvdata(pdev, data);
>  
>  	return 0;
>  }
>  
>  static int usbmisc_imx_remove(struct platform_device *pdev)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(&pdev->dev);
>  	clk_disable_unprepare(usbmisc->clk);
> -	usbmisc = NULL;
>  	return 0;
>  }
>  
> -- 
> 2.0.2
> 

Great patch, applied to my local tree, thanks.

-- 
Best Regards,
Peter Chen

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

* [PATCH v2 5/7] chipidea: usbmisc_imx: Add USB support for VF610 SoCs
@ 2014-08-02  1:08     ` Peter Chen
  0 siblings, 0 replies; 24+ messages in thread
From: Peter Chen @ 2014-08-02  1:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 28, 2014 at 04:57:31PM +0200, Stefan Agner wrote:
> This adds Vybrid VF610 SoC support. The IP is very similar to i.MX6,
> however, the non-core registers are spread in two different register
> areas. Hence we support multiple instances of the USB misc driver
> and add the driver instance to the imx_usbmisc_data structure.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> In the end, I decieded against the advice of Peter to integrate the
> multi-instance functionality in a second driver. To support multiple
> instances, I needed to extend the imx_usbmisc_data to point to the
> instance. Since this is part of the ci_hdrc_imx driver, I feel it's
> cleaner to extend the current driver rather to add a second driver
> and implement two different handlings in the ci_hdrc_imx driver.
> 
> Also, the current approach has a slight advantage for current users
> too: EPROBE_DEFER is returned earlier, when initializing the
> imx_usbmisc_data structure rather than later on, when accessing
> the driver by using imx_usbmisc_init/imx_usbmisc_init_post.
> 
> As a free bonus, this driver would now also support the mixed case:
> multiple non-core registers in different areas which each support
> multiple USB controllers...
> 
> Tell me if this is ok for you too.
> 
>  .../devicetree/bindings/usb/usbmisc-imx.txt        |  1 +
>  drivers/usb/chipidea/ci_hdrc_imx.c                 |  8 ++++
>  drivers/usb/chipidea/ci_hdrc_imx.h                 |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c                 | 52 +++++++++++++++++-----
>  4 files changed, 51 insertions(+), 11 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
> index 97ce94e..c101a4b 100644
> --- a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
> +++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
> @@ -4,6 +4,7 @@ Required properties:
>  - #index-cells: Cells used to descibe usb controller index. Should be <1>
>  - compatible: Should be one of below:
>  	"fsl,imx6q-usbmisc" for imx6q
> +	"fsl,vf610-usbmisc" for Vybrid vf610
>  - reg: Should contain registers location and length
>  
>  Examples:
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 2e58f8d..9af12b4 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -54,6 +54,7 @@ struct ci_hdrc_imx_data {
>  
>  static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  {
> +	struct platform_device *misc_pdev;
>  	struct device_node *np = dev->of_node;
>  	struct of_phandle_args args;
>  	struct imx_usbmisc_data *data;
> @@ -79,8 +80,15 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  	}
>  
>  	data->index = args.args[0];
> +
> +	misc_pdev = of_find_device_by_node(args.np);
>  	of_node_put(args.np);
>  
> +	if (!misc_pdev)
> +		return ERR_PTR(-EPROBE_DEFER);
> +
> +	data->dev = &misc_pdev->dev;
> +
>  	if (of_find_property(np, "disable-over-current", NULL))
>  		data->disable_oc = 1;
>  
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
> index 996ec93..4ed828f 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.h
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.h
> @@ -13,6 +13,7 @@
>  #define __DRIVER_USB_CHIPIDEA_CI_HDRC_IMX_H
>  
>  struct imx_usbmisc_data {
> +	struct device *dev;
>  	int index;
>  
>  	unsigned int disable_oc:1; /* over current detect disabled */
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index 85293b8..926c997 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -57,6 +57,8 @@
>  
>  #define MX6_BM_OVER_CUR_DIS		BIT(7)
>  
> +#define VF610_OVER_CUR_DIS		BIT(7)
> +
>  struct usbmisc_ops {
>  	/* It's called once when probe a usb device */
>  	int (*init)(struct imx_usbmisc_data *data);
> @@ -71,10 +73,9 @@ struct imx_usbmisc {
>  	const struct usbmisc_ops *ops;
>  };
>  
> -static struct imx_usbmisc *usbmisc;
> -
>  static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	unsigned long flags;
>  	u32 val = 0;
>  
> @@ -108,6 +109,7 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	void __iomem *reg;
>  	unsigned long flags;
>  	u32 val;
> @@ -130,6 +132,7 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	unsigned long flags;
>  	u32 val;
>  
> @@ -160,6 +163,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	void __iomem *reg = NULL;
>  	unsigned long flags;
>  	u32 val = 0;
> @@ -204,6 +208,7 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
>  
>  static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
>  	unsigned long flags;
>  	u32 reg;
>  
> @@ -221,6 +226,26 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
>  	return 0;
>  }
>  
> +static int usbmisc_vf610_init(struct imx_usbmisc_data *data)
> +{
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> +	u32 reg;
> +
> +	/*
> +	 * Vybrid only has one misc register set, but in two different
> +	 * areas. These is reflected in two instances of this driver.
> +	 */
> +	if (data->index >= 1)
> +		return -EINVAL;
> +
> +	if (data->disable_oc) {
> +		reg = readl(usbmisc->base);
> +		writel(reg | VF610_OVER_CUR_DIS, usbmisc->base);
> +	}
> +
> +	return 0;
> +}
> +
>  static const struct usbmisc_ops imx25_usbmisc_ops = {
>  	.init = usbmisc_imx25_init,
>  	.post = usbmisc_imx25_post,
> @@ -238,10 +263,14 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = {
>  	.init = usbmisc_imx6q_init,
>  };
>  
> +static const struct usbmisc_ops vf610_usbmisc_ops = {
> +	.init = usbmisc_vf610_init,
> +};
> +
>  int imx_usbmisc_init(struct imx_usbmisc_data *data)
>  {
> -	if (!usbmisc)
> -		return -EPROBE_DEFER;
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> +
>  	if (!usbmisc->ops->init)
>  		return 0;
>  	return usbmisc->ops->init(data);
> @@ -250,8 +279,8 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init);
>  
>  int imx_usbmisc_init_post(struct imx_usbmisc_data *data)
>  {
> -	if (!usbmisc)
> -		return -EPROBE_DEFER;
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> +
>  	if (!usbmisc->ops->post)
>  		return 0;
>  	return usbmisc->ops->post(data);
> @@ -283,6 +312,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
>  		.compatible = "fsl,imx6q-usbmisc",
>  		.data = &imx6q_usbmisc_ops,
>  	},
> +	{
> +		.compatible = "fsl,vf610-usbmisc",
> +		.data = &vf610_usbmisc_ops,
> +	},
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
> @@ -294,9 +327,6 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
>  	int ret;
>  	struct of_device_id *tmp_dev;
>  
> -	if (usbmisc)
> -		return -EBUSY;
> -
>  	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
> @@ -325,15 +355,15 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
>  	tmp_dev = (struct of_device_id *)
>  		of_match_device(usbmisc_imx_dt_ids, &pdev->dev);
>  	data->ops = (const struct usbmisc_ops *)tmp_dev->data;
> -	usbmisc = data;
> +	platform_set_drvdata(pdev, data);
>  
>  	return 0;
>  }
>  
>  static int usbmisc_imx_remove(struct platform_device *pdev)
>  {
> +	struct imx_usbmisc *usbmisc = dev_get_drvdata(&pdev->dev);
>  	clk_disable_unprepare(usbmisc->clk);
> -	usbmisc = NULL;
>  	return 0;
>  }
>  
> -- 
> 2.0.2
> 

Great patch, applied to my local tree, thanks.

-- 
Best Regards,
Peter Chen

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

* Re: [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support
  2014-08-02  0:36     ` Peter Chen
@ 2014-08-02 14:23       ` Stefan Agner
  -1 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-08-02 14:23 UTC (permalink / raw)
  To: Peter Chen, balbi
  Cc: s.hauer, shawn.guo, b35083, jingchang.lu, linux-arm-kernel,
	linux-usb, linux-kernel

Am 2014-08-02 02:36, schrieb Peter Chen:
> On Mon, Jul 28, 2014 at 04:57:29PM +0200, Stefan Agner wrote:
>> This adds support for the USB PHY in Vybrid VF610. We assume that
>> the disconnection without VBUS is also needed for Vybrid.
>>
>> Tests showed, without MXS_PHY_NEED_IP_FIX, enumeration of devices
>> behind a USB Hub fails with errors:
>>
>> [  215.163507] usb usb1-port1: cannot reset (err = -32)
>> [  215.170498] usb usb1-port1: cannot reset (err = -32)
>> [  215.185120] usb usb1-port1: cannot reset (err = -32)
>> [  215.191345] usb usb1-port1: cannot reset (err = -32)
>> [  215.202487] usb usb1-port1: cannot reset (err = -32)
>> [  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
>> [  215.219317] usb usb1-port1: unable to enumerate USB device
>>
>> Hence we also enable the MXS_PHY_NEED_IP_FIX flag.
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>>  Documentation/devicetree/bindings/usb/mxs-phy.txt | 1 +
>>  drivers/usb/phy/phy-mxs-usb.c                     | 6 ++++++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt
>> index cef181a..fe3eed8 100644
>> --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt
>> +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt
>> @@ -5,6 +5,7 @@ Required properties:
>>  	* "fsl,imx23-usbphy" for imx23 and imx28
>>  	* "fsl,imx6q-usbphy" for imx6dq and imx6dl
>>  	* "fsl,imx6sl-usbphy" for imx6sl
>> +	* "fsl,vf610-usbphy" for Vybrid vf610
>>    "fsl,imx23-usbphy" is still a fallback for other strings
>>  - reg: Should contain registers location and length
>>  - interrupts: Should contain phy interrupt
>> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
>> index c42bdf0..8c2f23b 100644
>> --- a/drivers/usb/phy/phy-mxs-usb.c
>> +++ b/drivers/usb/phy/phy-mxs-usb.c
>> @@ -125,10 +125,16 @@ static const struct mxs_phy_data imx6sl_phy_data = {
>>  		MXS_PHY_NEED_IP_FIX,
>>  };
>>
>> +static const struct mxs_phy_data vf610_phy_data = {
>> +	.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
>> +		MXS_PHY_NEED_IP_FIX,
>> +};
>> +
>>  static const struct of_device_id mxs_phy_dt_ids[] = {
>>  	{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
>>  	{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
>>  	{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
>> +	{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
>>  	{ /* sentinel */ }
>>  };
>>  MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
>> --
>> 2.0.2
>>
> 
> Acked-by: Peter Chen <peter.chen@freescale.com>

Thanks Peter.

Just realized that I missed USB PHY maintainer Felipe Balbi, sorry!
Felipe, I guess this goes through your tree?

--
Stefan



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

* [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support
@ 2014-08-02 14:23       ` Stefan Agner
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Agner @ 2014-08-02 14:23 UTC (permalink / raw)
  To: linux-arm-kernel

Am 2014-08-02 02:36, schrieb Peter Chen:
> On Mon, Jul 28, 2014 at 04:57:29PM +0200, Stefan Agner wrote:
>> This adds support for the USB PHY in Vybrid VF610. We assume that
>> the disconnection without VBUS is also needed for Vybrid.
>>
>> Tests showed, without MXS_PHY_NEED_IP_FIX, enumeration of devices
>> behind a USB Hub fails with errors:
>>
>> [  215.163507] usb usb1-port1: cannot reset (err = -32)
>> [  215.170498] usb usb1-port1: cannot reset (err = -32)
>> [  215.185120] usb usb1-port1: cannot reset (err = -32)
>> [  215.191345] usb usb1-port1: cannot reset (err = -32)
>> [  215.202487] usb usb1-port1: cannot reset (err = -32)
>> [  215.207718] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
>> [  215.219317] usb usb1-port1: unable to enumerate USB device
>>
>> Hence we also enable the MXS_PHY_NEED_IP_FIX flag.
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>>  Documentation/devicetree/bindings/usb/mxs-phy.txt | 1 +
>>  drivers/usb/phy/phy-mxs-usb.c                     | 6 ++++++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt
>> index cef181a..fe3eed8 100644
>> --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt
>> +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt
>> @@ -5,6 +5,7 @@ Required properties:
>>  	* "fsl,imx23-usbphy" for imx23 and imx28
>>  	* "fsl,imx6q-usbphy" for imx6dq and imx6dl
>>  	* "fsl,imx6sl-usbphy" for imx6sl
>> +	* "fsl,vf610-usbphy" for Vybrid vf610
>>    "fsl,imx23-usbphy" is still a fallback for other strings
>>  - reg: Should contain registers location and length
>>  - interrupts: Should contain phy interrupt
>> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
>> index c42bdf0..8c2f23b 100644
>> --- a/drivers/usb/phy/phy-mxs-usb.c
>> +++ b/drivers/usb/phy/phy-mxs-usb.c
>> @@ -125,10 +125,16 @@ static const struct mxs_phy_data imx6sl_phy_data = {
>>  		MXS_PHY_NEED_IP_FIX,
>>  };
>>
>> +static const struct mxs_phy_data vf610_phy_data = {
>> +	.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
>> +		MXS_PHY_NEED_IP_FIX,
>> +};
>> +
>>  static const struct of_device_id mxs_phy_dt_ids[] = {
>>  	{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
>>  	{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
>>  	{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
>> +	{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
>>  	{ /* sentinel */ }
>>  };
>>  MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
>> --
>> 2.0.2
>>
> 
> Acked-by: Peter Chen <peter.chen@freescale.com>

Thanks Peter.

Just realized that I missed USB PHY maintainer Felipe Balbi, sorry!
Felipe, I guess this goes through your tree?

--
Stefan

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

end of thread, other threads:[~2014-08-02 14:24 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 14:57 [PATCH v2 0/7] vf610: Add USB support Stefan Agner
2014-07-28 14:57 ` Stefan Agner
2014-07-28 14:57 ` [PATCH v2 1/7] ARM: dts: vf610: Add USB PHY and controller Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-07-28 14:57 ` [PATCH v2 2/7] ARM: imx: clk-vf610: Add USBPHY clocks Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-07-28 14:57 ` [PATCH v2 3/7] usb: phy: mxs: Add VF610 USB PHY support Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-08-02  0:36   ` Peter Chen
2014-08-02  0:36     ` Peter Chen
2014-08-02 14:23     ` Stefan Agner
2014-08-02 14:23       ` Stefan Agner
2014-07-28 14:57 ` [PATCH v2 4/7] ARM: dts: vf610: Add usbmisc for non-core registers Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-07-28 14:57 ` [PATCH v2 5/7] chipidea: usbmisc_imx: Add USB support for VF610 SoCs Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-08-02  1:08   ` Peter Chen
2014-08-02  1:08     ` Peter Chen
2014-07-28 14:57 ` [PATCH v2 6/7] ARM: dts: vf610-colibri: Add USB support Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-07-28 14:57 ` [PATCH v2 7/7] ARM: dts: vf610-twr: " Stefan Agner
2014-07-28 14:57   ` Stefan Agner
2014-07-29  9:22 ` [PATCH v2 0/7] vf610: " Shawn Guo
2014-07-29  9:22   ` Shawn Guo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.