All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock
@ 2014-03-11 10:54 Denis Carikli
  2014-03-11 10:54 ` [PATCH v2][ 2/8] ARM: dts: mx35: " Denis Carikli
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:54 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@freescale.com>

Like other imx SoCs only one USB clock is needed on mx25.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/boot/dts/imx25.dtsi |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index 77bb743..829791e 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -496,8 +496,7 @@
 				compatible = "fsl,imx25-usb", "fsl,imx27-usb";
 				reg = <0x53ff4000 0x0200>;
 				interrupts = <37>;
-				clocks = <&clks 9>, <&clks 70>, <&clks 8>;
-				clock-names = "ipg", "ahb", "per";
+				clocks = <&clks 70>;
 				fsl,usbmisc = <&usbmisc 0>;
 				status = "disabled";
 			};
@@ -506,8 +505,7 @@
 				compatible = "fsl,imx25-usb", "fsl,imx27-usb";
 				reg = <0x53ff4400 0x0200>;
 				interrupts = <35>;
-				clocks = <&clks 9>, <&clks 70>, <&clks 8>;
-				clock-names = "ipg", "ahb", "per";
+				clocks = <&clks 70>;
 				fsl,usbmisc = <&usbmisc 1>;
 				status = "disabled";
 			};
-- 
1.7.9.5

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

* [PATCH v2][ 2/8] ARM: dts: mx35: USB block requires only one clock
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
@ 2014-03-11 10:54 ` Denis Carikli
  2014-03-11 10:54 ` [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs Denis Carikli
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:54 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@freescale.com>

Like other imx SoCs only one USB clock is needed on mx35.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/boot/dts/imx35.dtsi |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index e59ccb4..474a73d 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -296,8 +296,7 @@
 				compatible = "fsl,imx35-usb", "fsl,imx27-usb";
 				reg = <0x53ff4000 0x0200>;
 				interrupts = <37>;
-				clocks = <&clks 9>, <&clks 73>, <&clks 28>;
-				clock-names = "ipg", "ahb", "per";
+				clocks = <&clks 73>;
 				fsl,usbmisc = <&usbmisc 0>;
 				status = "disabled";
 			};
@@ -306,8 +305,7 @@
 				compatible = "fsl,imx35-usb", "fsl,imx27-usb";
 				reg = <0x53ff4400 0x0200>;
 				interrupts = <35>;
-				clocks = <&clks 9>, <&clks 73>, <&clks 28>;
-				clock-names = "ipg", "ahb", "per";
+				clocks = <&clks 73>;
 				fsl,usbmisc = <&usbmisc 1>;
 				status = "disabled";
 			};
-- 
1.7.9.5

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

* [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
  2014-03-11 10:54 ` [PATCH v2][ 2/8] ARM: dts: mx35: " Denis Carikli
