From patchwork Tue Sep 25 22:14:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 186903 X-Patchwork-Delegate: twarren@nvidia.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 7AA192C0081 for ; Wed, 26 Sep 2012 08:16:10 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3938D280A2; Wed, 26 Sep 2012 00:15:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FuxcUN+udAKo; Wed, 26 Sep 2012 00:15:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 97856280A4; Wed, 26 Sep 2012 00:14:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1C5172807D for ; Wed, 26 Sep 2012 00:14:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cyR8aMHLnN+4 for ; Wed, 26 Sep 2012 00:14:46 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from km20343-01.keymachine.de (ns.km20343-01.keymachine.de [84.19.182.79]) by theia.denx.de (Postfix) with ESMTP id 410EE2807B for ; Wed, 26 Sep 2012 00:14:43 +0200 (CEST) Received: from localhost.localdomain (g229037003.adsl.alicedsl.de [92.229.37.3]) by km20343-01.keymachine.de (Postfix) with ESMTPA id 4874A7D4422; Wed, 26 Sep 2012 00:14:43 +0200 (CEST) From: Lucas Stach To: Marek Vasut Date: Wed, 26 Sep 2012 00:14:37 +0200 Message-Id: <1348611277-23935-5-git-send-email-dev@lynxeye.de> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348611277-23935-1-git-send-email-dev@lynxeye.de> References: <1348611277-23935-1-git-send-email-dev@lynxeye.de> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] =?utf-8?q?=5BPATCH_4/4=5D_tegra20=3A_port_to_new_ehci_in?= =?utf-8?q?terface?= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de EHCI interface now supports more than one controller. Wire up our usb functions to use this new interface. Signed-off-by: Lucas Stach --- 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 cac0918..eda8e6f 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -77,7 +77,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 @@ -351,30 +350,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); @@ -383,7 +377,7 @@ int tegrausb_stop_port(void) /* Initiate controller reset */ writel(2, &usbctlr->usb_cmd); udelay(1000); - port_current = -1; + return 0; } @@ -459,7 +453,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 638033b..4bbd4aa 100644 --- a/arch/arm/include/asm/arch-tegra20/usb.h +++ b/arch/arm/include/asm/arch-tegra20/usb.h @@ -240,13 +240,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); }