summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRemy Bohmer <linux@bohmer.net>2008-10-10 10:23:21 +0200
committerMarkus Klotzbuecher <mk@denx.de>2008-10-14 16:42:44 +0200
commit48867208444cb2a82e2af9c3249e90b7ed4a1751 (patch)
treef6a05b67058517735a3a3d99b15f993758f1aaf7 /include
parente58c41e26cf3c8accd60311be579f452e368e97e (diff)
downloadu-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 'include')
-rw-r--r--include/usb.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/usb.h b/include/usb.h
index e68e98e..9a2e72c 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -129,6 +129,13 @@ struct usb_config_descriptor {
struct usb_interface_descriptor if_desc[USB_MAXINTERFACES];
} __attribute__ ((packed));
+enum {
+ /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
+ PACKET_SIZE_8 = 0,
+ PACKET_SIZE_16 = 1,
+ PACKET_SIZE_32 = 2,
+ PACKET_SIZE_64 = 3,
+};
struct usb_device {
int devnum; /* Device number on USB bus */
@@ -137,9 +144,12 @@ struct usb_device {
char prod[32]; /* product */
char serial[32]; /* serial number */
- int maxpacketsize; /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
- unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */
- unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; */
+ /* Maximum packet size; one of: PACKET_SIZE_* */
+ int maxpacketsize;
+ /* one bit for each endpoint ([0] = IN, [1] = OUT) */
+ unsigned int toggle[2];
+ /* endpoint halts; one bit per endpoint # & direction; */
+ unsigned int halted[2];
/* [0] = IN, [1] = OUT */
int epmaxpacketin[16]; /* INput endpoint specific maximums */
int epmaxpacketout[16]; /* OUTput endpoint specific maximums */