From: Lucas Stach <dev@lynxeye.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] tegra20: port to new ehci interface
Date: Thu, 30 Aug 2012 18:03:23 +0200 [thread overview]
Message-ID: <1346342604-13355-4-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1346342604-13355-1-git-send-email-dev@lynxeye.de>
EHCI interface now supports more than one controller. Wire up our usb functions
to use this new interface.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/cpu/armv7/tegra20/usb.c | 15 ++++-----------
arch/arm/include/asm/arch-tegra20/usb.h | 4 ++--
drivers/usb/host/ehci-tegra.c | 5 ++---
3 Dateien ge?ndert, 8 Zeilen hinzugef?gt(+), 16 Zeilen entfernt(-)
diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index 4a3ec7c..219f9c2 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -87,7 +87,6 @@ struct fdt_usb {
static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */
static unsigned port_count; /* Number of available ports */
-static int port_current; /* Current port (-1 = none) */
/*
* This table has USB timing parameters for each Oscillator frequency we
@@ -453,30 +452,25 @@ static int add_port(struct fdt_usb *config, const u32 timing[])
return 0;
}
-int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
{
struct usb_ctlr *usbctlr;
if (portnum >= port_count)
return -1;
- tegrausb_stop_port();
set_host_mode(&port[portnum]);
usbctlr = port[portnum].reg;
*hccr = (u32)&usbctlr->cap_length;
*hcor = (u32)&usbctlr->usb_cmd;
- port_current = portnum;
return 0;
}
-int tegrausb_stop_port(void)
+int tegrausb_stop_port(int portnum)
{
struct usb_ctlr *usbctlr;
- if (port_current == -1)
- return -1;
-
- usbctlr = port[port_current].reg;
+ usbctlr = port[portnum].reg;
/* Stop controller */
writel(0, &usbctlr->usb_cmd);
@@ -485,7 +479,7 @@ int tegrausb_stop_port(void)
/* Initiate controller reset */
writel(2, &usbctlr->usb_cmd);
udelay(1000);
- port_current = -1;
+
return 0;
}
@@ -565,7 +559,6 @@ int board_usb_init(const void *blob)
return -1;
set_host_mode(&config);
}
- port_current = -1;
return 0;
}
diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h
index bd89d66..fdbd127 100644
--- a/arch/arm/include/asm/arch-tegra20/usb.h
+++ b/arch/arm/include/asm/arch-tegra20/usb.h
@@ -259,13 +259,13 @@ int board_usb_init(const void *blob);
* @param hcor returns start address of EHCI HCOR registers
* @return 0 if ok, -1 on error (generally invalid port number)
*/
-int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor);
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor);
/**
* Stop the current port
*
* @return 0 if ok, -1 if no port was active
*/
-int tegrausb_stop_port(void);
+int tegrausb_stop_port(int portnum);
#endif /* _TEGRA_USB_H_ */
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index bb5a68e..a1c43f8 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -57,7 +57,7 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
* Select the first port, as we don't have a way of selecting others
* yet
*/
- if (tegrausb_start_port(0, &our_hccr, &our_hcor))
+ if (tegrausb_start_port(index, &our_hccr, &our_hcor))
return -1;
*hccr = (struct ehci_hccr *)our_hccr;
@@ -72,6 +72,5 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
*/
int ehci_hcd_stop(int index)
{
- tegrausb_stop_port();
- return 0;
+ return tegrausb_stop_port(index);
}
--
1.7.11.4
next prev parent reply other threads:[~2012-08-30 16:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-30 16:03 [U-Boot] [PATCH 0/4] USB multi controller Lucas Stach
2012-08-30 16:03 ` [U-Boot] [PATCH 1/4] usb: lowlevel interface change to support multiple controllers Lucas Stach
2012-08-30 21:03 ` Marek Vasut
2012-08-30 16:03 ` [U-Boot] [PATCH 2/4] usb: ehci: rework to take advantage of new lowlevel interface Lucas Stach
2012-08-30 21:09 ` Marek Vasut
2012-08-30 21:51 ` Lucas Stach
2012-08-30 21:55 ` Marek Vasut
2012-08-30 16:03 ` Lucas Stach [this message]
2012-08-30 16:03 ` [U-Boot] [PATCH 4/4] usb: add support for multiple usb controllers Lucas Stach
2012-08-30 21:12 ` Marek Vasut
2012-09-04 23:05 ` [U-Boot] [PATCH 0/4] USB multi controller Stephen Warren
2012-09-05 0:30 ` Marek Vasut
2012-09-05 6:21 ` Lucas Stach
2012-09-05 6:30 ` Marek Vasut
2012-09-05 19:11 ` Stephen Warren
2012-09-05 19:27 ` Marek Vasut
2012-09-05 22:13 ` Lucas Stach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346342604-13355-4-git-send-email-dev@lynxeye.de \
--to=dev@lynxeye.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox