usb设备无法识别

之前用飞线用旧板子飞线连接了一个wifi模块到usb0口上,调试ok的,现在新设计的板子回来了,wifi模块是连接在usb2口上的,系统起来后发现wlan0不存在,用lsusb查看wifi模块的usb设备竟然没有识别到。


[    5.580165] insmod_host_driver
[    5.580165] 
[    5.588382] [ehci0-controller]: sunxi_usb_enable_ehci
[    5.594244] [sunxi-ehci0]: probe, pdev->name: 1c14000.ehci0-controller, sunxi_ehci: 0xc0a7a6ac, 0x:f1c14000, irq_no:47
[    5.606293] sunxi-ehci 1c14000.ehci0-controller: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.616501] sunxi-ehci 1c14000.ehci0-controller: new USB bus registered, assigned bus number 1
[    5.628050] sunxi-ehci 1c14000.ehci0-controller: irq 71, io mem 0xe48e2240
[    5.650274] sunxi-ehci 1c14000.ehci0-controller: USB 0.0 started, EHCI 1.00
[    5.658107] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    5.665879] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.673997] usb usb1: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.682408] usb usb1: Manufacturer: Linux 3.10.65 ehci_hcd
[    5.688406] usb usb1: SerialNumber: sunxi-ehci
[    5.696414] hub 1-0:1.0: USB hub found
[    5.700701] hub 1-0:1.0: 1 port detected
[    5.705491] [ohci0-controller]: sunxi_usb_enable_ohci
[    5.711204] [sunxi-ohci0]: probe, pdev->name: 1c14000.ohci0-controller, sunxi_ohci: 0xc0a7a01c
[    5.720840] sunxi-ohci 1c14000.ohci0-controller: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    5.730566] sunxi-ohci 1c14000.ohci0-controller: new USB bus registered, assigned bus number 2
[    5.740223] sunxi-ohci 1c14000.ohci0-controller: irq 72, io mem 0xe48e2240
[    5.804284] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    5.811974] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.820106] usb usb2: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    5.827930] usb usb2: Manufacturer: Linux 3.10.65 ohci_hcd
[    5.834252] usb usb2: SerialNumber: sunxi-ohci
[    5.842495] hub 2-0:1.0: USB hub found
[    5.846675] hub 2-0:1.0: 1 port detected

[root@t3_p3 /]# lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0001

初步分析从以下几个方向排查

1、wifi模块有问题?

2、硬件设计?usb2口有问题?

3、usb驱动有问题?

验证一、

我把usb2口的dm dp电阻断开,飞线到usb0口上,系统起来后,lsusb可以查看到设备,wlan0也可以正常使用了。说明模块是OK的。

Bus 001 Device 002: ID 0bda:8179
[    5.580176] insmod_host_driver
[    5.580176] 
[    5.586810] [ehci0-controller]: sunxi_usb_enable_ehci
[    5.592637] [sunxi-ehci0]: probe, pdev->name: 1c14000.ehci0-controller, sunxi_ehci: 0xc0a7a474, 0x:f1c14000, irq_no:47
[    5.604695] sunxi-ehci 1c14000.ehci0-controller: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.614945] sunxi-ehci 1c14000.ehci0-controller: new USB bus registered, assigned bus number 1
[    5.626399] sunxi-ehci 1c14000.ehci0-controller: irq 71, io mem 0xe48e21c0
[    5.650288] sunxi-ehci 1c14000.ehci0-controller: USB 0.0 started, EHCI 1.00
[    5.658159] ehci_irq: highspeed device connect
[    5.658189] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    5.658197] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.658204] usb usb1: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.658209] usb usb1: Manufacturer: Linux 3.10.65 ehci_hcd
[    5.658215] usb usb1: SerialNumber: sunxi-ehci
[    5.700213] hub 1-0:1.0: USB hub found
[    5.704401] hub 1-0:1.0: 1 port detected
[    5.709347] [ohci0-controller]: sunxi_usb_enable_ohci
[    5.715199] [sunxi-ohci0]: probe, pdev->name: 1c14000.ohci0-controller, sunxi_ohci: 0xc0a79c94
[    5.724938] sunxi-ohci 1c14000.ohci0-controller: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    5.734838] sunxi-ohci 1c14000.ohci0-controller: new USB bus registered, assigned bus number 2
[    5.744563] sunxi-ohci 1c14000.ohci0-controller: irq 72, io mem 0xe48e21c0
[    5.814237] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    5.821937] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.830082] usb usb2: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    5.837934] usb usb2: Manufacturer: Linux 3.10.65 ohci_hcd
[    5.844281] usb usb2: SerialNumber: sunxi-ohci
[    5.852013] hub 2-0:1.0: USB hub found
[    5.856223] hub 2-0:1.0: 1 port detected
[    6.020178] usb 1-1: new high-speed USB device number 2 using sunxi-ehci
[    6.173259] usb 1-1: New USB device found, idVendor=0bda, idProduct=8179
[    6.180813] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    6.188676] usb 1-1: Product: 802.11n WLAN NIC
[    6.193793] usb 1-1: Manufacturer: Realtek
[    6.213239] bFWReady == _FALSE call reset 8051...
[    6.307200] RTL871X: rtw_ndev_init(wlan0)
[    6.323833] RTL871X: rtw_ndev_init(wlan1)
[root@t3_p3 ~]# lsusb
Bus 001 Device 002: ID 0bda:8179
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0001

