All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] tegra20: Initialize multiple USB controllers at once
@ 2012-08-10  9:39 Jim Lin
  0 siblings, 0 replies; only message in thread
From: Jim Lin @ 2012-08-10  9:39 UTC (permalink / raw)
  To: u-boot

Add support for command line "usb reset" or "usb start" to initialize
, "usb stop" to stop multiple USB controllers at once.
Other commands like "usb tree" also support multiple controllers.

Example to add definitions in header file like include/configs/seaboard.h are:
define CONFIG_USB_MULTI
define CONFIG_USB_MAX_CONTROLLER_COUNT 3

Signed-off-by: Jim Lin <jilin@nvidia.com>
---
 arch/arm/cpu/armv7/tegra20/usb.c        |   15 +++++++++++++++
 arch/arm/include/asm/arch-tegra20/usb.h |    4 ++++
 drivers/usb/host/ehci-tegra.c           |   15 +++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index 178bb13..141d608 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -352,7 +352,11 @@ int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor)
 
 	if (portnum >= port_count)
 		return -1;
+#ifdef CONFIG_USB_MULTI
+	tegrausb_stop_port(portnum);
+#else
 	tegrausb_stop_port();
+#endif
 	set_host_mode(&port[portnum]);
 
 	usbctlr = port[portnum].reg;
@@ -362,6 +366,16 @@ int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor)
 	return 0;
 }
 
+#ifdef CONFIG_USB_MULTI
+int tegrausb_stop_port(unsigned portnum)
+{
+	struct usb_ctlr *usbctlr;
+
+	if (portnum >= port_count)
+		return -1;
+
+	usbctlr = port[portnum].reg;
+#else
 int tegrausb_stop_port(void)
 {
 	struct usb_ctlr *usbctlr;
@@ -370,6 +384,7 @@ int tegrausb_stop_port(void)
 		return -1;
 
 	usbctlr = port[port_current].reg;
+#endif
 
 	/* Stop controller */
 	writel(0, &usbctlr->usb_cmd);
diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h
index 638033b..e7bc167 100644
--- a/arch/arm/include/asm/arch-tegra20/usb.h
+++ b/arch/arm/include/asm/arch-tegra20/usb.h
@@ -247,6 +247,10 @@ int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor);
  *
  * @return 0 if ok, -1 if no port was active
  */
+#ifdef CONFIG_USB_MULTI
+int tegrausb_stop_port(unsigned portnum);
+#else
 int tegrausb_stop_port(void);
+#endif
 
 #endif	/* _TEGRA_USB_H_ */
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 4646b29..fa2e1b1 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -50,6 +50,12 @@ void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)
  * Create the appropriate control structures to manage
  * a new EHCI host controller.
  */
+#ifdef CONFIG_USB_MULTI
+int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
+{
+	return tegrausb_start_port(index, hccr, hcor);
+}
+#else
 int ehci_hcd_init(void)
 {
 	u32 our_hccr, our_hcor;
@@ -66,13 +72,22 @@ int ehci_hcd_init(void)
 
 	return 0;
 }
+#endif
 
 /*
  * Destroy the appropriate control structures corresponding
  * the the EHCI host controller.
  */
+#ifdef CONFIG_USB_MULTI
+int ehci_hcd_stop(int index)
+{
+	tegrausb_stop_port(index);
+	return 0;
+}
+#else
 int ehci_hcd_stop(void)
 {
 	tegrausb_stop_port();
 	return 0;
 }
+#endif
-- 
1.7.3


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-10  9:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-10  9:39 [U-Boot] [PATCH 1/1] tegra20: Initialize multiple USB controllers at once Jim Lin

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.