Patchwork [U-Boot,v6,1/4] usb: hub: make minimum power-on delay configurable

login
register
mail settings
Submitter Kuo-Jung Su
Date May 13, 2013, 2:07 a.m.
Message ID <1368410846-18038-2-git-send-email-dantesu@gmail.com>
Download mbox | patch
Permalink /patch/243235/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Kuo-Jung Su - May 13, 2013, 2:07 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

This patch makes the minimum power-on delay for USB HUB
become configurable. The original design waits at least
100 msec here, but some EHCI controlers(e.g. Faraday EHCI)
are known to require much longer delay interval.

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
CC: Marek Vasut <marex@denx.de>
---
Changes for v6:
   - Simplify CONFIG_USB_HUB_MIN_POWER_ON_DELAY default value setup.

Changes for v5:
   - Split up from Faraday EHCI patch
   - Replace the Faraday EHCI ifdef for the long delay
     in usb_hub_configure() with the new configuration option:
     USB_HUB_MIN_POWER_ON_DELAY, which is used in usb_hub_power_on()
     to control the minimum usb hub power-on delay.

Changes for v2 - v4:
   - See 'usb: ehci: add Faraday USB 2.0 EHCI support'

 README           |    3 +++
 common/usb_hub.c |    8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

--
1.7.9.5
Marek Vasut - May 13, 2013, 2:36 a.m.
Dear Kuo-Jung Su,

> From: Kuo-Jung Su <dantesu@faraday-tech.com>
> 
> This patch makes the minimum power-on delay for USB HUB
> become configurable. The original design waits at least
> 100 msec here, but some EHCI controlers(e.g. Faraday EHCI)
> are known to require much longer delay interval.
> 
> Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
> CC: Marek Vasut <marex@denx.de>

The rest of the patches are good, just 2/4 needs minor tweak.

I'd do it myself, but they don't apply to u-boot-usb/master , can you please 
adjust, rebase them and repost? Then I'll pick them.

Thanks!

Best regards,
Marek Vasut
Kuo-Jung Su - May 13, 2013, 8:12 a.m.
2013/5/13 Marek Vasut <marex@denx.de>:
> Dear Kuo-Jung Su,
>
>> From: Kuo-Jung Su <dantesu@faraday-tech.com>
>>
>> This patch makes the minimum power-on delay for USB HUB
>> become configurable. The original design waits at least
>> 100 msec here, but some EHCI controlers(e.g. Faraday EHCI)
>> are known to require much longer delay interval.
>>
>> Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
>> CC: Marek Vasut <marex@denx.de>
>
> The rest of the patches are good, just 2/4 needs minor tweak.
>
> I'd do it myself, but they don't apply to u-boot-usb/master , can you please
> adjust, rebase them and repost? Then I'll pick them.
>

Sorry about that, I didn't notice that the usb ehci had been updated 7 days ago.
I'll rebase my patches and repost later.

> Thanks!
>
> Best regards,
> Marek Vasut



--
Best wishes,
Kuo-Jung Su
Kuo-Jung Su - May 13, 2013, 8:28 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

This patch adds support to both Faraday FUSBH200 and FOTG210,
the differences between Faraday EHCI and standard EHCI are
listed bellow:

1. The PORTSC starts at 0x30 instead of 0x44.
2. The CONFIGFLAG(0x40) is not only un-implemented, and
   also has its address removed.
3. Faraday EHCI is a TDI design, but it doesn't
   compatible with the general TDI implementation
   found at both U-Boot and Linux.
4. The ISOC descriptors differs from standard EHCI in
   several ways. But since U-boot doesn't support ISOC,
   we don't have to worry about that.

The Faraday FOTG210 is an OTG chip which could operate
as either an EHCI Host or a USB Device at a time.

Changes for v7:
   - Rebase with u-boot-bbd0f7e3ba66d288a2f146f1c7797801e04598ae,
     and also make sure it's compatible with
     u-boot-usb-dc69e46302a36e60e2417bba8c6ea78761a37ebf.
   - Update TDI aliased functions, since there is another
     similar patch had been committed and acceptted.
   - ehci-hcd: ehci_get_portsc_register(): make sure port is always >= 0

Changes for v6:
   - usb_hub: Simplify CONFIG_USB_HUB_MIN_POWER_ON_DELAY
     default value setup.
   - ehci-hcd: Simplify weak aliased function declaration
   - ehci-hcd: Drop redundant line feed

Changes for v5:
   - Split up EHCI changeset
   - usb_hub: replace the Faraday EHCI ifdef for the long delay
     in usb_hub_configure() with the new configuration option:
     USB_HUB_MIN_POWER_ON_DELAY, which is used in usb_hub_power_on()
     to control the minimum usb hub power-on delay.
   - ehci-faraday: fix the invalid multi-line comment style.
   - gadget-fotg210: coding style cleanup.
   - gadget-fotg210: drop postfix '__iomem' from struct fotg210_regs
   - gadget-fotg210: use permanent delay for hardware reset
   - gadget-fotg210: drop '#ifndef CONFIG_SYS_DCACHE_OFF'
   - gadget-fotg210: drop magic numbers

Changes for v4:
   - Use only macro constants and named bit/mask
   - Use weak-aliased functions for tdi implementation and
     also portsc registers to avoid poluting ehci.h with ifdefs

Changes for v3:
   - Coding Style cleanup.
   - Drop bit fields from c struct.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Replace all the infinite wait loop with a timeout.
   - Add '__iomem' to all the declaration of HW register pointers.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().
   - echi-faraday: Remove debug codes.

Kuo-Jung Su (4):
  usb: hub: make minimum power-on delay configurable
  usb: ehci: add weak-aliased function for PORTSC
  usb: ehci: add Faraday USB 2.0 EHCI support
  usb: gadget: add Faraday FOTG210 USB gadget support

 README                            |    3 +
 common/usb_hub.c                  |   15 +-
 drivers/usb/gadget/Makefile       |    1 +
 drivers/usb/gadget/fotg210.c      |  948 +++++++++++++++++++++++++++++++++++++
 drivers/usb/gadget/gadget_chips.h |    8 +
 drivers/usb/host/Makefile         |    1 +
 drivers/usb/host/ehci-faraday.c   |  154 ++++++
 drivers/usb/host/ehci-hcd.c       |   28 +-
 include/usb/fotg210.h             |  364 ++++++++++++++
 include/usb/fusbh200.h            |   61 +++
 10 files changed, 1576 insertions(+), 7 deletions(-)
 create mode 100644 drivers/usb/gadget/fotg210.c
 create mode 100644 drivers/usb/host/ehci-faraday.c
 create mode 100644 include/usb/fotg210.h
 create mode 100644 include/usb/fusbh200.h

--
1.7.9.5

Patch

diff --git a/README b/README
index 0d37d56..455163b 100644
--- a/README
+++ b/README
@@ -1244,6 +1244,9 @@  The following options need to be configured:
 		CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the
 		txfilltuning field in the EHCI controller on reset.

+		CONFIG_USB_HUB_MIN_POWER_ON_DELAY defines the minimum
+		interval for usb hub power-on delay.(100msec by default)
+
 - USB Device:
 		Define the below if you wish to use the USB console.
 		Once firmware is rebuilt from a serial console issue the
diff --git a/common/usb_hub.c b/common/usb_hub.c
index b5eeb62..f240d8c 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -61,6 +61,10 @@ 
 #define USB_HUB_DEBUG	0
 #endif

+#ifndef CONFIG_USB_HUB_MIN_POWER_ON_DELAY
+#define CONFIG_USB_HUB_MIN_POWER_ON_DELAY	100
+#endif
+
 #define USB_PRINTF(fmt, args...)	debug_cond(USB_DEBUG, fmt, ##args)
 #define USB_HUB_PRINTF(fmt, args...)	debug_cond(USB_HUB_DEBUG, fmt, ##args)

@@ -120,8 +124,8 @@  static void usb_hub_power_on(struct usb_hub_device *hub)
 		USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status);
 	}

-	/* Wait at least 100 msec for power to become stable */
-	mdelay(max(pgood_delay, (unsigned)100));
+	/* Wait for power to become stable */
+	mdelay(max(pgood_delay, CONFIG_USB_HUB_MIN_POWER_ON_DELAY));
 }

 void usb_hub_reset(void)