mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] ARM: i.MX: Reset OTG controller during startup
Date: Fri, 31 Aug 2018 08:33:55 +0200	[thread overview]
Message-ID: <20180831063355.yc2ahroax5sjc7uz@pengutronix.de> (raw)
In-Reply-To: <20180829131834.12563-1-m.grzeschik@pengutronix.de>

On Wed, Aug 29, 2018 at 03:18:34PM +0200, Michael Grzeschik wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> When booting from USB it's sometimes observed that the USB stack on
> the remote host gets confused. This happens when we adjust the PLLs
> the USB controller is hanging on. The ROM just leaves the USB controller
> enabled when it passes control to the bootloader, so in case the usb
> clks are enabled make sure we reset the otg  before doing any critical
> clock operations.
> 
> This is currently done for i.MX50, i.MX51, i.MX53 and i.MX6, but a
> similar thing can happen on other i.MXes aswell.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> diff --git a/arch/arm/mach-imx/include/mach/usb.h b/arch/arm/mach-imx/include/mach/usb.h
> index 85528d77e6..ab827e9fab 100644
> --- a/arch/arm/mach-imx/include/mach/usb.h
> +++ b/arch/arm/mach-imx/include/mach/usb.h
> @@ -14,4 +14,27 @@
>  int imx6_usb_phy2_disable_oc(void);
>  int imx6_usb_phy2_enable(void);
>  
> +#define USBCMD	0x140
> +#define USB_CMD_RESET	0x00000002
> +
> +/*
> + * imx_disable_otg_controller - disable the USB OTG controller
> + * @base: The base address of the controller

It's imx_reset_otg_controller now. Fixed up while applying.

Sascha

> + *
> + * When booting from USB the ROM just leaves the controller enabled. This can
> + * have bad side effects when for example we change PLL frequencies. In this
> + * case it is seen that the hub the board is connected to gets confused and USB
> + * is no longer working properly on the remote host. This function disables the
> + * OTG controller. It should be called before the clocks the controller hangs on
> + * is fiddled with.
> + */
> +static inline void imx_reset_otg_controller(void __iomem *base)
> +{
> +	u32 r;
> +
> +	r = readl(base + USBCMD);
> +	r |= USB_CMD_RESET;
> +	writel(r, base + USBCMD);
> +}
> +
>  #endif /* __MACH_USB_H_*/
> -- 
> 2.18.0
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

      reply	other threads:[~2018-08-31  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 13:18 Michael Grzeschik
2018-08-31  6:33 ` Sascha Hauer [this message]

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=20180831063355.yc2ahroax5sjc7uz@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.grzeschik@pengutronix.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