验证二、

扫描二维码关注公众号,回复: 1675098 查看本文章

量测供电电压ok,与硬件设计沟通,硬件说我们跑android的板子(我现在搞的是linux系统)也是设计在usb2口上的,都能正常使用。于是我似乎发现了曙光,去找了个android刷机包刷进去,果然出来了。这说明硬件设计是ok的,usb2端口也没问题,剩下的肯定就是软件上的问题了。

<6>[ 0.281059] usbcore: registered new interface driver usbfs
<6>[ 0.281059] usbcore: registered new interface driver hub
<6>[ 0.281059] usbcore: registered new device driver usb
<6>[ 1.114699] usbcore: registered new interface driver asix
<6>[ 1.115006] usbcore: registered new interface driver ax88179_178a
<6>[ 1.115269] usbcore: registered new interface driver cdc_ether
<6>[ 1.115530] usbcore: registered new interface driver net1080
<6>[ 1.115782] usbcore: registered new interface driver cdc_subset
<6>[ 1.116058] usbcore: registered new interface driver zaurus
<6>[ 1.116393] usbcore: registered new interface driver cdc_ncm
<6>[ 1.130241] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 1.130254] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1.130266] usb usb1: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
<6>[ 1.130276] usb usb1: Manufacturer: Linux 3.10.65 ehci_hcd
<6>[ 1.130286] usb usb1: SerialNumber: sunxi-ehci
<6>[ 1.132312] usb usb1: USB disconnect, device number 1
<6>[ 1.150214] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 1.150227] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1.150238] usb usb1: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
<6>[ 1.150249] usb usb1: Manufacturer: Linux 3.10.65 ehci_hcd
<6>[ 1.150258] usb usb1: SerialNumber: sunxi-ehci
<6>[ 1.170253] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 1.170266] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1.170277] usb usb2: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
<6>[ 1.170287] usb usb2: Manufacturer: Linux 3.10.65 ehci_hcd
<6>[ 1.170297] usb usb2: SerialNumber: sunxi-ehci
<4>[ 1.173245] ohci0-controller get usb clk_losc clk failed.
<6>[ 1.234124] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
<6>[ 1.234139] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1.234150] usb usb3: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
<6>[ 1.234160] usb usb3: Manufacturer: Linux 3.10.65 ohci_hcd
<6>[ 1.234171] usb usb3: SerialNumber: sunxi-ohci
<6>[ 1.236064] usb usb3: USB disconnect, device number 1
<4>[ 1.237655] ohci1-controller get usb clk_losc clk failed.
<6>[ 1.294107] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
<6>[ 1.294122] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1.294133] usb usb3: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
<6>[ 1.294143] usb usb3: Manufacturer: Linux 3.10.65 ohci_hcd
<6>[ 1.294154] usb usb3: SerialNumber: sunxi-ohci
<4>[ 1.296070] ohci2-controller get usb clk_losc clk failed.
<6>[ 1.354114] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
<6>[ 1.354128] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1.354140] usb usb4: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
<6>[ 1.354150] usb usb4: Manufacturer: Linux 3.10.65 ohci_hcd
<6>[ 1.354160] usb usb4: SerialNumber: sunxi-ohci
<6>[ 1.356886] usbcore: registered new interface driver cdc_acm
<6>[ 1.357292] usbcore: registered new interface driver usb-storage
<6>[ 1.357548] usbcore: registered new interface driver ums-alauda
<6>[ 1.357797] usbcore: registered new interface driver ums-cypress
<6>[ 1.358046] usbcore: registered new interface driver ums-datafab
<6>[ 1.358288] usbcore: registered new interface driver ums_eneub6250
<6>[ 1.358536] usbcore: registered new interface driver ums-freecom
<6>[ 1.358787] usbcore: registered new interface driver ums-isd200
<6>[ 1.359034] usbcore: registered new interface driver ums-jumpshot
<6>[ 1.359275] usbcore: registered new interface driver ums-karma
<6>[ 1.359519] usbcore: registered new interface driver ums-onetouch
<6>[ 1.359810] usbcore: registered new interface driver ums-realtek
<6>[ 1.360113] usbcore: registered new interface driver ums-sddr09
<6>[ 1.360373] usbcore: registered new interface driver ums-sddr55
<6>[ 1.360621] usbcore: registered new interface driver ums-usbat
<6>[ 1.361347] usbcore: registered new interface driver usbserial
<6>[ 1.361603] usbcore: registered new interface driver usbserial_generic
<6>[ 1.361844] usbserial: USB Serial support registered for generic
<6>[ 1.362095] usbcore: registered new interface driver option
<6>[ 1.362347] usbserial: USB Serial support registered for GSM modem (1-port)
<6>[ 1.365186] usbcore: registered new interface driver xpad
<6>[ 1.365451] usbcore: registered new interface driver usb_acecad
<6>[ 1.365734] usbcore: registered new interface driver aiptek
<6>[ 1.365999] usbcore: registered new interface driver gtco
<6>[ 1.366255] usbcore: registered new interface driver hanwang
<6>[ 1.366511] usbcore: registered new interface driver kbtab
<6>[ 1.366794] usbcore: registered new interface driver wacom
<6>[ 1.378048] usbcore: registered new interface driver uvcvideo
<6>[ 1.490283] usb 2-1: new high-speed USB device number 2 using sunxi-ehci
<6>[ 1.594244] usbcore: registered new interface driver usbhid
<6>[ 1.594269] usbhid: USB HID core driver
<6>[ 1.645280] usb 2-1: New USB device found, idVendor=0bda, idProduct=8179
<6>[ 1.645324] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 1.645337] usb 2-1: Product: 802.11n NIC
<6>[ 1.645348] usb 2-1: Manufacturer: Realtek
<4>[ 1.693596] usb_serial_number:20080411
<4>[ 1.695608] [sw_udc]: sunxi_udc_set_selfpowered_2320: usb device is not active
<4>[ 1.695630] [sw_udc]: sunxi_udc_set_pullup_2337: usb device is not active
<4>[ 1.714369] [sw_udc]: sunxi_udc_set_selfpowered_2320: usb device is not active
<4>[ 4.032954] [sw_udc]: sunxi_udc_set_pullup_2337: usb device is not active
<6>[ 5.640369] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 5.640390] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 5.640404] usb usb5: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
<6>[ 5.640417] usb usb5: Manufacturer: Linux 3.10.65 ehci_hcd
<6>[ 5.640429] usb usb5: SerialNumber: sunxi-ehci
<6>[ 5.704228] usb usb6: New USB device found, idVendor=1d6b, idProduct=0001
<6>[ 5.704249] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 5.704260] usb usb6: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
<6>[ 5.704271] usb usb6: Manufacturer: Linux 3.10.65 ohci_hcd
<6>[ 5.704281] usb usb6: SerialNumber: sunxi-ohci
<4>[ 13.926587] [sw_udc]: sunxi_udc_set_pullup_2337: usb device is not active
<4>[ 13.988195] [sw_udc]: sunxi_udc_set_pullup_2337: usb device is not active
root@t3-p1:/ # busybox lsusb
Bus 002 Device 002: ID 0bda:8179
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0001
Bus 004 Device 001: ID 1d6b:0001
Bus 005 Device 001: ID 1d6b:0002
Bus 006 Device 001: ID 1d6b:0001

