Skip to contentSkip to conversation

tegra: usb: Fix device enumeration problem of USB1

PATCH New Jim Lin 4 participants 6 messages Jun 25, 2012 – Jun 27, 2012

Subsystems (4)
lore
Share & tools
lore

Jim Lin

author
#0 lore raw

PATCH v5 1/1 tegra: usb: Fix device enumeration problem of USB1

A known hardware issue of USB1 port where bit 1 (connect status change) of PORTSC register will be set after issuing Port Reset (like "usb reset" in u-boot command line).
This will be treated as an error and stops later device enumeration.

Therefore we clear that bit after Port Reset in order to proceed later device enumeration.

---
To reproduce this issue, you can modify board .dts file to set as the following to build u-boot binary.
"
usb0 = "/usb at c5000000";
usb1 = "/usb at c5008000";
"
Install device on USB1 port (address at 0xc5000000). And run "usb reset" in u-boot console to enumerate device.

Before adding this patch, we could see problem every time. After adding, tried 10 times of "usb reset", "usb tree", "usb stop" , without seeing issue.

Changes in v5:
- Define USB address mask value in header file

Changes in v4:
- Add comment to describe replacing weak function ehci_powerup_fixup of ehci-hcd.c
- Remove using variable my_reg

Changes in v3:
- Move patch for USB1 controller into ehci_powerup_fixup of ehci-tegra.c
- Update copyright year to 2012

Changes in v2:
- Change config name
- Add a callback function at the end of ehci_submit_root() function

 arch/arm/include/asm/arch-tegra2/tegra2.h |    1 +
 drivers/usb/host/ehci-tegra.c             |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
arch/arm/include/asm/arch-tegra2/tegra2.h +1 -0
index d4ada10..710334b 100644
@@ -45,6 +45,7 @@
 #define NV_PA_CSITE_BASE	0x70040000
 #define TEGRA_USB1_BASE		0xC5000000
 #define TEGRA_USB3_BASE		0xC5008000
+#define TEGRA_USB_ADDR_MASK	0xFFFFC000
 
 #define TEGRA2_SDRC_CS0		NV_PA_SDRAM_BASE
 #define LOW_LEVEL_SRAM_STACK	0x4000FFFC
drivers/usb/host/ehci-tegra.c +17 -1
index a7e105b..4646b29 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 NVIDIA Corporation
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -29,6 +29,22 @@
 #include <asm/errno.h>
 #include <asm/arch/usb.h>
 
+/*
+ * A known hardware issue where Connect Status Change bit of PORTSC register
+ * of USB1 controller will be set after Port Reset.
+ * We have to clear it in order for later device enumeration to proceed.
+ * This ehci_powerup_fixup overrides the weak function ehci_powerup_fixup
+ * in "ehci-hcd.c".
+ */
+void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)
+{
+	mdelay(50);
+	if (((u32) status_reg & TEGRA_USB_ADDR_MASK) != TEGRA_USB1_BASE)
+		return;
+	/* For EHCI_PS_CSC to be cleared in ehci_hcd.c */
+	if (ehci_readl(status_reg) & EHCI_PS_CSC)
+		*reg |= EHCI_PS_CSC;
+}
 
 /*
  * Create the appropriate control structures to manage
Signature · 3 lines
1.7.3

nvpublic
#1 lore raw

PATCH v5 1/1 tegra: usb: Fix device enumeration problem of USB1

Quoted 9 lines · Jim Lin

A known hardware issue of USB1 port where bit 1 (connect status change) of PORTSC register will be set after issuing Port Reset (like "usb reset" in u-boot command line).
This will be treated as an error and stops later device enumeration.

Therefore we clear that bit after Port Reset in order to proceed later device enumeration.

#2 lore raw

PATCH v5 1/1 tegra: usb: Fix device enumeration problem of USB1

Dear Stephen Warren,

Quoted 6 lines · Jim Lin
Quoted 5 lines

A known hardware issue of USB1 port where bit 1 (connect status change) of PORTSC register will be set after issuing Port Reset (like "usb reset" in u-boot command line).
This will be treated as an error and stops later device enumeration.

Quoted 6 lines
Quoted 4 lines

Therefore we clear that bit after Port Reset in order to proceed later device enumeration.

Ok, it's icky nvidia stuff :-)

Will you apply it? I'm good with the current shape.

Best regards,
Marek Vasut

#3 lore raw

PATCH v5 1/1 tegra: usb: Fix device enumeration problem of USB1

Marek,

Quoted 19 lines

-----Original Message-----
From: Marek Vasut [mailto:marek.vasut at gmail.com]
Sent: Monday, June 25, 2012 4:48 PM
To: Stephen Warren
Cc: Jim Lin; 'u-boot at lists.denx.de'; Tom Warren
Subject: Re: [PATCH v5 1/1] tegra: usb: Fix device enumeration problem of USB1

Dear Stephen Warren,

Quoted 9 lines · Jim Lin
Quoted 8 lines

A known hardware issue of USB1 port where bit 1 (connect status change) of PORTSC register will be set after issuing Port Reset (like "usb reset" in u-boot command line).
This will be treated as an error and stops later device enumeration.

Therefore we clear that bit after Port Reset in order to proceed later device enumeration.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Ok, it's icky nvidia stuff :-)

Will you apply it? I'm good with the current shape.

This will be applied to u-boot-tegra/next as soon as I'm done validating Allen's SPL changes.

Tom

Quoted 3 lines

Best regards,
Marek Vasut

Signature · 1 line
nvpublic
#4 lore raw

PATCH v5 1/1 tegra: usb: Fix device enumeration problem of USB1

Dear Tom Warren,

Quoted 23 lines

Marek,

Quoted 21 lines

-----Original Message-----
From: Marek Vasut [mailto:marek.vasut at gmail.com]
Sent: Monday, June 25, 2012 4:48 PM
To: Stephen Warren
Cc: Jim Lin; 'u-boot at lists.denx.de'; Tom Warren
Subject: Re: [PATCH v5 1/1] tegra: usb: Fix device enumeration problem of USB1

Dear Stephen Warren,

Quoted 11 lines · Jim Lin
Quoted 9 lines

A known hardware issue of USB1 port where bit 1 (connect status change) of PORTSC register will be set after issuing Port Reset (like "usb reset" in u-boot command line).
This will be treated as an error and stops later device enumeration.

Therefore we clear that bit after Port Reset in order to proceed later device enumeration.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Ok, it's icky nvidia stuff :-)

Will you apply it? I'm good with the current shape.

This will be applied to u-boot-tegra/next as soon as I'm done validating Allen's SPL changes.

Good, I'm sure I'm leaving it in good hands :)

Thanks Tom!

Quoted 4 lines

Tom

Quoted 2 lines

Best regards,
Marek Vasut

Best regards,
Marek Vasut

#5 lore raw

PATCH v5 1/1 tegra: usb: Fix device enumeration problem of USB1

In reply to Jim Lin

Jim,

Quoted 6 lines

-----Original Message-----
From: Jim Lin
Sent: Sunday, June 24, 2012 11:41 PM
To: 'u-boot at lists.denx.de'
Cc: Tom Warren; Marek Vasut; 'Stephen Warren'
Subject: [PATCH v5 1/1] tegra: usb: Fix device enumeration problem of USB1

This patch has been applied to u-boot-tegra/master. Thanks!

Tom

Quoted 94 lines

A known hardware issue of USB1 port where bit 1 (connect status change) of PORTSC register will be set after issuing Port Reset (like "usb reset" in u-boot command line).
This will be treated as an error and stops later device enumeration.

Therefore we clear that bit after Port Reset in order to proceed later device enumeration.

---
To reproduce this issue, you can modify board .dts file to set as the following to build u-boot binary.
"
usb0 = "/usb at c5000000";
usb1 = "/usb at c5008000";
"
Install device on USB1 port (address at 0xc5000000).
And run "usb reset" in u-boot console to enumerate device.

Before adding this patch, we could see problem every time. After adding, tried 10 times of "usb reset", "usb tree", "usb stop" , without seeing issue.

Changes in v5:
- Define USB address mask value in header file

Changes in v4:
- Add comment to describe replacing weak function ehci_powerup_fixup of ehci-hcd.c
- Remove using variable my_reg

Changes in v3:
- Move patch for USB1 controller into ehci_powerup_fixup of ehci-tegra.c
- Update copyright year to 2012

Changes in v2:
- Change config name
- Add a callback function at the end of ehci_submit_root() function

 arch/arm/include/asm/arch-tegra2/tegra2.h |    1 +
 drivers/usb/host/ehci-tegra.c             |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
arch/arm/include/asm/arch-tegra2/tegra2.h +1 -0
index d4ada10..710334b 100644
@@ -45,6 +45,7 @@
 #define NV_PA_CSITE_BASE	0x70040000
 #define TEGRA_USB1_BASE		0xC5000000
 #define TEGRA_USB3_BASE		0xC5008000
+#define TEGRA_USB_ADDR_MASK	0xFFFFC000
 
 #define TEGRA2_SDRC_CS0		NV_PA_SDRAM_BASE
 #define LOW_LEVEL_SRAM_STACK	0x4000FFFC
drivers/usb/host/ehci-tegra.c +18 -2
index a7e105b..4646b29 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 NVIDIA Corporation
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -29,6 +29,22 @@
 #include <asm/errno.h>
 #include <asm/arch/usb.h>
 
+/*
+ * A known hardware issue where Connect Status Change bit of PORTSC
+register
+ * of USB1 controller will be set after Port Reset.
+ * We have to clear it in order for later device enumeration to proceed.
+ * This ehci_powerup_fixup overrides the weak function
+ehci_powerup_fixup
+ * in "ehci-hcd.c".
+ */
+void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg) {
+	mdelay(50);
+	if (((u32) status_reg & TEGRA_USB_ADDR_MASK) != TEGRA_USB1_BASE)
+		return;
+	/* For EHCI_PS_CSC to be cleared in ehci_hcd.c */
+	if (ehci_readl(status_reg) & EHCI_PS_CSC)
+		*reg |= EHCI_PS_CSC;
+}
 
 /*
  * Create the appropriate control structures to manage
--

1.7.3

Signature · 1 line
nvpublic