From: Phil Sutter <phil@nwl.cc>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mvebu: usb: Add missing controller reset after initialization
Date: Sat, 2 Jan 2016 22:19:59 +0100 [thread overview]
Message-ID: <20160102211834.E49A161C74@mail.nwl.cc> (raw)
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
next reply other threads:[~2016-01-02 21:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-02 21:19 Phil Sutter [this message]
2016-01-03 8:59 ` [U-Boot] [PATCH] mvebu: usb: Add missing controller reset after initialization 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160102211834.E49A161C74@mail.nwl.cc \
--to=phil@nwl.cc \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox