Skip to contentSkip to conversation

AM35xx: Craneboard: Add USB EHCI support

PATCH Superseded [email protected] 5 participants 11 messages Nov 19, 2010 – Dec 21, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [PATCH] AM35xx-Craneboard-Add-USB-EHCI-support

#1 lore raw

PATCH 1/1 AM35xx: Craneboard: Add USB EHCI support

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

---
 arch/arm/mach-omap2/board-am3517crane.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +21 -0
index 13ead33..0e1a806 100644
@@ -28,8 +28,10 @@
 
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
 
 #include "mux.h"
+#include "control.h"
 
 /* Board initialization */
 static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
@@ -53,10 +55,29 @@ static void __init am3517_crane_init_irq(void)
 	omap_gpio_init();
 }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = 38,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL
+};
+
 static void __init am3517_crane_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	omap_mux_init_gpio(35, OMAP_PIN_OUTPUT);
+	gpio_request(35, "usb_ehci_enable");
+	gpio_direction_output(35, 1);
+	gpio_set_value(35, 1);
+	omap_mux_init_gpio(38, OMAP_PIN_OUTPUT);
+	usb_ehci_init(&ehci_pdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
Signature · 1 line
1.7.1.226.g770c5
#2 lore raw

Hi Srinath,

Quoted 40 lines · srinath at mistralsolutions.com

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

---
 arch/arm/mach-omap2/board-am3517crane.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +11 -0
index 13ead33..0e1a806 100644
@@ -28,8 +28,10 @@
 
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
 
 #include "mux.h"
+#include "control.h"
 
 /* Board initialization */
 static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
@@ -53,10 +55,29 @@ static void __init am3517_crane_init_irq(void)
 	omap_gpio_init();
 }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = 38,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 76

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +6 -0
+};
+
 static void __init am3517_crane_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	omap_mux_init_gpio(35, OMAP_PIN_OUTPUT);
+	gpio_request(35, "usb_ehci_enable");

gpio_request() can fail, you should check this and you should not use this gpio if the request fails. Also, may be the regulators framework is more appropriate for power enable line, but I'm not sure...

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 79

Quoted 3 lines
arch/arm/mach-omap2/board-am3517crane.c +3 -0
+	gpio_direction_output(35, 1);
+	gpio_set_value(35, 1);
+	omap_mux_init_gpio(38, OMAP_PIN_OUTPUT);

Shouldn't the omap_mux_init_gpio() be called before you request the gpio?

Quoted 4 lines
arch/arm/mach-omap2/board-am3517crane.c +1 -0
+	usb_ehci_init(&ehci_pdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
Signature · 2 lines
Regards,
Igor.
#3 lore raw
In reply to [email protected]

Hello.

Quoted 16 lines · srinath at mistralsolutions.com

From: Srinath<[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

---
  arch/arm/mach-omap2/board-am3517crane.c |   21 +++++++++++++++++++++
  1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +0 -0
index 13ead33..0e1a806 100644

[...]

Quoted 15 lines
arch/arm/mach-omap2/board-am3517crane.c +11 -0
@@ -53,10 +55,29 @@ static void __init am3517_crane_init_irq(void)
  	omap_gpio_init();
  }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = 38,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL
+};
+

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 78

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +6 -0
  static void __init am3517_crane_init(void)
  {
  	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	omap_mux_init_gpio(35, OMAP_PIN_OUTPUT);
+	gpio_request(35, "usb_ehci_enable");
+	gpio_direction_output(35, 1);
+	gpio_set_value(35, 1);

There's no need to call gpio_set_value(), as gpio_direction_output() has
already set the GPIO's value.

WBR, Sergei

author
#4 lore raw

Hi Sergei,

Thanks for review, I will modify and resend patch.

With Regards
Srinath

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Saturday, November 20, 2010 5:09 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v1] AM35xx: Craneboard: Add USB EHCI support

Hello.

Quoted 7 lines · On 19-11-2010 19:07, [email protected] wrote:

