Re: [PATCH v4 0/8] add HNP polling support for usb otg fsm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 23, 2015 at 03:19:07PM +0800, Li Jun wrote:
> On Fri, Mar 20, 2015 at 11:07:17AM +0800, Peter Chen wrote:
> > On Thu, Mar 19, 2015 at 11:11:17AM +0800, Li Jun wrote:
> > > HNP polling is a mechanism which allows the OTG device currently acting as host
> > > to determine when the other attached OTG device wishes to take the host role.
> > > When an OTG host, which supports HNP, is connected to an OTG peripheral which
> > > also supports HNP it shall poll the peripheral regularly to determine whether
> > > it requires a role-swap and grant this at the earliest opportunity.
> > > 
> > > changes for v4:
> > > - Add OTG HNP capable check for connected device before sending HNP polling
> > >   in patch 3/8.
> > > - Add comment to explain HNP test update in chipidea.txt in patch 8/8.
> > > - Fix some typo.
> > > - Add Peter's Ack in patch 1,2,4,5,6,7/8 of the series.
> > > 
> > 
> > Have a test with your patch set, one problem has been found, for how to
> > re-produce:
> > - Connect USB cable and MicroAB cable between two boards
> > - Boot up two boards
> > - load g_mass_storage at B-device side, the enumeration will success,
> > and A will see a usb mass-storage device
> > - load g_mass_storage at A-device side, the problem has occurred, the
> > connection will be lost at the beginning, then connect again. See below
> > log:
> > 
> > root@imx6sxsabresd:~# modprobe g_mass_storage file=/dev/mmcblk0p1
> > [   19.311974] Number of LUNs=8
> > [   19.314903] Mass Storage Function, version: 2009/09/11
> > [   19.320192] LUN: removable file: (no medium)
> > [   19.324520] Number of LUNs=1
> > [   19.327888] LUN: file: /dev/mmcblk0p1
> > [   19.331568] Number of LUNs=1
> > [   19.336831] g_mass_storage gadget: Mass Storage Gadget,
> > version: 2009/09/11
> > [   19.343817] g_mass_storage gadget: userspace failed to
> > provide iSerialNumber
> > [   19.350912] g_mass_storage gadget: g_mass_storage ready
> > root@imx6sxsabresd:~# [   19.396639] usb 1-1: USB disconnect,
> > device number 2
> > [   19.423829] sd 0:0:0:0: [sda] Synchronizing SCSI cache
> > [   19.430245] sd 0:0:0:0: [sda] Synchronize Cache(10) failed:
> > Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
> > [   19.446612] usb 1-1: Get one byte OTG status failed
> > [   19.735877] usb 1-1: new high-speed USB device number 3 using
> > ci_hdrc
> > [   19.887394] usb 1-1: Dual-Role OTG device on HNP port
> > [   19.905834] usb-storage 1-1:1.0: USB Mass Storage device
> > detected
> > [   19.912812] usb-storage 1-1:1.0: Quirks match for vid 0525
> > pid a4a5: 10000
> > [   19.922080] scsi host1: usb-storage 1-1:1.0
> > [   20.927712] scsi 1:0:0:0: Direct-Access     Linux
> > File-Stor Gadget 0400 PQ: 0 ANSI: 2
> > [   20.956936] sd 1:0:0:0: [sda] 1024000 512-byte logical
> > blocks: (524 MB/500 MiB)
> > [   21.069069] sd 1:0:0:0: [sda] Write Protect is off
> > [   21.179176] sd 1:0:0:0: [sda] Write cache: enabled, read
> > cache: enabled, doesn't support DPO or FUA
> > [   21.420525]  sda:
> > 
> > [   21.649297] sd 1:0:0:0: [sda] Attached SCSI disk
> > 
> This is because latest pullup DP change(fully controlled by udc-core)
> introduced but it's not in my code base, I will create a patch to adapt
> it to OTG fsm driver.
> 
> 467a78c usb: chipidea: udc: apply new usb_udc_vbus_handler interface
> 628ef0d usb: udc: add usb_udc_vbus_handler
> dfea9c9 usb: udc: store usb_udc pointer in struct usb_gadget
> 

Hi Jun,

The above three patches are in Greg's next tree, after I apply
your chipidea fix [1] for pullup dp, it still some other problems
for HNP, am I missing something?

The procedures to reproduce:

