From db6ca32346bfabaf1f3d95df460626268a98b063 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Wed, 21 May 2025 16:59:17 -0500 Subject: [PATCH] boards: rw612: Add code to configure the pins in PM Mode 3 These settings are used to put the pins in power saving mode when we enter SUSPEND power mode. Signed-off-by: Mahesh Mahadevan --- boards/nxp/frdm_rw612/init.c | 31 +++++++++++++++++++++++++++++++ boards/nxp/rd_rw612_bga/init.c | 23 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/boards/nxp/frdm_rw612/init.c b/boards/nxp/frdm_rw612/init.c index 44c05ad3efe..b67acb6dbda 100644 --- a/boards/nxp/frdm_rw612/init.c +++ b/boards/nxp/frdm_rw612/init.c @@ -6,6 +6,17 @@ #include #include #include +#include + +#define NON_AON_PINS_START 0 +#define NON_AON_PINS_BREAK 21 +#define NON_AON_PINS_RESTART 28 +#define NON_AON_PINS_END 63 +#define RF_CNTL_PINS_START 0 +#define RF_CNTL_PINS_END 3 +#define LED_BLUE_GPIO 0 +#define LED_RED_GPIO 1 +#define LED_GREEN_GPIO 12 static void frdm_rw612_power_init_config(void) { @@ -42,6 +53,26 @@ void board_early_init_hook(void) }; pm_notifier_register(&frdm_rw612_pm_notifier); + + int32_t i; + + /* Set all non-AON pins output low level in sleep mode. */ + for (i = NON_AON_PINS_START; i <= NON_AON_PINS_BREAK; i++) { + IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); + } + for (i = NON_AON_PINS_RESTART; i <= NON_AON_PINS_END; i++) { + IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); + } + + /* Set the LED GPIO output pins to be High in PM3 as these pins are Active Low */ + IO_MUX_SetPinOutLevelInSleep(LED_BLUE_GPIO, IO_MUX_SleepPinLevelHigh); + IO_MUX_SetPinOutLevelInSleep(LED_RED_GPIO, IO_MUX_SleepPinLevelHigh); + IO_MUX_SetPinOutLevelInSleep(LED_GREEN_GPIO, IO_MUX_SleepPinLevelHigh); + + /* Set RF_CNTL 0-3 output low level in sleep mode. */ + for (i = RF_CNTL_PINS_START; i <= RF_CNTL_PINS_END; i++) { + IO_MUX_SetRfPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); + } #endif #ifdef CONFIG_I2S_TEST_SEPARATE_DEVICES diff --git a/boards/nxp/rd_rw612_bga/init.c b/boards/nxp/rd_rw612_bga/init.c index d3b8459495d..3b658424151 100644 --- a/boards/nxp/rd_rw612_bga/init.c +++ b/boards/nxp/rd_rw612_bga/init.c @@ -6,6 +6,14 @@ #include #include #include +#include + +#define NON_AON_PINS_START 0 +#define NON_AON_PINS_BREAK 21 +#define NON_AON_PINS_RESTART 28 +#define NON_AON_PINS_END 63 +#define RF_CNTL_PINS_START 0 +#define RF_CNTL_PINS_END 3 static void rdrw61x_power_init_config(void) { @@ -42,6 +50,21 @@ void board_early_init_hook(void) }; pm_notifier_register(&rdrw61x_pm_notifier); + + int32_t i; + + /* Set all non-AON pins output low level in sleep mode. */ + for (i = NON_AON_PINS_START; i <= NON_AON_PINS_BREAK; i++) { + IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); + } + for (i = NON_AON_PINS_RESTART; i <= NON_AON_PINS_END; i++) { + IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); + } + + /* Set RF_CNTL 0-3 output low level in sleep mode. */ + for (i = RF_CNTL_PINS_START; i <= RF_CNTL_PINS_END; i++) { + IO_MUX_SetRfPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); + } #endif #ifdef CONFIG_I2S_TEST_SEPARATE_DEVICES