[PATCH 3/3] usb: use ep-specific pwrgood delay

2012-08-30 Thread Steffen Trumtrar
In usb_hub_configure the hub is asked for its descriptor and among other things
its bPwrOn2PwrGood time. In the actual hub_power_on function this information
was not used and a hardcoded value was used instead. For some hubs this delay
is to short. So, use the delay the hub wants.

Signed-off-by: Steffen Trumtrar s.trumt...@pengutronix.de
Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
---
 drivers/usb/core/usb.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 81ae9f1..48bc121 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -948,7 +948,8 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
USB_HUB_PRINTF(port %d returns %lX\n, i + 1, dev-status);
}
-   mdelay(20);
+   /* power on is encoded in 2ms increments - times 2 for the actual 
delay */
+   mdelay(hub-desc.bPwrOn2PwrGood*2);
 }
 
 #define MAX_TRIES 5
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 3/3] usb: use ep-specific pwrgood delay

2012-08-30 Thread Steffen Trumtrar
Hi Eric,

 Hi Steffen,
 
 Le Thu, 30 Aug 2012 14:30:50 +0200,
 Steffen Trumtrar s.trumt...@pengutronix.de a écrit :
 
  In usb_hub_configure the hub is asked for its descriptor and among other 
  things
  its bPwrOn2PwrGood time. In the actual hub_power_on function this 
  information
  was not used and a hardcoded value was used instead. For some hubs this 
  delay
  is to short. So, use the delay the hub wants.
  
  Signed-off-by: Steffen Trumtrar s.trumt...@pengutronix.de
  Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
  ---
   drivers/usb/core/usb.c |3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
  
  diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
  index 81ae9f1..48bc121 100644
  --- a/drivers/usb/core/usb.c
  +++ b/drivers/usb/core/usb.c
  @@ -948,7 +948,8 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
  usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
  USB_HUB_PRINTF(port %d returns %lX\n, i + 1, dev-status);
  }
  -   mdelay(20);
  +   /* power on is encoded in 2ms increments - times 2 for the actual 
  delay */
  +   mdelay(hub-desc.bPwrOn2PwrGood*2);
   }
   
   #define MAX_TRIES 5
 
 I tested you patch on my MX35 board and it doesn't work (the hub
 requires 50 ms, the mdelay is thus 100 ms and in the end that's not
 enough to see the USB mass storage connected to the hub) but
 mdelay(hub-desc.bPwrOn2PwrGood*3) works fine.
 Is it possible to increase this delay (*3 instead of *2) ?
 
 Thanks
 Eric
 

Where does your 50ms come from? From the debug messages of the usb-tool?
It has the same factor of times 2.
Have you tried hardcoding mdelay(100)?
I first thought about doing it the same way linux does it and use
max(pwrgood, 100). But 100ms minimum wouldn't help you either.
I don't really like the idea of just guessing a value. But if necessary,
I'm surely willing to change this patch.

Greetings
Steffen

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 3/3] usb: use ep-specific pwrgood delay

2012-08-30 Thread Eric Bénard
Hi Steffen,

Le Thu, 30 Aug 2012 15:26:31 +0200,
Steffen Trumtrar s.trumt...@pengutronix.de a écrit :
 Where does your 50ms come from? From the debug messages of the usb-tool?
from a printf of bPwrOn2PwrGood

 It has the same factor of times 2.
yes, so in the end the hub is supposed to need 100ms to enable power.

 Have you tried hardcoding mdelay(100)?
yes - doesn't work (see previous patch I sent 2 days ago on the same
subject).

 I first thought about doing it the same way linux does it and use
 max(pwrgood, 100). But 100ms minimum wouldn't help you either.
 I don't really like the idea of just guessing a value. But if necessary,
 I'm surely willing to change this patch.

with Linux's 100ms that works fine on the same board (under Linux). So
I'll check the if the mdelay(100) in barebox is really a 100ms timing
because the problem's root may be here !

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 3/3] usb: use ep-specific pwrgood delay

2012-08-30 Thread Steffen Trumtrar
Hi Eric,

On Thu, Aug 30, 2012 at 03:59:32PM +0200, Eric Bénard wrote:
 Hi Steffen,
 
 Le Thu, 30 Aug 2012 15:26:31 +0200,
 Steffen Trumtrar s.trumt...@pengutronix.de a écrit :
  Where does your 50ms come from? From the debug messages of the usb-tool?
 from a printf of bPwrOn2PwrGood
 
  It has the same factor of times 2.
 yes, so in the end the hub is supposed to need 100ms to enable power.

Okay. So you have an equal setting like me.

 
  Have you tried hardcoding mdelay(100)?
 yes - doesn't work (see previous patch I sent 2 days ago on the same
 subject).

Ah, okay.

  I first thought about doing it the same way linux does it and use
  max(pwrgood, 100). But 100ms minimum wouldn't help you either.
  I don't really like the idea of just guessing a value. But if necessary,
  I'm surely willing to change this patch.
 
 with Linux's 100ms that works fine on the same board (under Linux). So
 I'll check the if the mdelay(100) in barebox is really a 100ms timing
 because the problem's root may be here !

As both, barebox and linux, reset the hub and wait, it seems like the root
of the problem, yes.

Greetings
Steffen


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox