Usb otg does not work after switching(solved hardware fault) 切换otg模式后不能正常工作(已解决)硬件问题

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Usb otg does not work after switching(solved hardware fault) 切换otg模式后不能正常工作(已解决)硬件问题

1,980 次查看
axlrose
Contributor I

use source GitHub - boundarydevices/linux-imx6 at boundary-imx_4.9.x_1.0.0_ga  

Using imx6ul 4.1.15 kernel is normal, but using 4.9.x version kernel error

Every time you start inserting the u disk, the test is successful. When you insert it, you can't succeed after inserting it again. Then you can insert the usb cable and the computer does not fail

After retrying many times, I will occasionally succeed once.

使用imx官方4.1.15内核是正常的,尝试使用imx官方4.9.x还是boundarydevice的内核都失败, 尝试boundarydevice的4.1.15也不正常,无论是插u盘,还是切换到插电脑, 当使用4.9.88内核的时候,第一次插入U盘正常,拨出再次插入就出现问题,即使换成用usb线连接电脑,也不能正常工作,电脑无法识别imx6ul模拟的usb设备

但测试很多次发现,偶尔一两次会出现插拨都可以识别得到u盘的现像,不过再次重启又不能正常工作

因为所有工作都在4.9.88上完成,项目快完成的时候才发现这个usb otg问题,如果再次移植4.1.15会有其他需要的功能不好实现的问题,所以只好想办法解决这个问题

请问如何解决?谢谢

Please ask how to solve the problem, thank you

使用4.1.15版的内核正常,但因为大部分工作都是基于4.9.88上开发的,重新移植4.1.15比较麻烦,还涉及到其他功能无法正常工作的现像

使用的4.9版内核源代码位置 GitHub - boundarydevices/linux-imx6 at boundary-imx_4.9.x_1.0.0_ga  

故障如下:

遇到usb第一次插入u盘成功,但拨出再次插入时出现无法识别usb设备的问题

经测试发现,每次重启后,插入U盘都可以正常识别,但只要拨出以后,再次插入就无法识别, 再尝试将USB线连上PC端也不正常, 如果只单独做为host或device正常,只要一涉及到otg切换就会出现问题

 

重试很多次,偶尔会出现一切正常的现像,即随便插拨U盘,正常,再通过USB连电脑也正常,但再次重启后又不正常

上文是截取的内核log信息,第一次插入,拨出,再次插入的三次log信息

 

尝试用比较工具对比4.1.15的内核,修改过很多地方无效, 昨天试着关掉 disable_irq(ci->irq) 有反应

linux-imx6/otg.c at boundary-imx_4.9.x_1.0.0_ga · boundarydevices/linux-imx6 · GitHub  

disable_irq(ci->irq); ----屏蔽这一句后可以检测到设备,但出现其他内核错误信息

 

static void ci_otg_work(struct work_struct *work)
{
           struct ci_hdrc *ci = container_of(work, struct ci_hdrc, work);

          disable_irq(ci->irq);  ----屏蔽这一句后可以检测到设备,但出现其他内核错误信息,
         if (ci->vbus_glitch_check_event) {
                 ci->vbus_glitch_check_event = false;
                 pm_runtime_get_sync(ci->dev);
                ci_handle_vbus_glitch(ci);
               pm_runtime_put_sync(ci->dev);
       }

Insert the u disk for the first time after startup

第一次插入u盘的log信息,每次启动后第一次插入都能正确识别到u盘

[ 26.356176] imx_usb 2184000.usb: at imx_controller_resume
[ 26.361652] ci_hdrc ci_hdrc.0: at ci_controller_resume
[ 26.386484] ci_hdrc ci_hdrc.0: role 1 to 0
[ 26.398558] ci_hdrc ci_hdrc.0: ci_hdrc.0 role = 0 host to 1
[ 26.404476] bq24190_charger_set_vbus_power() chg_config = 0x02
[ 26.405926] bq24190_charger_extcon_evt_worker() changed = 1
[ 26.453433] ci_hdrc ci_hdrc.0: switching from gadget to host
[ 26.459157] ci_hdrc ci_hdrc.0: EHCI Host Controller
[ 26.476994] imx_usb 2184200.usb: at imx_controller_resume
[ 26.477039] ci_hdrc ci_hdrc.1: at ci_controller_resume
[ 26.501864] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[ 26.535704] ci_hdrc ci_hdrc.0: supports USB remote wakeup
[ 26.563374] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 26.576088] usb usb1: udev 1, busnum 1, minor = 0
[ 26.580836] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 26.603431] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 26.610687] usb usb1: Product: EHCI Host Controller
[ 26.633360] usb usb1: Manufacturer: Linux 4.9.88 ehci_hcd
[ 26.638965] usb usb1: SerialNumber: ci_hdrc.0
[ 26.658690] hub 1-0:1.0: USB hub found
[ 26.673350] hub 1-0:1.0: 1 port detected
[ 26.683337] hub 1-0:1.0: standalone hub
[ 26.687208] hub 1-0:1.0: individual port power switching
[ 26.692536] hub 1-0:1.0: individual port over-current protection
[ 26.723320] hub 1-0:1.0: Single TT
[ 26.726762] hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
[ 26.753352] hub 1-0:1.0: power on to power good time: 20ms
[ 26.759007] hub 1-0:1.0: local power source is good
[ 26.773606] hub 1-0:1.0: enabling power on all ports
[ 26.793771] ci_hdrc ci_hdrc.0: role host to 1
[ 26.815207] ci_hdrc ci_hdrc.0: role 0 ^ 1, gadget to 0
[ 26.820479] ci_hdrc ci_hdrc.0: ci_handle_id_switch() EXTCON_USB_HOST = 1, EXTCON_USB= 0, EXTCON_CHG_USB_SDP = 0
[ 26.873319] ci_hdrc ci_hdrc.1: there is a vbus glitch
[ 26.893556] usb usb1-port1: status 0101 change 0001
[ 27.013330] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
[ 27.025517] usb usb1-port1: status 0101, change 0000, 12 Mb/s
[ 27.173333] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 27.374087] usb 1-1: udev 2, busnum 1, minor = 1
[ 27.378792] usb 1-1: New USB device found, idVendor=0bda, idProduct=0150
[ 27.399509] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 27.413451] usb 1-1: Product: USB2.0-CRW
[ 27.417408] usb 1-1: Manufacturer: Generic
[ 27.421520] usb 1-1: SerialNumber: 20120926571200000
[ 27.453969] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 27.500905] scsi host0: usb-storage 1-1:1.0
[ 27.515682] mxs_phy 20c9000.usbphy: HS device has connected
[ 27.521313] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
[ 28.587810] scsi 0:0:0:0: Direct-Access Generic- Multi-Card 1.00 PQ: 0 ANSI: 4
[ 29.293334] ci_hdrc ci_hdrc.1: at ci_runtime_suspend
[ 29.299482] imx_usb 2184200.usb: at imx_controller_suspend
[ 29.477876] sd 0:0:0:0: [sda] 15523840 512-byte logical blocks: (7.95 GB/7.40 GiB)
[ 29.487086] sd 0:0:0:0: [sda] Write Protect is off
[ 29.504892] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 29.530828] sda: sda1
[ 29.548137] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 31.014625] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Take out the u disk
取出u盘的log信息

