alexcekay opened a new pull request, #21405:
URL: https://github.com/apache/nuttx/pull/21405
## Summary
The i.MX9 FlexSPI driver only exists in `arch/arm64/src/imx9` for the
Cortex-A. This adds it to `arch/arm/src/imx9`, so the i.MX95 Cortex-M7 can use
the FlexSPI controller, e.g. for an octal NOR flash.
`imx9_flexspi.{c,h}` and `hardware/imx9_flexspi.h` are copies of the arm64
files. The only changes are:
- `arm_internal.h` instead of `arm64_internal.h`, and the paths and include
guards.
- The clock setup in `imx9_flexspi_initialize()`. The arm64 driver programs
the CCM directly (`imx9_ccm_gate_on()`, `imx9_ccm_configure_root_clock()`) with
i.MX93 clock IDs. These do not exist for the i.MX95 M7, where the clock root is
set over SCMI. Like the other arm/imx9 drivers (LPSPI, LPI2C, FlexCAN), the
driver now keeps a `clk_root` and calls `imx9_configure_clock()` with
`FLEXSPI1_CLK`, which the board defines in `board.h`, e.g.:
```c
#define FLEXSPI1_CLK (FLEXSPI1_CLK_ROOT_SYS_PLL1_DFS1_CLK | CLOCK_DIV(2))
```
The driver is enabled with the new `CONFIG_IMX9_FLEXSPI` option.
## Impact
- New option `CONFIG_IMX9_FLEXSPI`, default `n`. Nothing changes for
existing boards or configurations.
- A board that enables it must define `FLEXSPI1_CLK` in `board.h`. Without
it the build fails with `'FLEXSPI1_CLK' undeclared`, the same as for the other
arm/imx9 drivers using `clk_root`.
- The arm64 driver is unchanged.
- No in-tree arm/imx9 board enables FlexSPI yet.
## Testing
**Runtime, i.MX95 (Cortex-M7):**
- Tested in the context of PX4 on an i.MX95 board with a Macronix octal
flash (OPI DTR), port A1, `FLEXSPI1_CLK` from `SYS_PLL1_DFS1` / 2 (400 MHz
root).
- The board brings up the flash with `imx9_flexspi_initialize(0)` and
`FLEXSPI_SET_DEVICE_CONFIG`, then reads the flash ID, MCUboot runs and boots
PX4 from the flash:
```
flexspi_nor: root 400000000 Hz, RXCLKSRC 3, STS2 0x00000827, id 0xc2
*** Booting MCUboot build fefc398cc13ebbc527e297fe9df78cd98a359d75 ***
Booting from /dev/ota0...
HW arch: NXP_IMX95
PX4 git-hash: c5095fb91549674060ef36f2965ef1fdd67a755e
PX4 version: 1.18.0 80 (17956992)
PX4 git-branch: pr-board-imx95
OS: NuttX
OS version: Release 12.12.0 (202113279)
OS git-hash: b460f7d2da6eedc2f3f6557e11388a9fe5c52cd4
Build datetime: Oct 27 2026 17:42:35
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 13.2.1 20231009
PX4GUID: 000affff0000000000000000000000000000
MCU: IMX95, rev. 0
```
**Build (macOS, arm-none-eabi-gcc 13.2.1):**
- `imx95-evk:nsh` and `imx93-qsb:nsh` with `CONFIG_IMX9_FLEXSPI=y` and
`FLEXSPI1_CLK` added to `board.h`: builds without warnings (make).
`imx95-evk:nsh` also with CMake.
- Without `FLEXSPI1_CLK`: fails with `'FLEXSPI1_CLK' undeclared`, as
intended.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]