diff options
author | Remy Bohmer <linux@bohmer.net> | 2008-10-10 10:23:21 +0200 |
---|---|---|
committer | Markus Klotzbuecher <mk@denx.de> | 2008-10-14 16:42:44 +0200 |
commit | 48867208444cb2a82e2af9c3249e90b7ed4a1751 (patch) | |
tree | f6a05b67058517735a3a3d99b15f993758f1aaf7 /drivers/usb | |
parent | e58c41e26cf3c8accd60311be579f452e368e97e (diff) | |
download | u-boot-imx-48867208444cb2a82e2af9c3249e90b7ed4a1751.zip u-boot-imx-48867208444cb2a82e2af9c3249e90b7ed4a1751.tar.gz u-boot-imx-48867208444cb2a82e2af9c3249e90b7ed4a1751.tar.bz2 |
fix USB initialisation procedure
The max packet size is encoded as 0,1,2,3 for 8,16,32,64 bytes.
At some places directly 8,16,32,64 was used instead of the encoded
value. Made a enum for the options to make this more clear and to help
preventing similar errors in the future.
After fixing this bug it became clear that another bug existed where
the 'pipe' is and-ed with PIPE_* flags, where it should have been
'usb_pipetype(pipe)', or even better usb_pipeint(pipe).
Also removed the triple 'get_device_descriptor' sequence, it has no use,
and Windows nor Linux behaves that way.
There is also a poll going on with a timeout when usb_control_msg() fails.
However, the poll is useless, because the flag will never be set on a error,
because there is no code that runs in a parallel that can set this flag.
Changed this to something more logical.
Tested on AT91SAM9261ek and compared the flow on the USB bus to what
Linux is doing. There is no difference anymore in the early initialisation
sequence.
Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/usb_ohci.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/usb_ohci.c index 76c6390..660b4b3 100644 --- a/drivers/usb/usb_ohci.c +++ b/drivers/usb/usb_ohci.c @@ -856,8 +856,7 @@ static void td_fill(ohci_t *ohci, unsigned int info, td->index = index; td->data = (__u32)data; #ifdef OHCI_FILL_TRACE - if ((usb_pipetype(urb_priv->pipe) == PIPE_BULK) && - usb_pipeout(urb_priv->pipe)) { + if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) { for (i = 0; i < len; i++) printf("td->data[%d] %#2x ", i, ((unsigned char *)td->data)[i]); printf("\n"); @@ -983,7 +982,7 @@ static void dl_transfer_length(td_t *td) tdBE = m32_swap(td->hwBE); tdCBP = m32_swap(td->hwCBP); - if (!(usb_pipetype(lurb_priv->pipe) == PIPE_CONTROL && + if (!(usb_pipecontrol(lurb_priv->pipe) && ((td->index == 0) || (td->index == lurb_priv->length - 1)))) { if (tdBE != 0) { if (td->hwCBP == 0) @@ -1096,8 +1095,7 @@ static int takeback_td(ohci_t *ohci, td_t *td_list) dbg("dl_done_list: processing TD %x, len %x\n", lurb_priv->td_cnt, lurb_priv->length); - if (ed->state != ED_NEW && - (usb_pipetype(lurb_priv->pipe) != PIPE_INTERRUPT)) { + if (ed->state != ED_NEW && (!usb_pipeint(lurb_priv->pipe))) { edHeadP = m32_swap(ed->hwHeadP) & 0xfffffff0; edTailP = m32_swap(ed->hwTailP); @@ -1287,7 +1285,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, #else wait_ms(1); #endif - if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) { + if (usb_pipeint(pipe)) { info("Root-Hub submit IRQ: NOT implemented"); return 0; } @@ -1538,7 +1536,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, /* allow more time for a BULK device to react - some are slow */ #define BULK_TO 5000 /* timeout in milliseconds */ - if (usb_pipetype(pipe) == PIPE_BULK) + if (usb_pipebulk(pipe)) timeout = BULK_TO; else timeout = 100; @@ -1591,7 +1589,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer, #endif /* free TDs in urb_priv */ - if (usb_pipetype(pipe) != PIPE_INTERRUPT) + if (!usb_pipeint(pipe)) urb_free_priv(urb); return 0; } |