Skip to content
  • Remy Bohmer's avatar
    fix USB initialisation procedure · 48867208
    Remy Bohmer authored
    
    
    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: default avatarRemy Bohmer <linux@bohmer.net>
    Signed-off-by: default avatarMarkus Klotzbuecher <mk@denx.de>
    48867208