Skip to content

Commit 8a2d4d7

Browse files
committed
[nrf fromtree] drivers: flash_mspi_nor: Add support for DDR in mx25u family
When Octal IO mode is to be used with DDR in mx25u family chips, bit 1 instead of 0 must be set in the Configuration Register 2 at address 0. Signed-off-by: Andrzej Głąbek <[email protected]> (cherry picked from commit 77f00f0)
1 parent 0d565bb commit 8a2d4d7

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

drivers/flash/flash_mspi_nor_quirks.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,30 @@ struct flash_mspi_nor_quirks flash_quirks_mxicy_mx25r = {
123123

124124
#if DT_HAS_COMPAT_STATUS_OKAY(mxicy_mx25u)
125125

126-
#define MXICY_MX25R_OE_MASK BIT(0)
127-
128-
static uint8_t mxicy_mx25u_oe_payload = MXICY_MX25R_OE_MASK;
129-
130126
static inline int mxicy_mx25u_post_switch_mode(const struct device *dev)
131127
{
132128
const struct flash_mspi_nor_config *dev_config = dev->config;
133129
struct flash_mspi_nor_data *dev_data = dev->data;
134130
enum mspi_io_mode io_mode = dev_config->mspi_nor_cfg.io_mode;
131+
uint8_t opi_enable;
135132
int rc;
136133

137134
if (io_mode != MSPI_IO_MODE_OCTAL) {
138135
return 0;
139136
}
140137

138+
/*
139+
* TODO - replace this with a generic routine that uses information
140+
* from SFDP header FF87 (Status, Control and Configuration
141+
* Register Map)
142+
*/
143+
144+
if (dev_config->mspi_nor_cfg.data_rate == MSPI_DATA_RATE_DUAL) {
145+
opi_enable = BIT(1);
146+
} else {
147+
opi_enable = BIT(0);
148+
}
149+
141150
/* Write enable */
142151
rc = cmd_wren(dev);
143152
if (rc < 0) {
@@ -148,8 +157,8 @@ static inline int mxicy_mx25u_post_switch_mode(const struct device *dev)
148157
set_up_xfer(dev, MSPI_TX);
149158
dev_data->xfer.addr_length = 4;
150159
dev_data->packet.address = 0;
151-
dev_data->packet.data_buf = &mxicy_mx25u_oe_payload;
152-
dev_data->packet.num_bytes = sizeof(mxicy_mx25u_oe_payload);
160+
dev_data->packet.data_buf = &opi_enable;
161+
dev_data->packet.num_bytes = sizeof(opi_enable);
153162
return perform_xfer(dev, SPI_NOR_CMD_WR_CFGREG2, false);
154163
}
155164

0 commit comments

Comments
 (0)