[U-Boot] At91 mass storage device

Hi, I've got a problem recognizing a USB mass storage device on the at91sam9263ek. I'm not familiar with this interface and I'm hoping someone might be able to shed some light on it. I enable debug hoping something might catch my eyes but so far nothing. At one point I was unable to reset the port;
DEBUG: roothub.a: 02001202 POTPGT=2 NOCP NPS NDP=2 DEBUG: roothub.b: 00000000 PPCM=0000 DR=0000 DEBUG: roothub.status: 00000000 DEBUG: roothub.portstatus [0] = 0x00120301 PRSC PESC LSDA PPS CCS DEBUG: roothub.portstatus [1] = 0x00000100 PPS DEBUG: RET(rh) URB:[ bfd] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x0 cannot reset port 1!?
However, most of the time I get the results below. Does anyone have any ideas?
INFO: submit_control_msg DEBUG: SUB URB:[ 23f] dev: 1,ep: 0-O,type:CTRL,len:0/0 stat:0x80000000 DEBUG: SUB(rh) URB:[ 245] dev: 1,ep: 0-O,type:CTRL,len:0/0 stat:0x80000000 INFO: Root-Hub: adr: 1 cmd(8): 00000323 0008 0001 0000 INFO: WR:portstatus[0] 0x100 DEBUG: roothub.a: 02001202 POTPGT=2 NOCP NPS NDP=2 DEBUG: roothub.b: 00000000 PPCM=0000 DR=0000 DEBUG: roothub.status: 00000000 DEBUG: roothub.portstatus [0] = 0x00000100 PPS DEBUG: roothub.portstatus [1] = 0x00000100 PPS DEBUG: RET(rh) URB:[ 2b7] dev: 1,ep: 0-O,type:CTRL,len:0/0 stat:0x0 INFO: submit_control_msg DEBUG: SUB URB:[ 2c2] dev: 1,ep: 0-O,type:CTRL,len:0/0 stat:0x80000000 DEBUG: SUB(rh) URB:[ 2c9] dev: 1,ep: 0-O,type:CTRL,len:0/0 stat:0x80000000 INFO: Root-Hub: adr: 1 cmd(8): 00000323 0008 0002 0000 INFO: WR:portstatus[1] 0x100 DEBUG: roothub.a: 02001202 POTPGT=2 NOCP NPS NDP=2 DEBUG: roothub.b: 00000000 PPCM=0000 DR=0000 DEBUG: roothub.status: 00000000 DEBUG: roothub.portstatus [0] = 0x00000100 PPS DEBUG: roothub.portstatus [1] = 0x00000100 PPS DEBUG: RET(rh) URB:[ 33b] dev: 1,ep: 0-O,type:CTRL,len:0/0 stat:0x0 INFO: submit_control_msg DEBUG: SUB URB:[ 346] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x80000000 DEBUG: SUB(rh) URB:[ 34c] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x80000000 INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 DEBUG: roothub.a: 02001202 POTPGT=2 NOCP NPS NDP=2 DEBUG: roothub.b: 00000000 PPCM=0000 DR=0000 DEBUG: roothub.status: 00000000 DEBUG: roothub.portstatus [0] = 0x00000100 PPS DEBUG: roothub.portstatus [1] = 0x00000100 PPS DEBUG: RET(rh) URB:[ 36b] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x0 INFO: submit_control_msg DEBUG: SUB URB:[ 373] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x80000000 DEBUG: SUB(rh) URB:[ 379] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x80000000 INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0002 0004 DEBUG: roothub.a: 02001202 POTPGT=2 NOCP NPS NDP=2 DEBUG: roothub.b: 00000000 PPCM=0000 DR=0000 DEBUG: roothub.status: 00000000 DEBUG: roothub.portstatus [0] = 0x00000100 PPS DEBUG: roothub.portstatus [1] = 0x00000100 PPS DEBUG: RET(rh) URB:[ 398] dev: 1,ep: 0-I,type:CTRL,len:0/4 stat:0x0 1 USB Device(s) found scanning bus for storage devices... i=0 i=1 0 Storage Device(s) found

Hello,
I've got a problem recognizing a USB mass storage device on the at91sam9263ek. I'm not familiar with this interface and I'm hoping someone might be able to shed some light on it. I enable debug hoping something might catch my eyes but so far nothing. At one point I was unable to reset the port;
What version of U-boot are you using? There has been changes the last U-boot releases in this area to get it working, even on 9263ek. As far as I know, the latest releases should work properly.
Kind Regards,
Remy

