Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/mspi/mspi_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct mspi_dw_data {
enum mspi_cpp_mode xip_cpp;
#endif

uint16_t dummy_bytes;
uint32_t dummy_bytes;
uint8_t bytes_to_discard;
uint8_t bytes_per_frame_exp;
bool standard_spi;
Expand Down Expand Up @@ -317,7 +317,7 @@ static bool tx_dummy_bytes(const struct device *dev, bool *repeat)
uint8_t fifo_room = dev_config->max_queued_dummy_bytes
- FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev));
uint8_t rx_fifo_items = FIELD_GET(RXFLR_RXTFL_MASK, read_rxflr(dev));
uint16_t dummy_bytes = dev_data->dummy_bytes;
uint32_t dummy_bytes = dev_data->dummy_bytes;
const uint8_t dummy_val = 0;

/* Subtract the number of items that are already stored in the RX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
&mx25uw63 {
status = "okay";
mspi-max-frequency = <DT_FREQ_K(256)>;
transfer-timeout = <500>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@
status = "okay";
mspi-max-frequency = <DT_FREQ_M(50)>;
mspi-io-mode = "MSPI_IO_MODE_SINGLE";
transfer-timeout = <5000>;
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
Expand Down Expand Up @@ -39,8 +39,8 @@
<NRF_PSEL(EXMIF_DQ6, 6, 6)>,
<NRF_PSEL(EXMIF_DQ7, 6, 4)>;
};
};

Check failure on line 43 in tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

tests/drivers/flash/common/boards/mx25uw63_single_io_4B_addr_sreset.overlay:42 Expecting 1 new line(s)
};

&gpio6 {
Expand All @@ -61,4 +61,5 @@
mspi-io-mode = "MSPI_IO_MODE_SINGLE";
use-4byte-addressing;
initial-soft-reset;
transfer-timeout = <5000>;
};
38 changes: 38 additions & 0 deletions tests/drivers/flash/common/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
#error There is no flash device enabled or it is missing Kconfig options
#endif

#if DT_NODE_HAS_PROP(DT_BUS(TEST_AREA_DEV_NODE), packet_data_limit)
#define CONTROLLER_PACKET_DATA_LIMIT DT_PROP(DT_BUS(TEST_AREA_DEV_NODE), packet_data_limit)
#define BUFFER_SIZE_OVER_PACKET_LIMIT CONTROLLER_PACKET_DATA_LIMIT + 1
#endif

static const struct device *const flash_dev = TEST_AREA_DEVICE;
static struct flash_pages_info page_info;
static uint8_t __aligned(4) expected[EXPECTED_SIZE];
Expand Down Expand Up @@ -334,6 +339,39 @@ ZTEST(flash_driver, test_flash_erase)
zassert_not_equal(expected[0], erase_value, "These values shall be different");
}

ZTEST(flash_driver, test_flash_write_read_over_the_packet_limit)
{

#if !defined(CONTROLLER_PACKET_DATA_LIMIT)
TC_PRINT("Given bus controller does not have 'packet_data_limit' property\n");
ztest_test_skip();
#else
int rc;
const uint8_t pattern = 0xA1;
static uint8_t large_data_buf[BUFFER_SIZE_OVER_PACKET_LIMIT];

/* Flatten area corresponding to the size of two packets */
rc = flash_flatten(flash_dev, page_info.start_offset, 2 * CONTROLLER_PACKET_DATA_LIMIT);
zassert_equal(rc, 0, "Flash flatten failed: %d", rc);

/* Fill flash area with buffer size over the configured packet limit */
rc = flash_fill(flash_dev, pattern, page_info.start_offset, BUFFER_SIZE_OVER_PACKET_LIMIT);
zassert_equal(rc, 0, "Flash fill failed");

/* Read flash area with buffer size over the MSPI packet limit */
rc = flash_read(flash_dev, page_info.start_offset, large_data_buf,
BUFFER_SIZE_OVER_PACKET_LIMIT);
zassert_equal(rc, 0, "Flash read failed");

/* Compare read data to the pre-defined pattern */
for (int i = 0; i < BUFFER_SIZE_OVER_PACKET_LIMIT; i++) {
zassert_equal(large_data_buf[i], pattern,
"large_data_buf[%u]=%x read, does not match written pattern %x", i,
large_data_buf[i], pattern);
}
#endif
}

ZTEST(flash_driver, test_supply_gpios_control)
{
if (!DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, supply_gpios)) {
Expand Down
Loading