Skip to content

Commit 5c03e6f

Browse files
committed
[nrf fromtree] drivers: flash: nrf_qspi_nor: Fix compilation with QER set to NONE
This is a follow-up to commit d1abe40. Function `qspi_wait_while_writing()` (and also `qspi_rdsr()` that is called by it) is now always required for `qspi_erase()`, so it can no longer be under `#if !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE)`. Also definition of `dev_config` in `configure_chip()` needs to be moved, as for QER set to NONE, it is not used and causes a compilation warning. Add a test case that will ensure the driver can be built successfully with `quad-enable-requirements = "NONE"`. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no> (cherry picked from commit 68fab5f)
1 parent b10c46a commit 5c03e6f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

drivers/flash/nrf_qspi_nor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ static int qspi_send_cmd(const struct device *dev, const struct qspi_cmd *cmd,
481481
return qspi_get_zephyr_ret_code(res);
482482
}
483483

484-
#if !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE)
485484
/* RDSR. Negative value is error. */
486485
static int qspi_rdsr(const struct device *dev, uint8_t sr_num)
487486
{
@@ -525,6 +524,7 @@ static int qspi_wait_while_writing(const struct device *dev, k_timeout_t poll_pe
525524
return (rc < 0) ? rc : 0;
526525
}
527526

527+
#if !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE)
528528
static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num)
529529
{
530530
int rc = 0;
@@ -657,7 +657,6 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size)
657657

658658
static int configure_chip(const struct device *dev)
659659
{
660-
const struct qspi_nor_config *dev_config = dev->config;
661660
int rc = 0;
662661

663662
/* Set QE to match transfer mode. If not using quad
@@ -668,6 +667,7 @@ static int configure_chip(const struct device *dev)
668667
* S2B1v1/4/5/6. Other options require more logic.
669668
*/
670669
#if !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE)
670+
const struct qspi_nor_config *dev_config = dev->config;
671671
nrf_qspi_prot_conf_t const *prot_if =
672672
&dev_config->nrfx_cfg.prot_if;
673673
bool qe_value = (prot_if->writeoc == NRF_QSPI_WRITEOC_PP4IO) ||
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2025, Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&mx25r64 {
8+
quad-enable-requirements = "NONE";
9+
};

tests/drivers/flash/common/testcase.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ tests:
2929
- CONFIG_TEST_DRIVER_FLASH_SIZE=8388608
3030
integration_platforms:
3131
- nrf52840dk/nrf52840
32+
drivers.flash.common.nrf_qspi_nor.qer_none:
33+
build_only: true
34+
platform_allow: nrf52840dk/nrf52840
35+
extra_args:
36+
- DTC_OVERLAY_FILE=boards/nrf52840dk_qer_none.overlay
37+
integration_platforms:
38+
- nrf52840dk/nrf52840
3239
drivers.flash.common.nrf_qspi_nor_4B_addr:
3340
platform_allow: nrf52840dk/nrf52840
3441
extra_configs:

0 commit comments

Comments
 (0)