Hello, I've been testing the NetBSD 10 Arm bootable images on my Beaglebone Black, and I've found that the usb host (motg 1) is completely unresponsive. I tried connecting and disconnecting various usb thumb drives and wireless adapters, but the system doesn't seem to recognize anything happening on that bus. There are no dmesg messages, no devices shown in usbdevs, no interrupts for motg 1 in intrctl. I also built trunk with usb debugging enabled and usb kernhist enabled, but there is no output or history when a device is plugged in.
To make a long story short, the bootable images switched from using U-Boot v2018.11, to v2022.04, and this seems to be the source of the problem. I was able to re-create the issue by taking and older bootable image (where the usb host was working), and replacing the old U-Boot image with the new v2022.04 U-Boot, and sure enough the exact same issue occurred. I'm not sure exactly what changed in the U-Boot source code to cause this, but it seems that previously NetBSD was relying on U-Boot to initialize the motg controller, and with the new U-Boot that initialization is not happening. I found that the old U-Boot code powers on the phy for the usb controller, but there is no equivalent code in the NetBSD driver: static void ti_musb_set_phy_power(struct udevice *dev, u8 on) { struct ti_musb_platdata *platdata = dev_get_platdata(dev); if (on) { clrsetbits_le32(platdata->ctrl_mod_base, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN, OTGVDET_EN | OTGSESSENDEN); ... I tried adding the equivalent to the ti_motg_attach() (right before motg_init() is called): bus_addr_t ctrl_reg = 0x44e10620; static bus_space_handle_t ctrl_h; bus_space_map(sc->sc_ctrliot, ctrl_reg, 12, 0, &ctrl_h); val = bus_space_read_4(sc->sc_ctrliot, ctrl_h, 8); val &= ~(TI_USB_CTRL_CMPWRDWN | TI_USB_CTRL_OTGPWRDWN); val |= (TI_USB_CTRL_OTGVDETEN | TI_USB_CTRL_OTGSESSENDEN); bus_space_write_4(sc->sc_ctrliot, ctrl_h, offset, val); This improved things a bit, now interrupts are triggered, and devices are successfully identified, however they are unstable. When I try usb storage devices, they are identified successfully, but they are un-mountable. When I tried my run0 wlan adapter, it is identified, but causes a panic after I start wpa_supplicant: armv7# usbdevs addr 1: MOTG root hub, NetBSD addr 1: MOTG root hub, NetBSD addr 2: 802.11 n WLAN, Ralink armv7# ifconfig ... run0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ssid "" powersave off address: 70:f1:1c:4b:14:c3 media: IEEE802.11 autoselect (DS1) status: no network ... panic: kernel diagnostic assertion "ep->phase == IDLE" failed: file "src-draft/sys/dev/usb/motg.c", line 1355 [ 426.1765561] cpu0: Begin traceback... [ 426.1765561] 0xa7a87cfc: netbsd:db_panic+0x14 [ 426.1837860] 0xa7a87d1c: netbsd:vpanic+0x114 [ 426.1837860] 0xa7a87d34: netbsd:kern_assert+0x40 [ 426.1948661] 0xa7a87d8c: netbsd:motg_device_ctrl_start1+0x6c8 [ 426.2037819] 0xa7a87dd4: netbsd:usbd_transfer+0x130 [ 426.2150160] 0xa7a87e34: netbsd:usbd_do_request_len+0x118 [ 426.2150160] 0xa7a87e54: netbsd:usbd_do_request+0x2c [ 426.2252487] 0xa7a87e7c: netbsd:run_read+0x3c [ 426.2337876] 0xa7a87ea4: netbsd:run_bbp_write.isra.0+0x34 [ 426.2453804] 0xa7a87eec: netbsd:run_set_chan.isra.0+0xa08 [ 426.2542159] 0xa7a87f34: netbsd:run_newstate_cb+0x5c [ 426.2542159] 0xa7a87f6c: netbsd:run_task+0x78 [ 426.2657437] 0xa7a87fac: netbsd:usb_task_thread+0xc8 [ 426.2737818] cpu0: End traceback... [ 426.2737818] dump to dev 92,1 not possible [ 426.2857962] rebooting... I've been stuck at this point for a while, I've tried adding other various bits and pieces from U-Boot to NetBSD's ti_motg driver, but no luck. Any suggestions? Best, James