[U-Boot] [PATCH] mvebu: usb: Add missing controller reset after initialization
Phil Sutter
phil at nwl.cc
Sat Jan 2 22:19:59 CET 2016
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 at 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
More information about the U-Boot
mailing list