Skip to content

Commit cfe422d

Browse files
samples: drivers: spi_flash: Add support OSPI for Renesas RA8
Add support OSPI for Renesas ek_ra8m1, ek_ra8d1 to run sample spi_flash Signed-off-by: Khoa Nguyen <[email protected]> Signed-off-by: Tri Nguyen <[email protected]> Signed-off-by: Thao Luong <[email protected]>
1 parent b2659d3 commit cfe422d

File tree

1 file changed

+23
-3
lines changed
  • samples/drivers/spi_flash/src

1 file changed

+23
-3
lines changed

samples/drivers/spi_flash/src/main.c

+23-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@
2121
#elif defined(CONFIG_BOARD_NPCX9M6F_EVB) || \
2222
defined(CONFIG_BOARD_NPCX7M6FB_EVB)
2323
#define SPI_FLASH_TEST_REGION_OFFSET 0x7F000
24+
#elif defined(CONFIG_BOARD_EK_RA8M1) || defined(CONFIG_BOARD_EK_RA8D1)
25+
#define SPI_FLASH_TEST_REGION_OFFSET 0x40000
2426
#else
2527
#define SPI_FLASH_TEST_REGION_OFFSET 0xff000
2628
#endif
29+
#if defined(CONFIG_BOARD_EK_RA8M1) || defined(CONFIG_BOARD_EK_RA8D1)
30+
#define SPI_FLASH_SECTOR_SIZE 262144
31+
#else
2732
#define SPI_FLASH_SECTOR_SIZE 4096
33+
#endif
34+
35+
#if defined(CONFIG_FLASH_STM32_OSPI) || defined(CONFIG_FLASH_STM32_QSPI) || \
36+
defined(CONFIG_FLASH_STM32_XSPI) || defined(CONFIG_FLASH_RENESAS_RA_OSPI_B)
2837

29-
#if defined(CONFIG_FLASH_STM32_OSPI) || \
30-
defined(CONFIG_FLASH_STM32_QSPI) || \
31-
defined(CONFIG_FLASH_STM32_XSPI)
3238
#define SPI_FLASH_MULTI_SECTOR_TEST
3339
#endif
3440

@@ -44,15 +50,25 @@
4450
#define SPI_FLASH_COMPAT st_stm32_xspi_nor
4551
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_qspi_nor)
4652
#define SPI_FLASH_COMPAT nordic_qspi_nor
53+
#elif DT_HAS_COMPAT_STATUS_OKAY(renesas_ra_ospi_b_nor)
54+
#define SPI_FLASH_COMPAT renesas_ra_ospi_b_nor
4755
#else
4856
#define SPI_FLASH_COMPAT invalid
4957
#endif
5058

59+
#if defined(CONFIG_FLASH_RENESAS_RA_OSPI_B)
60+
const uint8_t erased[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
61+
#else
5162
const uint8_t erased[] = { 0xff, 0xff, 0xff, 0xff };
63+
#endif
5264

5365
void single_sector_test(const struct device *flash_dev)
5466
{
67+
#if defined(CONFIG_FLASH_RENESAS_RA_OSPI_B)
68+
const uint8_t expected[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
69+
#else
5570
const uint8_t expected[] = { 0x55, 0xaa, 0x66, 0x99 };
71+
#endif
5672
const size_t len = sizeof(expected);
5773
uint8_t buf[sizeof(expected)];
5874
int rc;
@@ -124,7 +140,11 @@ void single_sector_test(const struct device *flash_dev)
124140
#if defined SPI_FLASH_MULTI_SECTOR_TEST
125141
void multi_sector_test(const struct device *flash_dev)
126142
{
143+
#if defined(CONFIG_FLASH_RENESAS_RA_OSPI_B)
144+
const uint8_t expected[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
145+
#else
127146
const uint8_t expected[] = { 0x55, 0xaa, 0x66, 0x99 };
147+
#endif
128148
const size_t len = sizeof(expected);
129149
uint8_t buf[sizeof(expected)];
130150
int rc;

0 commit comments

Comments
 (0)