Skip to content

Commit 55af282

Browse files
Hi-Im-Davidcfriedt
authored andcommitted
drivers: mspi_dw: Add CONFIG_MSPI_DW_DDR
Dual data rate isn't always supported so this config enables/disables the relevant code in the driver. Signed-off-by: David Jewsbury <[email protected]>
1 parent 4bf6a75 commit 55af282

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/mspi/Kconfig.dw

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ config MSPI_DW
1111

1212
if MSPI_DW
1313

14+
config MSPI_DW_DDR
15+
bool "Dual Data-Rate (DDR) capabilities"
16+
default y
17+
help
18+
Dual data rate is supported by some devices and requires specific
19+
registers to be enabled in the IP.
20+
1421
config MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE
1522
bool "Handle FIFO in system workqueue"
1623
depends on MULTITHREADING
@@ -23,6 +30,7 @@ config MSPI_DW_HANDLE_FIFOS_IN_SYSTEM_WORKQUEUE
2330

2431
config MSPI_DW_TXD_DIV
2532
int "Designware SSI TX Drive edge divisor"
33+
depends on MSPI_DW_DDR
2634
default 4
2735
help
2836
Division factor to apply to calculated BAUDR value when writing it
@@ -31,6 +39,7 @@ config MSPI_DW_TXD_DIV
3139

3240
config MSPI_DW_TXD_MUL
3341
int "Designware SSI TX Drive edge multiplier"
42+
depends on MSPI_DW_DDR
3443
default 1
3544
help
3645
Multiplication factor to apply to calculated BAUDR value when writing

drivers/mspi/mspi_dw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,13 +937,15 @@ static int _api_dev_config(const struct device *dev,
937937
switch (cfg->data_rate) {
938938
case MSPI_DATA_RATE_SINGLE:
939939
break;
940+
#if defined(CONFIG_MSPI_DW_DDR)
940941
case MSPI_DATA_RATE_DUAL:
941942
dev_data->spi_ctrlr0 |= SPI_CTRLR0_INST_DDR_EN_BIT;
942943
/* Also need to set DDR_EN bit */
943944
__fallthrough;
944945
case MSPI_DATA_RATE_S_D_D:
945946
dev_data->spi_ctrlr0 |= SPI_CTRLR0_SPI_DDR_EN_BIT;
946947
break;
948+
#endif
947949
default:
948950
LOG_ERR("Data rate %d not supported",
949951
cfg->data_rate);
@@ -1238,6 +1240,7 @@ static int start_next_packet(const struct device *dev)
12381240
write_spi_ctrlr0(dev, dev_data->spi_ctrlr0);
12391241
write_baudr(dev, dev_data->baudr);
12401242
write_rx_sample_dly(dev, dev_data->rx_sample_dly);
1243+
#if defined(CONFIG_MSPI_DW_DDR)
12411244
if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT |
12421245
SPI_CTRLR0_INST_DDR_EN_BIT)) {
12431246
int txd = (CONFIG_MSPI_DW_TXD_MUL * dev_data->baudr) /
@@ -1247,6 +1250,7 @@ static int start_next_packet(const struct device *dev)
12471250
} else {
12481251
write_txd_drive_edge(dev, 0);
12491252
}
1253+
#endif
12501254

12511255
if (xip_enabled) {
12521256
write_ssienr(dev, SSIENR_SSIC_EN_BIT);

0 commit comments

Comments
 (0)