Skip to contentSkip to conversation

ARM: OMAP4: Panda USB Host support and DVI EDID fix

PATCH Superseded Roger Quadros 2 participants 8 messages Jun 18, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: OMAP4: Panda USB Host support and DVI EDID fix

Hi Benoit & Tony,

The first two patches make changes to dts files to get USB host support and DVI EDID to work on Panda.

The third patch should get USB host functional on uEVM.

The fourth patch is a temporary workaround to create a clock alias to the USB PHY clock as it is not possible to define this via device tree. This patch is required for USB host to work on Panda and uEVM.

The first 3 patches are for Benoit and the last one is for Tony.

cheers,
-roger

Roger Quadros (4):
ARM: dts: omap4-panda: Add USB Host support
ARM: dts: omap4-panda: Fix DVI EDID reads
ARM: dts: omap5-uevm: Provide USB Host PHY clock frequency
ARM: OMAP2+: dts: HACK: Provide alias to USB PHY clock

 arch/arm/boot/dts/omap4-panda-common.dtsi |   67 +++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap5-uevm.dts          |    7 +++
 arch/arm/mach-omap2/board-generic.c       |   23 +++++++++-
 3 files changed, 96 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/4 ARM: dts: omap4-panda: Add USB Host support

Provide the RESET and Power regulators for the USB PHY, the USB Host port mode and the PHY device.

Also provide pin multiplexer information for the USB host pins.

---
 arch/arm/boot/dts/omap4-panda-common.dtsi |   62 +++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda-common.dtsi +62 -0
index 00cbaa5..7a21e8e 100644
@@ -59,6 +59,42 @@
 			"AFML", "Line In",
 			"AFMR", "Line In";
 	};
+
+	/* HS USB Port 1 RESET */
+	hsusb1_reset: hsusb1_reset_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb1_reset";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio2 30 0>;	/* gpio_62 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Port 1 Power */
+	hsusb1_power: hsusb1_power_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb1_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 1 0>;	/* gpio_1 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Host PHY on PORT 1 */
+	hsusb1_phy: hsusb1_phy {
+		compatible = "usb-nop-xceiv";
+		reset-supply = <&hsusb1_reset>;
+		vcc-supply = <&hsusb1_power>;
+	/**
+	 * FIXME:
+	 * put the right clock phandle here when available
+	 *	clocks = <&auxclk3>;
+	 *	clock-names = "main_clk";
+	 */
+		clock-frequency = <19200000>;
+	};
 };
 
 &omap4_pmx_wkup {
@@ -83,6 +119,7 @@
 			&mcbsp1_pins
 			&dss_hdmi_pins
 			&tpd12s015_pins
+			&hsusbb1_pins
 	>;
 
 	twl6030_pins: pinmux_twl6030_pins {
@@ -133,6 +170,23 @@
 		>;
 	};
 
+	hsusbb1_pins: pinmux_hsusbb1_pins {
+		pinctrl-single,pins = <
+			0x82 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_clk.usbb1_ulpiphy_clk */
+			0x84 (PIN_OUTPUT | MUX_MODE4)		/* usbb1_ulpitll_stp.usbb1_ulpiphy_stp */
+			0x86 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dir.usbb1_ulpiphy_dir */
+			0x88 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_nxt.usbb1_ulpiphy_nxt */
+			0x8a (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat0.usbb1_ulpiphy_dat0 */
+			0x8c (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat1.usbb1_ulpiphy_dat1 */
+			0x8e (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat2.usbb1_ulpiphy_dat2 */
+			0x90 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat3.usbb1_ulpiphy_dat3 */
+			0x92 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat4.usbb1_ulpiphy_dat4 */
+			0x94 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat5.usbb1_ulpiphy_dat5 */
+			0x96 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat6.usbb1_ulpiphy_dat6 */
+			0x98 (PIN_INPUT_PULLDOWN | MUX_MODE4)	/* usbb1_ulpitll_dat7.usbb1_ulpiphy_dat7 */
+		>;
+	};
+
 	i2c1_pins: pinmux_i2c1_pins {
 		pinctrl-single,pins = <
 			0xe2 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c1_scl */
@@ -283,3 +337,11 @@
 	mode = <3>;
 	power = <50>;
 };
+
+&usbhshost {
+	port1-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <&hsusb1_phy>;
+};
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/4 ARM: dts: omap4-panda: Fix DVI EDID reads

In reply to Roger Quadros

On Panda the +5V supply for DVI EDID is supplied by the same regulator that poweres the USB Hub. Currently, the DSS/DVI subsystem doesn't know how to manage this regulator and so DVI EDID reads will fail if USB Hub is not enabled.

As a temporary fix we keep this regulator permanently enabled on boot. This fixes the DVI EDID read problem.

---
 arch/arm/boot/dts/omap4-panda-common.dtsi |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda-common.dtsi +5 -0
index 7a21e8e..40df79e 100644
@@ -80,6 +80,11 @@
 		gpio = <&gpio1 1 0>;	/* gpio_1 */
 		startup-delay-us = <70000>;
 		enable-active-high;
+		/*
+		 * FIXME: Remove boot-on when DSS can handle this regulator
+		 * for DVI EDID.
+		 */
+		regulator-boot-on;
 	};
 
 	/* HS USB Host PHY on PORT 1 */
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/4] ARM: dts: omap4-panda: Fix DVI EDID reads

Quoted 19 lines · Roger Quadros

On Panda the +5V supply for DVI EDID is supplied by the same regulator that poweres the USB Hub. Currently, the DSS/DVI subsystem doesn't know how to manage this regulator and so DVI EDID reads will fail if USB Hub is not enabled.

As a temporary fix we keep this regulator permanently enabled on boot. This fixes the DVI EDID read problem.

---
 arch/arm/boot/dts/omap4-panda-common.dtsi |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda-common.dtsi +0 -0
index 7a21e8e..40df79e 100644

arch/arm/boot/dts/omap4-panda-common.dtsi line 87

Quoted 8 lines
arch/arm/boot/dts/omap4-panda-common.dtsi +5 -0
@@ -80,6 +80,11 @@
 		gpio = <&gpio1 1 0>;	/* gpio_1 */
 		startup-delay-us = <70000>;
 		enable-active-high;
+		/*
+		 * FIXME: Remove boot-on when DSS can handle this regulator
+		 * for DVI EDID.
+		 */
+		regulator-boot-on;

As pointed out by Tomi, the correct usage here is "regulator-always-on".

The reason I use "regulator-boot-on" is because the regulator framework doesn't turn on the regulator. (maybe a bug in the regulator framework?)

"regulator-boot-on" is not sufficient as it doesn't prevent drivers from turning it off. e.g. loading and unloading the USB host driver will turn of the regulator. So it must be used along with "regulator-always-on"

I'll fix this in v2.

cheers,
-roger

#4 lore raw

PATCH 3/4 ARM: dts: omap5-uevm: Provide USB Host PHY clock frequency

In reply to Roger Quadros

USB Host PHY clock on port 2 must be configured to 19.2MHz. Provide this information.

---
 arch/arm/boot/dts/omap5-uevm.dts |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap5-uevm.dts +7 -0
index 927db1e..c0ad472 100644
@@ -40,6 +40,13 @@
 	hsusb2_phy: hsusb2_phy {
 		compatible = "usb-nop-xceiv";
 		reset-supply = <&hsusb2_reset>;
+	/**
+	  * FIXME
+	  * Put the right clock phandle here when available
+	  *	clocks = <&auxclk1>;
+	  *	clock-names = "main_clk";
+	  */
+		clock-frequency = <19200000>;
 	};
 
 	/* HS USB Port 3 RESET */
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 4/4 ARM: OMAP2+: dts: HACK: Provide alias to USB PHY clock

In reply to Roger Quadros

Till the OMAP clocks are correctly defined in device tree, use this temporary hack to provide clock alias to the USB PHY clocks.

Without this, USB Host & Ethernet will not be functional with device tree boots on Panda and uEVM.

---
 arch/arm/mach-omap2/board-generic.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-generic.c +22 -1
index 88aa6b1..2b2d0de 100644
@@ -15,6 +15,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/irqdomain.h>
+#include <linux/clk.h>
 
 #include <asm/mach/arch.h>
 
@@ -35,6 +36,21 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
 	{ }
 };
 
+/*
+ * HACK: create alias for USB host PHY clock.
+ * Remove this when clock phandle can be provided via DT
+ */
+static void __init legacy_init_ehci_clk(char *clkname)
+{
+	int ret;
+
+	ret = clk_add_alias("main_clk", NULL, clkname, NULL);
+	if (ret) {
+		pr_err("%s:Failed to add main_clk alias to %s :%d\n",
+						__func__, clkname, ret);
+	}
+}
+
 static void __init omap_generic_init(void)
 {
 	omap_sdrc_init(NULL, NULL);
@@ -45,10 +61,15 @@ static void __init omap_generic_init(void)
 	 * HACK: call display setup code for selected boards to enable omapdss.
 	 * This will be removed when omapdss supports DT.
 	 */
-	if (of_machine_is_compatible("ti,omap4-panda"))
+	if (of_machine_is_compatible("ti,omap4-panda")) {
 		omap4_panda_display_init_of();
+		legacy_init_ehci_clk("auxclk3_ck");
+
+	}
 	else if (of_machine_is_compatible("ti,omap4-sdp"))
 		omap_4430sdp_display_init_of();
+	else if (of_machine_is_compatible("ti,omap5-uevm"))
+		legacy_init_ehci_clk("auxclk1_ck");
 }
 
 #ifdef CONFIG_SOC_OMAP2420
Signature · 1 line
1.7.4.1
maintainer
#6 lore raw

Re: [PATCH 4/4] ARM: OMAP2+: dts: HACK: Provide alias to USB PHY clock

Quoted 5 lines · Roger Quadros

Till the OMAP clocks are correctly defined in device tree, use this temporary hack to provide clock alias to the USB PHY clocks.

Without this, USB Host & Ethernet will not be functional with device tree boots on Panda and uEVM.

Thanks, this looks OK to me to have USB working until we have the DT defined clock patches ready.

The $Subject needs updating though, just make it ARM: OMAP2+: and leave out the dts and hack from there.

Regards,

Tony

Quoted 59 lines
---
 arch/arm/mach-omap2/board-generic.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-generic.c +22 -1
index 88aa6b1..2b2d0de 100644
@@ -15,6 +15,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/irqdomain.h>
+#include <linux/clk.h>
 
 #include <asm/mach/arch.h>
 
@@ -35,6 +36,21 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
 	{ }
 };
 
+/*
+ * HACK: create alias for USB host PHY clock.
+ * Remove this when clock phandle can be provided via DT
+ */
+static void __init legacy_init_ehci_clk(char *clkname)
+{
+	int ret;
+
+	ret = clk_add_alias("main_clk", NULL, clkname, NULL);
+	if (ret) {
+		pr_err("%s:Failed to add main_clk alias to %s :%d\n",
+						__func__, clkname, ret);
+	}
+}
+
 static void __init omap_generic_init(void)
 {
 	omap_sdrc_init(NULL, NULL);
@@ -45,10 +61,15 @@ static void __init omap_generic_init(void)
 	 * HACK: call display setup code for selected boards to enable omapdss.
 	 * This will be removed when omapdss supports DT.
 	 */
-	if (of_machine_is_compatible("ti,omap4-panda"))
+	if (of_machine_is_compatible("ti,omap4-panda")) {
 		omap4_panda_display_init_of();
+		legacy_init_ehci_clk("auxclk3_ck");
+
+	}
 	else if (of_machine_is_compatible("ti,omap4-sdp"))
 		omap_4430sdp_display_init_of();
+	else if (of_machine_is_compatible("ti,omap5-uevm"))
+		legacy_init_ehci_clk("auxclk1_ck");
 }
 
 #ifdef CONFIG_SOC_OMAP2420
Signature · 1 line
1.7.4.1
#7 lore raw

Re: [PATCH 4/4] ARM: OMAP2+: dts: HACK: Provide alias to USB PHY clock

Quoted 4 lines · Tony Lindgren
Quoted 3 lines · Roger Quadros

Till the OMAP clocks are correctly defined in device tree, use this temporary hack to provide clock alias to the USB PHY clocks.

Quoted 9 lines
Quoted 2 lines

Without this, USB Host & Ethernet will not be functional with device tree boots on Panda and uEVM.

Thanks, this looks OK to me to have USB working until we have the DT defined clock patches ready.

The $Subject needs updating though, just make it ARM: OMAP2+: and leave out the dts and hack from there.

OK. will send v2 as i need to make another minor change in the panda dts file.

cheers,
-roger