> From: Dinh Nguyen [mailto:dinh.linux@xxxxxxxxx] > Sent: Thursday, August 07, 2014 2:01 PM > > On Thu, Aug 7, 2014 at 3:55 PM, Paul Zimmerman > <Paul.Zimmerman@xxxxxxxxxxxx> wrote: > >> From: Dinh Nguyen [mailto:dinh.linux@xxxxxxxxx] > >> Sent: Thursday, August 07, 2014 5:12 AM > >> > >> On 8/1/14, 4:41 PM, Dinh Nguyen wrote: > >> > On Fri, 2014-08-01 at 20:42 +0000, Paul Zimmerman wrote: > >> >>> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of > dinguyen@xxxxxxxxxx > >> >>> Sent: Wednesday, July 30, 2014 8:21 AM > > > > ... > > > >> >>> config USB_DWC2_PERIPHERAL > >> >>> - tristate "Gadget only mode" > >> >>> + bool "Gadget only mode" > >> >>> depends on USB_GADGET > >> >>> help > >> >>> The Designware USB2.0 high-speed gadget controller > >> >>> - integrated into many SoCs. > >> >>> + integrated into many SoCs. Select this option if you want the > >> >>> + driver to operate in Peripheral-only mode. > >> >>> + > >> >>> +config USB_DWC2_DUAL_ROLE > >> >>> + bool "Dual Role mode" > >> >>> + depends on ((USB=y || USB=USB_DWC2) && (USB_GADGET=y)) > >> >> > >> >> Hi Dinh, > >> >> > >> >> I just noticed that for dual-role mode, you are not allowing USB_GADGET > >> >> to be modular. Is there a reason for that? If so, please mention it in > >> >> the commit message. It should also be explained in the help text. Or > >> >> maybe add another comment line saying "Dual-role mode requires USB Gadget > >> >> = y" or something like that. > >> >> > >> > > >> > I think it was an oversight on my part and there's not reason why > >> > USB_GADGET can't be modular. > >> > > >> > >> I went back to look this for v3 and it appears that I need USB_GADGET=y > >> to avoid a build error when building the new driver for Gadget or Dual-role. > >> > >> drivers/built-in.o: In function `dwc2_gadget_init': > >> /home/dinguyen/linux_dev/linux-socfpga/drivers/usb/dwc2/gadget.c:3516: > >> undefined reference to `usb_add_gadget_udc' > >> drivers/built-in.o: In function `s3c_hsotg_remove': > >> /home/dinguyen/linux_dev/linux-socfpga/drivers/usb/dwc2/gadget.c:3543: > >> undefined reference to `usb_del_gadget_udc' > >> /home/dinguyen/linux_dev/linux-socfpga/drivers/usb/dwc2/gadget.c:3549: > >> undefined reference to `usb_gadget_unregister_driver' > > > > I don't see why that shouldn't work. usb_add_gadget_udc is defined in > > udc-core.c, which gets built if CONFIG_USB_GADGET is set. What Kconfig > > line did you use when you got this build error? I think it should be: > > > > config USB_DWC2_DUAL_ROLE > > bool "Dual Role mode" > > depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2) > > > > Right, I think your original comment was why I had "USB_GADGET=y" as a > dependency for DWC2_DUAL_ROLE. If I replace USB_GADGET=y with just > USB_GADGET, and make USB_GADGET a module. This is fine if I build DWC > as module, but If I build DWC2 into the kernel, then the driver cannot > link those gadget functions in. I don't think just USB_GADGET will work. Please try it with the line I showed above. -- Paul ��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