1

My issue

I am creating an image for my RaspberryPi 4 64 using Yocto and the meta-raspberrypi layer. I would like to plug the RPi into my laptop, have my laptop get an IP, and SSH into the RPi.

My issue is that my laptop does not "see" when I plug the RPi (i.e. nothing appears in dmesg). Also I don't see any USB network interface when I ip l in the RPi:

$ ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether dc:a6:32:cd:0f:c4 brd ff:ff:ff:ff:ff:ff

What I tried

I did set ENABLE_DWC2_PERIPHERAL = "1" such that config.txt has the line:

dtoverlay=dwc2,dr_mode=peripheral

Which, in my understanding, tells it to set the micro-c to peripheral mode (not sure which usb is "dwc2", though... but I'm guessing it's the micro-c).

Using kernel-module-dwc2

With the following Yocto line:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-dwc2"

I tried to make the following kernel module load at boot time (my understanding was that dwc2 was the module required for the USB chip of the RPi 4):

$ lsmod
dwc2 196608 0 - Live 0xffffffc008ac0000

At boot time, I see the following lines:

[    3.143331] dwc2 fe980000.usb: fe980000.usb supply vusb_d not found, using dummy regulator
[    3.152787] dwc2 fe980000.usb: fe980000.usb supply vusb_a not found, using dummy regulator
[    3.263285] dwc2 fe980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM

Using kernel-module-g-ether

With the following Yocto line:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-g-ether kernel-module-usb-f-eem"

I tried to make the following kernel modules load at boot time (those are the ones I load on my pocketbeagle, where it works):

$ lsmod
usb_f_eem 16384 0 - Live 0xffffffc008ad1000
g_ether 16384 0 - Live 0xffffffc008af2000
usb_f_rndis 32768 1 g_ether, Live 0xffffffc008ae4000
u_ether 24576 3 usb_f_eem,g_ether,usb_f_rndis, Live 0xffffffc008ad9000
libcomposite 65536 3 usb_f_eem,g_ether,usb_f_rndis, Live 0xffffffc008ac0000

Notes

I can boot into U-Boot, but I don't really know how to check that the device tree is setting dr_mode to peripheral for the micro-c (i.e. I don't know the address to pass to fdt print). I would like to verify that it is in peripheral mode.

Also I checked the kernel options with bitbake -c menuconfig virtual/kernel and the USB gadget options were set as "M", so it seemed fine to me...

1 Answer 1

0

Found it! I needed:

KERNEL_MODULE_AUTOLOAD += "dwc2 g_ether usb_f_ecm usb_f_eem"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-dwc2 kernel-module-g-ether kernel-module-usb-f-ecm kernel-module-usb-f-eem"

And the modules:

$ lsmod
usb_f_eem 16384 0 - Live 0xffffffc008aee000
usb_f_ecm 20480 1 - Live 0xffffffc008b18000
g_ether 16384 0 - Live 0xffffffc008b0f000
usb_f_rndis 32768 2 g_ether, Live 0xffffffc008b01000
u_ether 24576 4 usb_f_eem,usb_f_ecm,g_ether,usb_f_rndis, Live 0xffffffc008af6000
libcomposite 65536 4 usb_f_eem,usb_f_ecm,g_ether,usb_f_rndis, Live 0xffffffc008add000
dwc2 114688 0 - Live 0xffffffc008ac0000

dwc2 needs g_ether, as per the log output below:

[   90.587953] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[   90.594775] g_ether gadget: g_ether ready
[   90.599073] dwc2 fe980000.usb: bound driver g_ether

usb_f_eem is needed otherwise the usb interface is apparently not recognized properly on my laptop side, for some reason.

And g_ether loads all the other of the list above, i.e. usb_f_ecm, usb_f_rndis, u_ether, libcomposite.

Now I finally get my usb network interface:

$ ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether dc:a6:32:cd:0f:c4 brd ff:ff:ff:ff:ff:ff
4: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether c6:cf:14:d2:48:b9 brd ff:ff:ff:ff:ff:ff

I must say I don't really get why I need usb_f_ecm here and usb_f_eem seems to be enough on the pocketbeagle. I would be happy to have some insights!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.