@ 2014-03-11 10:54 ` Denis Carikli
  2014-03-12  6:08   ` Peter Chen
  2014-03-11 10:55 ` [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support Denis Carikli
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v1->v2:
- converted two remaining defines to BIT()
- Removed a variable declaration that was not used in usbmisc_imx25_init
---
 drivers/usb/chipidea/usbmisc_imx.c |   58 ++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index cd061ab..3523c09 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -21,6 +21,26 @@
 #define MX25_USB_PHY_CTRL_OFFSET	0x08
 #define MX25_BM_EXTERNAL_VBUS_DIVIDER	BIT(23)
 
+#define MXC_EHCI_INTERFACE_SINGLE_UNI	(2 << 0)
+#define MXC_EHCI_INTERFACE_DIFF_UNI	(0 << 0)
+#define MXC_EHCI_INTERFACE_MASK		(0xf)
+
+#define MX25_OTG_SIC_SHIFT		29
+#define MX25_OTG_SIC_MASK		(0x3 << MX25_OTG_SIC_SHIFT)
+#define MX25_OTG_PM_BIT			BIT(24)
+#define MX25_OTG_PP_BIT			BIT(11)
+#define MX25_OTG_OCPOL_BIT		BIT(3)
+
+#define MX25_H1_SIC_SHIFT		21
+#define MX25_H1_SIC_MASK		(0x3 << MX25_H1_SIC_SHIFT)
+#define MX25_H1_PP_BIT			BIT(18)
+#define MX25_H1_PM_BIT			BIT(16)
+#define MX25_H1_IPPUE_UP_BIT		BIT(7)
+#define MX25_H1_IPPUE_DOWN_BIT		BIT(6)
+#define MX25_H1_TLL_BIT			BIT(5)
+#define MX25_H1_USBTE_BIT		BIT(4)
+#define MX25_H1_OCPOL_BIT		BIT(2)
+
 #define MX27_H1_PM_BIT			BIT(8)
 #define MX27_H2_PM_BIT			BIT(16)
 #define MX27_OTG_PM_BIT			BIT(24)
@@ -50,6 +70,39 @@ struct imx_usbmisc {
 
 static struct imx_usbmisc *usbmisc;
 
+static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
+{
+	unsigned long flags;
+	u32 val = 0;
+
+	if (data->index > 1)
+		return -EINVAL;
+
+	spin_lock_irqsave(&usbmisc->lock, flags);
+	switch (data->index) {
+	case 0:
+		val = readl(usbmisc->base);
+		val &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT);
+		val |= (MXC_EHCI_INTERFACE_DIFF_UNI & MXC_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT;
+		val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT);
+		writel(val, usbmisc->base);
+		break;
+	case 1:
+		val = readl(usbmisc->base);
+		val &= ~(MX25_H1_SIC_MASK | MX25_H1_PP_BIT |  MX25_H1_IPPUE_UP_BIT);
+		val |= (MXC_EHCI_INTERFACE_SINGLE_UNI & MXC_EHCI_INTERFACE_MASK) << MX25_H1_SIC_SHIFT;
+		val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT |
+			MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT);
+
+		writel(val, usbmisc->base);
+
+		break;
+	}
+	spin_unlock_irqrestore(&usbmisc->lock, flags);
+
+	return 0;
+}
+
 static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
 {
 	void __iomem *reg;
@@ -159,6 +212,7 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 }
 
 static const struct usbmisc_ops imx25_usbmisc_ops = {
+	.init = usbmisc_imx25_init,
 	.post = usbmisc_imx25_post,
 };
 
@@ -200,6 +254,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
 		.data = &imx25_usbmisc_ops,
 	},
 	{
+		.compatible = "fsl,imx35-usbmisc",
+		.data = &imx25_usbmisc_ops,
+	},
+	{
 		.compatible = "fsl,imx27-usbmisc",
 		.data = &imx27_usbmisc_ops,
 	},
-- 
1.7.9.5

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

* [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support.
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
  2014-03-11 10:54 ` [PATCH v2][ 2/8] ARM: dts: mx35: " Denis Carikli
  2014-03-11 10:54 ` [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs Denis Carikli
@ 2014-03-11 10:55 ` Denis Carikli
  2014-03-11 11:58   ` Fabio Estevam
  2014-03-11 20:14   ` Sergei Shtylyov
  2014-03-11 10:55 ` [PATCH v2][ 5/8] ARM: dts: mbimxsd25 baseboard: Add " Denis Carikli
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@freescale.com>

This patch was adapted from the thread named
"USB Host support for mx25" on linux-usb at vger.kernel.org

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v1->v2:
- The usbphy nodes were made to look like the ones in imx53.dtsi
- The patch was rebased on top of the clock fixes commits.
---
 arch/arm/boot/dts/imx25.dtsi |   27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index 829791e..16bc571 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -482,22 +482,13 @@
 				clocks = <&clks 99>;
 			};
 
-			usbphy1: usbphy at 1 {
-				compatible = "nop-usbphy";
-				status = "disabled";
-			};
-
-			usbphy2: usbphy at 2 {
-				compatible = "nop-usbphy";
-				status = "disabled";
-			};
-
 			usbotg: usb at 53ff4000 {
 				compatible = "fsl,imx25-usb", "fsl,imx27-usb";
 				reg = <0x53ff4000 0x0200>;
 				interrupts = <37>;
 				clocks = <&clks 70>;
 				fsl,usbmisc = <&usbmisc 0>;
+				fsl,usbphy = <&usbphy1>;
 				status = "disabled";
 			};
 
@@ -507,6 +498,7 @@
 				interrupts = <35>;
 				clocks = <&clks 70>;
 				fsl,usbmisc = <&usbmisc 1>;
+				fsl,usbphy = <&usbphy2>;
 				status = "disabled";
 			};
 
@@ -516,7 +508,6 @@
 				clocks = <&clks 9>, <&clks 70>, <&clks 8>;
 				clock-names = "ipg", "ahb", "per";
 				reg = <0x53ff4600 0x00f>;
-				status = "disabled";
 			};
 
 			dryice at 53ffc000 {
@@ -548,4 +539,18 @@
 			};
 		};
 	};
+
+	usbphy {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "simple-bus";
+
+		usbphy1: usbphy at 1 {
+			compatible = "usb-nop-xceiv";
+		};
+
+		usbphy2: usbphy at 2 {
+			compatible = "usb-nop-xceiv";
+		};
+	};
 };
-- 
1.7.9.5

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

* [PATCH v2][ 5/8] ARM: dts: mbimxsd25 baseboard: Add USB support
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
                   ` (2 preceding siblings ...)
  2014-03-11 10:55 ` [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support Denis Carikli
@ 2014-03-11 10:55 ` Denis Carikli
  2014-03-11 10:55 ` [PATCH v2][ 6/8] ARM: dts: i.MX35: " Denis Carikli
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v1->v2:
- With the clock fix patches, the usb gadget also work.
  So I've set the otg port to otg instead of host.
---
 .../boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts  |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
index 62fb3da..ad12da3 100644
--- a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
+++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
@@ -172,3 +172,16 @@
 	fsl,uart-has-rtscts;
 	status = "okay";
 };
+
+&usbhost1 {
+	phy_type = "serial";
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbotg {
+	phy_type = "utmi";
+	dr_mode = "otg";
+	external-vbus-divider;
+	status = "okay";
+};
-- 
1.7.9.5

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

* [PATCH v2][ 6/8] ARM: dts: i.MX35: Add USB support.
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
                   ` (3 preceding siblings ...)
  2014-03-11 10:55 ` [PATCH v2][ 5/8] ARM: dts: mbimxsd25 baseboard: Add " Denis Carikli
@ 2014-03-11 10:55 ` Denis Carikli
  2014-03-11 20:13   ` Sergei Shtylyov
  2014-03-11 10:55 ` [PATCH v2][ 7/8] ARM: dts: mbimxsd35 baseboard: " Denis Carikli
  2014-03-11 10:55 ` [PATCH v2][ 8/8] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 " Denis Carikli
  6 siblings, 1 reply; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v1->v2:
- The usbphy nodes were made to look like the ones in imx53.dtsi
- The patch was rebased on top of the clock fixes commits.

---
 arch/arm/boot/dts/imx35.dtsi |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index 474a73d..b943123 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -298,6 +298,7 @@
 				interrupts = <37>;
 				clocks = <&clks 73>;
 				fsl,usbmisc = <&usbmisc 0>;
+				fsl,usbphy = <&usbphy0>;
 				status = "disabled";
 			};
 
@@ -307,6 +308,7 @@
 				interrupts = <35>;
 				clocks = <&clks 73>;
 				fsl,usbmisc = <&usbmisc 1>;
+				fsl,usbphy = <&usbphy1>;
 				status = "disabled";
 			};
 
@@ -355,4 +357,18 @@
 			};
 		};
 	};
+
+	usbphy {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "simple-bus";
+
+		usbphy0: usbphy at 0 {
+			compatible = "usb-nop-xceiv";
+		};
+
+		usbphy1: usbphy at 1 {
+			compatible = "usb-nop-xceiv";
+		};
+	};
 };
-- 
1.7.9.5

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

* [PATCH v2][ 7/8] ARM: dts: mbimxsd35 baseboard: Add USB support.
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
                   ` (4 preceding siblings ...)
  2014-03-11 10:55 ` [PATCH v2][ 6/8] ARM: dts: i.MX35: " Denis Carikli
@ 2014-03-11 10:55 ` Denis Carikli
  2014-03-11 10:55 ` [PATCH v2][ 8/8] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 " Denis Carikli
  6 siblings, 0 replies; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v1->v2:
- With the clock fix patches, the usb gadget also work.
  So I've set the otg port to otg instead of host.
- Before I forgott to set dr_mode to host in the usbhost port.
  That is now fixed.
---
 .../boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts  |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts
index 71197b9..f04ae91 100644
--- a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts
@@ -150,3 +150,16 @@
 	fsl,uart-has-rtscts;
 	status = "okay";
 };
+
+&usbhost1 {
+	phy_type = "serial";
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbotg {
+	phy_type = "utmi";
+	dr_mode = "otg";
+	external-vbus-divider;
+	status = "okay";
+};
-- 
1.7.9.5

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

* [PATCH v2][ 8/8] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 USB support.
  2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
                   ` (5 preceding siblings ...)
  2014-03-11 10:55 ` [PATCH v2][ 7/8] ARM: dts: mbimxsd35 baseboard: " Denis Carikli
@ 2014-03-11 10:55 ` Denis Carikli
  2014-03-11 11:37   ` Fabio Estevam
  6 siblings, 1 reply; 13+ messages in thread
From: Denis Carikli @ 2014-03-11 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v1->v2:
- With the clock fix patches, the usb gadget also work.
  So I've addeed it to this patch too.
- CONFIG_USB_OTG_FSM=y was not needed, so it was removed.
---
 arch/arm/configs/imx_v4_v5_defconfig |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index f1aeb7d..07f4e5e 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -80,6 +80,7 @@ CONFIG_MTD_UBI=y
 CONFIG_EEPROM_AT24=y
 CONFIG_EEPROM_AT25=y
 CONFIG_ATA=y
+CONFIG_BLK_DEV_SD=y
 CONFIG_PATA_IMX=y
 CONFIG_NETDEVICES=y
 CONFIG_CS89x0=y
@@ -153,6 +154,14 @@ CONFIG_USB_HID=m
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_MXC=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_CHIPIDEA=y
+CONFIG_USB_CHIPIDEA_UDC=y
+CONFIG_USB_CHIPIDEA_HOST=y
+CONFIG_NOP_USB_XCEIV=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_ETH=m
+CONFIG_USB_MASS_STORAGE=m
 CONFIG_MMC=y
 CONFIG_MMC_UNSAFE_RESUME=y
 CONFIG_MMC_SDHCI=y
-- 
1.7.9.5

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

* [PATCH v2][ 8/8] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 USB support.
  2014-03-11 10:55 ` [PATCH v2][ 8/8] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 " Denis Carikli
