summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-06-29 14:53:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-16 11:05:22 +0200
commit4399f342035c4dc41877c6114ac276bff98072fd (patch)
treee9518bf34ef4be894f17d3992e94c2f90cd2deed
parentb918f85ebe0fb61564ac4fbba59647a2a2cbe185 (diff)
downloadbarebox-4399f342035c4dc41877c6114ac276bff98072fd.tar.gz
barebox-4399f342035c4dc41877c6114ac276bff98072fd.tar.xz
ARM mxs: Clear USB boot mode during startup
When the i.MX28 boots from USB, the ROM code sets this bit. When after a reset the ROM code detects that this bit is set it will boot from USB again. This means that if we boot once from USB the chip will continue to boot from USB until the next power cycle. To prevent this (and boot from the configured bootsource instead) clear this bit here. This bit is not documented in the datasheets, it was figured out the hard way. Whether this is the same on i.MX23 is currently not known. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-mxs/imx.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/imx.c b/arch/arm/mach-mxs/imx.c
index c64f23ceb5..db878fb5c7 100644
--- a/arch/arm/mach-mxs/imx.c
+++ b/arch/arm/mach-mxs/imx.c
@@ -20,6 +20,30 @@
#include <common.h>
#include <command.h>
#include <complete.h>
+#include <init.h>
+#include <io.h>
+#include <mach/imx-regs.h>
+
+#define HW_RTC_PERSISTENT1 0x070
+
+static int imx_reset_usb_bootstrap(void)
+{
+ /*
+ * Clear USB boot mode.
+ *
+ * When the i.MX28 boots from USB, the ROM code sets this bit. When
+ * after a reset the ROM code detects that this bit is set it will
+ * boot from USB again. This means that if we boot once from USB the
+ * chip will continue to boot from USB until the next power cycle.
+ *
+ * To prevent this (and boot from the configured bootsource instead)
+ * clear this bit here.
+ */
+ writel(0x2, IMX_WDT_BASE + HW_RTC_PERSISTENT1 + BIT_CLR);
+
+ return 0;
+}
+device_initcall(imx_reset_usb_bootstrap);
extern void imx_dump_clocks(void);