[ 104.560015] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
[ 104.565879] ci_hdrc ci_hdrc.0: role 0 to 1
[ 104.566201] ci_hdrc ci_hdrc.0: ci_hdrc.0 role = 1 gadget to 1
[ 104.566232] ci_hdrc ci_hdrc.0: switching from host to gadget
[ 104.566260] ci_hdrc ci_hdrc.0: remove, state 1
[ 104.566348] ci_hdrc ci_hdrc.0: roothub graceful disconnect
[ 104.566396] usb usb1: USB disconnect, device number 1
[ 104.566432] usb 1-1: USB disconnect, device number 2
[ 104.566460] usb 1-1: unregistering device
[ 104.766860] usb usb1: unregistering device
[ 104.771251] ci_hdrc ci_hdrc.0: shutdown urb 8722fd80 ep1in-intr
[ 104.807244] usb 1-0:1.0: state 0 ports 0 chg 0000 evt 0002
[ 104.816698] ci_hdrc ci_hdrc.0: USB bus 1 deregistered
[ 104.853317] ci_hdrc ci_hdrc.0: role gadget to 1
[ 104.871565] ci_hdrc ci_hdrc.0: role 1 ^ 1, host to 0
[ 104.876819] bq24190_charger_set_vbus_power() chg_config = 0x01
[ 104.878450] bq24190_charger_extcon_evt_worker() changed = 1
[ 104.909079] ci_hdrc ci_hdrc.0: ci_handle_id_switch() EXTCON_USB_HOST = 0, EXTCON_USB= 1, EXTCON_CHG_USB_SDP = 0
[ 104.950029] ci_hdrc ci_hdrc.0: at ci_runtime_suspend
[ 104.964673] ci_hdrc ci_hdrc.0: at ci_controller_resume

[ 107.293376] ci_hdrc ci_hdrc.0: at ci_runtime_suspend
[ 107.299649] imx_usb 2184000.usb: at imx_controller_suspend

Insert the u disk again

再次插入u盘后的log信息,无法检测到u盘信息

[ 116.159825] imx_usb 2184000.usb: at imx_controller_resume
[ 116.166442] ci_hdrc ci_hdrc.0: at ci_controller_resume
[ 116.182174] ci_hdrc ci_hdrc.0: role 1 to 0
[ 116.193620] ci_hdrc ci_hdrc.0: ci_hdrc.0 role = 0 host to 1
[ 116.199374] ci_hdrc ci_hdrc.0: switching from gadget to host
[ 116.205471] bq24190_charger_set_vbus_power() chg_config = 0x02
[ 116.207917] bq24190_charger_extcon_evt_worker() changed = 1
[ 116.255346] ci_hdrc ci_hdrc.0: EHCI Host Controller
[ 116.260407] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[ 116.275658] ci_hdrc ci_hdrc.0: supports USB remote wakeup
[ 116.303383] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 116.309282] usb usb1: udev 1, busnum 1, minor = 0
[ 116.317080] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 116.325888] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 116.334406] usb usb1: Product: EHCI Host Controller
[ 116.339529] usb usb1: Manufacturer: Linux 4.9.88 ehci_hcd
[ 116.347015] usb usb1: SerialNumber: ci_hdrc.0
[ 116.360859] hub 1-0:1.0: USB hub found
[ 116.373993] hub 1-0:1.0: 1 port detected
[ 116.378957] hub 1-0:1.0: standalone hub
[ 116.382834] hub 1-0:1.0: individual port power switching
[ 116.393326] hub 1-0:1.0: individual port over-current protection
[ 116.399374] hub 1-0:1.0: Single TT
[ 116.402804] hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
[ 116.421094] hub 1-0:1.0: power on to power good time: 20ms
[ 116.429930] hub 1-0:1.0: local power source is good
[ 116.437840] hub 1-0:1.0: enabling power on all ports
[ 116.453694] ci_hdrc ci_hdrc.0: role host to 1
[ 116.467905] ci_hdrc ci_hdrc.0: role 0 ^ 1, gadget to 0
[ 116.481623] ci_hdrc ci_hdrc.0: ci_handle_id_switch() EXTCON_USB_HOST = 1, EXTCON_USB= 0, EXTCON_CHG_USB_SDP = 0
[ 116.553372] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000
[ 116.558919] hub 1-0:1.0: hub_suspend
[ 116.562576] usb usb1: bus auto-suspend, wakeup 1
 [ 118.253482] ci_hdrc ci_hdrc.0: at ci_runtime_suspend
[ 118.258681] imx_usb 2184000.usb: at imx_controller_suspend

标签 (1)
标记 (1)
0 项奖励
回复
0 回复数