Skip to content

Conversation

@tiennguyenzg
Copy link
Contributor

@tiennguyenzg tiennguyenzg commented Sep 30, 2025

This driver is based on the XSPI_QSPI driver for Renesas RZ/T2M and N2L, and the SPIBSC driver for Renesas RZ/A3UL from the HAL.

Need: zephyrproject-rtos/hal_renesas#149 (merged)

@github-actions
Copy link

github-actions bot commented Sep 30, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_renesas zephyrproject-rtos/hal_renesas@5ab2c84 zephyrproject-rtos/hal_renesas@3ce2bdc zephyrproject-rtos/[email protected]

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.


slot0_partition: partition@20200 {
label = "image-0";
reg = <0x00020200 (DT_SIZE_M(16) - 0x20200)>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use reg = <0x00020200 0xFDFE00>; instead?

Copy link
Contributor Author

@tiennguyenzg tiennguyenzg Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to retain this value because it is more readable and easier to maintain.

.command_length = 1U,
.address_length = 0U,
.data_length = THREE_BYTE,
.dummy_cycles = 0U};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for formatting

Suggested change
.dummy_cycles = 0U};
.dummy_cycles = 0U,};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

.command_length = 1U,
.address_length = 3U,
.data_length = FOUR_BYTE,
.dummy_cycles = SPI_NOR_DUMMY_RD};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.dummy_cycles = SPI_NOR_DUMMY_RD};
.dummy_cycles = SPI_NOR_DUMMY_RD,};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


static int qspi_flash_rz_read(const struct device *dev, off_t offset, void *data, size_t len)
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

.command_length = 1U,
.address_length = 0U,
.data_length = data_length,
.dummy_cycles = 0U};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.dummy_cycles = 0U};
.dummy_cycles = 0U,};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

struct flash_renesas_rz_data *data = dev->data;
spi_flash_status_t status = {.write_in_progress = true};
uint32_t timeout = UINT32_MAX;
fsp_err_t err = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the initialized value since you literally set this in config->fsp_api->statusGet and you're using return 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it. Thank you.


while ((status.write_in_progress) && (timeout > 0)) {
err = config->fsp_api->statusGet(data->fsp_ctrl, &status);
if (FSP_SUCCESS != (fsp_err_t)err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to cast it again since it's already declared as fsp_err_t

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it. Thank you.

# SPDX-License-Identifier: Apache-2.0

config FLASH_RENESAS_RZ_QSPI_XSPI
bool "Renesas RZ Quad-SPI driver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool "Renesas RZ Quad-SPI driver"
bool "Renesas RZ Quad-SPI XPSI driver"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Enable Quad-SPI XSPI Nor flash driver for RZ series

config FLASH_RENESAS_RZ_QSPI_SPIBSC
bool "Renesas RZ Quad-SPI driver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool "Renesas RZ Quad-SPI driver"
bool "Renesas RZ Quad-SPI SPIBC driver"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment on lines +25 to +28
#define QSPI_DEFAULT_SR (0x40)
#define QSPI_UPDATE_CR (0xC0) /* Configuration register (DC0=1, DC1=1 (Dummy cycle = 10)) */
#define QSPI_DATA_CR_UPDATE (QSPI_UPDATE_CR << 8 | QSPI_DEFAULT_SR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define QSPI_DEFAULT_SR (0x40)
#define QSPI_UPDATE_CR (0xC0) /* Configuration register (DC0=1, DC1=1 (Dummy cycle = 10)) */
#define QSPI_DATA_CR_UPDATE (QSPI_UPDATE_CR << 8 | QSPI_DEFAULT_SR)
#ifdef CONFIG_FLASH_RENESAS_RZ_QSPI_XSPI
#define QSPI_DEFAULT_SR (0x40)
#define QSPI_UPDATE_CR (0xC0) /* Configuration register (DC0=1, DC1=1 (Dummy cycle = 10)) */
#define QSPI_DATA_CR_UPDATE (QSPI_UPDATE_CR << 8 | QSPI_DEFAULT_SR)
#endif /* CONFIG_FLASH_RENESAS_RZ_QSPI_XSPI */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@tiennguyenzg
Copy link
Contributor Author

First push: Rebase to resolve conflict
Second push: Update for feedback

@tiennguyenzg tiennguyenzg force-pushed the rz_support_flash branch 2 times, most recently from 2a86aaf to 585455b Compare October 17, 2025 08:31
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Oct 17, 2025
de-nordic
de-nordic previously approved these changes Oct 17, 2025
Copy link
Contributor

@de-nordic de-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample and tests look ok.

@de-nordic de-nordic removed their assignment Oct 17, 2025
binhnguyen2434
binhnguyen2434 previously approved these changes Oct 18, 2025
Update commit id for hal_renesas to support Flash driver
for Renesas RZ/A, T, N series

Signed-off-by: Tien Nguyen <[email protected]>
This driver is based on the XSPI driver for Renesas RZ/T2M and N2L,
and the SPIBSC driver for Renesas RZ/A3UL from the HAL.

Signed-off-by: Tien Nguyen <[email protected]>
Add SPIBSC node for RZ/A3UL
Add XSPI node for RZ/T2M, N2L

Signed-off-by: Tien Nguyen <[email protected]>
Add flash memory regions for RZ/A3UL

Signed-off-by: Tien Nguyen <[email protected]>
Add flash support for RZ/A3UL, N2L, T2M

Signed-off-by: Tien Nguyen <[email protected]>
Add Flash driver for RZ/A3UL, T2M, N2L

Signed-off-by: Tien Nguyen <[email protected]>
Add Flash driver for RZ/A3UL, T2M, N2L

Signed-off-by: Tien Nguyen <[email protected]>
Add Flash driver for RZ/A3UL, T2M, N2L

Signed-off-by: Tien Nguyen <[email protected]>
Add a macro to define the 32KB block size in spi_nor.h

Signed-off-by: Tien Nguyen <[email protected]>
@sonarqubecloud
Copy link

@tiennguyenzg
Copy link
Contributor Author

Hi @de-nordic, @binhnguyen2434, @quytranpzz
I just rebased to pick up commits of #97971 to fix CI failures.
Could you help me take another look? Thank you.

@kartben kartben merged commit 5341c88 into zephyrproject-rtos:main Oct 22, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants