Skip to content
Open
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
3 changes: 2 additions & 1 deletion boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,10 @@ slot3_partition: &cpurad_slot1_partition {
status = "disabled";

mx25uw63: mx25uw6345g@0 {
compatible = "mxicy,mx25u", "jedec,mspi-nor";
compatible = "jedec,mspi-nor";
status = "disabled";
reg = <0>;
chip-family = "mxicy,mx25uw";
jedec-id = [c2 84 37];
sfdp-bfp = [e5 20 8a ff ff ff ff 03 00 ff 00 ff 00 ff 00 ff
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 10 d8
Expand Down
3 changes: 2 additions & 1 deletion boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ ipc0: &cpuapp_cpurad_ipc {
status = "okay";

mx25uw63: mx25uw6345g@0 {
compatible = "mxicy,mx25u", "jedec,mspi-nor";
compatible = "jedec,mspi-nor";
status = "disabled";
reg = <0>;
chip-family = "mxicy,mx25uw";
jedec-id = [c2 84 37];
sfdp-bfp = [e5 20 8a ff ff ff ff 03 00 ff 00 ff 00 ff 00 ff
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 10 d8
Expand Down
2 changes: 0 additions & 2 deletions drivers/flash/flash_mspi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,8 +1257,6 @@ static DEVICE_API(flash, drv_api) = {
.dqs_enable = false, \
}

#define FLASH_QUIRKS(inst) FLASH_MSPI_QUIRKS_GET(DT_DRV_INST(inst))

#define IO_MODE_FLAGS(io_mode) \
.multi_io_cmd = (io_mode == MSPI_IO_MODE_DUAL || \
io_mode == MSPI_IO_MODE_QUAD || \
Expand Down
37 changes: 18 additions & 19 deletions drivers/flash/flash_mspi_nor_quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ struct flash_mspi_nor_quirks {
};

/* Extend this macro when adding new flash chip with quirks */
#define FLASH_MSPI_QUIRKS_GET(node) \
COND_CODE_1(DT_NODE_HAS_COMPAT_STATUS(node, mxicy_mx25r, okay), \
(&flash_quirks_mxicy_mx25r), \
(COND_CODE_1(DT_NODE_HAS_COMPAT_STATUS(node, mxicy_mx25u, okay), \
(&flash_quirks_mxicy_mx25u), \
(NULL))))

#if DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25r)
#define FLASH_QUIRKS(inst) \
DT_INST_ENUM_HAS_VALUE(inst, chip_family, mxicy_mx25r) ? \
&flash_quirks_mxicy_mx25r : \
DT_INST_ENUM_HAS_VALUE(inst, chip_family, mxicy_mx25um) || \
DT_INST_ENUM_HAS_VALUE(inst, chip_family, mxicy_mx25uw) || \
DT_INST_ENUM_HAS_VALUE(inst, chip_family, mxicy_mx66um) || \
DT_INST_ENUM_HAS_VALUE(inst, chip_family, mxicy_mx66uw) ? \
&flash_quirks_mxicy_mx25um : \
NULL

/* ---- Macronix MX25R ---- */

#define MXICY_MX25R_LH_MASK BIT(1)
#define MXICY_MX25R_QE_MASK BIT(6)
Expand Down Expand Up @@ -115,15 +118,13 @@ static inline int mxicy_mx25r_post_switch_mode(const struct device *dev)
return 0;
}

struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25r = {
__unused struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25r = {
.post_switch_mode = mxicy_mx25r_post_switch_mode,
};

#endif /* DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25r) */

#if DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25u)
/* ---- Macronix MX25UM, MX25UW, MX66UM, MX66UW ---- */

static inline int mxicy_mx25u_post_switch_mode(const struct device *dev)
static inline int mxicy_mx25um_post_switch_mode(const struct device *dev)
{
const struct flash_mspi_nor_config *dev_config = dev->config;
struct flash_mspi_nor_data *dev_data = dev->data;
Expand Down Expand Up @@ -162,7 +163,7 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev)
return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false);
}

static int mxicy_mx25u_pre_init(const struct device *dev)
static int mxicy_mx25um_pre_init(const struct device *dev)
{
const struct flash_mspi_nor_config *dev_config = dev->config;
struct flash_mspi_nor_data *dev_data = dev->data;
Expand Down Expand Up @@ -204,11 +205,9 @@ static int mxicy_mx25u_pre_init(const struct device *dev)
return 0;
}

struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25u = {
.pre_init = mxicy_mx25u_pre_init,
.post_switch_mode = mxicy_mx25u_post_switch_mode,
__unused struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25um = {
.pre_init = mxicy_mx25um_pre_init,
.post_switch_mode = mxicy_mx25um_post_switch_mode,
};

#endif /* DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25u) */

#endif /*__FLASH_MSPI_NOR_QUIRKS_H__*/
14 changes: 14 additions & 0 deletions dts/bindings/mtd/jedec,mspi-nor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ include:
- t-exit-dpd

properties:
chip-family:
type: string
description: |
Some flash chips need special handling in certain aspects, for example,
to be configured properly at initialization. This property determines
what specific routines need to be used for the flash chip. If not set,
only generic handling is used.
enum:
- "mxicy,mx25r"
- "mxicy,mx25um"
- "mxicy,mx25uw"
- "mxicy,mx66um"
- "mxicy,mx66uw"

reset-gpios:
type: phandle-array
description: |
Expand Down