tegra: usb: Fix device enumeration problem of USB1
Subsystems (3)
PATCH v4 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 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
drivers/usb/host/ehci-tegra.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)
drivers/usb/host/ehci-tegra.c +17 -1
@@ -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 &0xFFFFC000 ) !=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
PATCH v4 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.
Signed-off-by Jim Lin <[email protected]>
PATCH v4 1/1 tegra: usb: Fix device enumeration problem of USB1
In reply to Jim LinDear Jim Lin,
Quoted 55 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.
Signed-off-by Jim Lin <[email protected]>---
To reproduce this issue, you can modify board .dts file to set as the following to build u-boot binary.
"
usb0 = "/usb atc5000000";
usb1 = "/usb atc5008000";
"
Install device on USB1 port (address at0xc5000000). 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 v4:
- Add comment to describe replacing weak functionehci_powerup_fixupofehci-hcd.c- Remove using variablemy_regChanges in v3:
- Move patch for USB1 controller intoehci_powerup_fixupofehci-tegra.c
- Update copyright year to 2012Changes in v2:
- Change config name
- Add a callback function at the end ofehci_submit_root()functiondrivers/usb/host/ehci-tegra.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)drivers/usb/host/ehci-tegra.c +3
-1@@ -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
Quoted 6 lines
register + * of USB1 controller will be set after Port Reset.
+ * We have to clear it in order for later device enumeration to proceed.
+ * Thisehci_powerup_fixupoverrides the weak functionehci_powerup_fixup
+ * in "ehci-hcd.c".
+ */
+voidehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)
So it was even enough to use the already preinstalled callback? :-)
drivers/usb/host/ehci-tegra.c line 42
Quoted 3 lines
drivers/usb/host/ehci-tegra.c +3
-0+{ +mdelay (50 ); +if (((u32 ) status_reg &0xFFFFC000 ) !=TEGRA_USB1_BASE )
What's this magic number here?
drivers/usb/host/ehci-tegra.c line 46
Quoted 4 lines
drivers/usb/host/ehci-tegra.c +4
-0+return ; +/* For EHCI_PS_CSC to be cleared in ehci_hcd.c */ +if (ehci_readl (status_reg) &EHCI_PS_CSC ) + *reg |=EHCI_PS_CSC ;
writel()
Quoted 4 lines
+}
/*
* Create the appropriate control structures to manage
Best regards,
Marek Vasut
PATCH v4 1/1 tegra: usb: Fix device enumeration problem of USB1
Quoted 15 lines
From: Marek Vasut [mailto:marek.vasut at gmail.com]
Sent: Thursday, June 21, 2012 6:16 PMQuoted 13 lines
drivers/usb/host/ehci-tegra.c +1
-1@@ -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>
Quoted 10 lines
Quoted 8 lines
drivers/usb/host/ehci-tegra.c +2
-0+/* +* 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.
+ * Thisehci_powerup_fixupoverrides the weak functionehci_powerup_fixup
+ * in "ehci-hcd.c".
+ */
+voidehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)So it was even enough to use the already preinstalled callback? :-)
Yes.
Quoted 5 lines
drivers/usb/host/ehci-tegra.c line 42
Quoted 3 lines
drivers/usb/host/ehci-tegra.c +3
-0+{ +mdelay (50 ); +if (((u32 ) status_reg &0xFFFFC000 ) !=TEGRA_USB1_BASE )What's this magic number here?
Address Mask value, any suggestion?
Quoted 6 lines
Quoted 1 line
drivers/usb/host/ehci-tegra.c +1
-0+return ;drivers/usb/host/ehci-tegra.c +1
-0+/* For EHCI_PS_CSC to be cleared in ehci_hcd.c */ drivers/usb/host/ehci-tegra.c line 46
Quoted 2 lines
drivers/usb/host/ehci-tegra.c +2
-0+if (ehci_readl (status_reg) &EHCI_PS_CSC ) + *reg |=EHCI_PS_CSC ;
writel()
The real IO write (ehci_writel) is done in ehci-hcd.c after calling of ehci_powerup_fixup. Any suggestion?
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
PATCH v4 1/1 tegra: usb: Fix device enumeration problem of USB1
Dear Jim Lin,
Quoted 34 lines
Quoted 21 lines
From: Marek Vasut [mailto:marek.vasut at gmail.com]
Sent: Thursday, June 21, 2012 6:16 PMQuoted 18 lines
drivers/usb/host/ehci-tegra.c +1
-1@@ -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.drivers/usb/host/ehci-tegra.c +0
-0@@ -29,6 +29,22 @@#include <asm/errno.h> #include <asm/arch/usb.h> Quoted 10 lines
Quoted 8 lines
drivers/usb/host/ehci-tegra.c +2
-0+/* +* 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. + * Thisehci_powerup_fixupoverrides the weak functionehci_powerup_fixup+ * in "ehci-hcd.c".
+ */
+voidehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)So it was even enough to use the already preinstalled callback? :-)
Yes.
Quoted 7 lines
Quoted 5 lines
drivers/usb/host/ehci-tegra.c line 42
Quoted 3 lines
drivers/usb/host/ehci-tegra.c +3
-0+{ +mdelay (50 ); +if (((u32 ) status_reg &0xFFFFC000 ) !=TEGRA_USB1_BASE )What's this magic number here?
Address Mask value, any suggestion?
I wonder ... either comment or #define it somewhere, the later is favorable.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
drivers/usb/host/ehci-tegra.c +1
-0+return ;drivers/usb/host/ehci-tegra.c +1
-0+/* For EHCI_PS_CSC to be cleared in ehci_hcd.c */
Quoted 7 lines
Quoted 4 lines
drivers/usb/host/ehci-tegra.c line 46
Quoted 2 lines
drivers/usb/host/ehci-tegra.c +2
-0+if (ehci_readl (status_reg) &EHCI_PS_CSC ) + *reg |=EHCI_PS_CSC ;
writel()The real IO write (
ehci_writel) is done inehci-hcd.cafter calling ofehci_powerup_fixup. Any suggestion?
Good, leave it at that.
Quoted 8 lines
---------------------------------------------------------------------------
-------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
---------------------------------------------------------------------------
--------
^^ The above is nvidia bullshit, please remove it, it doesn't make sense here.
Best regards,
Marek Vasut