From patchwork Sat Jan 2 21:19:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 562104 X-Patchwork-Delegate: marek.vasut@gmail.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 75C2414076B for ; Sun, 3 Jan 2016 08:18:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 97B5E4B8C1; Sat, 2 Jan 2016 22:18:42 +0100 (CET) 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 0675VslSgiwq; Sat, 2 Jan 2016 22:18:42 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E25894B8C3; Sat, 2 Jan 2016 22:18:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BC0484B8C3 for ; Sat, 2 Jan 2016 22:18:39 +0100 (CET) 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 C8oXRtvJnjIo for ; Sat, 2 Jan 2016 22:18:39 +0100 (CET) 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 mail.nwl.cc (orbyte.nwl.cc [151.80.46.58]) by theia.denx.de (Postfix) with ESMTPS id 94FBD4B8C1 for ; Sat, 2 Jan 2016 22:18:35 +0100 (CET) Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id 15C7561C76; Sat, 2 Jan 2016 22:18:35 +0100 (CET) Received: from base (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id E49A161C74; Sat, 2 Jan 2016 22:18:34 +0100 (CET) From: Phil Sutter To: u-boot@lists.denx.de Date: Sat, 2 Jan 2016 22:19:59 +0100 X-Mailer: git-send-email 2.5.3 Message-Id: <20160102211834.E49A161C74@mail.nwl.cc> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Dennis Gilmore , Stefan Roese , Luka Perkov Subject: [U-Boot] [PATCH] mvebu: usb: Add missing controller reset after initialization X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In order to allow for Linux properly register the integrated EHCI host, we have to reset it after initialization. Without this, enumeration fails if 'usb start' wasn't issued prior to booting Linux. Signed-off-by: Phil Sutter --- arch/arm/mach-mvebu/cpu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 5c62fd5..cb885f8 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -281,6 +281,8 @@ static void set_cbar(u32 addr) (((addr) & 0xF) << 6)) #define MV_USB_X3_PHY_CHANNEL(dev, reg) (MV_USB_X3_BASE((dev) + 1) | \ (((reg) & 0xF) << 2)) +#define MV_USB_CMD_REG(dev) (MVEBU_AXP_USB_BASE + (dev * 0x1000) + 0x140) +#define MV_USB_MODE_REG(dev) (MVEBU_AXP_USB_BASE + (dev * 0x1000) + 0x1A8) static void setup_usb_phys(void) { @@ -313,6 +315,16 @@ static void setup_usb_phys(void) setbits_le32(MV_USB_X3_PHY_CHANNEL(dev, 1), BIT(12)); udelay(40); clrbits_le32(MV_USB_X3_PHY_CHANNEL(dev, 1), BIT(12)); + + /* disable (bit 0) and reset (bit 1) controller */ + /* XXX: do this in two steps? */ + clrsetbits_le32(MV_USB_CMD_REG(dev), BIT(0), BIT(1)); + + while(readl(MV_USB_CMD_REG(dev)) & BIT(1)) + ; + + /* set host mode (device mode is (0x2 | 1 << 3)) */ + writel(0x3, MV_USB_MODE_REG(dev)); } }