@ 2014-03-11 11:37   ` Fabio Estevam
  0 siblings, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2014-03-11 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Denis,

On Tue, Mar 11, 2014 at 7:55 AM, Denis Carikli <denis@eukrea.com> wrote:

>  CONFIG_USB_EHCI_MXC=y
> +CONFIG_USB_STORAGE=y
> +CONFIG_USB_CHIPIDEA=y
> +CONFIG_USB_CHIPIDEA_UDC=y
> +CONFIG_USB_CHIPIDEA_HOST=y
> +CONFIG_NOP_USB_XCEIV=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_ETH=m
> +CONFIG_USB_MASS_STORAGE=m

I prefer the way you did in the previous version: CONFIG_USB_STORAGE=y

Regards,

Fabio Estevam

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

* [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support.
  2014-03-11 10:55 ` [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support Denis Carikli
@ 2014-03-11 11:58   ` Fabio Estevam
  2014-03-11 20:14   ` Sergei Shtylyov
  1 sibling, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2014-03-11 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Denis,

On Tue, Mar 11, 2014 at 7:55 AM, Denis Carikli <denis@eukrea.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> This patch was adapted from the thread named
> "USB Host support for mx25" on linux-usb at vger.kernel.org
>
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> Changelog v1->v2:
> - The usbphy nodes were made to look like the ones in imx53.dtsi
> - The patch was rebased on top of the clock fixes commits.
> ---
>  arch/arm/boot/dts/imx25.dtsi |   27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
> index 829791e..16bc571 100644
> --- a/arch/arm/boot/dts/imx25.dtsi
> +++ b/arch/arm/boot/dts/imx25.dtsi
> @@ -482,22 +482,13 @@
>                                 clocks = <&clks 99>;
>                         };
>
> -                       usbphy1: usbphy at 1 {
> -                               compatible = "nop-usbphy";
> -                               status = "disabled";
> -                       };
> -
> -                       usbphy2: usbphy at 2 {
> -                               compatible = "nop-usbphy";
> -                               status = "disabled";
> -                       };
> -
>                         usbotg: usb at 53ff4000 {
>                                 compatible = "fsl,imx25-usb", "fsl,imx27-usb";
>                                 reg = <0x53ff4000 0x0200>;
>                                 interrupts = <37>;
>                                 clocks = <&clks 70>;
>                                 fsl,usbmisc = <&usbmisc 0>;
> +                               fsl,usbphy = <&usbphy1>;
>                                 status = "disabled";
>                         };
>
> @@ -507,6 +498,7 @@
>                                 interrupts = <35>;
>                                 clocks = <&clks 70>;
>                                 fsl,usbmisc = <&usbmisc 1>;
> +                               fsl,usbphy = <&usbphy2>;
>                                 status = "disabled";
>                         };
>
> @@ -516,7 +508,6 @@
>                                 clocks = <&clks 9>, <&clks 70>, <&clks 8>;
>                                 clock-names = "ipg", "ahb", "per";
>                                 reg = <0x53ff4600 0x00f>;
> -                               status = "disabled";
>                         };
>
>                         dryice at 53ffc000 {
> @@ -548,4 +539,18 @@
>                         };
>                 };
>         };
> +
> +       usbphy {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               compatible = "simple-bus";
> +
> +               usbphy1: usbphy at 1 {
> +                       compatible = "usb-nop-xceiv";
> +               };
> +
> +               usbphy2: usbphy at 2 {
> +                       compatible = "usb-nop-xceiv";
> +               };
> +       };

