arch/arm64/imx95-a55: add GPIO and eMMC (USDHC) support with partition table parsing#18501
Conversation
|
Hi @fdcavalcanti @tmedicci @eren-terzioglu We are receiving this error on all PRs. Can you check it? Boards https://github.com/apache/nuttx/actions/runs/22758561387/job/66009383296#logs |
There's a fix coming very soon. |
mzanders
left a comment
There was a problem hiding this comment.
Manual review done, some smaller items noted. Except maybe for the inclusion of imx9_gpiobase.c by imx9_gpio.c which is rather ugly (but which was already present).
To check for regressions on the iMX93, I tried building and running the A55 part of IMX93-EVK on an IMX93-QSB board for the current master (43f65ce ("build(deps): bump docker/build-push-action from 6 to 7", 2026-03-09)) first. Unfortunately without succes. So it doesn't make a lot of sense to try and test this PR on target..
u-boot=> fatload mmc 0:1 0x80000000 nuttx_a55.bin
585728 bytes read in 400 ms (1.4 MiB/s)
u-boot=> go 0x80000000
## Starting application at 0x80000000 ...
- Ready to Boot Primary CPU
- Boot from EL2
- Boot from EL1
- Boot to C runtime for OS Initialize
"Synchronous Abort" handler, esr 0x02000000
elr: 0000000080202580 lr : 00000000012f3700 (reloc)
elr: 00000000fef10580 lr : 0000000080001700
x0 : 000000008008ec10 x1 : 0000000080065d38
x2 : 0000000096000021 x3 : 0000000000000000
x4 : 00000000443c0180 x5 : 00000000800047d8
x6 : 0000000000003fc4 x7 : 0000000000000006
x8 : 0000000000000003 x9 : 0000000096000021
x10: 0000000000000025 x11: 0000000000000000
x12: 000000000000001c x13: 00000000fcf0dd86
x14: 0000000000000008 x15: 00000000fcefef5d
x16: 0000000080000000 x17: 0000000000000004
x18: 00000000fcf0dd70 x19: 000000008008ec10
x20: 0000000000000000 x21: 0000000000000002
x22: 00000000fcf1b390 x23: 0000000080000068
x24: 000000008008f000 x25: 0000000080000e38
x26: 0000000000000000 x27: 0000000000000000
x28: 00000000fcf33650 x29: 00000000fceff7f0
Code: f9403e41 1400a056 801ffe10 00000000 (feff7040)
Resetting CPU ...
resetting ...
|
Thank you @mzanders !! I got my FRDM-IMX93 but need to find some time to play maybe this week :-) |
guess crash with the CLOCK_SDIO_DISABLED place modify, but when I test with my board, the emmc break, and mount cause uboot erased, will do verify again after use uuu recover the image. my private fork worked before #18403 , if you have a plan add support for i.mx 95, please continue, as I did not have environment to double check if i.mx 93 work as expected. |
acassis
left a comment
There was a problem hiding this comment.
@jasonbu nice work, kudos!!!
Please add a board config to exercise these peripherals and please update the board Documentation to include these configs and a Picture of the board: https://nuttx.apache.org/docs/latest/platforms/arm64/imx9/boards/imx95-a55-evk/index.html
|
@jasonbu is that board? https://www.nxp.com/part/IMX95LPD5EVK-19 wow, U$ 1,200.00, I think this company didn't learn anything from ST! |
|
@acassis hi Alan, the board I'm currently used is not fully public, will add board description/image later. add emmc/defconfig to help user more easy to use, actually I have two imx95 EVK, the emmc feature is compatible. Also update tutorial rst to help user do flash with uboot only. hi, @mzanders could you please help evaluate the imx93 already fixed in this version? CC @cederom And shall we split it into more small patch, for example, cmake fix, include .c fix, etc. will take less influence. |
|
I just lost contract, need to do some things first, will play with iMX a bit later, sorry, I am sure this update is good if it works for you, go ahead do not wait for me :-) |
|
Hi @jasonbu: I'm testing a new way to Build PRs in Our Own NuttX Repos, wonder if you would like to try out, and give your feedback to @simbit18 and me? Thank you so much :-)
|
Hi, @lupyuen , will try today, I found my ci error maybe defconfig refresh required. and if I just force push to this pr/branch. maybe trigger a new apache/nuttx CI, so guess I need to new a branch to avoid the github action auto retrigger. will give a feedback to you. By the way. I see the action in your picture is try run whole action ci in personal fork. and when I fork the repo, it need to choose specific defconfig? Is it due to the personal ci job cost? it is a real problem. |
|
Thanks @jasonbu! Yes you are correct, if our PR involves One Single Defconfig, it's definitely easier to run Docker to test the PR. The method that I suggested (manual-nuttx-ci) is more suitable for PRs that affect Multiple Architectures, so manual-nuttx-ci is simpler than running Multiple Docker Builds. Or maybe we have devs who are not familiar with Docker, then they can use manual-nuttx-ci too. We have just implemented a new feature to build One Single Defconfig, it might be helpful too. Thanks :-)
|
arm64_modifyreg8.c, arm64_modifyreg16.c, arm64_modifyreg32.c were present in Make.defs but missing from CMakeLists.txt, causing link errors when building with cmake. Signed-off-by: buxiasen <buxiasen@xiaomi.com>
…upport The MMC CMD6 bus width switch was gated on priv->buswidth which is derived from the SD SCR register. For MMC cards this field is never set (unless SDIO_CAPS_4BIT_ONLY), so the CMD6 was skipped while the host PROCTL DTW was still changed - causing a bus width mismatch and data transfer timeouts. Fix by checking priv->caps instead of priv->buswidth for MMC cards. Also select EXT_CSD_BUS_WIDTH_8 when host reports SDIO_CAPS_8BIT. Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Rename IMX9_IRQ_uSDHC{1,2,3} to IMX9_IRQ_USDHC{1,2,3} in both arm
and arm64 imx95_irq.h to follow the all-caps naming convention used
by imx93_irq.h and the rest of the NuttX codebase. Remove the now
unnecessary USDHC IRQ alias block from arm64 imx95_irq.h.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Add imx95 GPIO register definitions (same IP block as imx93), fill g_gpio_base[] array for imx95, include imx95_gpio.h from the common header, and compile imx9_gpio.c/imx9_gpiobase.c for imx95 in cmake. Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Port USDHC1 (eMMC) driver to the i.MX95 FRDM EVK board: - Create imx95_pinmux.h with SD1/USDHC1 pin definitions - Add USDHC1 pin macros to board.h - Create board-level imx9_usdhc.c glue code - Update imx9_bringup.c with DMA allocator and USDHC init - Add SCMI clock guards in imx9_usdhc.c (imx95 clock roots are owned by System Manager, direct CCM writes are no-ops) - Fix CCM_CR_USDHC2 copy-paste bug to CCM_CR_USDHC1 Signed-off-by: buxiasen <buxiasen@xiaomi.com>
imx9_dmapreflight() rejected unaligned buffers unconditionally, but dmarecvsetup() has a bounce path via priv->rxbuffer for small transfers. Add a buflen > sizeof(priv->rxbuffer) check so that small reads (e.g. ext_csd 512-byte stack buffer) can use the bounce buffer instead of failing with -EFAULT. Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Parse the partition table on /dev/mmcsd0 during board bringup and register each partition as /dev/mmcsd0pN. MBR partitions have no name field so a custom handler is needed instead of the default register_partition which skips unnamed entries. Verify by i.mx95 FRDM 'mount -t vfat /dev/mmcsd0p0 /data' Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Add a dedicated emmc board configuration that enables USDHC1 8-bit eMMC access with MBR/GPT partition table parsing, instead of polluting the base nsh defconfig. This allows users to build and test eMMC functionality with: cmake -DBOARD_CONFIG=imx95-a55-evk/emmc Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Add detailed steps for copying nuttx.bin to eMMC via u-boot USB Mass Storage (ums) mode, which exposes the eMMC as a USB drive on the host PC for easy file transfer. Signed-off-by: buxiasen <buxiasen@xiaomi.com>
https://github.com/jasonbu/manual-nuttx-ci/actions/runs/23424198384 Also it show the cmake is faster than Makefile. |
|
Hi @jasonbu, thanks for your feedback I've updated the workflow by adding the parallel -j option for the Make build The build times are now similar. Please note that the V=1 option is enabled for the Make build |





