mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] imx{5,6}: reset otg port after usb-serial boot
Date: Fri, 24 Aug 2018 17:17:39 +0200	[thread overview]
Message-ID: <20180824151739.8883-1-m.grzeschik@pengutronix.de> (raw)

The ROM loader leaves the otg port in peripheral mode which confuses the
host controller. After the handover to barebox we ensure to bring in the
port into the otg state by resetting it.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
This was tested with mx53 and mx6 for now. I suppose we should
adopt this to the mx2 and mx3 models.

 arch/arm/mach-imx/imx50.c | 3 +++
 arch/arm/mach-imx/imx51.c | 3 +++
 arch/arm/mach-imx/imx53.c | 3 +++
 arch/arm/mach-imx/imx6.c  | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/arch/arm/mach-imx/imx50.c b/arch/arm/mach-imx/imx50.c
index f7cbc9d4ba..ac326cf3c0 100644
--- a/arch/arm/mach-imx/imx50.c
+++ b/arch/arm/mach-imx/imx50.c
@@ -92,6 +92,9 @@ void imx50_init_lowlevel_early(unsigned int cpufreq_mhz)
 
 	imx5_init_lowlevel();
 
+	/* reset otg: in case we started via usb-serial */
+	writel((readl(0x53F80140) | 2), 0x53F80140);
+
 	/*
 	 * AIPS setup - Only setup MPROTx registers.
 	 * The PACR default values are good.
diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
index ec8cdd868b..91f6df1cfa 100644
--- a/arch/arm/mach-imx/imx51.c
+++ b/arch/arm/mach-imx/imx51.c
@@ -142,6 +142,9 @@ void imx51_init_lowlevel(unsigned int cpufreq_mhz)
 
 	imx5_init_lowlevel();
 
+	/* reset otg: in case we started via usb-serial */
+	writel((readl(0x73F80140) | 2), 0x73F80140);
+
 	/* disable write combine for TO 2 and lower revs */
 	if (rev < IMX_CHIP_REV_3_0) {
 		__asm__ __volatile__("mrc 15, 1, %0, c9, c0, 1":"=r"(r));
diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c
index b22929f749..99e942ed52 100644
--- a/arch/arm/mach-imx/imx53.c
+++ b/arch/arm/mach-imx/imx53.c
@@ -90,6 +90,9 @@ void imx53_init_lowlevel_early(unsigned int cpufreq_mhz)
 
 	imx5_init_lowlevel();
 
+	/* reset otg: in case we started via usb-serial */
+	writel((readl(0x53F80140) | 2), 0x53F80140);
+
 	/*
 	 * AIPS setup - Only setup MPROTx registers.
 	 * The PACR default values are good.
diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index 3d95c9e374..8af051c34a 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -193,6 +193,9 @@ int imx6_init(void)
 
 	imx6_init_lowlevel();
 
+	/* reset otg: in case we started via usb-serial */
+	writel((readl(0x21840140) | 2), 0x21840140);
+
 	imx6_boot_save_loc();
 
 	mx6_silicon_revision = imx6_cpu_revision();
-- 
2.18.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2018-08-24 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 15:17 Michael Grzeschik [this message]
2018-08-24 16:27 ` Sam Ravnborg
2018-08-24 17:04 ` Sascha Hauer
2018-08-24 19:55   ` Michael Grzeschik
2018-08-24 20:18     ` Fabio Estevam
2018-08-27  7:47       ` Michael Grzeschik
2018-08-27  7:52         ` Sascha Hauer
2018-08-27  8:13           ` Michael Grzeschik
2018-08-27  8:17             ` Michael Grzeschik
2018-08-27  8:29             ` Sascha Hauer

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=20180824151739.8883-1-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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