Saturday, March 23, 2024

A note on UUU

I didn't pay much attention to the UUU tool till we ran into an issue recently with imx8mm.

Adding this note as a future reference.

In a new port build, UUUing the image didn't proceed as usual, so checked its help, then ran in verbose mode and individual command mode to see what's going on

First check the lsusb


$ ./uuu -lsusb

uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.141-3-g3a5beb6


Connected Known USB Devices

Path Chip Pro Vid Pid BcdVersion

==================================================

3:6 MX8MM SDP: 0x1FC9 0x0134 0x0101



$ lsusb

Bus 003 Device 017: ID 1fc9:0134 NXP Semiconductors SE Blank M845S


Now, UUU in verbose mode. This will also list all compatible configs


$ sudo ./uuu -v -b emmc_all imx8mm-boot.bin imx8mm.sdcard

uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.141-3-g3a5beb6


Build in config:

Pctl Chip Vid Pid BcdVersion

==================================================

SDPS: MX8QXP 0x1fc9 0x012f [0x0002..0xffff]

SDPS: MX8QM 0x1fc9 0x0129 [0x0002..0xffff]

SDPS: MX8DXL 0x1fc9 0x0147

SDPS: MX28 0x15a2 0x004f

SDPS: MX815 0x1fc9 0x013e

SDPS: MX865 0x1fc9 0x0146

SDPS: MX8ULP 0x1fc9 0x014a

SDPS: MX8ULP 0x1fc9 0x014b

SDPS: MX93 0x1fc9 0x014e

SDPS: MX95 0x1fc9 0x015d

SDP: MX7D 0x15a2 0x0076

SDP: MX6Q 0x15a2 0x0054

SDP: MX6D 0x15a2 0x0061

SDP: MX6SL 0x15a2 0x0063

SDP: MX6SX 0x15a2 0x0071

SDP: MX6UL 0x15a2 0x007d

SDP: MX6ULL 0x15a2 0x0080

SDP: MX6SLL 0x1fc9 0x0128

SDP: MX7ULP 0x1fc9 0x0126

SDP: MXRT106X 0x1fc9 0x0135

SDP: MX8MM 0x1fc9 0x0134

SDP: MX8MQ 0x1fc9 0x012b

SDPU: SPL 0x0525 0xb4a4 [0x0000..0x04ff]

SDPV: SPL1 0x0525 0xb4a4 [0x0500..0x9998]

SDPV: SPL1 0x1fc9 0x0151 [0x0500..0x9998]

SDPU: SPL 0x0525 0xb4a4 [0x9999..0x9999]

SDPU: SPL 0x3016 0x1001 [0x0000..0x04ff]

SDPV: SPL1 0x3016 0x1001 [0x0500..0x9998]

FBK: 0x066f 0x9afe

FBK: 0x066f 0x9bff

FBK: 0x1fc9 0x0153

FB: 0x0525 0xa4a5

FB: 0x18d1 0x0d02

FB: 0x3016 0x0001

FB: 0x1fc9 0x0152

FB: 0x0483 0x0afb


Run built-in script:

 

uuu_version 1.4.149


# @_flash.bin            | bootloader, which can extract from wic image

# @_image   [_flash.bin] | wic image burn to emmc.



# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ

SDP: boot -f imx8mm-boot.bin -scanlimited 0x800000


# This command will be run when ROM support stream mode

# i.MX8QXP, i.MX8QM

SDPS: boot -scanterm -f imx8mm-boot.bin -scanlimited 0x800000


# These commands will be run when use SPL and will be skipped if no spl

# SDPU will be deprecated. please use SDPV instead of SDPU

# {

SDPU: delay 1000

SDPU: write -f imx8mm-boot.bin -offset 0x57c00

SDPU: jump -scanlimited 0x800000

# }


# These commands will be run when use SPL and will be skipped if no spl

# if (SPL support SDPV)

# {

SDPV: delay 1000

SDPV: write -f imx8mm-boot.bin -skipspl -scanterm -scanlimited 0x800000

SDPV: jump -scanlimited 0x800000

# }



FB: ucmd setenv fastboot_dev mmc

FB: ucmd setenv mmcdev ${emmc_dev}

FB: ucmd mmc dev ${emmc_dev}

FB: flash -raw2sparse all imx8mm.sdcard

FB: flash -scanterm -scanlimited 0x800000 bootloader imx8mm-boot.bin

FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;

FB: ucmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0

FB: done



Wait for Known USB Device Appear...

New USB Device Attached at 3:6

3:6>Start Cmd:SDP: boot -f imx8mm-boot.bin -scanlimited 0x800000

100%3:6>Okay (0.652s)

^C


It doesn't proceed beyond this SDP and gets stuck. So, if you run


$ sudo ./uuu SDP: boot -f imx8mm-boot.bin -scanlimited 0x800000


it'll be successful, but SDPV won't


$ ./uuu -lsusb

uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.141-3-g3a5beb6


Connected Known USB Devices

Path Chip Pro Vid Pid BcdVersion

==================================================


So, it's not listing down any compatible mode. Let's check what USB is seeing


$ lsusb

Bus 003 Device 016: ID 0525:0151 Netchip Technology, Inc. USB download gadget


In the UUU config listing we saw above, there's no config compatible with the vid/pid USB is seeing


In NXP u-boot commit e330a88a8a76f1815d54109c6ad0d94b34808dac, they had changed vid/pid CONFIG_USB_GADGET_VENDOR_NUM/CONFIG_USB_GADGET_PRODUCT_NUM, but we had't changed them in our defconfig

For example, at SDPV, UUU expects 0x1fc9/0x0151

After accommodating the vid/pid change, things work as usual with UUU.


commit e330a88a8a76f1815d54109c6ad0d94b34808dac

Author: Frank Li <Frank.Li@nxp.com>

Date:   Thu Dec 16 12:21:49 2021 -0600


    MLK-25803-2: Update VID/PID

    

    VID 0x525 and PID 0xa4a5 already registered as

    PLX Technology, Inc.

    Linux-USB File-backed Storage Gadget

    

    But fastboot device is not mass storage devices

    windowns 10 latest update already cached above vid/pid

    

    Change to use Freescale VID 0x1fc9

    

    PID 0x151, for SPL SDP HID download

    PID 0x152, for Fastboot

    PID 0x153, for Kernel fastboot

    

    Need update uuu above 1.4.182

    

    Signed-off-by: Frank Li <Frank.Li@nxp.com>

    Reviewed-by: Ye Li <ye.li@nxp.com>

    (cherry picked from commit 7b84c587ba607844d53a7553c7238e6acd0bba9a)


diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c

index 46b7f80b8b..7644f1e1e6 100644

--- a/arch/arm/mach-imx/spl.c

+++ b/arch/arm/mach-imx/spl.c

@@ -183,7 +183,7 @@ u32 spl_boot_device(void)

 #ifdef CONFIG_SPL_USB_GADGET

 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)

 {

-       put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM + 0xfff, &dev->idProduct);

+       put_unaligned(0x0151, &dev->idProduct);

 

        return 0;

 }

diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig

index ae27857e6f..294d580b91 100644

--- a/configs/imx6dl_mamoj_defconfig

+++ b/configs/imx6dl_mamoj_defconfig

@@ -58,6 +58,6 @@ CONFIG_USB=y

 # CONFIG_SPL_DM_USB is not set

 CONFIG_USB_GADGET=y

 CONFIG_USB_GADGET_MANUFACTURER="FSL"

-CONFIG_USB_GADGET_VENDOR_NUM=0x0525

-CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5

+CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9

+CONFIG_USB_GADGET_PRODUCT_NUM=0x0152

 CONFIG_CI_UDC=y

: