On 19.08.24 16:36, Lukasz Majewski wrote: > Hi Benjamin, > >> Hi Lukasz, >> did you test this? It does not work for me. When I try it, the U-Boot >> hangs in SPL. Here is what I got: >> From Host: >> >> bhahn@llp-hahn:~/git-repos/u-boot$ sudo uuu -b spl >> build/mini/flash.bin uuu (Universal Update Utility) for nxp imx chips >> -- lib1.4.193 >> >> Success 0 Failure 0 >> >> >> 7:3 1/ 1 [=================100%=================] SDP: boot -f >> build/mini/flash.bin >> > Please test this branch: > https://github.com/lmajewski/u-boot/commits/phycore-imx8mm-qspi-nvme > > On HOST: > uuu -v -b qspi ~/work/DENX/u-boot/flash.bin > > Stop on u-boot prompt. > > u-boot=> fastboot 0 > > QSPI is flashed via USB - however - I've noticed that there are some > flipped bits on USB transmission when I do compare it with tftp > transfer. > > This needs to be investigated, however seems to be an orthogonal > problem from QSPI boot support.
I tested your branch. Your commands seem to work. Here is the log: U-Boot SPL 2024.10-rc2-g718c0f57cacb (Aug 21 2024 - 10:12:26 +0200) WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) Trying to boot from USB SDP SDP: initialize... SDP: handle requests... Downloading file of size 984992 to 0x40400000... done Jumping to header at 0x40400000 Header Tag is not an IMX image Found header at 0x40424a00 NOTICE: BL31: v2.6(release):lf-5.15.71-2.2.1-0-gf4540f956 NOTICE: BL31: Built : 06:10:48, Apr 13 2023 U-Boot 2024.10-rc2-g718c0f57cacb (Aug 21 2024 - 10:12:26 +0200) CPU: Freescale i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz) CPU: Industrial temperature grade (-40C to 105C) at 42C Reset cause: POR Model: PHYTEC phyBOARD-Polis-i.MX8MM RDK DRAM: 2 GiB Core: 114 devices, 28 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... *** Warning - bad CRC, using default environment Reading from MMC(2)... In: serial@30880000 Out: serial@30880000 Err: serial@30880000 Net: eth0: ethernet@30be0000 Hit any key to stop autoboot: 0 u-boot=> fastboot 0 Starting download of 1194400 bytes ......... downloading of 1194400 bytes finished Unknown command 'qspihdr' - try 'help' SF: Detected n25q256ax1 with page size 256 Bytes, erase size 64 KiB, total 32 MiB SF: 1245184 bytes @ 0x0 Erased: OK device 0 offset 0x0, size 0x1239a0 SF: 1194400 bytes @ 0x0 Written: OK I noticed this message in the log though: Unknown command 'qspihdr' - try 'help' Booting over qspi does not work. Probably because it is not a dedicated qspi flash image (does not get flashed with the correct offset). About some bits getting flipped: For me it is not just some bits getting flipped. I read back the image from /dev/mtd0 with the dd command and compare the hexdump ouput to the original image. Theoretically it should identical, but that is not the case. There are not just some flipped bits, but the Image flashed via uuu looks like a completely different image. I also tested flashing with dd in linux and in U-Boot with loading the image via fatload from the sdcard and flashing it with "sf update ${loadaddr} 0 ${filesize}". With those two flashing methods I get an Image that is identical to the original Image when I read it back, as I would expect. Benjamin > >> Log on target: >> >> U-Boot SPL 2024.10-rc2-00131-g0303f2240376 (Aug 19 2024 - 15:18:36 >> +0200) WDT: Started watchdog@30280000 with servicing every 1000ms >> (60s timeout) Trying to boot from USB SDP >> >> U-Boot SPL 2024.10-rc2-00131-g0303f2240376 (Aug 19 2024 - 15:18:36 >> +0200) WDT: Started watchdog@30280000 with servicing every 1000ms >> (60s timeout) Trying to boot from USB SDP >> >> To me it looks like there are some changes missing to get this >> feature to work. >> You can take a look at my commits where I added this feature for >> imx8mp. 199229e28b2b2da57c52ee46452f930785cf6002 ("phycore-imx8mp: >> add USB mass storage support") >> 8dcf1df48dff339b172d1bce2a38a965ee4aafca ("phycore-imx8mp: add >> support for booting and flashing emmc via UUU") >> >> >> Here are the changes I needed to do on top of your patch to get this >> feature to work for mini: >> >> diff --git a/arch/arm/dts/imx8mm-phyboard-polis-rdk-u-boot.dtsi >> b/arch/arm/dts/imx8mm-phyboard-polis-rdk-u-boot.dtsi >> index 516e52e1f5de..cdaff2f8da9b 100644 >> --- a/arch/arm/dts/imx8mm-phyboard-polis-rdk-u-boot.dtsi >> +++ b/arch/arm/dts/imx8mm-phyboard-polis-rdk-u-boot.dtsi >> @@ -69,3 +69,8 @@ >> &wdog1 { >> bootph-pre-ram; >> }; >> + >> +&usbotg1 { >> + dr_mode = "peripheral"; >> + u-boot,dm-spl; >> +}; >> diff --git a/board/phytec/phycore_imx8mm/phycore-imx8mm.c >> b/board/phytec/phycore_imx8mm/phycore-imx8mm.c >> index 06cffbca3a69..00fdd4edbe36 100644 >> --- a/board/phytec/phycore_imx8mm/phycore-imx8mm.c >> +++ b/board/phytec/phycore_imx8mm/phycore-imx8mm.c >> @@ -45,6 +45,10 @@ int board_late_init(void) >> case MMC3_BOOT: >> env_set_ulong("mmcdev", 2); >> break; >> + case USB_BOOT: >> + printf("Detect USB boot. Will enter fastboot >> mode!\n"); >> + env_set_ulong("dofastboot", 1); >> + break; >> default: >> break; >> } >> diff --git a/configs/phycore-imx8mm_defconfig >> b/configs/phycore-imx8mm_defconfig >> index beb2f1e9f031..e8d3ffe8c05d 100644 >> --- a/configs/phycore-imx8mm_defconfig >> +++ b/configs/phycore-imx8mm_defconfig >> @@ -31,7 +31,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000 >> CONFIG_SPL_LOAD_FIT=y >> CONFIG_OF_SYSTEM_SETUP=y >> CONFIG_USE_BOOTCOMMAND=y >> -CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run >> loadimage; then run mmcboot; else run netboot; fi; fi;" >> +CONFIG_BOOTCOMMAND="if test ${dofastboot} = 1; then fastboot 0; fi; >> mmc dev ${mmcdev}; if mmc rescan; then if run loadimage; then run >> mmcboot; else run netboot; fi; fi;" >> CONFIG_DEFAULT_FDT_FILE="oftree" >> CONFIG_SYS_CBSIZE=2048 >> CONFIG_SYS_PBSIZE=2074 >> @@ -153,3 +153,11 @@ CONFIG_CI_UDC=y >> CONFIG_SDP_LOADADDR=0x40400000 >> CONFIG_SPL_USB_SDP_SUPPORT=y >> CONFIG_IMX_WATCHDOG=y >> +CONFIG_CMD_USB_SDP=y >> +CONFIG_FASTBOOT_FLASH=y >> +CONFIG_FASTBOOT_FLASH_MMC_DEV=2 >> +CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y >> +CONFIG_FASTBOOT_MMC_BOOT1_NAME="mmc2boot0" >> +CONFIG_FASTBOOT_MMC_BOOT2_NAME="mmc2boot1" >> +CONFIG_FASTBOOT_MMC_USER_SUPPORT=y >> +CONFIG_FASTBOOT_MMC_USER_NAME="mmc2" >> diff --git a/include/configs/phycore_imx8mm.h >> b/include/configs/phycore_imx8mm.h >> index dd7cfdba52d2..f3a750089dd5 100644 >> --- a/include/configs/phycore_imx8mm.h >> +++ b/include/configs/phycore_imx8mm.h >> @@ -26,6 +26,11 @@ >> "fdt_addr=0x48000000\0" \ >> "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ >> "ip_dyn=yes\0" \ >> + "dofastboot=0\0" \ >> + "fastboot_raw_partition_bootloader=66 8128\0" \ >> + "fastboot_raw_partition_all=0 4194304\0" \ >> + "emmc_dev=2\0" \ >> + "sd_dev=1\0" \ >> "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \ >> "mmcpart=1\0" \ >> "mmcroot=2\0" \ >> >> >> With these changes booting via SDP with uuu and flashing emmc with >> uuu should work. Sadly I did not find a way to be able to flash eMMC >> and SD-Card over uuu with the same bootloader because it was >> necessary for me to specify the device to flash in >> CONFIG_FASTBOOT_FLASH_MMC_DEV. >> >> with kind regards, >> Benjamin >> >> On 15.08.24 10:45, Lukasz Majewski wrote: >>> After this change it would be possible to boot SDP gadget when >>> Phytec's Phycore imx8mm module has USB ROM boot selected. >>> >>> With this change it shall be possible to flash eMMC/SD card content >>> with uuu program. >>> >>> Signed-off-by: Lukasz Majewski <lu...@denx.de> >>> --- >>> configs/phycore-imx8mm_defconfig | 18 +++++++++++++++++- >>> 1 file changed, 17 insertions(+), 1 deletion(-) >>> >>> diff --git a/configs/phycore-imx8mm_defconfig >>> b/configs/phycore-imx8mm_defconfig index 6748e6fafb..beb2f1e9f0 >>> 100644 --- a/configs/phycore-imx8mm_defconfig >>> +++ b/configs/phycore-imx8mm_defconfig >>> @@ -25,6 +25,7 @@ CONFIG_SPL=y >>> CONFIG_ENV_OFFSET_REDUND=0x3E0000 >>> CONFIG_SYS_LOAD_ADDR=0x40480000 >>> CONFIG_PCI=y >>> +# CONFIG_ANDROID_BOOT_IMAGE is not set >>> CONFIG_FIT=y >>> CONFIG_FIT_EXTERNAL_OFFSET=0x3000 >>> CONFIG_SPL_LOAD_FIT=y >>> @@ -57,6 +58,7 @@ CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2 >>> CONFIG_SYS_EEPROM_SIZE=4096 >>> CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=5 >>> CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=5 >>> +# CONFIG_CMD_BIND is not set >>> CONFIG_CMD_CLK=y >>> CONFIG_CMD_FUSE=y >>> CONFIG_CMD_GPIO=y >>> @@ -86,6 +88,10 @@ CONFIG_SPL_CLK_COMPOSITE_CCF=y >>> CONFIG_CLK_COMPOSITE_CCF=y >>> CONFIG_SPL_CLK_IMX8MM=y >>> CONFIG_CLK_IMX8MM=y >>> +CONFIG_USB_FUNCTION_FASTBOOT=y >>> +CONFIG_FASTBOOT_BUF_ADDR=0x42800000 >>> +CONFIG_FASTBOOT_BUF_SIZE=0x20000000 >>> +CONFIG_FASTBOOT_UUU_SUPPORT=y >>> CONFIG_MXC_GPIO=y >>> CONFIG_DM_I2C=y >>> CONFIG_MISC=y >>> @@ -116,7 +122,6 @@ CONFIG_FEC_MXC=y >>> CONFIG_MII=y >>> CONFIG_NVME_PCI=y >>> CONFIG_PCIE_DW_IMX=y >>> -CONFIG_PHY=y >>> CONFIG_PHY_IMX8M_PCIE=y >>> CONFIG_PINCTRL=y >>> CONFIG_SPL_PINCTRL=y >>> @@ -136,4 +141,15 @@ CONFIG_SYSRESET_PSCI=y >>> CONFIG_SYSRESET_WATCHDOG=y >>> CONFIG_DM_THERMAL=y >>> CONFIG_IMX_TMU=y >>> +CONFIG_USB=y >>> +CONFIG_SPL_USB_HOST=y >>> +CONFIG_USB_EHCI_HCD=y >>> +CONFIG_MXC_USB_OTG_HACTIVE=y >>> +CONFIG_USB_GADGET=y >>> +CONFIG_SPL_USB_GADGET=y >>> +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 >>> +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 >>> +CONFIG_CI_UDC=y >>> +CONFIG_SDP_LOADADDR=0x40400000 >>> +CONFIG_SPL_USB_SDP_SUPPORT=y >>> CONFIG_IMX_WATCHDOG=y >> > > > > Best regards, > > Lukasz Majewski > > -- > > DENX Software Engineering GmbH, Managing Director: Erika Unter > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lu...@denx.de