public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] usb: ehci-omap: Reset the USB Host OMAP module
Date: Wed, 04 Dec 2013 20:03:15 +0200	[thread overview]
Message-ID: <529F6E63.20906@compulab.co.il> (raw)
In-Reply-To: <1385992065-15329-2-git-send-email-rogerq@ti.com>

Hi Roger,

This patch fixes a USB issue we had which was caused by the function
ehci_shutdown() in usb_lowlevel_stop(). The issue was that once "usb
stop" was called, usb devices would no longer be detected by the
"usb start" command. With this patch the devices are detected each
time.

One suggestion though (see below):

On 12/02/2013 03:47 PM, Roger Quadros wrote:
> In commit bb1f327 we removed the UHH reset to fix NFS root (over usb
> ethernet) problems with Beagleboard (3530 ES1.0). However, this
> seems to cause USB detection problems for Pandaboard, about (3/8).
>
> On further investigation, it seems that doing the UHH reset is not
> the cause of the original Beagleboard problem, but in the way the reset
> was done.
>
> This patch adds proper UHH RESET mechanism for OMAP3 and OMAP4/5 based
> on the UHH_REVISION register. This should fix the Beagleboard NFS
> problem as well as the Pandaboard USB detection problem.
>
> Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> CC: Stefan Roese <sr@denx.de>
> Reviewed-by: Stefan Roese <sr@denx.de>
> Signed-off-by: Roger Quadros <rogerq@ti.com>

[...]

> +
> +	switch (rev) {
> +	case OMAP_USBHS_REV1:
> +		/* Wait for soft RESET to complete */
> +		while (!(readl(&uhh->syss) & 0x1)) {
> +			if (timeout > 100) {
> +				printf("%s: RESET timeout\n", __func__);
> +				return -1;
> +			}
> +			udelay(10);
> +			timeout++;
> +		}
> +
> +		/* Set No-Idle, No-Standby */
> +		writel(OMAP_UHH_SYSCONFIG_VAL, &uhh->sysc);
> +		break;
> +
> +	default:	/* Rev. 2 onwards */
> +
> +		udelay(2); /* Need to wait before accessing SYSCONFIG back */
> +
> +		/* Wait for soft RESET to complete */
> +		while ((readl(&uhh->sysc) & 0x1)) {
> +			if (timeout > 100) {
> +				printf("%s: RESET timeout\n", __func__);
> +				return -1;
> +			}
> +			udelay(10);
> +			timeout++;
> +		}
> +
> +		writel(OMAP_UHH_SYSCONFIG_VAL, &uhh->sysc);
> +		break;
> +	}
> +

You have a lot of unnecessart code duplication in this switch statment.
How about:
====
if (rev != OMAP_USBHS_REV1)
	udelay(2); /* Need to wait before accessing SYSCONFIG back */

/* Wait for soft RESET to complete */
while (!omap_uhh_reset_done(rev)) {
	if (timeout > 100) {
		printf("%s: RESET timeout\n", __func__);
		return -1;
	}

	udelay(10);
	timeout++;
}

writel(OMAP_UHH_SYSCONFIG_VAL, &uhh->sysc);
====
With omap_uhh_reset_done() doing the appropriate check for the revision.

Also, why can't we do udelay(2) when rev == OMAP_USBHS_REV1?

-- 
Regards,
Nikita.

  reply	other threads:[~2013-12-04 18:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 13:47 [U-Boot] [PATCH 0/3] OMAP USB host fixes for Beagle & Panda Roger Quadros
2013-12-02 13:47 ` [U-Boot] [PATCH 1/3] usb: ehci-omap: Reset the USB Host OMAP module Roger Quadros
2013-12-04 18:03   ` Nikita Kiryanov [this message]
2013-12-02 13:47 ` [U-Boot] [PATCH 2/3] omap3_beagle: Don't use ulpi_reset Roger Quadros
2013-12-02 13:47 ` [U-Boot] [PATCH 3/3] omap4_panda: " Roger Quadros
2013-12-02 15:59 ` [U-Boot] [PATCH 0/3] OMAP USB host fixes for Beagle & Panda Marek Vasut
2013-12-02 16:01   ` Tom Rini
2013-12-02 16:02   ` Marek Vasut
2013-12-04  9:58 ` Tomi Valkeinen
2013-12-04 11:17   ` Roger Quadros
2013-12-04 22:05 ` Tom Rini

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=529F6E63.20906@compulab.co.il \
    --to=nikita@compulab.co.il \
    --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