Skip to content

Commit e41898e

Browse files
AnElderlyFoxDenis Isaev
authored andcommitted
spi_mcux_lpspi: revert old driver
Revert the old MCUX LPSPI driver to its original location to allow users to choose which implementation to use. The new driver remains under development and has shown instability and functional issues in some configurations. Providing the previous version ensures a stable and reliable option for users who prefer or require it. The restored driver was taken from commit <42511c80bacee5f072fc64b0c9d6dc068005e31b> (before it was moved to the new location). Signed-off-by: Isaev Denis <[email protected]>
1 parent 0520dfe commit e41898e

File tree

11 files changed

+925
-10
lines changed

11 files changed

+925
-10
lines changed

drivers/clock_control/clock_control_mcux_ccm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(clock_control);
2525
static sc_ipc_t ipc_handle;
2626
#endif
2727

28-
#ifdef CONFIG_SPI_NXP_LPSPI
28+
#if defined(CONFIG_SPI_NXP_LPSPI) || defined(CONFIG_SPI_MCUX_LPSPI)
2929
static const clock_name_t lpspi_clocks[] = {
3030
kCLOCK_Usb1PllPfd1Clk,
3131
kCLOCK_Usb1PllPfd0Clk,
@@ -270,7 +270,7 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
270270
break;
271271
#endif
272272

273-
#ifdef CONFIG_SPI_NXP_LPSPI
273+
#if defined(CONFIG_SPI_NXP_LPSPI) || defined(CONFIG_SPI_MCUX_LPSPI)
274274
case IMX_CCM_LPSPI_CLK:
275275
{
276276
uint32_t lpspi_mux = CLOCK_GetMux(kCLOCK_LpspiMux);

drivers/clock_control/clock_control_mcux_ccm_rev2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
8181
break;
8282
#endif
8383

84-
#ifdef CONFIG_SPI_NXP_LPSPI
84+
#if defined(CONFIG_SPI_NXP_LPSPI) || defined(CONFIG_SPI_MCUX_LPSPI)
8585
#if defined(CONFIG_SOC_SERIES_IMXRT118X)
8686
case IMX_CCM_LPSPI0102_CLK:
8787
clock_root = kCLOCK_Root_Lpspi0102 + instance;
@@ -91,7 +91,7 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
9191
clock_root = kCLOCK_Root_Lpspi1 + instance;
9292
break;
9393
#endif /* CONFIG_SOC_SERIES_IMXRT118X */
94-
#endif /* CONFIG_SPI_NXP_LPSPI */
94+
#endif /* CONFIG_SPI_NXP_LPSPI || CONFIG_SPI_MCUX_LPSPI */
9595

9696
#ifdef CONFIG_UART_MCUX_LPUART
9797
#if defined(CONFIG_SOC_SERIES_IMXRT118X)

drivers/clock_control/clock_control_mcux_syscon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,14 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(const struct device *de
603603
break;
604604
#endif /* defined(CONFIG_DT_HAS_NXP_XSPI_ENABLED) */
605605

606-
#if (defined(CONFIG_SPI_NXP_LPSPI) && CONFIG_SOC_FAMILY_MCXA)
606+
#if ((defined(CONFIG_SPI_NXP_LPSPI) || defined(CONFIG_SPI_MCUX_LPSPI)) && CONFIG_SOC_FAMILY_MCXA)
607607
case MCUX_LPSPI0_CLK:
608608
*rate = CLOCK_GetLpspiClkFreq(0);
609609
break;
610610
case MCUX_LPSPI1_CLK:
611611
*rate = CLOCK_GetLpspiClkFreq(1);
612612
break;
613-
#endif /* defined(CONFIG_SPI_NXP_LPSPI) */
613+
#endif /* defined(CONFIG_SPI_NXP_LPSPI) || defined(CONFIG_SPI_MCUX_LPSPI) */
614614
}
615615

616616
return 0;

drivers/spi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_DSPI spi_mcux_dspi.c)
3939
zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_ECSPI spi_mcux_ecspi.c)
4040
zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_FLEXCOMM spi_mcux_flexcomm.c)
4141
zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_FLEXIO spi_mcux_flexio.c)
42+
zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_LPSPI spi_mcux_lpspi.c)
4243
zephyr_library_sources_ifdef(CONFIG_SPI_MEC5_QSPI spi_mchp_mec5_qspi.c)
4344
zephyr_library_sources_ifdef(CONFIG_SPI_NPCX_SPIP spi_npcx_spip.c)
4445
zephyr_library_sources_ifdef(CONFIG_SPI_NRFX_SPI spi_nrfx_spi.c spi_nrfx_common.c)

drivers/spi/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ source "drivers/spi/Kconfig.mcux_dspi"
118118
source "drivers/spi/Kconfig.mcux_ecspi"
119119
source "drivers/spi/Kconfig.mcux_flexcomm"
120120
source "drivers/spi/Kconfig.mcux_flexio"
121+
source "drivers/spi/Kconfig.mcux_lpspi"
121122
source "drivers/spi/Kconfig.mec5"
122123
source "drivers/spi/Kconfig.npcx"
123124
source "drivers/spi/Kconfig.nrfx"

drivers/spi/Kconfig.mcux_lpspi

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# MCUXpresso SDK SPI
2+
3+
# Copyright (c) 2018, NXP
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config SPI_MCUX_LPSPI
7+
bool "MCUX LPSPI driver"
8+
default y
9+
depends on DT_HAS_NXP_LPSPI_ENABLED
10+
depends on CLOCK_CONTROL
11+
select PINCTRL
12+
help
13+
Enable support for MCUX LPSPI driver.
14+
15+
if SPI_MCUX_LPSPI
16+
config SPI_MCUX_LPSPI_DMA
17+
bool "MCUX LPSPI SPI DMA Support"
18+
select DMA
19+
help
20+
Enable the SPI DMA mode for SPI instances
21+
that enable dma channels in their device tree node.
22+
23+
if SPI_RTIO
24+
config SPI_MCUX_RTIO_SQ_SIZE
25+
int "number of available submission queue entries"
26+
default 8 # sensible default that covers most common spi transactions
27+
help
28+
when rtio is use with spi each driver holds a context with which blocking
29+
api calls use to perform spi transactions. this queue needs to be as deep
30+
as the longest set of spi_buf_sets used, where normal spi operations are
31+
used (equal length buffers). it may need to be slightly deeper where the
32+
spi buffer sets for transmit/receive are not always matched equally in
33+
length as these are transformed into normal transceives.
34+
endif # SPI_RTIO
35+
36+
endif # SPI_MCUX_LPSPI

0 commit comments

Comments
 (0)