我正在使用 u-boot (2013-07) 作为 SOC 平台中的引导加载程序的嵌入式 Linux 系统,现在我尝试在 u-boot 中支持 USB 磁盘,所以我做了一些移植和硬件配置。
我思考usb start
u-boot可以检测到U盘,但是在命令行中运行时出现错误。
我启用了 DEBUG 和 BBB_XPORT_TRACE 以common/usb_storage.c
获取有关错误的更多信息,它们来了(此 SOC 中的 CACHELINE_SIZE 为 32)。
0# usb start
(Re)start USB...
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... i=0
i=1
USB Mass Storage device detected
Transport: Bulk/Bulk/Bulk
Endpoints In 1 Out 2 Int 0
Get Max LUN -> len = 1, result = 0
address 2
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 83faf2a0 datalen 36 pdata 83b4a000
cmd[0] 0x12 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x24 cmd[5] 0x0 cmd[6] 0x0 cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0
DATA phase
pdata[0] 0x0 pdata[1] 0x80 pdata[2] 0x6 pdata[3] 0x12 pdata[4] 0x43 pdata[5] 0x0 pdata[6] 0x0 pdata[7] 0x0 pdata[8] 0x53 pdata[9] 0x61 pdata[10] 0x6e pdata[11] 0x44 pdata[12] 0x69 pdata[13] 0x73 pdata[14] 0x6b pdata[15] 0x0 pdata[16] 0x43 pdata[17] 0x72 pdata[18] 0x75 pdata[19] 0x7a pdata[20] 0x65 pdata[21] 0x72 pdata[22] 0x20 pdata[23] 0x42 pdata[24] 0x6c pdata[25] 0x61 pdata[26] 0x64 pdata[27] 0x65 pdata[28] 0x0 pdata[29] 0x0 pdata[30] 0x0 pdata[31] 0x0 pdata[32] 0x31 pdata[33] 0x2e pdata[34] 0x30 pdata[35] 0x30
STATUS phase
ptr[0] 0x0 ptr[1] 0x80 ptr[2] 0x6 ptr[3] 0x12 ptr[4] 0x43 ptr[5] 0x0 ptr[6] 0x0 ptr[7] 0x0 ptr[8] 0x53 ptr[9] 0x61 ptr[10] 0x6e ptr[11] 0x44 ptr[12] 0x69
XXXXXXXXXXXx csw@83b49f80, CSWSig = 0x12068000, result: 0
!CSWSIGNATURE
BBB_reset
BBB_reset result 0: status 0 reset
BBB_reset result 0: status 0 clearing IN endpoint
BBB_reset result 0: status 0 clearing OUT endpoint
BBB_reset done
inquiry returns -1
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 83faf2a0 datalen 36 pdata 83b4a000
cmd[0] 0x12 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x24 cmd[5] 0x0 cmd[6] 0x0 cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0
DATA phase
usb_bulk_msg error status 0
BBB_reset
BBB_reset result -1: status 0 reset
BBB_reset result -1: status 0 clearing IN endpoint
BBB_reset result -1: status 0 clearing OUT endpoint
BBB_reset done
inquiry returns -1
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 83faf2a0 datalen 36 pdata 83b4a000
cmd[0] 0x12 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x24 cmd[5] 0x0 cmd[6] 0x0 cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0
usb_stor_BBB_comdat:usb_bulk_msg error
failed to send CBW status 0
BBB_reset
BBB_reset result -1: status 0 reset
BBB_reset result -1: status 0 clearing IN endpoint
BBB_reset result -1: status 0 clearing OUT endpoint
BBB_reset done
inquiry returns -1
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 83faf2a0 datalen 36 pdata 83b4a000
cmd[0] 0x12 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x24 cmd[5] 0x0 cmd[6] 0x0 cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0
usb_stor_BBB_comdat:usb_bulk_msg error
failed to send CBW status 0
BBB_reset
BBB_reset result -1: status 0 reset
BBB_reset result -1: status 0 clearing IN endpoint
BBB_reset result -1: status 0 clearing OUT endpoint
BBB_reset done
inquiry returns -1
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 83faf2a0 datalen 36 pdata 83b4a000
cmd[0] 0x12 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x24 cmd[5] 0x0 cmd[6] 0x0 cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0
usb_stor_BBB_comdat:usb_bulk_msg error
failed to send CBW status 0
BBB_reset
BBB_reset result -1: status 0 reset
BBB_reset result -1: status 0 clearing IN endpoint
BBB_reset result -1: status 0 clearing OUT endpoint
BBB_reset done
inquiry returns -1
error in inquiry
i=2
0 Storage Device(s) found
scanning usb for video devices... 0 Video Device(s) found
并usb info
显示如下,
# usb info
1: Hub, USB Revision 1.10
- U-Boot Root Hub
- Class: Hub
- PacketSize: 8 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 0.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms
2: Mass Storage, USB Revision 2.0
- SanDisk Cruzer Blade 040172060905221??653
- Class: (from Interface) Mass Storage
- PacketSize: 64 Configurations: 1
- Vendor: 0x0781 Product 0x5567 Version 1.0
Configuration: 1
- Interfaces: 1 Bus Powered 200mA
Interface: 0
- Alternate Setting 0, Endpoints: 2
- Class Mass Storage, Transp. SCSI, Bulk only
- Endpoint 1 In Bulk MaxPacket 512
- Endpoint 2 Out Bulk MaxPacket 512
我尝试在 中添加 1000ms 延迟usb_stor_BBB_transport()
,但没有效果。
我对 U-boot 中的 USB 堆栈还很陌生,那么这个错误的可能原因是什么?我能做些什么来修复它?
使用工作 SOC 的日志进行更新
我在类似的 SOC 上尝试了 u-boot 代码库,它正在运行。我得到了以下日志usb start
,并且没有这样的错误STATUS phase
,即它得到了正确的CSWSIGNATURE
。
USB0: scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... i=0
i=1
USB Mass Storage device detected
Transport: Bulk/Bulk/Bulk
Endpoints In 1 Out 2 Int 0
Get Max LUN -> len = 1, result = 0
address 2
COMMAND phase
dir 1 lun 0 cmdlen 12 cmd 87faba20 datalen 36 pdata 86efb000
cmd[0] 0x12 cmd[1] 0x0 cmd[2] 0x0 cmd[3] 0x0 cmd[4] 0x24 cmd[5] 0x0 cmd[6] 0x0 cmd[7] 0x0 cmd[8] 0x0 cmd[9] 0x0 cmd[10] 0x0 cmd[11] 0x0
DATA phase
pdata[0] 0x0 pdata[1] 0x80 pdata[2] 0x6 pdata[3] 0x12 pdata[4] 0x43 pdata[5] 0x0 pdata[6] 0x0 pdata[7] 0x0 pdata[8] 0x53 pdata[9] 0x61 pdata[10] 0x6e pdata[11] 0x44 pdata[12] 0x69 pdata[13] 0x73 pdata[14] 0x6b pdata[15] 0x0 pdata[16] 0x43 pdata[17] 0x72 pdata[18] 0x75 pdata[19] 0x7a pdata[20] 0x65 pdata[21] 0x72 pdata[22] 0x20 pdata[23] 0x42 pdata[24] 0x6c pdata[25] 0x61 pdata[26] 0x64 pdata[27] 0x65 pdata[28] 0x0 pdata[29] 0x0 pdata[30] 0x0 pdata[31] 0x0 pdata[32] 0x31 pdata[33] 0x2e pdata[34] 0x30 pdata[35] 0x30
STATUS phase
ptr[0] 0x55 ptr[1] 0x53 ptr[2] 0x42 ptr[3] 0x53 ptr[4] 0x0 ptr[5] 0x0 ptr[6] 0x0 ptr[7] 0x0 ptr[8] 0x0 ptr[9] 0x0 ptr[10] 0x0 ptr[11] 0x0 ptr[12] 0x0
XXXXXXXXXXXx csw@86efaf80, CSWSig = 0x53425355, result: 0
inquiry returns 0