Customer: MCCI
Platform: i.MX8MP EVK
MCCI have got USB2 on Zephyr working with the IMX8MPlus and are debugging USB3. They got the phy working, but now they are seeing a strange DMA problem (only on USB3).
Get Configuration is trying to return a 93 byte descriptor. They set up the TRB (just as for USB2) and the XDCI starts it’s thing. But instead of sending 93 bytes, it sends only 32 bytes, with a CRC error (evidently because it thought something went wrong fetching the data). Something indeed went wrong, because the last 8 bytes of the 32 bytes are corrupt (compared to the memory buffer). (They’re just wrong – no obvious relationship…) AXI is 64 bits, so possibly the last beat went wrong in some way. Buffer is in DDR at an address that ends in ... F0 (so it’s 16 byte, not 32-byte, aligned).
MCCI is using the Cortex M7 to run this, in case that matters.
Code is shared for USB2 and USB3 path in this area, so MCCI is pretty sure they’re flushing the cache, etc.
Do you have any suggestion?
Hi @jason_he,
I would like to reproduce your working USB 3.0 device on Linux. Where can I download Linux kernel image?
Hi @jason_he,
I downloaded Linux kernel image (LF_v6.12.3-1.0.0_images_IMX8MPEVK.zip) and upgraded it on my imx8mp-evk board.
I tried to reproduce USB device enumeration after boot Linux, but host PC doesn't detect USB device connection. So, no USB device enumeration happen. Do you have any instruction to bring up USB device stack on the imx8mp-evk board?
I found below error message when booting Linux. I attached full booting log for your reference.
starting USB...
Bus usb@38100000: Failed to initialize board for imx8m USB
probe failed, error -1
I tested MCCI USB driver with Zephyr image. I set the RDC register before run Zephyr image, but I got NULL event as you see before. Are you using same u-boot image along with LF_v6.12.3-1.0.0_images_IMX8MPEVK.zip? Please confirm I downloaded correct version.
BTW, I suspected the USB 3.0 PHY setting cause this issue. I created another ticket and please take a look this ticket. I need the USB 3.0 femtoPHY register map and description. Can you help this?
Re: imx8mp-evk USB PHY initialization - NXP Community
I found below error message when booting Linux. I attached full booting log for your reference.
> I think these logs are from uboot. Can you run USB device after kernel boot?
Please confirm I downloaded correct version.
> From you previous log "U-Boot 2020.04-5.4.70-2.3.2+g185bdaaaf5 (Apr 02 2021 - 17:52:17 +0000)". I am using uboot from 5.4.70-2.3.2 and the others from 6.1.36. You may only reflash the uboot if you can use 6.12.3 kernel normally.
I need the USB 3.0 femtoPHY register map and description.
> Actually you needn't take care of RX_OVRD_IN_HI. I checked my EVK board and the value haven't been override. you can check the source code from kernel code. (drivers/phy/freescale/phy-fsl-imx8mq-usb.c)
// read
echo 0x1006 > /sys/kernel/debug/phy/phy-381f0040.usb-phy.2/ctrl_reg_base
echo 1 > /sys/kernel/debug/phy/phy-381f0040.usb-phy.2/ctrl_reg_count
cat /sys/kernel/debug/phy/phy-381f0040.usb-phy.2/ctrl_reg_value
// write
echo 0x1006 > /sys/kernel/debug/phy/phy-381f0040.usb-phy.2/ctrl_reg_base
echo 0xB80 > /sys/kernel/debug/phy/phy-381f0040.usb-phy.2/ctrl_reg_value
Hi @jason_he,
Okay, I updated same version as your u-boot and Linux kernel.
It looks like that USB device stack is not enabled by default after boot Linux. Can you tell me how I can enable USB device stack? Do you have script for it?
Regarding femtoPHY registers, I dumped femtoPHY register with Linux and Zephyr, registers are not same. I don't have register information, and I don't know exact meanings. So, I asked you provide register information.
root@imx8mpevk:~# cat /sys/kernel/debug/phy/phy-381f0040.usb-phy.2/phy-381f0040.usb-phy.2/ctrl_reg_value
Control Register 0x1000 value is 0x 0
Control Register 0x1001 value is 0x 0
Control Register 0x1002 value is 0x 0
Control Register 0x1003 value is 0x 0
Control Register 0x1004 value is 0x 0
Control Register 0x1005 value is 0x 0
Control Register 0x1006 value is 0x 0
Control Register 0x1007 value is 0x 0
Control Register 0x1008 value is 0x 880
Control Register 0x1009 value is 0x2bf8
Control Register 0x100a value is 0x 0
Control Register 0x100b value is 0x 8
Control Register 0x100c value is 0x4240
Control Register 0x100d value is 0x 4
Control Register 0x100e value is 0x 0
Control Register 0x100f value is 0x 0
Control Register 0x1010 value is 0x1100
Control Register 0x1011 value is 0x 9f
Control Register 0x1012 value is 0x5c1f
Control Register 0x1013 value is 0xc109
Control Register 0x1014 value is 0x 0
Control Register 0x1015 value is 0x 0
Control Register 0x1016 value is 0x 0
Control Register 0x1017 value is 0x 0
Control Register 0x1018 value is 0x 0
Control Register 0x1019 value is 0x 0
Control Register 0x101a value is 0x 0
Control Register 0x101b value is 0x f
Control Register 0x101c value is 0x 208
Control Register 0x101d value is 0x8000
Control Register 0x101e value is 0x 0
Control Register 0x101f value is 0x 0
root@imx8mpevk:~#
*** Booting Zephyr OS build mcci-v3.7-tmm-usb3-20250421a-75-g6dd71b23c6a6 ***
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1000: 0x 0
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1001: 0x 0
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1002: 0x 0
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1003: 0x 0
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1004: 0x 0
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1005: 0x 0
[00:00:00.000,000] <inf> udc_xdci_imx8mp: register 1006: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1007: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1008: 0x 880
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1009: 0x30ff
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 100a: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 100b: 0x 8
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 100c: 0x4240
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 100d: 0x 4
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 100e: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 100f: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1010: 0x1100
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1011: 0x 9f
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1012: 0x5c1f
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1013: 0xc00e
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1014: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1015: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1016: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1017: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1018: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 1019: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 101a: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 101b: 0x f
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 101c: 0x 208
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 101d: 0x8000
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 101e: 0x 0
[00:00:00.001,000] <inf> udc_xdci_imx8mp: register 101f: 0x 0
Hi @jason_he,
I ran your usb_gser.sh script but I got error as below.
root@imx8mpevk:/run/media/CHAEHEE SD-mmcblk1p1# ./usb_gser.sh
[ 92.987807] UDC core: g1: couldn't find an available UDC or it's busy
./usb_gser.sh: line 17: echo: write error: Device or resource busy
USB Serial enabled
Here is list of directories which created by script. I found echo "38100000.usb" > UDC command failed.
root@imx8mpevk:/sys/kernel/config/usb_gadget/g1# ls
UDC bDeviceProtocol bMaxPacketSize0 bcdUSB functions idVendor os_desc
bDeviceClass bDeviceSubClass bcdDevice configs idProduct max_speed strings
root@imx8mpevk:/sys/kernel/config/usb_gadget/g1# cat UDC
root@imx8mpevk:/sys/kernel/config/usb_gadget/g1# echo "38100000.usb" > UDC
[ 353.333924] UDC core: g1: couldn't find an available UDC or it's busy
-sh: echo: write error: Device or resource busy
Is there any node in /sys/class/udc/? (you need to plugin the USB cable and connect to PC)
please replace with the node name under /sys/class/udc/?
38100000.usb is the name based on 6.1.36 kernel.
I compared zephyr and linux dwc3 register configuration. and there are some difference . Actually I changed zephyr code and make it like linux these days. But it still doesn't work.
Design team will be back after 6.27 and I will check with him later.
Hi @jason_he,
I found HSIOAXI root clock setting is different in the Linux.
I changed HSIOAXI root clock setting to match the Linux, and it fixed the issue.
Super speed connection is working now.
Thank you for your help.
Great!
Actually I found both CCM_TARGET_ROOT7(HSIO) and CCM_TARGET_ROOT99(USB PHY) are different. But it still doesn't work when I changed it in uboot before running zephyr.bin.
Could you please share your steps and patches?
Another question is why USB disables it EPS and do reset again after receiving CONNECTDONE event(xdci_event_enum_done)? The step is different from Linux driver code.
Oh
I found CCM_TARGET_ROOT7 changed to 24M after running zephyr.bin. I am not sure if you configured CLK since ccm driver code is not suitable currently.
@jasonhe , could you help to check?