On Thu, Feb 27, 2014 at 07:38:18AM +0800, Li Jun wrote: > From: b47624 <b47624@ubuntu64bit1204.(none)> > > This patchset adds USB OTG HNP and SRP support on chipidea usb driver, > existing OTG port role swtich function by ID pin status kept unchanged, > based on that, if select CONFIG_USB_OTG_FSM, OTG HNP and SRP will be > supported. The CONFIG_USB_OTG should also be needed? > > Reference to: > "On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification July 27, 2012 > Revision 2.0 version 1.1a" > Jun, at next time, you can have a patch at Documentation/ to introduce how to do it. > How to test HNP&SRP with 2 Freescale i.MX6Q sabre SD boards: > 1. Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded > (e.g. g_mass_storage). > > 2. Connect 2 boards with usb cable with one end is micro A plug, the other end > is micro B plug. > > 3. The A device with micro A plug inserted should enumrate B device. > If I swap step 1 and step 2, it can't enumerate. Plug out and plug in again can work. Have a check please. > 4. Role switch. > On B device: > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req > > if HNP polling patchset is not applied, also need: You can say if HNP polling is not supported.... > On A device: > echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req > > B device should take host role and enumrate A device(peripheral). It works. > > 5. A device switch back to host. > On B device: > echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req > > A device should switch back to host and enumrate B device. works. > > 6. Remove B device and insert again in 10 seconds, A device should > enumrate B device again. > > 7. Remove B device and insert again after 10 seconds, A device should > NOT enumrate B device. > > if A device wants to use bus: > On A device: > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req > > if B device wants to use bus: > On B device: > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req Works. What does A(B) device wants to use bus? The vbus should always from A device, correct? > > 8. A device power down the bus. > On A device: > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop > > 9. B device do data pulse for SRP. > On B device: > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req > > A device usb bus should be resumed and enumrate B device. Works. Peter > > Changes since v2: > - Add ABI document for sysfs input files description: > Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg > - Add a debug file for show some USB registers value. > - Split host driver change to be 2 patches, one for otg_port number init; > the other one for vbus control change. > - Export interrupt enable and status read functions from udc driver. > - Only enable AVV irq in otg fsm init. > - Remove duplicated USBSTS bits definitions. > - typo correction. > - Add HowTo demo role switch with 2 Freescale i.MX6Q sabre SD boards > in cover letter. > > Changes since v1: > - Move out HNP polling patch from this series, which will be a seperated patchset > followed this one > - Change fsm timers global variables to be a structure embeded in ci_hdrc, > to make multiple OTG instances can exist in one system > - Change some otg fsm functions to be static > - Re-split timer init patch to avoid a later patch changing a previous one > in the same series > - Change timer structure memory allocation to be devm_kzalloc > - Update some format alignment and spelling errors > > Li Jun (13): > usb: phy-fsm: update OTG HNP state transition conditions according to > OTG and EH 2.0 spec. > usb: chipidea: usb OTG fsm initialization. > usb: chipidea: host: vbus control change for OTG HNP. > usb: chipidea: host: init otg port number. > usb: chipidea: udc: driver update for OTG HNP. > usb: chipidea: export interrupt enable and status register read > functions. > usb: chipidea: add OTG fsm operation functions implemenation. > usb: chipidea: OTG fsm timers initialization. > usb: chipidea: OTG HNP and SRP fsm implementation. > usb: chipidea: add sys inputs for OTG fsm input. > usb: chipidea: debug: add debug file for OTG variables show. > usb: chipidea: debug: add debug file for controller registers dump. > Documentation: ABI: usb: chipidea USB OTG HNP sysfs interface > description. > > .../ABI/testing/sysfs-platform-chipidea-usb-otg | 55 ++ > drivers/usb/chipidea/Makefile | 1 + > drivers/usb/chipidea/bits.h | 12 + > drivers/usb/chipidea/ci.h | 6 + > drivers/usb/chipidea/core.c | 30 +- > drivers/usb/chipidea/debug.c | 133 +++ > drivers/usb/chipidea/host.c | 13 +- > drivers/usb/chipidea/host.h | 9 + > drivers/usb/chipidea/otg.c | 17 +- > drivers/usb/chipidea/otg_fsm.c | 872 ++++++++++++++++++++ > drivers/usb/chipidea/otg_fsm.h | 141 ++++ > drivers/usb/chipidea/udc.c | 31 +- > drivers/usb/phy/phy-fsm-usb.c | 9 +- > 13 files changed, 1297 insertions(+), 32 deletions(-) > create mode 100644 Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg > create mode 100644 drivers/usb/chipidea/otg_fsm.c > create mode 100644 drivers/usb/chipidea/otg_fsm.h > > -- > 1.7.9.5 > > -- 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