I'm using git source from a few weeks back, sometime early part of last month. Have those changes merged or are they somewhere else?
On Thu, Mar 12, 2009 at 3:49 PM, Remy Bohmer linux@bohmer.net wrote:
Hello,
I've got a problem recognizing a USB mass storage device on the at91sam9263ek. I'm not familiar with this interface and I'm hoping someone might be able to shed some light on it. I enable debug hoping something might catch my eyes but so far nothing. At one point I was unable to reset the port;
What version of U-boot are you using? There has been changes the last U-boot releases in this area to get it working, even on 9263ek. As far as I know, the latest releases should work properly.
Kind Regards,
Remy

Hello,
Please don't top post.
A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? (see http://www.netmeister.org/news/learn2quote.html)
2009/3/12 E Robertson e.robertson.svg@gmail.com:
I'm using git source from a few weeks back, sometime early part of last month. Have those changes merged or are they somewhere else?
Okay, you are quite up-to-date, so you are not using an ancient version :-), it worked in versions like 2008.10 (if PLLB is configured properly, bootstrap code did it wrong, see also cpu/arm926ejs/at91/usb.c of git), maybe there is some regression here. Unfortunately I do not have the hardware so I cannot verify it, or debug it...
Besides, there are still USB sticks that do not work at all, have you tried a different stick already?
Strange, in the logging I see that it only seems to communicate with the roothub only, it never communicates to the device at all, so my first guess would be the PLLB not running, but that was repaired somewhere early this year in a recent git... Maybe you can verify if it is running and all peripheral clocks are available?
Kind Regards,
Remy

On Thu, Mar 12, 2009 at 5:50 PM, Remy Bohmer linux@bohmer.net wrote:
Hello,
Please don't top post.
A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? (see http://www.netmeister.org/news/learn2quote.html)
I'm aware of the top post irritant, nonetheless I employ some discretion on short emails. Don't worry, I wouldn't repeat it :).
2009/3/12 E Robertson e.robertson.svg@gmail.com:
I'm using git source from a few weeks back, sometime early part of last month. Have those changes merged or are they somewhere else?
Okay, you are quite up-to-date, so you are not using an ancient version :-), it worked in versions like 2008.10 (if PLLB is configured properly, bootstrap code did it wrong, see also cpu/arm926ejs/at91/usb.c of git), maybe there is some regression here. Unfortunately I do not have the hardware so I cannot verify it, or debug it...
Besides, there are still USB sticks that do not work at all, have you tried a different stick already?
Strange, in the logging I see that it only seems to communicate with the roothub only, it never communicates to the device at all, so my first guess would be the PLLB not running, but that was repaired somewhere early this year in a recent git... Maybe you can verify if it is running and all peripheral clocks are available?
I revisit these and it looked like my UHP power wasn't enabled. I thought I did this in the Bootstrap code but apparently not:
at91_sys_write(AT91_PMC_PCER, (1 << AT91SAM9263_ID_PIOA) | (1<<AT91SAM9263_ID_UHP)); /* Enable VBus on UHP ports */ at91_set_gpio_output(AT91_PIN_PA21, 1); at91_set_gpio_output(AT91_PIN_PA24, 1);
One thing I never understood is that after a power cycle with a usb memory stick plugged in, I always have to start and restart the usb probe to recognize the storage device. This happened in a previous version of u-boot (like 1.2.0) and it's also the case with the current source. Is their a reason for that? Perhaps an inadequate peripheral reset?

On Fri, Mar 13, 2009 at 11:19 AM, E Robertson e.robertson.svg@gmail.com wrote:
On Thu, Mar 12, 2009 at 5:50 PM, Remy Bohmer linux@bohmer.net wrote: ...
One thing I never understood is that after a power cycle with a usb memory stick plugged in, I always have to start and restart the usb probe to recognize the storage device. This happened in a previous version of u-boot (like 1.2.0) and it's also the case with the current source. Is their a reason for that? Perhaps an inadequate peripheral reset?
I decided to do some digging and I see the not responding error reported below. I added a wait of 2ms to the *dl_reverse_done_list(ohci_t *ohci) loop. I'm not sure how this affects everything else. However, although I did not get the no response error, I did get the STALL PID error.
(Re)start USB... USB: INFO: aligned ghcca 27f79c00 scanning bus for devices... INFO: submit_control_msg INFO: Root-Hub: adr: 0 cmd(8): 00000680 0100 0000 0040 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000500 0001 0000 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0100 0000 0012 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0200 0000 0009 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0200 0000 0019 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000900 0001 0000 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0300 0000 00ff INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0301 0409 00ff INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000006a0 2900 0000 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000006a0 2900 0000 0009 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a0 0000 0000 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0008 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0008 0002 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000123 0010 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0004 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000123 0014 0001 0000 INFO: submit_control_msg ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or did not provide a handshake (OUT) (5) ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or did not provide a handshake (OUT) (5) INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000123 0001 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0002 0004 2 USB Device(s) found scanning bus for storage devices... i=0 i=1 i=2 0 Storage Device(s) found
usb start
(Re)start USB... USB: INFO: aligned ghcca 27f79c00 scanning bus for devices... INFO: submit_control_msg INFO: Root-Hub: adr: 0 cmd(8): 00000680 0100 0000 0040 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000500 0001 0000 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0100 0000 0012 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0200 0000 0009 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0200 0000 0019 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000900 0001 0000 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0300 0000 00ff INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000680 0301 0409 00ff INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000006a0 2900 0000 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000006a0 2900 0000 0009 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a0 0000 0000 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0008 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0008 0002 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000123 0010 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0004 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000123 0014 0001 0000 INFO: submit_control_msg INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000323 0004 0001 0000 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0001 0004 INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 00000123 0014 0001 0000 INFO: submit_control_msg INFO: submit_control_msg INFO: submit_control_msg INFO: submit_control_msg INFO: submit_control_msg INFO: submit_control_msg INFO: Root-Hub: adr: 1 cmd(8): 000000a3 0000 0002 0004 2 USB Device(s) found scanning bus for storage devices... i=0 i=1
USB Mass Storage device detected Transport: Bulk/Bulk/Bulk Endpoints In 1 Out 1 Int 0 BBB_reset INFO: submit_control_msg ERROR: USB-error: STALL: TD was moved to the Done Queue because the endpoint returned a STALL PID (4) ERROR: USB-error: STALL: TD was moved to the Done Queue because the endpoint returned a STALL PID ( 4) RESET:stall address 2 COMMAND phase INFO: submit_bulk_msg DATA phase INFO: submit_bulk_msg STATUS phase INFO: submit_bulk_msg inquiry returns 0 ISO Vers 2, Response Data 2 COMMAND phase INFO: submit_bulk_msg STATUS phase INFO: submit_bulk_msg COMMAND phase INFO: submit_bulk_msg DATA phase INFO: submit_bulk_msg STATUS phase INFO: submit_bulk_msg Read Capacity returns: 0x7fe70100, 0x20000 Capacity = 0x1e780, blocksz = 0x200 address 2 partype: 0
usb_read: dev 0 COMMAND phase INFO: submit_bulk_msg STATUS phase INFO: submit_bulk_msg
usb_read: dev 0 startblk 0, blccnt 1 buffer 27ed2934 read10: start 0 blocks 1 COMMAND phase INFO: submit_bulk_msg DATA phase INFO: submit_bulk_msg STATUS phase INFO: submit_bulk_msg usb_read: end startblk 1, blccnt 1 buffer 27ed2b34 partype: 2 i=2 1 Storage Device(s) found

Hello,
I decided to do some digging and I see the not responding error reported below. I added a wait of 2ms to the *dl_reverse_done_list(ohci_t *ohci) loop. I'm not sure how this affects everything else. However, although I did not get the no response error, I did get the STALL PID error.
The device not responding error is one of the weird things I talked about. Some USB-sticks happen to do that, have you tried a different stick? This is a workaround, but if you find out what really goes wrong here, I would be happy to hear it.
The stall state of the device not handled in U-boot at all, the USB-stack of U-boot does not recover from this, it has to be implemented. Once the device returns the stall state, the only thing that can be done is to restart all over. (reset)
Kind Regards,
Remy

Hello,
One thing I never understood is that after a power cycle with a usb memory stick plugged in, I always have to start and restart the usb probe to recognize the storage device. This happened in a previous version of u-boot (like 1.2.0) and it's also the case with the current source. Is their a reason for that?
I do not know a reason for that, and it is not supposed to be that way. On the boards I use I have not seen that behaviour.
Perhaps an inadequate peripheral reset?
The initialisation sequence looks very much alike the Windows/Linux initialisation sequence these days, there are a few minor differences but these are valid too and are not related to things like this. There are still a few weird issues with USB sticks I do not fully understand yet, but if you can improve it, please provide patches.
Kind regards,
Remy
participants (2)
-
E Robertson
-
Remy Bohmer