Add Cadence MSPI controller and Infineon S28HX512T driver#102513
Add Cadence MSPI controller and Infineon S28HX512T driver#102513natto1784 wants to merge 14 commits intozephyrproject-rtos:mainfrom
Conversation
a557064 to
335024e
Compare
swift-tk
left a comment
There was a problem hiding this comment.
The mutex usage in the current controller is not recommended and is technically incorrect. Since the controller is IRQ capable, the controller design should take that into account as invoking k_mutex_unlock from an ISR context is not permitted.
335024e to
35b285d
Compare
|
Hi, the controller is IRQ capable but does not make use of any interrupts, i.e, none of the interrupts are enabled and hence, k_mutex_unlock is not done from an ISR since there is no ISR in the first place. |
I know, but do you not plan to add IRQ support for the controller at all? Normally, the controller access is protected by a mutex and then the transfer(API) context is protected by a semaphore. |
c08c84e to
2adbdaa
Compare
|
Force push change: rename the |
2adbdaa to
d6868c7
Compare
|
Hi, I have rebased the patchset against main A new change
|
| flash0: flash@0 { | ||
| compatible = "infineon,s28hx512t", "jedec,mspi-nor"; | ||
| status = "okay"; | ||
| reg = <0>; |
There was a problem hiding this comment.
The reason ranges wouldn't work is FLASH_SIZE and FLASH_BASE_ADDRESS are selected based on zephyr,flash node. However MSPI controller's does not allow setting size as part of
The flash itself is at 0x6000000 hence, a separate flash0_memory nodes is added as well
| flash0_memory: flash@60000000 { | ||
| compatible = "soc-nv-flash"; | ||
| reg = <0x60000000 DT_SIZE_M(128)>; | ||
| }; |
|
|
|
||
| flash0_memory: flash@60000000 { | ||
| compatible = "soc-nv-flash"; | ||
| reg = <0x60000000 DT_SIZE_M(128)>; |
There was a problem hiding this comment.
Don't think I can use ranges to configure size due to this
zephyr/dts/bindings/mspi/mspi-controller.yaml
Lines 18 to 20 in 60aaf22
and ranges will mess this up if I map it, right?
There was a problem hiding this comment.
You are right. the address and size cell const value were copied from SPI. It will prevent defining a size cell in child's reg property.
Even if we set size-cell to 1 and add the ranges, the REG_IDX_0_VAL_ADDRESS of the child will have changed to the mapping address and no longer represent index or CE number.
It looks like we need to move away from SPI DT anyways in order to use ranges. @JarmouniA @nordicjm
There was a problem hiding this comment.
I think this edge case is just how it will have to be, there would be a similar thing with i2c, so the SPI device will need to not have ranges then, but the flash node (and below) which is a child of it will need ranges which is the best that can be made of the situation
There was a problem hiding this comment.
Alright, added ranges to the flash0 node to map the memory region to zephyr,flash
|
Sorry, I'm forgetting things. Is this PR waiting on the other draft PR or is it ready yet? |
It is ready, CI test failure is unrelated. Thanks for reviewing |
| # GPIO is required for ce_gpios despite the field being ignored | ||
| select GPIO | ||
| select PINCTRL | ||
| select MSPI_TIMING |
There was a problem hiding this comment.
| select MSPI_TIMING | |
| imply MSPI_TIMING |
There was a problem hiding this comment.
cherrypicked and rebased
Add a Cadence MSPI peripheral driver, used in the TI K3 platform. The driver was tested in 1S-1S-1S and 4S-4S-4S mode with the onboard infineon s25h flash of the am243x launchpad and a custom driver for the flash using this interface. The command and dummy cycles are always taken from the xfer request and never from the devicetree since different commands might have different latencies. The driver is somewhat basic for now and lacks e.g. callback implementation. This is something that can be added in the future. If a non-supported / invalid request is detected a error code is returned. Signed-off-by: Mika Braunschweig <mika.braunschweig@siemens.com>
Cadence OSPI/QSPI controller allows peripherals on its bus to have configurations like 8D-8D-8D or 4S-4D-4D which require DTR configuration for dual transfer rate. Hence, allow having DTR configuration in the driver. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Cadence OSPI controller allows dual byte opcodes which are used by the flash on the bus for modes such as Octal SDR/DDR. Hence, allow configuration for dual byte opcodes. Signed-off-by: Amneesh Singh <amneesh@ti.com>
We configure address length as 'length - 1' in the controller. This currently does not check if the length is 0, in which case it causes unsigned integer underflow, so add a check for that. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add a mechanism to configure the CS timing based on the configured clock frequency for the peripheral (SCLK) in reference clock cycles for the controller (RCLK). Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add the read delay field in the timing configuration to allow configuring delay for read data capture. This is supposed to be set either by the peripheral using this controller at runtime or the user. Additionally, also make the related struct and parameters public by separating out the header. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Reset the STIG register configuration in case it was set before initializing the driver. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Cadence MSPI controller uses a FIFO for indirect access operations on the device on bus. Right now we directly use the physical address provided via DT. This does not work on cores with MMU like A53; hence, map the FIFO address the same way base contrller register space is mapped. Signed-off-by: Amneesh Singh <amneesh@ti.com>
DDR Octal SPI configurations require reading an even number of bytes at a time. This includes commands such as RDSR (Status Register) and RDID (JEDEC ID). Currently this can cause timing issues, hence use an even number of bytes for the both aforementioned commands if the data rate is dual. Signed-off-by: Amneesh Singh <amneesh@ti.com>
1. Remove endianness configuraton, since some MSPI controllers may return -ENOSYS if they are configured as big or small endian. 2. Set default command (opcode) length to 1 byte for 1S-1S-1S (SPI) mode. Signed-off-by: Amneesh Singh <amneesh@ti.com>
- Add support for Infineon Semper S28HX512T NOR flash. This supports SPI mode (1S-1S-1S), 8S-8S-8S and 8D-8D-8D. - Expose set_up_xfer_with_addr, read_jedec_id and soft_reset_66_99 function declarations to the vendor specific quirks. - Add more macros to the spi_nor_s28hx512t.h header that can be used in addition to the already present macros. - Add a specific quirk that is only used when the parent controller for this flash is Cadence MSPI (OSPI). This involves calibrating a delay for capturing data on the controller by reading JEDEC IDs on different configurations. - Add DT binding for the flash to allow convenient Kconfig symbols that depend on the presence of the compatible flash node in the DT. - Add Kconfig option FLASH_MSPI_INFINEON_S28HX512T_TI_EARLY_FIXUP_RESET for TI K3 SoCs. This is required as the ROM bootloader on the SoCs may leave the flash in 8D-8D-8D state depending on what bootmode is set. This requires resetting the board beforehand in this very specific configuration. - Move FLASH_MSPI_QUIRKS_GET to the bottom of file in flash_mspi_nor_quirks.h header. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add boot-time reset for TI MSPI flash devices left in 8D-8D-8D mode by ROM bootloader. Issues reset commands to restore 1S-1S-1S mode before normal flash driver initialization. The priority is set to default flash priority minus one. The priority is a non-issue as long as MSPI bus (flash controller) is initialized before this. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add Cadence MSPI controller and the S28HX512T NOR flash on its bus. Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add Cadence MSPI controller and the S28HX512T NOR flash on its bus. Signed-off-by: Amneesh Singh <amneesh@ti.com>
|



This patchset adds Cadence MSPI (OSPI) controller and the Infineon S28HX512T driver as part of the generic MSPI NOR Flash driver.
Please see individual commit descriptions for more information.
Initial MSPI support overlap: #88487
Testing
Tested with following options
west build -b am243x_evm/am2434/r5f0_0 tests/drivers/flash/common -DCONFIG_MAIN_STACK_SIZE=20000 -DCONFIG_FLASH_PAGE_LAYOUT=y -DCONFIG_FLASH_FILL_BUFFER_SIZE=256Note that the unaligned test WILL fail on 8D-8D-8D configuration since it tries to write odd number of bytes at odd offsets which a DTR configuration like 8D-8D-8D does not support
Pending