From: Srinath<[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

Review

Quoted 6 lines
---
  arch/arm/mach-omap2/board-am3517crane.c |   21 +++++++++++++++++++++
  1 files changed, 21 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-am3517crane.c

Quoted 3 lines

index 13ead33..0e1a806 100644

arch/arm/mach-omap2/board-am3517crane.c +0 -0

[...]

Quoted 15 lines
arch/arm/mach-omap2/board-am3517crane.c +11 -0
@@ -53,10 +55,29 @@ static void __init am3517_crane_init_irq(void)
  	omap_gpio_init();
  }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = 38,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL
+};
+

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 78

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +6 -0
  static void __init am3517_crane_init(void)
  {
  	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	omap_mux_init_gpio(35, OMAP_PIN_OUTPUT);
+	gpio_request(35, "usb_ehci_enable");
+	gpio_direction_output(35, 1);
+	gpio_set_value(35, 1);

There's no need to call gpio_set_value(), as gpio_direction_output() has

already set the GPIO's value.

WBR, Sergei

#5 lore raw

PATCH v2 1/1 AM35xx: Craneboard: Add USB EHCI support

In reply to a message not in the archive

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

---
 arch/arm/mach-omap2/board-am3517crane.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +20 -0
index 13ead33..91791bc 100644
@@ -28,8 +28,10 @@
 
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
 
 #include "mux.h"
+#include "control.h"
 
 /* Board initialization */
 static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
@@ -53,10 +55,28 @@ static void __init am3517_crane_init_irq(void)
 	omap_gpio_init();
 }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = 38,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL
+};
+
 static void __init am3517_crane_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	omap_mux_init_gpio(35, OMAP_PIN_OUTPUT);
+	gpio_request(35, "usb_ehci_enable");
+	gpio_direction_output(35, 1);
+	omap_mux_init_gpio(38, OMAP_PIN_OUTPUT);
+	usb_ehci_init(&ehci_pdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
Signature · 1 line
1.7.1.226.g770c5
#6 lore raw
Quoted 39 lines · srinath at mistralsolutions.com

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

---
 arch/arm/mach-omap2/board-am3517crane.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +2 -0
index 13ead33..91791bc 100644
@@ -28,8 +28,10 @@
 
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
 
 #include "mux.h"
+#include "control.h"
 
 /* Board initialization */
 static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
@@ -53,10 +55,28 @@ static void __init am3517_crane_init_irq(void)
 	omap_gpio_init();
 }
Quoted 1 line
arch/arm/mach-omap2/board-am3517crane.c +8 -0
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = 38,
+	.reset_gpio_port[1]  = -EINVAL,

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 75

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +6 -0
+	.reset_gpio_port[2]  = -EINVAL
+};
+
 static void __init am3517_crane_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	omap_mux_init_gpio(35, OMAP_PIN_OUTPUT);

Please define a symbolic constant for these GPIO numbers instead of using hard-coded constants.

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 76

Quoted 1 line
arch/arm/mach-omap2/board-am3517crane.c +1 -0
+	gpio_request(35, "usb_ehci_enable");

GPIO APIs can fail. Please check return value and act accordingly.

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 82

Quoted 6 lines
arch/arm/mach-omap2/board-am3517crane.c +3 -0
+	gpio_direction_output(35, 1);
+	omap_mux_init_gpio(38, OMAP_PIN_OUTPUT);
+	usb_ehci_init(&ehci_pdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")

Kevin

#7 lore raw

PATCH v4 1/1 AM35xx: Craneboard: Add USB EHCI support

In reply to a message not in the archive

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

History:
http://marc.info/?l=linux-omap&w=2&r=1&s=Craneboard%3A+Add+USB+EHCI+support&q=t

---
 arch/arm/mach-omap2/board-am3517crane.c |   53 +++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +53 -0
index 8ba4047..1a80175 100644
@@ -19,6 +19,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -27,8 +28,14 @@
 
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
 
 #include "mux.h"
+#include "control.h"
+
+#define GPIO_USB_POWER		35
+#define GPIO_USB_NRESET		38
+
 
 /* Board initialization */
 static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
@@ -51,10 +58,56 @@ static void __init am3517_crane_init_irq(void)
 	omap_init_irq();
 }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = GPIO_USB_NRESET,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL
+};
+
 static void __init am3517_crane_init(void)
 {
+	int ret;
+
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	if (omap_mux_init_gpio(GPIO_USB_NRESET, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not cofigure mux for GPIO_USB_NRESET %d\n",
+			GPIO_USB_NRESET);
+		return;
+	}
+
+	if (omap_mux_init_gpio(GPIO_USB_POWER, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not cofigure mux for GPIO_USB_POWER %d\n",
+
+			GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable");
+	if (ret < 0) {
+		pr_err("Cannot request GPIO %d\n", GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_direction_output(GPIO_USB_POWER, 1);
+	if (ret < 0)
+		goto err;
+
+
+	usb_ehci_init(&ehci_pdata);
+	return;
+
+err:
+	gpio_free(GPIO_USB_POWER);
+	pr_err("Unable to initialize EHCI power\n");
+	return;
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
Signature · 1 line
1.7.1.226.g770c5
#8 lore raw

Hi,

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 81

Quoted 10 lines · srinath at mistralsolutions.com

static void __init am3517_crane_init(void)
{

(quoted diff) +2 -0
+	int ret;
+
	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
	omap_serial_init();
arch/arm/mach-omap2/board-am3517crane.c +4 -0
+
+	/* Configure GPIO for EHCI port */
+	if (omap_mux_init_gpio(GPIO_USB_NRESET, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not cofigure mux for GPIO_USB_NRESET %d\n",

typo: configure

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 87

Quoted 6 lines
arch/arm/mach-omap2/board-am3517crane.c +6 -0
+			GPIO_USB_NRESET);
+		return;
+	}
+
+	if (omap_mux_init_gpio(GPIO_USB_POWER, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not cofigure mux for GPIO_USB_POWER %d\n",

typo: configure

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 95

Quoted 7 lines
arch/arm/mach-omap2/board-am3517crane.c +7 -0
+			GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable");
+	if (ret < 0) {
+		pr_err("Cannot request GPIO %d\n", GPIO_USB_POWER);

Keep consistency, either use Can not or Cannot.

Quoted 5 lines
arch/arm/mach-omap2/board-am3517crane.c +5 -0
+		return;
+	}
+
+	ret = gpio_direction_output(GPIO_USB_POWER, 1);
+	if (ret < 0)

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 110

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +10 -0
+		goto err;
+
+
+	usb_ehci_init(&ehci_pdata);
+	return;
+
+err:
+	gpio_free(GPIO_USB_POWER);
+	pr_err("Unable to initialize EHCI power\n");
+	return;

this return is unnecessary

Signature · 1 line
balbi
#9 lore raw
In reply to [email protected]

Hello.

Quoted 19 lines · srinath at mistralsolutions.com

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

History:
http://marc.info/?l=linux-omap&w=2&r=1&s=Craneboard%3A+Add+USB+EHCI+support&q=t

---
  arch/arm/mach-omap2/board-am3517crane.c |   53 +++++++++++++++++++++++++++++++
  1 files changed, 53 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +0 -0
index 8ba4047..1a80175 100644

[...]

Quoted 1 line
arch/arm/mach-omap2/board-am3517crane.c +0 -0
@@ -51,10 +58,56 @@ static void __init am3517_crane_init_irq(void)

[...]

Quoted 7 lines
  static void __init am3517_crane_init(void)
  {
arch/arm/mach-omap2/board-am3517crane.c +3 -0
+	int ret;
+
  	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  	omap_serial_init();
+

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 88

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +10 -0
+	/* Configure GPIO for EHCI port */
+	if (omap_mux_init_gpio(GPIO_USB_NRESET, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not cofigure mux for GPIO_USB_NRESET %d\n",
+			GPIO_USB_NRESET);
+		return;
+	}
+
+	if (omap_mux_init_gpio(GPIO_USB_POWER, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not cofigure mux for GPIO_USB_POWER %d\n",
+

Empty line not needed here...

Quoted 5 lines
arch/arm/mach-omap2/board-am3517crane.c +5 -0
+			GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable");

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 103

Quoted 10 lines
arch/arm/mach-omap2/board-am3517crane.c +10 -0
+	if (ret < 0) {
+		pr_err("Cannot request GPIO %d\n", GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_direction_output(GPIO_USB_POWER, 1);
+	if (ret < 0)
+		goto err;
+
+

Too many empty lines here...

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 107

Quoted 4 lines
arch/arm/mach-omap2/board-am3517crane.c +4 -0
+	usb_ehci_init(&ehci_pdata);
+	return;
+
+err:

There's no need for *goto* and label.

arch/arm/mach-omap2/board-am3517crane.c static void __init am3517_crane_init_irq(void) · line 111

Quoted 4 lines
arch/arm/mach-omap2/board-am3517crane.c +3 -0
+	gpio_free(GPIO_USB_POWER);
+	pr_err("Unable to initialize EHCI power\n");
+	return;
  }

WBR, Sergei

#10 lore raw

PATCH v5 1/1 AM35xx: Craneboard: Add USB EHCI support

In reply to a message not in the archive

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

History:
http://marc.info/?l=linux-omap&w=2&r=1&s=Craneboard%253A%2BAdd%2BUSB%2BEHCI%2Bsupport&q=b

---
 arch/arm/mach-omap2/board-am3517crane.c |   48 +++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-am3517crane.c +48 -0
index 8ba4047..e56900f 100644
@@ -19,6 +19,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -27,8 +28,14 @@
 
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
 
 #include "mux.h"
+#include "control.h"
+
+#define GPIO_USB_POWER		35
+#define GPIO_USB_NRESET		38
+
 
 /* Board initialization */
 static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
@@ -51,10 +58,51 @@ static void __init am3517_crane_init_irq(void)
 	omap_init_irq();
 }
 
+static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
+	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+
+	.phy_reset  = true,
+	.reset_gpio_port[0]  = GPIO_USB_NRESET,
+	.reset_gpio_port[1]  = -EINVAL,
+	.reset_gpio_port[2]  = -EINVAL
+};
+
 static void __init am3517_crane_init(void)
 {
+	int ret;
+
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap_serial_init();
+
+	/* Configure GPIO for EHCI port */
+	if (omap_mux_init_gpio(GPIO_USB_NRESET, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not configure mux for GPIO_USB_NRESET %d\n",
+			GPIO_USB_NRESET);
+		return;
+	}
+
+	if (omap_mux_init_gpio(GPIO_USB_POWER, OMAP_PIN_OUTPUT)) {
+		pr_err("Can not configure mux for GPIO_USB_POWER %d\n",
+			GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable");
+	if (ret < 0) {
+		pr_err("Can not request GPIO %d\n", GPIO_USB_POWER);
+		return;
+	}
+
+	ret = gpio_direction_output(GPIO_USB_POWER, 1);
+	if (ret < 0) {
+		gpio_free(GPIO_USB_POWER);
+		pr_err("Unable to initialize EHCI power\n");
+		return;
+	}
+
+	usb_ehci_init(&ehci_pdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
Signature · 1 line
1.7.1.226.g770c5
Acked-by on v5 1/1
#11 lore raw
Quoted 11 lines · srinath at mistralsolutions.com

From: Srinath <[email protected]>

AM3517/05 Craneboard has one EHCI interface on board using port1.

GPIO35 is used as power enable.
GPIO38 is used as port1 PHY reset.

History:
http://marc.info/?l=linux-omap&w=2&r=1&s=Craneboard%253A%2BAdd%2BUSB%2BEHCI%2Bsupport&q=b

Tony, do you want to make a pull request for you ? I guess this would only go on next merge window.

If you want to take yourself, here's my acked-by:

Signature · 1 line
balbi