通过对比两份ok的log和一份NG的log发现一个规律,usb设备无论是在usb0被识别还是usb2被识别,该usb端口跑的驱动是EHCI Driver,而没有识别的时候,usb端口跑的是OHCI Driver,那么问题来了,这两玩意是啥?有啥区别额?干啥用的?我怎么让usb2或者所有的USB端口也跑EHCI Driver?

是时候恶补一下usb相关的理论知识了--google登场。

参考以下

USB EHCI和OHCI端口切换原理分析

https://blog.csdn.net/ljzcom/article/details/8186914

linux USB HOST之EHCI和OHCI

https://blog.csdn.net/ljzcom/article/details/8186914

原来EHCI、OHCI才是usb端口的幕后玩家,而OHCI是EHCI的小助手。

关于端口逻辑这块需要特别注意,Driver设计者要注意:当前端口正在属于谁。当端口被OHCI所拥有时,你插入个高速设备怎么办?没办法!在没有插入设备时,就不应该让OHCI拥有这个端口。只有EHCI控制器才能识别出设备是全速、高速还是低速。

这句话深深地刺痛了我,难怪我的设备没法被识别,因为我那个端口被OHCI控制了。

现在我需要做的时候把USB2也配置成EHCI控制,那么问题来了去哪里配置?