Do we really need to put usbphy1 and usbphy2 under 'simple-bus'? This
is not documented at
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt.

I know that other imx SoCs do like this as you marked below the --- line.

In the version I sent yesterday I kept usbphy1/2 in their original
locations, and have not placed them under 'simple-bus'.

Adding Mark on Cc in case he can confirm it.

Thanks,

Fabio Estevam

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

* [PATCH v2][ 6/8] ARM: dts: i.MX35: Add USB support.
  2014-03-11 10:55 ` [PATCH v2][ 6/8] ARM: dts: i.MX35: " Denis Carikli
@ 2014-03-11 20:13   ` Sergei Shtylyov
  0 siblings, 0 replies; 13+ messages in thread
From: Sergei Shtylyov @ 2014-03-11 20:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 03/11/2014 01:55 PM, Denis Carikli wrote:

> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> Changelog v1->v2:
> - The usbphy nodes were made to look like the ones in imx53.dtsi
> - The patch was rebased on top of the clock fixes commits.

> ---
>   arch/arm/boot/dts/imx35.dtsi |   16 ++++++++++++++++
>   1 file changed, 16 insertions(+)

> diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
> index 474a73d..b943123 100644
> --- a/arch/arm/boot/dts/imx35.dtsi
> +++ b/arch/arm/boot/dts/imx35.dtsi
> @@ -298,6 +298,7 @@
>   				interrupts = <37>;
>   				clocks = <&clks 73>;
>   				fsl,usbmisc = <&usbmisc 0>;
> +				fsl,usbphy = <&usbphy0>;

    Why use Freescale specific prop here, when there's de-facto standard 
"usb-phy" already?

> @@ -307,6 +308,7 @@
>   				interrupts = <35>;
>   				clocks = <&clks 73>;
>   				fsl,usbmisc = <&usbmisc 1>;
> +				fsl,usbphy = <&usbphy1>;

    Likewise.

> @@ -355,4 +357,18 @@
>   			};
>   		};
>   	};
> +
> +	usbphy {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		compatible = "simple-bus";
> +
> +		usbphy0: usbphy at 0 {

    Why use the node name with the address part when you don't have "reg" prop?
Moreover, I suggest "usb-phy" instead to be more in line with ePAPR [1] 
specified "ethernet-phy" device nodes.

[1] http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf

WBR, Sergei

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

* [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support.
  2014-03-11 10:55 ` [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support Denis Carikli
  2014-03-11 11:58   ` Fabio Estevam
@ 2014-03-11 20:14   ` Sergei Shtylyov
  1 sibling, 0 replies; 13+ messages in thread
From: Sergei Shtylyov @ 2014-03-11 20:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 03/11/2014 01:55 PM, Denis Carikli wrote:

> From: Fabio Estevam <fabio.estevam@freescale.com>

> This patch was adapted from the thread named
> "USB Host support for mx25" on linux-usb at vger.kernel.org

> Signed-off-by: Denis Carikli <denis@eukrea.com>

    Same comments as to the patch #6.

WBR, Sergei

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

* [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
  2014-03-11 10:54 ` [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs Denis Carikli
@ 2014-03-12  6:08   ` Peter Chen
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Chen @ 2014-03-12  6:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 11, 2014 at 11:54:59AM +0100, Denis Carikli wrote:
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---

Add something at commit log please.

> Changelog v1->v2:
> - converted two remaining defines to BIT()
> - Removed a variable declaration that was not used in usbmisc_imx25_init
> ---
>  drivers/usb/chipidea/usbmisc_imx.c |   58 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 58 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index cd061ab..3523c09 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -21,6 +21,26 @@
>  #define MX25_USB_PHY_CTRL_OFFSET	0x08
>  #define MX25_BM_EXTERNAL_VBUS_DIVIDER	BIT(23)
>  
> +#define MXC_EHCI_INTERFACE_SINGLE_UNI	(2 << 0)
> +#define MXC_EHCI_INTERFACE_DIFF_UNI	(0 << 0)
> +#define MXC_EHCI_INTERFACE_MASK		(0xf)
> +

Which SoCs will use above Macros?
If only imx25 and imx35, using prefix MX25 please.
Otherwise, adding prefix IMX_ for above Macros and
the comment for which SoC needs them.

> +#define MX25_OTG_SIC_SHIFT		29
> +#define MX25_OTG_SIC_MASK		(0x3 << MX25_OTG_SIC_SHIFT)
> +#define MX25_OTG_PM_BIT			BIT(24)
> +#define MX25_OTG_PP_BIT			BIT(11)
> +#define MX25_OTG_OCPOL_BIT		BIT(3)
> +
> +#define MX25_H1_SIC_SHIFT		21
> +#define MX25_H1_SIC_MASK		(0x3 << MX25_H1_SIC_SHIFT)
> +#define MX25_H1_PP_BIT			BIT(18)
> +#define MX25_H1_PM_BIT			BIT(16)
> +#define MX25_H1_IPPUE_UP_BIT		BIT(7)
> +#define MX25_H1_IPPUE_DOWN_BIT		BIT(6)
> +#define MX25_H1_TLL_BIT			BIT(5)
> +#define MX25_H1_USBTE_BIT		BIT(4)
> +#define MX25_H1_OCPOL_BIT		BIT(2)
> +
>  #define MX27_H1_PM_BIT			BIT(8)
>  #define MX27_H2_PM_BIT			BIT(16)
>  #define MX27_OTG_PM_BIT			BIT(24)
> @@ -50,6 +70,39 @@ struct imx_usbmisc {
>  
>  static struct imx_usbmisc *usbmisc;
>  
> +static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
> +{
> +	unsigned long flags;
> +	u32 val = 0;
> +
> +	if (data->index > 1)
> +		return -EINVAL;
> +
> +	spin_lock_irqsave(&usbmisc->lock, flags);
> +	switch (data->index) {
> +	case 0:
> +		val = readl(usbmisc->base);
> +		val &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT);
> +		val |= (MXC_EHCI_INTERFACE_DIFF_UNI & MXC_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT;
> +		val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT);
> +		writel(val, usbmisc->base);
> +		break;
> +	case 1:
> +		val = readl(usbmisc->base);
> +		val &= ~(MX25_H1_SIC_MASK | MX25_H1_PP_BIT |  MX25_H1_IPPUE_UP_BIT);
> +		val |= (MXC_EHCI_INTERFACE_SINGLE_UNI & MXC_EHCI_INTERFACE_MASK) << MX25_H1_SIC_SHIFT;
> +		val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT |
> +			MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT);
> +
> +		writel(val, usbmisc->base);
> +
> +		break;
> +	}
> +	spin_unlock_irqrestore(&usbmisc->lock, flags);
> +
> +	return 0;
> +}
> +
>  static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
>  {
>  	void __iomem *reg;
> @@ -159,6 +212,7 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
>  }
>  
>  static const struct usbmisc_ops imx25_usbmisc_ops = {
> +	.init = usbmisc_imx25_init,
>  	.post = usbmisc_imx25_post,
>  };
>  
> @@ -200,6 +254,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
>  		.data = &imx25_usbmisc_ops,
>  	},
>  	{
> +		.compatible = "fsl,imx35-usbmisc",
> +		.data = &imx25_usbmisc_ops,
> +	},
> +	{
>  		.compatible = "fsl,imx27-usbmisc",
>  		.data = &imx27_usbmisc_ops,
>  	},
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

-- 

Best Regards,
Peter Chen

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

end of thread, other threads:[~2014-03-12  6:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 10:54 [PATCH v2][ 1/8] ARM: dts: mx25: USB block requires only one clock Denis Carikli
2014-03-11 10:54 ` [PATCH v2][ 2/8] ARM: dts: mx35: " Denis Carikli
2014-03-11 10:54 ` [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs Denis Carikli
2014-03-12  6:08   ` Peter Chen
2014-03-11 10:55 ` [PATCH v2][ 4/8] ARM: dts: imx25.dtsi: Fix USB support Denis Carikli
2014-03-11 11:58   ` Fabio Estevam
2014-03-11 20:14   ` Sergei Shtylyov
2014-03-11 10:55 ` [PATCH v2][ 5/8] ARM: dts: mbimxsd25 baseboard: Add " Denis Carikli
2014-03-11 10:55 ` [PATCH v2][ 6/8] ARM: dts: i.MX35: " Denis Carikli
2014-03-11 20:13   ` Sergei Shtylyov
2014-03-11 10:55 ` [PATCH v2][ 7/8] ARM: dts: mbimxsd35 baseboard: " Denis Carikli
2014-03-11 10:55 ` [PATCH v2][ 8/8] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 " Denis Carikli
2014-03-11 11:37   ` Fabio Estevam

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.