From 9b6567e19bc55187bc1bb094b00a9f63acb30071 Mon Sep 17 00:00:00 2001 From: Li Jun Date: Mon, 23 Mar 2015 16:03:35 +0800 Subject: usb: chipidea: udc: bypass pullup DP when gadget connect in OTG fsm mode By pass pullup DP in OTG fsm mode when do gadget connect, to let it handled by OTG state machine. This patch can fix the problem you found with my HNP polling patchset after below 3 patches introduced: 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 Problem: - 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. This patch is based on commit eff933c1d3a2e046492b3dfc86db813856553a29 (chipidea: pci: make it depends on NOP_USB_XCEIV) on branch peter-usb-dev of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git Signed-off-by: Li Jun Signed-off-by: Peter Chen --- drivers/usb/chipidea/udc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 41914a55055d..764f668d45a9 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1574,6 +1574,10 @@ static int ci_udc_pullup(struct usb_gadget *_gadget, int is_on) { struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); + /* Data+ pullup controlled by OTG state machine in OTG fsm mode */ + if (ci_otg_is_fsm_mode(ci)) + return 0; + pm_runtime_get_sync(&ci->gadget.dev); if (is_on) hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); -- cgit v1.2.3-59-g8ed1b From 0c4d6af42d8375e003f0e4626f2f661862b5df4b Mon Sep 17 00:00:00 2001 From: Li Jun Date: Fri, 27 Mar 2015 19:43:01 +0800 Subject: usb: chipidea: debug: add low power mode check before print registers Since the required clock to access registers is gated off in low power mode, add ci->in_lpm check before try to dump registers value. Signed-off-by: Li Jun Signed-off-by: Peter Chen --- drivers/usb/chipidea/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 268e4236e84c..dfb05edcdb96 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -336,8 +336,8 @@ static int ci_registers_show(struct seq_file *s, void *unused) struct ci_hdrc *ci = s->private; u32 tmp_reg; - if (!ci) - return 0; + if (!ci || ci->in_lpm) + return -EPERM; /* ------ Registers ----- */ tmp_reg = hw_read_intr_enable(ci); -- cgit v1.2.3-59-g8ed1b