[U-Boot] [PATCH 0/3] OMAP USB host fixes for Beagle & Panda

Hi,
This series
- Fixes OMAP4 Panda USB device detection issues - Gets rid of ULPI reset errors on Beagle & Panda
--- cheers, -roger
Roger Quadros (3): usb: ehci-omap: Reset the USB Host OMAP module omap3_beagle: Don't use ulpi_reset omap4_panda: Don't use ulpi_reset
drivers/usb/host/ehci-omap.c | 57 +++++++++++++++++++++++++++++++----------- include/configs/omap3_beagle.h | 3 --- include/configs/omap4_panda.h | 3 --- 3 files changed, 42 insertions(+), 21 deletions(-)

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 --- drivers/usb/host/ehci-omap.c | 57 ++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 3c58f9e..98cea00 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -28,21 +28,48 @@ static struct omap_ehci *const ehci = (struct omap_ehci *)OMAP_EHCI_BASE;
static int omap_uhh_reset(void) { -/* - * Soft resetting the UHH module causes instability issues on - * all OMAPs so we just avoid it. - * - * See OMAP36xx Errata - * i571: USB host EHCI may stall when entering smart-standby mode - * i660: USBHOST Configured In Smart-Idle Can Lead To a Deadlock - * - * On OMAP4/5, soft-resetting the UHH module will put it into - * Smart-Idle mode and lead to a deadlock. - * - * On OMAP3, this doesn't seem to be the case but still instabilities - * are observed on beagle (3530 ES1.0) if soft-reset is used. - * e.g. NFS root failures with Linux kernel. - */ + int timeout = 0; + u32 rev; + + rev = readl(&uhh->rev); + + /* Soft RESET */ + writel(OMAP_UHH_SYSCONFIG_SOFTRESET, &uhh->sysc); + + 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; + } + return 0; }

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?

Fixes this error message when USB is started. "ULPI: ulpi_reset: failed writing reset bit"
It is pointless to manually reset the ULPI as the USB Host Reset and PHY RESET line should take care of that.
Reported-by: Tomi Valkeinen tomi.valkeinen@ti.com Reviewed-by: Stefan Roese sr@denx.de Signed-off-by: Roger Quadros rogerq@ti.com --- include/configs/omap3_beagle.h | 3 --- 1 file changed, 3 deletions(-)
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 9fcd50b..88b67e7 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -118,9 +118,6 @@ #define CONFIG_USB_EHCI_OMAP #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO 147
-#define CONFIG_USB_ULPI -#define CONFIG_USB_ULPI_VIEWPORT_OMAP - #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_SMSC95XX

Fixes this error message when USB is started. "ULPI: ulpi_reset: failed writing reset bit"
It is pointless to manually reset the ULPI as the USB Host Reset and PHY RESET line should take care of that.
Reported-by: Tomi Valkeinen tomi.valkeinen@ti.com Reviewed-by: Stefan Roese sr@denx.de Signed-off-by: Roger Quadros rogerq@ti.com --- include/configs/omap4_panda.h | 3 --- 1 file changed, 3 deletions(-)
diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index 8294622..89b1c51 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -36,9 +36,6 @@ #define CONFIG_CMD_PING #define CONFIG_CMD_DHCP
-#define CONFIG_USB_ULPI -#define CONFIG_USB_ULPI_VIEWPORT_OMAP - #include <configs/omap4_common.h> #define CONFIG_CMD_NET

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/02/2013 10:59 AM, Marek Vasut wrote:
Dear Roger Quadros,
Hi,
This series
- Fixes OMAP4 Panda USB device detection issues - Gets rid of
ULPI reset errors on Beagle & Panda
Is this a V2 or what is this? I already see similar series posted a few days ago.
You missed my email. Roger forgot to CC the mailing list.
- -- Tom

Hi,
Dear Roger Quadros,
Hi,
This series
- Fixes OMAP4 Panda USB device detection issues
- Gets rid of ULPI reset errors on Beagle & Panda
Is this a V2 or what is this? I already see similar series posted a few days ago.
I see, it was not posted to the ML before.
Best regards, Marek Vasut

On 2013-12-02 15:47, Roger Quadros wrote:
Hi,
This series
- Fixes OMAP4 Panda USB device detection issues
- Gets rid of ULPI reset errors on Beagle & Panda
cheers, -roger
Roger Quadros (3): usb: ehci-omap: Reset the USB Host OMAP module omap3_beagle: Don't use ulpi_reset omap4_panda: Don't use ulpi_reset
drivers/usb/host/ehci-omap.c | 57 +++++++++++++++++++++++++++++++----------- include/configs/omap3_beagle.h | 3 --- include/configs/omap4_panda.h | 3 --- 3 files changed, 42 insertions(+), 21 deletions(-)
Tested on OMAP4 Panda and OMAP3 Beagle xM.
Usually seems to work, but on Panda I still sometimes see that the eth is not found:
(Re)start USB... USB0: USB EHCI 1.00 scanning bus 0 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices... 0 Ethernet Device(s) found No ethernet found.
Tomi

Hi,
On 12/04/2013 11:58 AM, Tomi Valkeinen wrote:
On 2013-12-02 15:47, Roger Quadros wrote:
Hi,
This series
- Fixes OMAP4 Panda USB device detection issues
- Gets rid of ULPI reset errors on Beagle & Panda
cheers, -roger
Roger Quadros (3): usb: ehci-omap: Reset the USB Host OMAP module omap3_beagle: Don't use ulpi_reset omap4_panda: Don't use ulpi_reset
drivers/usb/host/ehci-omap.c | 57 +++++++++++++++++++++++++++++++----------- include/configs/omap3_beagle.h | 3 --- include/configs/omap4_panda.h | 3 --- 3 files changed, 42 insertions(+), 21 deletions(-)
Tested on OMAP4 Panda and OMAP3 Beagle xM.
Usually seems to work, but on Panda I still sometimes see that the eth is not found:
(Re)start USB... USB0: USB EHCI 1.00 scanning bus 0 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices... 0 Ethernet Device(s) found No ethernet found.
Thanks for the tests. I'll need to investigate more, but the patches are good enough to go as they are.
cheers, -roger

On Mon, Dec 02, 2013 at 03:47:42PM +0200, Roger Quadros wrote:
Hi,
This series
- Fixes OMAP4 Panda USB device detection issues
- Gets rid of ULPI reset errors on Beagle & Panda
cheers, -roger
Roger Quadros (3): usb: ehci-omap: Reset the USB Host OMAP module omap3_beagle: Don't use ulpi_reset omap4_panda: Don't use ulpi_reset
drivers/usb/host/ehci-omap.c | 57 +++++++++++++++++++++++++++++++----------- include/configs/omap3_beagle.h | 3 --- include/configs/omap4_panda.h | 3 --- 3 files changed, 42 insertions(+), 21 deletions(-)
Applied to u-boot-ti/master, thanks!
participants (5)
-
Marek Vasut
-
Nikita Kiryanov
-
Roger Quadros
-
Tom Rini
-
Tomi Valkeinen