From patchwork Sun May 26 18:36:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Silbe X-Patchwork-Id: 246463 X-Patchwork-Delegate: prafulla@marvell.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 C8C232C0296 for ; Mon, 27 May 2013 06:51:01 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4B4B64A029; Sun, 26 May 2013 22:50:36 +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 skx0FwkxzEdQ; Sun, 26 May 2013 22:50:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6F7794A03B; Sun, 26 May 2013 22:49:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0BC114A01C for ; Sun, 26 May 2013 20:42:55 +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 QWmQRefT0CO0 for ; Sun, 26 May 2013 20:42:53 +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 b.mx.chost.de (setoy2.chost.de [87.106.8.89]) by theia.denx.de (Postfix) with ESMTPS id 3862A4A026 for ; Sun, 26 May 2013 20:42:45 +0200 (CEST) Received: from sshgate.chost.de (sshgate.chost.de [::ffff:87.106.80.19]) by b.mx.chost.de with esmtp; Sun, 26 May 2013 20:37:37 +0200 id 0EF45FDF.51A25671.000003E6 Received: by sshgate.chost.de (sSMTP sendmail emulation); Sun, 26 May 2013 20:37:37 +0200 Received: (nullmailer pid 20129 invoked by uid 8193); Sun, 26 May 2013 18:37:31 -0000 From: Sascha Silbe To: u-boot@lists.denx.de Date: Sun, 26 May 2013 20:36:55 +0200 Message-Id: <1369593423-19763-3-git-send-email-t-uboot@infra-silbe.de> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1369593423-19763-1-git-send-email-t-uboot@infra-silbe.de> References: <1369593423-19763-1-git-send-email-t-uboot@infra-silbe.de> X-Mailman-Approved-At: Sun, 26 May 2013 22:49:45 +0200 Cc: Rabeeh Khoury , Luka Perkov , Daniel Stodden , Andy Fleming Subject: [U-Boot] [PATCH v4 02/10] usb: ehci-marvell: add support for second USB controller 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Sascha Silbe Marvell 88AP510 (Armada 510, dove) has two separate USB controllers. Use the index parameter that already gets passed in to calculate the base address of the controller. Signed-off-by: Sascha Silbe --- v3->v4: new patch drivers/usb/host/ehci-marvell.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c index 2b73e4a..d2cf026 100644 --- a/drivers/usb/host/ehci-marvell.c +++ b/drivers/usb/host/ehci-marvell.c @@ -28,7 +28,9 @@ #include "ehci.h" #include -#if defined(CONFIG_KIRKWOOD) +#if defined(CONFIG_DOVE) +#include +#elif defined(CONFIG_KIRKWOOD) #include #elif defined(CONFIG_ORION5X) #include @@ -36,8 +38,8 @@ DECLARE_GLOBAL_DATA_PTR; -#define rdl(off) readl(MVUSB0_BASE + (off)) -#define wrl(off, val) writel((val), MVUSB0_BASE + (off)) +#define rdl(base, off) readl((base) + (off)) +#define wrl(base, off, val) writel((val), (base) + (off)) #define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4)) #define USB_WINDOW_BASE(i) (0x324 + ((i) << 4)) @@ -46,10 +48,15 @@ DECLARE_GLOBAL_DATA_PTR; /* * USB 2.0 Bridge Address Decoding registers setup */ -static void usb_brg_adrdec_setup(void) +static void usb_brg_adrdec_setup(int index) { int i; u32 size, base, attrib; +#ifdef MVUSB1_BASE + u32 usb_base = (index == 0) ? MVUSB0_BASE : MVUSB1_BASE; +#else + u32 usb_base = MVUSB0_BASE; +#endif for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { @@ -76,13 +83,13 @@ static void usb_brg_adrdec_setup(void) size = gd->bd->bi_dram[i].size; base = gd->bd->bi_dram[i].start; if ((size) && (attrib)) - wrl(USB_WINDOW_CTRL(i), - MVCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM, - attrib, MVCPU_WIN_ENABLE)); + wrl(usb_base, USB_WINDOW_CTRL(i), + MVCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM, + attrib, MVCPU_WIN_ENABLE)); else - wrl(USB_WINDOW_CTRL(i), MVCPU_WIN_DISABLE); + wrl(usb_base, USB_WINDOW_CTRL(i), MVCPU_WIN_DISABLE); - wrl(USB_WINDOW_BASE(i), base); + wrl(usb_base, USB_WINDOW_BASE(i), base); } } @@ -92,9 +99,15 @@ static void usb_brg_adrdec_setup(void) */ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - usb_brg_adrdec_setup(); +#ifdef MVUSB1_BASE + u32 usb_base = (index == 0) ? MVUSB0_BASE : MVUSB1_BASE; +#else + u32 usb_base = MVUSB0_BASE; +#endif - *hccr = (struct ehci_hccr *)(MVUSB0_BASE + 0x100); + usb_brg_adrdec_setup(index); + + *hccr = (struct ehci_hccr *)(usb_base + 0x100); *hcor = (struct ehci_hcor *)((uint32_t) *hccr + HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));