summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorGUI <[email protected]>2025-02-11 14:54:59 +0800
committerGitHub <[email protected]>2025-02-11 14:54:59 +0800
commit1564735b5ccba8ca09cae340333b2bfb032205d3 (patch)
tree7836b44faaa6712034c80d21f932ece0443b1d14 /components/drivers/include
parentf820c1948a268b8824077e3155986c8e2706391f (diff)
[DM/SPI] Make CS pin config fixed in system (#9977)
Make a max CS pin value (16) for SPI, that will not alloc `*cs_pins` by malloc, because drivers call `rt_device_unregister` may not free item. Fixup the QSPI init configure member in DM mode. Make SoC Kconfig import easy. Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/dev_spi.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/components/drivers/include/drivers/dev_spi.h b/components/drivers/include/drivers/dev_spi.h
index 0aa08c49e8..ee757347f4 100644
--- a/components/drivers/include/drivers/dev_spi.h
+++ b/components/drivers/include/drivers/dev_spi.h
@@ -132,6 +132,8 @@ extern "C"{
#define RT_SPI_BUS_MODE_SPI (1<<0)
#define RT_SPI_BUS_MODE_QSPI (1<<1)
+#define RT_SPI_CS_CNT_MAX 16
+
/**
* @brief SPI message structure
*/
@@ -175,7 +177,8 @@ struct rt_spi_bus
const struct rt_spi_ops *ops;
#ifdef RT_USING_DM
- rt_base_t *pins;
+ rt_base_t cs_pins[RT_SPI_CS_CNT_MAX];
+ rt_uint8_t cs_active_vals[RT_SPI_CS_CNT_MAX];
rt_bool_t slave;
int num_chipselect;
#endif /* RT_USING_DM */
@@ -220,7 +223,7 @@ struct rt_spi_device
const struct rt_spi_device_id *id;
const struct rt_ofw_node_id *ofw_id;
- rt_uint8_t chip_select;
+ rt_uint8_t chip_select[RT_SPI_CS_CNT_MAX];
struct rt_spi_delay cs_setup;
struct rt_spi_delay cs_hold;
struct rt_spi_delay cs_inactive;