From: Lucas Stach <dev@lynxeye.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/8] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]
Date: Tue, 30 Oct 2012 10:22:53 +0100 [thread overview]
Message-ID: <1351588973-20699-8-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1351588973-20699-1-git-send-email-dev@lynxeye.de>
The ehci_hcd entry points were just calling into the Tegra USB functions. Now
that they are in the same file we can just move over the implementation.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/include/asm/arch-tegra20/usb.h | 19 -------
drivers/usb/host/ehci-tegra.c | 93 +++++++++++++--------------------
2 Dateien ge?ndert, 35 Zeilen hinzugef?gt(+), 77 Zeilen entfernt(-)
diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h
index b18c850..ef6c089 100644
--- a/arch/arm/include/asm/arch-tegra20/usb.h
+++ b/arch/arm/include/asm/arch-tegra20/usb.h
@@ -246,23 +246,4 @@ struct usb_ctlr {
/* Setup USB on the board */
int board_usb_init(const void *blob);
-/**
- * Start up the given port number (ports are numbered from 0 on each board).
- * This returns values for the appropriate hccr and hcor addresses to use for
- * USB EHCI operations.
- *
- * @param portnum port number to start
- * @param hccr returns start address of EHCI HCCR registers
- * @param hcor returns start address of EHCI HCOR registers
- * @return 0 if ok, -1 on error (generally invalid port number)
- */
-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(int portnum);
-
#endif /* _TEGRA_USB_H_ */
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 3df43a9..5966e2d 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -426,51 +426,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
}
#endif
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
-{
- struct fdt_usb *config;
- struct usb_ctlr *usbctlr;
-
- if (portnum >= port_count)
- return -1;
-
- config = &port[portnum];
-
- if (config->utmi && init_utmi_usb_controller(config)) {
- printf("tegrausb: Cannot init port %d\n", portnum);
- return -1;
- }
-
- if (config->ulpi && init_ulpi_usb_controller(config)) {
- printf("tegrausb: Cannot init port %d\n", portnum);
- return -1;
- }
-
- set_host_mode(config);
-
- usbctlr = config->reg;
- *hccr = (u32)&usbctlr->cap_length;
- *hcor = (u32)&usbctlr->usb_cmd;
- return 0;
-}
-
-int tegrausb_stop_port(int portnum)
-{
- struct usb_ctlr *usbctlr;
-
- usbctlr = port[portnum].reg;
-
- /* Stop controller */
- writel(0, &usbctlr->usb_cmd);
- udelay(1000);
-
- /* Initiate controller reset */
- writel(2, &usbctlr->usb_cmd);
- udelay(1000);
-
- return 0;
-}
-
int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
{
const char *phy, *mode;
@@ -556,31 +511,53 @@ int board_usb_init(const void *blob)
}
/*
- * Create the appropriate control structures to manage
- * a new EHCI host controller.
+ * Initialize the USB controller and return the control structures.
*/
int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
{
- u32 our_hccr, our_hcor;
+ struct fdt_usb *config;
+ struct usb_ctlr *usbctlr;
- /*
- * Select the first port, as we don't have a way of selecting others
- * yet
- */
- if (tegrausb_start_port(index, &our_hccr, &our_hcor))
+ if (index >= port_count)
+ return -1;
+
+ config = &port[index];
+
+ if (config->utmi && init_utmi_usb_controller(config)) {
+ printf("tegrausb: Cannot init port %d\n", index);
+ return -1;
+ }
+
+ if (config->ulpi && init_ulpi_usb_controller(config)) {
+ printf("tegrausb: Cannot init port %d\n", index);
return -1;
+ }
+
+ set_host_mode(config);
- *hccr = (struct ehci_hccr *)our_hccr;
- *hcor = (struct ehci_hcor *)our_hcor;
+ usbctlr = config->reg;
+ *hccr = (struct ehci_hccr *)&usbctlr->cap_length;
+ *hcor = (struct ehci_hcor *)&usbctlr->usb_cmd;
return 0;
}
/*
- * Destroy the appropriate control structures corresponding
- * the the EHCI host controller.
+ * Bring down the USB controller.
*/
int ehci_hcd_stop(int index)
{
- return tegrausb_stop_port(index);
+ struct usb_ctlr *usbctlr;
+
+ usbctlr = port[index].reg;
+
+ /* Stop controller */
+ writel(0, &usbctlr->usb_cmd);
+ udelay(1000);
+
+ /* Initiate controller reset */
+ writel(2, &usbctlr->usb_cmd);
+ udelay(1000);
+
+ return 0;
}
--
1.7.11.7
next prev parent reply other threads:[~2012-10-30 9:22 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 9:22 [U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define Lucas Stach
2012-10-30 9:22 ` [U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained Lucas Stach
2012-10-30 13:03 ` Simon Glass
2012-10-30 13:16 ` Lucas Stach
2012-10-30 15:35 ` Simon Glass
2012-10-30 9:22 ` [U-Boot] [PATCH 3/8] tegra: usb: fold initial pll setup into board_usb_init Lucas Stach
2012-10-30 13:23 ` Simon Glass
2012-10-30 13:32 ` Lucas Stach
2012-10-30 9:22 ` [U-Boot] [PATCH 4/8] tegra: usb: remove unneeded function parameter Lucas Stach
2012-10-30 13:18 ` Simon Glass
2012-10-30 9:22 ` [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port Lucas Stach
2012-10-30 10:59 ` Marek Vasut
2012-10-30 12:12 ` Lucas Stach
2012-10-30 12:33 ` Marek Vasut
2012-10-30 12:44 ` Lucas Stach
2012-10-30 18:34 ` Stephen Warren
2012-10-30 13:27 ` Simon Glass
2012-10-30 13:37 ` Lucas Stach
2012-10-30 13:48 ` Simon Glass
2012-10-30 13:54 ` Lucas Stach
2012-10-30 14:03 ` Simon Glass
2012-10-30 9:22 ` [U-Boot] [PATCH 6/8] tegra: usb: various small cleanups Lucas Stach
2012-10-30 13:31 ` Simon Glass
2012-10-30 9:22 ` [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory Lucas Stach
2012-10-30 13:33 ` Simon Glass
2012-10-30 13:38 ` Lucas Stach
2012-10-30 13:53 ` Simon Glass
2012-10-30 14:03 ` Lucas Stach
2012-10-30 16:11 ` Tom Warren
2012-10-30 16:18 ` Simon Glass
2012-10-30 18:38 ` Stephen Warren
2012-10-30 18:45 ` Lucas Stach
2012-10-30 18:51 ` Stephen Warren
2012-10-30 18:58 ` Lucas Stach
2012-10-30 9:22 ` Lucas Stach [this message]
2012-10-30 13:39 ` [U-Boot] [PATCH 8/8] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop] Simon Glass
2012-10-30 13:09 ` [U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define Simon Glass
2012-10-30 13:11 ` Marek Vasut
2012-10-30 13:40 ` Simon Glass
2012-11-02 20:41 ` Marek Vasut
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=1351588973-20699-8-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 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.