Summary
Add GPIO and eMMC (USDHC) support for the i.MX95 A55 EVK board, enabling 8-bit eMMC access with MBR/GPT partition table parsing.
Changes
1.
imx9: add GPIO support for imx95g_gpio_base[]array for imx95imx95_gpio.hfrom the common headerimx9_gpio.c/imx9_gpiobase.cfor imx95 in cmake2.
imx95-a55-evk: add USDHC eMMC driver supportimx95_pinmux.h/imx95_ccm.h/imx95_pll.hhardware definitions for imx95board.himx9_usdhc.cglue codeimx9_bringup.cwith DMA allocator and USDHC initCONFIG_IMX9_CLK_OVER_SCMIcompile-time guards inimx9_usdhc.cto isolate the IMX95 SCMI clock path from the existing IMX93 direct-CCM path — no functional change for IMX933.
imx9: usdhc fix dmapreflight rejecting small unaligned buffersimx9_dmapreflight()rejected unaligned buffers unconditionally, butdmarecvsetup()has a bounce path viapriv->rxbufferfor small transfersbuflen > sizeof(priv->rxbuffer)check so that small reads (e.g. ext_csd 512-byte stack buffer) can use the bounce buffer instead of failing with-EFAULT4.
imx95-a55-evk: add MBR/GPT partition table parsing on eMMC/dev/mmcsd0during board bringup and register each partition as/dev/mmcsd0pNImpact
#ifndef CONFIG_IMX9_CLK_OVER_SCMIguards — zero functional change for existing IMX93 boardsdmapreflightfix is a generic improvement that benefits all imx9 USDHC usersTesting
compile by cmake
Verified on i.MX95 FRDM EVK:
mount -t vfat /dev/mmcsd0p0 /dataworksostest passed in i.MX95 FRDM EVK
[2026-03-06 17:57:11] user_main: Exiting [2026-03-06 17:57:11] ostest_main: Exiting with status 0 [2026-03-06 17:57:11] nsh>