Skip to content

Commit 6e3a8da

Browse files
danieldegrassecfriedt
authored andcommitted
drivers: mspi: mspi_dw: support configuration of TXD_DRIVE_EDGE setting
TXD_DRIVE_EDGE setting will typically be set to BAUDR/4 for DDR mode, but this may not cover all cases. Add a configurable multiplier and divisor to apply to the BAUDR value so the value's relation to BAUDR can be customized. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent f4e466e commit 6e3a8da

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

drivers/mspi/Kconfig.dw

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# Copyright (c) 2025 Tenstorrent AI ULC
23
# SPDX-License-Identifier: Apache-2.0
34

45
config MSPI_DW
@@ -7,3 +8,23 @@ config MSPI_DW
78
depends on DT_HAS_SNPS_DESIGNWARE_SSI_ENABLED
89
select PINCTRL if $(dt_compat_any_has_prop,$(DT_COMPAT_SNPS_DESIGNWARE_SSI),pinctrl-0)
910
imply MSPI_XIP
11+
12+
if MSPI_DW
13+
14+
config MSPI_DW_TXD_DIV
15+
int "Designware SSI TX Drive edge divisor"
16+
default 4
17+
help
18+
Division factor to apply to calculated BAUDR value when writing it
19+
to the TXD_DRIVE_EDGE register in DDR mode. Note that the maximum
20+
value of this register is (BAUDR / 2) - 1.
21+
22+
config MSPI_DW_TXD_MUL
23+
int "Designware SSI TX Drive edge multiplier"
24+
default 1
25+
help
26+
Multiplication factor to apply to calculated BAUDR value when writing
27+
it to the TXD_DRIVE_EDGE register in DDR mode. Note that the maximum
28+
value of this register is (BAUDR / 2) - 1.
29+
30+
endif # MSPI_DW

drivers/mspi/mspi_dw.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,10 @@ static int start_next_packet(const struct device *dev, k_timeout_t timeout)
956956
write_rx_sample_dly(dev, dev_data->rx_sample_dly);
957957
if (dev_data->spi_ctrlr0 & (SPI_CTRLR0_SPI_DDR_EN_BIT |
958958
SPI_CTRLR0_INST_DDR_EN_BIT)) {
959-
write_txd_drive_edge(dev, dev_data->baudr / 4);
959+
int txd = (CONFIG_MSPI_DW_TXD_MUL * dev_data->baudr) /
960+
CONFIG_MSPI_DW_TXD_DIV;
961+
962+
write_txd_drive_edge(dev, txd);
960963
} else {
961964
write_txd_drive_edge(dev, 0);
962965
}

0 commit comments

Comments
 (0)