Hi again, > -----Mensaje original----- > De: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb- > owner@xxxxxxxxxxxxxxx] En nombre de Fernandez Gonzalo > Enviado el: sábado, 28 de abril de 2012 23:48 > Para: Chen Peter-B29397; linux-usb@xxxxxxxxxxxxxxx > Asunto: RE: iMX25PDK - Problems with USB gadget > > Peter, thanks for your comments. I'll came back next Wednesday and will > give it a try. I'll let you know the results. > > > > > > > > > > Problem #1.- Continuous reset of the USB controller > > > To check if the hardware is fine, I've run the BSP > FSL-2.6.31_09.12.01 > > > from Freescale and I can load any gadget driver with positive > results. > > > > > > The problem appears on new kernels when fsl_udc_core is compiled > with > > > VERBOSE and DEBUG defined. I've tried 3.2.2, 3.3.2 and 3.4-rc3 > kernels, > > > all of them with the same results; if I load -any- gadget driver and > > > plug the USB cord into my Linux Host, I get the following error > > > messages, continuously, non stopping: > > > > ------------------------------------------------------------------------ > > > --- [fsl_udc_irq] reset int > > > [reset_irq] Controller reset > > > [dr_controller_setup] vir[qh_base] is ffdf9000 phy[qh_base] is > > > 0x838c4000 reg is 0x838c4000 > > > [fsl_udc_irq] reset int > > > [reset_irq] Controller reset > > > [dr_controller_setup] vir[qh_base] is ffdf9000 phy[qh_base] is > > > 0x838c4000 reg is 0x838c4000 > > > .......... > > > .......... > > > > ------------------------------------------------------------------------ > > > --- > > > If fsl_udc_core is compiled with VERBOSE -OR- DEBUG undefined, I can > > > load any gadget driver with no "reset" problem. > > > > > PORTSCX_PORT_RESET is cleared by hardware automatically when the reset > > is completed, if you have inserted too many debug message after reset > > occurs, the PORTSCX_PORT_RESET will be 0. > > > > The code at upstream may have some problems, you may not need below > code: > > 1833 } else { > > 1834 VDBG("Controller reset"); > > 1835 /* initialize usb hw reg except for regs for EP, > not > > 1836 * touch usbintr reg */ > > 1837 dr_controller_setup(udc); > > 1838 > > 1839 /* Reset all internal used Queues */ > > 1840 reset_queues(udc); > > 1841 > > 1842 ep0_setup(udc); > > 1843 > > 1844 /* Enable DR IRQ reg, Set Run bit, change udc > state > > */ > > 1845 dr_controller_run(udc); > > 1846 udc->usb_state = USB_STATE_ATTACHED; > > 1847 } > > > > > This solves the reset issue. Now I can use fsl_udc_core compiled with DEBUG and VEROSE defined. > > > > > > Problem #2.- g_webcam enumeration > > > The enumeration starts as soon as the USB cord is plugged into my > Linux > > > Host, but with no user space support (the device /dev/video0 hasn't > been > > > opened). > > > > > > With the USB cord unplugged I've traced the call chain when g_webcam > is > > > modprobed down to "fsl_pullup". This function is only called once > and, > > > as expected, "is_on" parameter is 0 so the pullup should disabled, > but > > > when I plug the USB cord ..... enumeration starts :( > > > > > Some logic about controlling controller run/stop is incomplete at > current > > i.mx framework (lack of vbus interrupt to trigger fsl_vbus_session) > > > > Temp solution for let your thing work (only for g_webcam): > > 1. Does not set USB_CMD_RUN_STOP at dr_controller_run > > 2. Change fsl_pullup: > > > > 1234 if (can_pullup(udc)) > > --> > > 1234 if (is_on) > > I've also modified this, but the problem persists. In the original code can_pullup(udc) was returning 0, so the problem should be just the opposite (not able to activate the pullup). I've compiled g_webcam for debug output and added a bunch of printks along the composite and g_webcam files to see how all of this is flowing (their output begins with "<composite> =>"). In usb_udc_core I've also added printks where the pullups are enabled/disabled. This is the debug output when g_webcam is modprobed: root@freescale ~$ modprobe g_webcam <composite> => usb_composite_probe <composite> => composite_bind <composite> => usb_ep_autoconfig_reset <composite> => usb_string_id <composite> => usb_string_id <composite> => usb_string_id <composite> => usb_add_config g_webcam gadget: adding config #1 'Video'/bf018de0 <composite> => uvc_bind_config <composite> => usb_string_id <composite> => usb_string_id <composite> => usb_string_id <composite> => usb_add_function g_webcam gadget: adding 'uvc'/c3b14008 to config 'Video'/bf018de0 <composite> => uvc_function_bind g_webcam gadget: uvc_function_bind <composite> => usb_ep_autoconfig <composite> => usb_ep_autoconfig_ss <composite> => ep_matches <composite> => ep_matches <composite> => usb_ep_autoconfig <composite> => usb_ep_autoconfig_ss <composite> => ep_matches <composite> => ep_matches <composite> => ep_matches <composite> => ep_matches <composite> => usb_interface_id <composite> => usb_interface_id <composite> => uvc_copy_descriptors <composite> => uvc_copy_descriptors <composite> => usb_function_deactivate [fsl_pullup]: PULLUP OFF <composite> => uvc_video_init <composite> => uvc_queue_init <composite> => uvc_register_video g_webcam gadget: cfg 1/bf018de0 speeds: high full g_webcam gadget: interface 0 = uvc/c3b14008 g_webcam gadget: interface 1 = uvc/c3b14008 <composite> => usb_ep_autoconfig_reset g_webcam gadget: Webcam Video Gadget g_webcam gadget: g_webcam ready fsl-usb2-udc: bind to driver g_webcam root@freescale ~$ root@freescale ~$ Please, note this output: [fsl_pullup]: PULLUP OFF. Now I plug the USB cord in my host: root@freescale ~$ root@freescale ~$ root@freescale ~$ <composite> => composite_suspend g_webcam gadget: suspend <composite> => composite_resume g_webcam gadget: resume [fsl_udc_irq] reset int [fsl_udc_irq] Packet int <composite> => count_configs [fsl_build_dtd] length = 18 address= 0x83b81000 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 [fsl_udc_irq] reset int [fsl_udc_irq] Packet int [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 [fsl_udc_irq] Packet int <composite> => count_configs [fsl_build_dtd] length = 18 address= 0x83b81000 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => config_desc <composite> => config_buf <composite> => usb_descriptor_fillbuf [fsl_build_dtd] length = 9 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => config_desc <composite> => config_buf <composite> => usb_descriptor_fillbuf [fsl_build_dtd] length = 309 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => get_string <composite> => collect_langs <composite> => collect_langs [fsl_build_dtd] length = 4 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => get_string <composite> => lookup_string <composite> => usb_gadget_get_string [fsl_build_dtd] length = 28 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => get_string <composite> => lookup_string <composite> => usb_gadget_get_string [fsl_build_dtd] length = 34 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => set_config g_webcam gadget: high-speed config #1: Video <composite> => uvc_function_set_alt g_webcam gadget: uvc_function_set_alt(0, 0) <composite> => uvc_function_set_alt g_webcam gadget: uvc_function_set_alt(1, 0) [fsl_build_dtd] length = 0 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int <composite> => composite_setup_complete g_webcam gadget: setup complete --> -108, 0/0 <composite> => get_string <composite> => lookup_string <composite> => usb_gadget_get_string [fsl_build_dtd] length = 12 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => get_string <composite> => lookup_string <composite> => usb_gadget_get_string <composite> => lookup_string <composite> => usb_gadget_get_string [fsl_build_dtd] length = 28 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => get_string <composite> => lookup_string <composite> => usb_gadget_get_string <composite> => lookup_string <composite> => usb_gadget_get_string [fsl_build_dtd] length = 32 address= 0x83b81000 [process_ep_req] Request not complete [dtd_complete_irq] status of process_ep_req= 1, ep = 0 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 <composite> => composite_setup_complete [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int [process_ep_req] dTD transmitted successful [dtd_complete_irq] status of process_ep_req= 0, ep = 0 [fsl_udc_irq] Packet int <composite> => uvc_function_set_alt g_webcam gadget: uvc_function_set_alt(1, 0) [fsl_build_dtd] length = 0 address= 0x83b81000 [fsl_udc_irq] Packet int <composite> => composite_setup_complete g_webcam gadget: setup complete --> -108, 0/0 g_webcam gadget: non-core control reqa1.87 v0100 i0001 l26 [fsl_udc_irq] Packet int [fsl_udc_irq] Packet int g_webcam gadget: non-core control reqa1.81 v0100 i0001 l26 root@freescale ~$ root@freescale ~$ root@freescale ~$ root@freescale ~$ Any ideas? Gonzalo. -- 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