Hello Peter, On 16-04-21 17:13:34, Peter Chen wrote: > On Tue, Apr 19, 2016 at 12:20:18PM +0530, maitysanchayan@xxxxxxxxx wrote: > > Hello Peter, > > > > On 16-04-19 10:40:20, Peter Chen wrote: > > > On Mon, Apr 18, 2016 at 02:36:06PM +0530, maitysanchayan@xxxxxxxxx wrote: > > > > Hello Peter, > > > > > > > > I tested this on a Colibri Vybrid VF61 module with the patches applied > > > > on top of for-next branch. > > > > > > > > root@colibri-vf:~# uname -a > > > > Linux colibri-vf 4.6.0-rc1-00044-gc76529e-dirty #120 Mon Apr 18 13:46:34 IST 2016 armv7l GNU/Linux > > > > > > > > Host and client mode work only on boot up. Trying to change the mode by disconnecting/reconnecting > > > > the cable or plugging in a USB device does not work. Also when the USB client mode is working on > > > > boot up, disconnecting the cable results in the below stack trace. > > > > > > > > root@colibri-vf:~# ping 192.168.11.234 > > > > PING 192.168.11.234 (192.168.11.234): 56 data bytes > > > > 64 bytes from 192.168.11.234: seq=0 ttl=64 time=5.399 ms > > > > ^C > > > > --- 192.168.11.234 ping statistics --- > > > > 1 packets transmitted, 1 packets received, 0% packet loss > > > > round-trip min/avg/max = 5.399/5.399/5.399 ms > > > > --------------------- On Cable disconnection------------------------- > > > > root@colibri-vf:~# [ 23.923607] irq 35: nobody cared (try booting with the "irqpoll" option) > > > > [ 23.930354] CPU: 0 PID: 0 Comm: swapper Not tainted 4.6.0-rc1-00044-gc76529e-dirty #120 > > > > [ 23.938359] Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) > > > > [ 23.944807] Backtrace: > > > > [ 23.947327] [<8010b56c>] (dump_backtrace) from [<8010b764>] (show_stack+0x18/0x1c) > > > > [ 23.954900] r7:00000023 r6:00000000 r5:00000000 r4:8f4ad240 > > > > [ 23.960644] [<8010b74c>] (show_stack) from [<803a1c00>] (dump_stack+0x24/0x28) > > > > [ 23.967893] [<803a1bdc>] (dump_stack) from [<80148150>] (__report_bad_irq+0x30/0xb8) > > > > [ 23.975655] [<80148120>] (__report_bad_irq) from [<801484a8>] (note_interrupt+0x260/0x2b0) > > > > [ 23.983918] r5:00000000 r4:8f4ad240 > > > > [ 23.987538] [<80148248>] (note_interrupt) from [<801460cc>] (handle_irq_event_percpu+0xe0/0x154) > > > > [ 23.996328] r10:00000000 r9:80b35683 r8:8f4ad240 r7:00000023 r6:00000000 r5:00000000 > > > > [ 24.004242] r4:00000000 r3:00000000 > > > > [ 24.007860] [<80145fec>] (handle_irq_event_percpu) from [<80146170>] (handle_irq_event+0x30/0x44) > > > > [ 24.016732] r10:80b0210c r9:90003100 r8:8f406000 r7:80b01f10 r6:00000000 r5:80b14ed0 > > > > [ 24.024646] r4:8f4ad240 > > > > [ 24.027206] [<80146140>] (handle_irq_event) from [<80148d2c>] (handle_fasteoi_irq+0xa8/0x170) > > > > [ 24.035737] r5:80b14ed0 r4:8f4ad240 > > > > [ 24.039363] [<80148c84>] (handle_fasteoi_irq) from [<801457a0>] (generic_handle_irq+0x2c/0x3c) > > > > [ 24.047973] r7:80b01f10 r6:00000000 r5:00000023 r4:80b14d8c > > > > [ 24.053706] [<80145774>] (generic_handle_irq) from [<80145a30>] (__handle_domain_irq+0x5c/0xb0) > > > > [ 24.062420] [<801459d4>] (__handle_domain_irq) from [<801013d0>] (gic_handle_irq+0x50/0x84) > > > > [ 24.070771] r9:90003100 r8:80b01e00 r7:90002100 r6:9000210c r5:80b023b0 r4:80b14ec0 > > > > [ 24.078611] [<80101380>] (gic_handle_irq) from [<8010c214>] (__irq_svc+0x54/0x70) > > > > [ 24.086101] Exception stack(0x80b01e00 to 0x80b01e48) > > > > [ 24.091173] 1e00: 80b360c0 00200000 80b36080 00000000 00000002 00000010 00000000 00000000 > > > > [ 24.099363] 1e20: 8f406000 90003100 80b0210c 80b01eac 00200000 80b01e50 8011cf18 8011caec > > > > [ 24.107545] 1e40: 600c0113 ffffffff > > > > [ 24.111039] r9:90003100 r8:8f406000 r7:80b01e34 r6:ffffffff r5:600c0113 r4:8011caec > > > > [ 24.118892] [<8011ca4c>] (__do_softirq) from [<8011cf18>] (irq_exit+0xb8/0xf4) > > > > [ 24.126114] r10:80b0210c r9:90003100 r8:8f406000 r7:00000000 r6:00000000 r5:00000010 > > > > [ 24.134028] r4:80b14d8c > > > > [ 24.136587] [<8011ce60>] (irq_exit) from [<80145a34>] (__handle_domain_irq+0x60/0xb0) > > > > [ 24.144429] [<801459d4>] (__handle_domain_irq) from [<801013d0>] (gic_handle_irq+0x50/0x84) > > > > [ 24.152782] r9:90003100 r8:80b01f10 r7:90002100 r6:9000210c r5:80b023b0 r4:80b14ec0 > > > > [ 24.160621] [<80101380>] (gic_handle_irq) from [<8010c214>] (__irq_svc+0x54/0x70) > > > > [ 24.168110] Exception stack(0x80b01f10 to 0x80b01f58) > > > > [ 24.173175] 1f00: 00000001 00000000 00000000 80115ac0 > > > > [ 24.181365] 1f20: 00000000 80b0210c 00000000 80b29c78 80b02114 80b00000 80b0210c 80b01f6c > > > > [ 24.189554] 1f40: 80b01f70 80b01f60 80108200 80108204 600c0013 ffffffff > > > > [ 24.196173] r9:80b00000 r8:80b02114 r7:80b01f44 r6:ffffffff r5:600c0013 r4:80108204 > > > > [ 24.204026] [<801081c4>] (arch_cpu_idle) from [<8013dea8>] (default_idle_call+0x28/0x34) > > > > [ 24.212134] [<8013de80>] (default_idle_call) from [<8013e018>] (cpu_startup_entry+0x164/0x1c0) > > > > [ 24.220776] [<8013deb4>] (cpu_startup_entry) from [<806fa2a4>] (rest_init+0x78/0x7c) > > > > [ 24.228518] r7:ffffffff > > > > [ 24.231097] [<806fa22c>] (rest_init) from [<80a00ce0>] (start_kernel+0x370/0x37c) > > > > [ 24.238599] [<80a00970>] (start_kernel) from [<80008078>] (0x80008078) > > > > [ 24.245127] handlers: > > > > [ 24.247415] [<804f2dcc>] ci_irq > > > > [ 24.250578] Disabling IRQ #35 > > > > > > > > Below is a diff of the changes to the kernel after applying these two patches > > > > > > > > diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi > > > > index a8a8e43..e85b534 100644 > > > > --- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi > > > > +++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi > > > > @@ -50,6 +50,14 @@ > > > > clock-frequency = <16000000>; > > > > }; > > > > > > > > + extcon_usbc_det: usbc_det { > > > > + compatible = "linux,extcon-usb-gpio"; > > > > + debounce = <25>; > > > > + id-gpio = <&gpio3 6 GPIO_ACTIVE_HIGH>; > > > > + pinctrl-names = "default"; > > > > + pinctrl-0 = <&pinctrl_usbc_det>; > > > > + }; > > > > + > > > > panel: panel { > > > > compatible = "edt,et057090dhu"; > > > > backlight = <&bl>; > > > > @@ -162,6 +170,10 @@ > > > > status = "okay"; > > > > }; > > > > > > > > +&usbdev0 { > > > > + extcon = <&extcon_usbc_det>, <&extcon_usbc_det>; > > > > +}; > > > > + > > > > > > Would you please show me your board design for vbus and id control? > > > And what's the default value for both signal? > > > > I have attached a screenshot of the PDF schematic. > > > > The PDF schematic is here if you would like to access it in it's entirety. > > http://developer.toradex.com/products/colibri-evaluation-board#Design_Guides_and_Application_Notes Sorry for the delay in reply. Have been involved in some other work on iMX6. > > > > We use a GPIO for only the ID pin. The ID pin is connected to a regulator's > > ENABLE which then controls the VBUS. > > When the ID = 0, the vbus = 5v; When the ID = 1, vbus = 0v. But after > checking sch, USB_ID pin controls EN pin directly, but not opposite > control, am I missing something? The ID pin goes to the EN pin but the EN pin is negative logic denoted by EN_1#. So for ID = 0 VBUS = 5V and ID = 1 VBUS = 0V. > > Do you know the connect/disconnect by using USB Cable (not ID cable), I > just want to know if the software can know connection, I did not understand this? Can you elaborate? > if not, please > try below patch on the top of this patch set, my patch set can't cover > this case for dual-role switch. Can you give me some pointers in the right direction to look and work on so I can also try to upstream our use case? > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > index 6986a50..d9a0119 100644 > --- a/drivers/usb/chipidea/udc.c > +++ b/drivers/usb/chipidea/udc.c > @@ -1960,6 +1960,9 @@ static int udc_id_switch_for_device(struct ci_hdrc *ci) > ci_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE, > OTGSC_BSVIS | OTGSC_BSVIE); > > + if (ci->dp_always_pullup) > + usb_gadget_vbus_connect(&ci->gadget); > + > return 0; > } > Tried the above none the less, but no change in previous observations. Thanks. Regards, Sanchayan. > Peter > > > > > > > > In your dts, both signals use the same pin. In the most of the designs, > > > they are two different pins. > > > Below are content from the chipidea binding doc: > > > > > > - extcon: phandles to external connector devices. First phandle should point to > > > external connector, which provide "USB" cable events, the second should point > > > to external connector device, which provide "USB-HOST" cable events. If one > > > of the external connector devices is not required, empty <0> phandle should > > > be specified. > > > > > > > My bad. I remembered this document but made the erroneous change. Second phandle > > should have been <0>. With this change I still have the previous observations. > > I will take a better look at your patchset. > > > > > -- > > 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