当然是kernel

make menuconfig--> Device Driver-->USB Support-->SoftWinner SUNXI USB Host Controller support 以及下面的那些EHCI0-n  OHCI0-n全部选上保存退出重新编译内核。

CONFIG_USB_SUNXI_HCD=y
CONFIG_USB_SUNXI_HCI=y
CONFIG_USB_SUNXI_EHCI0=y
CONFIG_USB_SUNXI_EHCI1=y
CONFIG_USB_SUNXI_EHCI2=y
CONFIG_USB_SUNXI_OHCI0=y
CONFIG_USB_SUNXI_OHCI1=y
CONFIG_USB_SUNXI_OHCI2=y

打包烧录重新开机 终于看到usb设备了

[    5.580167] insmod_host_driver
[    5.580167] 
[    5.588365] [ehci0-controller]: sunxi_usb_enable_ehci
[    5.594146] [sunxi-ehci0]: probe, pdev->name: 1c14000.ehci0-controller, sunxi_ehci: 0xc0a7a6ac, 0x:f1c14000, irq_no:47
[    5.606204] sunxi-ehci 1c14000.ehci0-controller: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.616404] sunxi-ehci 1c14000.ehci0-controller: new USB bus registered, assigned bus number 5
[    5.627615] sunxi-ehci 1c14000.ehci0-controller: irq 71, io mem 0xe48e21c0
[    5.650166] sunxi-ehci 1c14000.ehci0-controller: USB 0.0 started, EHCI 1.00
[    5.658005] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002
[    5.665756] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.673876] usb usb5: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.682213] usb usb5: Manufacturer: Linux 3.10.65 ehci_hcd
[    5.688206] usb usb5: SerialNumber: sunxi-ehci
[    5.696525] hub 5-0:1.0: USB hub found
[    5.700824] hub 5-0:1.0: 1 port detected
[    5.705800] [ohci0-controller]: sunxi_usb_enable_ohci
[    5.711551] [sunxi-ohci0]: probe, pdev->name: 1c14000.ohci0-controller, sunxi_ohci: 0xc0a7a01c
[    5.721192] sunxi-ohci 1c14000.ohci0-controller: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    5.730909] sunxi-ohci 1c14000.ohci0-controller: new USB bus registered, assigned bus number 6
[    5.740571] sunxi-ohci 1c14000.ohci0-controller: irq 72, io mem 0xe48e21c0
[    5.804202] usb usb6: New USB device found, idVendor=1d6b, idProduct=0001
[    5.811872] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.819787] usb usb6: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    5.827865] usb usb6: Manufacturer: Linux 3.10.65 ohci_hcd
[    5.834077] usb usb6: SerialNumber: sunxi-ohci
[    5.842397] hub 6-0:1.0: USB hub found
[    5.846580] hub 6-0:1.0: 1 port detected
[root@t3_p3 ~]# [   10.470895] gpu cooling callback set freq limit 384

[root@t3_p3 ~]# lsusb
Bus 002 Device 002: ID 0bda:8179
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0001
Bus 004 Device 001: ID 1d6b:0001
Bus 005 Device 001: ID 1d6b:0002
Bus 006 Device 001: ID 1d6b:0001
没错就是他Bus 002 Device 002: ID 0bda:8179


TheEnd-----------

2018-06-21
深圳南山科技工业园

猜你喜欢

转载自www.cnblogs.com/tid-think/p/9207652.html