I am trying to get USB gadget serial port (using legacy/g_serial.ko) up in our custom board based on LS1021a-twr. Current linux kernel is based on NXP tag lf-5.15.32-2.0.0 When I insert g_serial.ko module I get below error. #insmod g_serial.ko root@ls1021atwr:/lib/modules/5.15[ 6609.125266] udc-core: couldn't find an available UDC - added [g_serial] to list of pending drivers.
I tried to follow NXP article hoping it will insert any missing dependencies. https://docs.nxp.com/bundle/GUID-C241BB12-95F6-4D6B-A205-7EFD35551DE2/page/GUID-FFE157FA-E8DF-4494-8... In there it mentions to set, CONFIG_USB_FSL_MPH_DR_OF (Enable NXP EHCI USB controller) However I cannot see this option available in kernel config. I cannot find this kernel source file included either, "drivers/usb/gadget/fsl_usb2_udc.c", as mentioned in the same article.
Please refer to the following procedure
Update kernel menuconfig
Device tree
Device Tree update, change property dr_mode’s data from “host” to “peripheral”, add property maximum-speed = “super-speed”; as below
Build whole Linux kernel, below KO will be compiled:
LD [M] drivers/usb/gadget/function/usb_f_acm.ko
LD [M] drivers/usb/gadget/function/u_serial.ko
LD [M] drivers/usb/gadget/function/usb_f_obex.ko
LD [M] drivers/usb/gadget/function/usb_f_serial.ko
LD [M] drivers/usb/gadget/legacy/g_serial.ko
Insmod ko on Layerscape board console
insmod libcomposite.ko
insmod u_serial.ko
insmod usb_f_acm.ko
insmod usb_f_obex.ko
insmod usb_f_serial.ko
insmod g_serial.ko