Skip to contentSkip to conversation

MUSB compile failure for imx28

PATCH Rogan Dawes 2 participants 6 messages Jan 2, 2025 – Jan 8, 2025

lore
Share & tools
lore
#0 lore raw

Hi folks,

I am trying to get a modern u-boot running on my Wink Hub v1 (Hi Fabio! :-)

One of the features I am trying to enable is ultimately usbacm console, but in the process of trying to get there, I first tried enabling MUSB.

configs/mx28evk_defconfig +1 -0
index fdab7ef73e5..8185c7e0d5a 100644
@@ -70,3 +70,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_MUSB_GADGET=y

The result was a failure to compile:

CC drivers/usb/musb-new/musb_gadget.o
drivers/usb/musb-new/musb_gadget.c: In function ‘map_dma_buffer’:
drivers/usb/musb-new/musb_gadget.c:108:40: warning: implicit declaration of function ‘dma_map_single’ [-Wimplicit-function-declaration]
108 | request->request.dma = dma_map_single(

      |                                        ^~~~~~~~~~~~~~

drivers/usb/musb-new/musb_gadget.c:113:43: error: ‘DMA_TO_DEVICE’ undeclared (first use in this function)
113 | ? DMA_TO_DEVICE
| ^~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c:113:43: note: each undeclared identifier is reported only once for each function it appears in drivers/usb/musb-new/musb_gadget.c:114:43: error: ‘DMA_FROM_DEVICE’ undeclared (first use in this function)

  114 |                                         : DMA_FROM_DEVICE);
      |                                           ^~~~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c:117:17: warning: implicit declaration of function ‘dma_sync_single_for_device’ [-Wimplicit-function-declaration]
  117 |                 dma_sync_single_for_device(musb->controller,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c: In function ‘unmap_dma_buffer’:
drivers/usb/musb-new/musb_gadget.c:140:17: warning: implicit declaration of function ‘dma_unmap_single’ [-Wimplicit-function-declaration]
  140 |                 dma_unmap_single(musb->controller,
      |                 ^~~~~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c:144:35: error: ‘DMA_TO_DEVICE’ undeclared (first use in this function)
  144 |                                 ? DMA_TO_DEVICE
      |                                   ^~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c:145:35: error: ‘DMA_FROM_DEVICE’ undeclared (first use in this function)
  145 |                                 : DMA_FROM_DEVICE);
      |                                   ^~~~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c:148:17: warning: implicit declaration of function ‘dma_sync_single_for_cpu’ [-Wimplicit-function-declaration]
  148 |                 dma_sync_single_for_cpu(musb->controller,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~

make[1]: *** [scripts/Makefile.build:257: drivers/usb/musb-new/musb_gadget.o] Error 1
make: *** [Makefile:1915: drivers/usb/musb-new] Error 2

This looked like it might be a result of the #include <common.h> removal, so I tried directly including linux/dma-mapping.h, but that seems to not be the correct approach, because the arguments to various functions are no longer as expected.

Any ideas on how to fix this?

Thanks!

Rogan

P.S. For what it is worth, I seem to have destroyed the console UART on my hardware, which is why I am trying to enable USB Gadget console. It also means that I am unable to provide any console logs from an actual running device. I do have another on the way, but right now, I'm actually trying to use the flash chip on my Hub 1 to hold an image read from the Hub 2, mount the various filesystems, and create a file that will enable a console on the Hub 2, which is otherwise locked down with HABv4!

#1 lore raw
Quoted 13 lines · Rogan Dawes

Hi folks,

I am trying to get a modern u-boot running on my Wink Hub v1 (Hi Fabio! :-)

One of the features I am trying to enable is ultimately usbacm console, but in the process of trying to get there, I first tried enabling MUSB.

configs/mx28evk_defconfig +0 -0
index fdab7ef73e5..8185c7e0d5a 100644

configs/mx28evk_defconfig CONFIG_USB_GADGET_VENDOR_NUM=0x0525 · line 73

Quoted 4 lines
configs/mx28evk_defconfig +1 -0
@@ -70,3 +70,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_MUSB_GADGET=y

* snipped compile errors *

Quoted 1 line

Any ideas on how to fix this?

Turns out the problem was failure to include:

CONFIG_USB_MUSB_PIO_ONLY=y

in the defconfig file. Would it make sense for this to be a configuration error with a suitable error message when enabled without this option?

I also had to remove the CONFIG_CI_UDC option, as it was the incorrect UDC driver, and resulted in duplicate symbols being defined.

Quoted 8 lines

P.S. For what it is worth, I seem to have destroyed the console UART on my hardware, which is why I am trying to enable USB Gadget console. It also means that I am unable to provide any console logs from an actual running device. I do have another on the way, but right now, I'm actually trying to use the flash chip on my Hub 1 to hold an image read from the Hub 2, mount the various filesystems, and create a file that will enable a console on the Hub 2, which is otherwise locked down with HABv4!

Unfortunately, while I can get it to compile now, I still don't get any new USB activity once I load it with snagrecover:

$ cat wink.yaml
flash-bin:
  path: u-boot.sb
$ snagrecover -s imx28 -f wink.yaml
2025-01-02 14:04:50,577 [INFO] Starting recovery of imx28 board
2025-01-02 14:04:50,637 [INFO] HID device 1-2 has hidraw dev /dev/hidraw1
2025-01-02 14:04:50,637 [INFO] Finished initializing HID device {pretty_addr}
2025-01-02 14:04:50,638 [INFO] Installing firmware flash-bin
2025-01-02 14:04:50,638 [INFO] Subfirmware: spl-sdps
2025-01-02 14:04:50,639 [INFO] SDPS write with parameters size:0xa3910 offset:0x00
2025-01-02 14:04:50,830 [INFO] Done installing firmware flash-bin
2025-01-02 14:04:50,830 [INFO] Done recovering imx28 board
2025-01-02 14:04:50,830 [INFO] Done recovering imx28 board

I did add the following entries, trying to match a similar config that worked for an OrangePi R1 I was using to confirm the concept:

CONFIG_USB_FUNCTION_ACM=y
CONFIG_USB_TTY=y
CONFIG_CONSOLE_MUX=y
CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="setenv stderr serial,usbacm; setenv stdout serial,usbacm; setenv stdin serial,usbacm"

This results in the OrangePi R1 enumerating as a new CDC-ACM device once it has booted and executed the PREBOOT command. Unfortunately, I don't get a similar result from the Wink Hub. And without the console UART, it's really difficult to debug what is going wrong :-(

Does anyone have an i.MX28 target that they might be able to use to confirm the basic configuration works? Many thanks!

Regards,

Rogan

#2 lore raw
In reply to Rogan Dawes

Hi Rogan,

Quoted 8 lines · Rogan Dawes

Hi folks,

I am trying to get a modern u-boot running on my Wink Hub v1 (Hi Fabio! :-)

One of the features I am trying to enable is ultimately usbacm console, but in the process of trying to get there, I first tried enabling MUSB.

There is no MUSB controller on the i.MX28.

The USB IP on the i.MX28 is ChipIdea.

#3 lore raw
Quoted 9 lines · Fabio Estevam

Hi Rogan,

Quoted 6 lines · Rogan Dawes

Hi folks,

I am trying to get a modern u-boot running on my Wink Hub v1 (Hi Fabio! :-)

Quoted 6 lines
Quoted 2 lines

One of the features I am trying to enable is ultimately usbacm console, but in the process of trying to get there, I first tried enabling MUSB.

There is no MUSB controller on the i.MX28.

The USB IP on the i.MX28 is ChipIdea.

That would explain it, then! :facepalm:

Thanks

Rogan

#4 lore raw
Quoted 1 line · Rogan Dawes

That would explain it, then! :facepalm:

I tested to access the console via usbacm and it worked on my imx28evk:

configs/mx28evk_defconfig +2 -0
@@ -70,3 +70,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_FUNCTION_ACM=y
+CONFIG_BOOTDELAY=100

First, I booted via normal serial console and run:

=> setenv stderr usbacm && setenv stdout usbacm && setenv stdin usbacm && saveenv

Then booted again, and I saw on the console:

U-Boot 2025.01-dirty (Jan 07 2025 - 16:10:42 -0300)

CPU:   Freescale i.MX28 rev1.2 at 454 MHz
BOOT:  SSP SD/MMC #0, 3V3
DRAM:  128 MiB
Core:  91 devices, 13 uclasses, devicetree: separate
NAND:  2048 MiB
MMC:   MXS MMC: 0
Loading Environment from MMC... Reading from MMC(0)... OK
In:    usbacm
Out:   usbacm
Err:   usbacm

Then, on another PC window:

sudo picocom -b 115200 /dev/ttyACM0

And the console can be seen there.

#5 lore raw
Quoted 6 lines · Fabio Estevam
Quoted 1 line · Rogan Dawes

That would explain it, then! :facepalm:

I tested to access the console via usbacm and it worked on my imx28evk:

Yes, I have also been able to get access to my Wink 1 with usbacm. Turns out the approach of using one of the Application UART's also worked, once I help the ZWave peripheral in reset, and "hijacked" its uart!

Thanks for your assistance!

Rogan