Skip to content

Commit bf6af85

Browse files
jerome-pouillerjhedberg
authored andcommitted
wiseconnect: Get rid of PSRAM_CHIP_SELECT
PSRAM_CHIP_SELECTS contains an hardware configuration parameter. This parameter belongs to the DT on the Zephyr side. Hence, it can't be defined with a macro. Fortunately, this symbol is redundant with ....spi_config_2.cs_no. So we can replace the macro by this field. Signed-off-by: Jérôme Pouiller <[email protected]>
1 parent 23a0658 commit bf6af85

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

wiseconnect/components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_psram_handle.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,16 @@ extern struct sl_psram_info_type_t PSRAM_Device;
6969
* @{
7070
*/
7171
#if (PSRAM_GPIO_PIN_SET_SEL == PSRAM_GPIO_PIN_SET_52_TO_57)
72-
#define PSRAM_CHIP_SELECT (CHIP_ZERO) /**< Chip Select for GPIO Pin Set 52 to 57 */
7372
#define PSRAM_BASE_ADDRESS (0x0A000000) /**< Base Address for GPIO Pin Set 52 to 57 */
7473
#elif (PSRAM_GPIO_PIN_SET_SEL == PSRAM_GPIO_PIN_SET_0_TO_5)
75-
#define PSRAM_CHIP_SELECT (CHIP_ZERO) /**< Chip Select for GPIO Pin Set 0 to 5 */
7674
#define PSRAM_BASE_ADDRESS (0x0A000000) /**< Base Address for GPIO Pin Set 0 to 5 */
7775
#elif (PSRAM_GPIO_PIN_SET_SEL == PSRAM_GPIO_PIN_SET_46_TO_51_CS_0)
78-
#define PSRAM_CHIP_SELECT (CHIP_ZERO) /**< Chip Select for GPIO Pin Set 46 to 51 with CS 0 */
7976
#define PSRAM_BASE_ADDRESS (0x0A000000) /**< Base Address for GPIO Pin Set 46 to 51 with CS 0 */
8077
#elif (PSRAM_GPIO_PIN_SET_SEL == PSRAM_GPIO_PIN_SET_46_TO_51_CS_1)
81-
#define PSRAM_CHIP_SELECT (CHIP_ONE) /**< Chip Select for GPIO Pin Set 46 to 51 with CS 1 */
8278
#define PSRAM_BASE_ADDRESS (0x0B000000) /**< Base Address for GPIO Pin Set 46 to 51 with CS 1 */
8379
#elif (PSRAM_GPIO_PIN_SET_SEL == PSRAM_GPIO_PIN_SET_46_TO_57_CS_0)
84-
#define PSRAM_CHIP_SELECT (CHIP_ZERO) /**< Chip Select for GPIO Pin Set 46 to 57 with CS 0 */
8580
#define PSRAM_BASE_ADDRESS (0x0A000000) /**< Base Address for GPIO Pin Set 46 to 57 with CS 0 */
8681
#elif (PSRAM_GPIO_PIN_SET_SEL == PSRAM_GPIO_PIN_SET_46_TO_57_CS_1)
87-
#define PSRAM_CHIP_SELECT (CHIP_ONE) /**< Chip Select for GPIO Pin Set 46 to 57 with CS 1 */
8882
#define PSRAM_BASE_ADDRESS (0x0B000000) /**< Base Address for GPIO Pin Set 46 to 57 with CS 1 */
8983
#endif
9084
/// @} end group PSRAM_CHIP_SELECT

wiseconnect/components/device/silabs/si91x/mcu/drivers/unified_api/src/sl_si91x_psram.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ spi_config_t spi_psram_default_config = {
7474
.extra_byte_en = 0 },
7575

7676
.spi_config_2 = { .auto_mode = EN_MANUAL_MODE,
77-
.cs_no = PSRAM_CHIP_SELECT,
77+
/* .cs_no will be filled with value from PSRAM_Device */
78+
.cs_no = 0,
7879
.neg_edge_sampling = NEG_EDGE_SAMPLING,
7980
.qspi_clk_en = QSPI_FULL_TIME_CLK,
8081
.protection = DNT_REM_WR_PROT,
@@ -983,6 +984,7 @@ sl_psram_return_type_t sl_si91x_psram_init()
983984
}
984985

985986
/*QSPI Initialization*/
987+
spi_psram_default_config.spi_config_2.cs_no = PSRAM_Device.spi_config.spi_config_2.cs_no;
986988

987989
/*Initialize the QSPI controller to PSRAM default mode configuration*/
988990
RSI_QSPI_SpiInit((qspi_reg_t *)M4_QSPI_2_BASE_ADDRESS, (spi_config_t *)&spi_psram_default_config, 0, 0, 0);
@@ -1087,6 +1089,7 @@ sl_psram_return_type_t sl_si91x_psram_uninit(void)
10871089
psram_exit_qpi_mode();
10881090

10891091
PSRAMStatus.interfaceMode = SINGLE_MODE;
1092+
spi_psram_default_config.spi_config_2.cs_no = PSRAM_Device.spi_config.spi_config_2.cs_no;
10901093

10911094
/*Initialize the QSPI controller to PSRAM default mode configuration*/
10921095
RSI_QSPI_SpiInit((qspi_reg_t *)M4_QSPI_2_BASE_ADDRESS, (spi_config_t *)&spi_psram_default_config, 0, 0, 0);

0 commit comments

Comments
 (0)