- Connect USB cable and MicroAB cable between two boards
- Boot up two boards
- load g_mass_storage at B-device side, the enumeration will success,
and A will see a usb mass-storage device
- load g_mass_storage at A-device side
- Do HNP at B side, the HNP will succeed
echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
- Do HNP at A side
echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req

The problem has occurred, the A can't be back to host again.

The log at A side:
root@imx6sxsabresd:~# modprobe g_mass_storage file=/dev/mmcblk0p1
[  428.998052] Number of LUNs=8
[  429.000979] Mass Storage Function, version: 2009/09/11
[  429.006135] LUN: removable file: (no medium)
[  429.013328] Number of LUNs=1
[  429.016669] LUN: file: /dev/mmcblk0p1
[  429.020415] Number of LUNs=1
[  429.026513] g_mass_storage gadget: Mass Storage Gadget,
version: 2009/09/11
[  429.033539] g_mass_storage gadget: userspace failed to
provide iSerialNumber
[  429.040646] g_mass_storage gadget: g_mass_storage ready
root@imx6sxsabresd:~# 
root@imx6sxsabresd:~# [  436.232338] ci_hdrc ci_hdrc.0: remove,
state 1
[  436.237892] usb usb1: USB disconnect, device number 1
[  436.243003] usb 1-1: USB disconnect, device number 2
[  436.295634] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[  436.302602] sd 0:0:0:0: [sda] Synchronize Cache(10) failed:
Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[  436.348743] ci_hdrc ci_hdrc.0: USB bus 1 deregistered
[  436.802544] g_mass_storage gadget: high-speed config #1:
Linux File-Backed Storage

root@imx6sxsabresd:~# 
root@imx6sxsabresd:~# ./a_req.sh 1
root@imx6sxsabresd:~# [  445.859142] ci_hdrc ci_hdrc.0: EHCI
Host Controller
[  445.864193] ci_hdrc ci_hdrc.0: new USB bus registered,
assigned bus number 1
[  445.887470] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[  445.901979] hub 1-0:1.0: USB hub found
[  445.905970] hub 1-0:1.0: 1 port detected

The log at B side:
root@imx6sxsabresd:~# modprobe g_mass_storage file=/dev/mmcblk0p1
[  410.036646] Number of LUNs=8
[  410.039570] Mass Storage Function, version: 2009/09/11
[  410.046814] LUN: removable file: (no medium)
[  410.051156] Number of LUNs=1
[  410.056427] LUN: file: /dev/mmcblk0p1
[  410.060111] Number of LUNs=1
[  410.065826] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  410.072870] g_mass_storage gadget: userspace failed to provide iSerialNumber
[  410.079929] g_mass_storage gadget: g_mass_storage ready
root@imx6sxsabresd:~# [  411.655125] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

root@imx6sxsabresd:~# 
root@imx6sxsabresd:~# ./srp.sh 1
root@imx6sxsabresd:~# [  433.614825] ci_hdrc ci_hdrc.0: EHCI Host Controller
[  433.619988] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 2
[  433.642383] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[  433.672645] hub 2-0:1.0: USB hub found
[  433.677885] hub 2-0:1.0: 1 port detected
[  434.002595] usb 2-1: new high-speed USB device number 2 using ci_hdrc
[  434.155133] usb 2-1: Dual-Role OTG device on HNP port
[  434.198494] usb-storage 2-1:1.0: USB Mass Storage device detected
[  434.216429] usb-storage 2-1:1.0: Quirks match for vid 0525 pid a4a5: 10000
[  434.223674] scsi host0: usb-storage 2-1:1.0
[  435.250973] scsi 0:0:0:0: Direct-Access     Linux    File-Stor Gadget 0400 PQ: 0 ANSI: 2
[  435.293819] sd 0:0:0:0: [sda] 1024000 512-byte logical blocks: (524 MB/500 MiB)
[  435.408765] sd 0:0:0:0: [sda] Write Protect is off
[  435.519321] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  435.779704]  sda:
[  436.019371] sd 0:0:0:0: [sda] Attached SCSI disk
[  436.851044] FAT-fs (sda): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  442.732739] ci_hdrc ci_hdrc.0: remove, state 1
[  442.738459] usb usb2: USB disconnect, device number 1
[  443.243489] usb 2-1: USB disconnect, device number 2
[  443.325970] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[  443.334882] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[  443.406662] ci_hdrc ci_hdrc.0: USB bus 2 deregistered

[1] http://www.spinics.net/lists/linux-usb/msg123204.html

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux