public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mvebu: usb: Add missing controller reset after initialization
@ 2016-01-02 21:19 Phil Sutter
  2016-01-03  8:59 ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Sutter @ 2016-01-02 21:19 UTC (permalink / raw)
  To: 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 <phil@nwl.cc>
---
 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));
 	}
 }
 
-- 
2.5.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-24  9:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-02 21:19 [U-Boot] [PATCH] mvebu: usb: Add missing controller reset after initialization Phil Sutter
2016-01-03  8:59 ` Wolfgang Denk
2016-01-03  9:35   ` Marek Vasut
2016-01-03 23:38   ` Phil Sutter
2016-01-03 23:47     ` Marek Vasut
2016-01-04  3:02       ` Phil Sutter
2016-01-04 11:25         ` Marek Vasut
2016-03-24  9:13           ` Stefan Roese
2016-03-24  9:47             ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox