Skip to content

Commit fd3adad

Browse files
mmahadevan108henrikbrixandersen
authored andcommitted
soc: nxp: rw: Move the code for pin configuration in sleep mode to SoC file
All pins are configured by default to be output low during sleep. A device-tree property called "sleep-output" is provided for cases where pins need to be configured differently. Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent 5541f3f commit fd3adad

File tree

3 files changed

+22
-54
lines changed

3 files changed

+22
-54
lines changed

boards/nxp/frdm_rw612/init.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
#include <zephyr/pm/pm.h>
77
#include <fsl_power.h>
88
#include <fsl_common.h>
9-
#include <fsl_io_mux.h>
10-
11-
#define NON_AON_PINS_START 0
12-
#define NON_AON_PINS_BREAK 21
13-
#define NON_AON_PINS_RESTART 28
14-
#define NON_AON_PINS_END 63
15-
#define RF_CNTL_PINS_START 0
16-
#define RF_CNTL_PINS_END 3
17-
#define LED_BLUE_GPIO 0
18-
#define LED_RED_GPIO 1
19-
#define LED_GREEN_GPIO 12
209

2110
static void frdm_rw612_power_init_config(void)
2211
{
@@ -53,26 +42,6 @@ void board_early_init_hook(void)
5342
};
5443

5544
pm_notifier_register(&frdm_rw612_pm_notifier);
56-
57-
int32_t i;
58-
59-
/* Set all non-AON pins output low level in sleep mode. */
60-
for (i = NON_AON_PINS_START; i <= NON_AON_PINS_BREAK; i++) {
61-
IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
62-
}
63-
for (i = NON_AON_PINS_RESTART; i <= NON_AON_PINS_END; i++) {
64-
IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
65-
}
66-
67-
/* Set the LED GPIO output pins to be High in PM3 as these pins are Active Low */
68-
IO_MUX_SetPinOutLevelInSleep(LED_BLUE_GPIO, IO_MUX_SleepPinLevelHigh);
69-
IO_MUX_SetPinOutLevelInSleep(LED_RED_GPIO, IO_MUX_SleepPinLevelHigh);
70-
IO_MUX_SetPinOutLevelInSleep(LED_GREEN_GPIO, IO_MUX_SleepPinLevelHigh);
71-
72-
/* Set RF_CNTL 0-3 output low level in sleep mode. */
73-
for (i = RF_CNTL_PINS_START; i <= RF_CNTL_PINS_END; i++) {
74-
IO_MUX_SetRfPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
75-
}
7645
#endif
7746

7847
#ifdef CONFIG_I2S_TEST_SEPARATE_DEVICES

boards/nxp/rd_rw612_bga/init.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
#include <zephyr/pm/pm.h>
77
#include <fsl_power.h>
88
#include <fsl_common.h>
9-
#include <fsl_io_mux.h>
10-
11-
#define NON_AON_PINS_START 0
12-
#define NON_AON_PINS_BREAK 21
13-
#define NON_AON_PINS_RESTART 28
14-
#define NON_AON_PINS_END 63
15-
#define RF_CNTL_PINS_START 0
16-
#define RF_CNTL_PINS_END 3
179

1810
static void rdrw61x_power_init_config(void)
1911
{
@@ -50,21 +42,6 @@ void board_early_init_hook(void)
5042
};
5143

5244
pm_notifier_register(&rdrw61x_pm_notifier);
53-
54-
int32_t i;
55-
56-
/* Set all non-AON pins output low level in sleep mode. */
57-
for (i = NON_AON_PINS_START; i <= NON_AON_PINS_BREAK; i++) {
58-
IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
59-
}
60-
for (i = NON_AON_PINS_RESTART; i <= NON_AON_PINS_END; i++) {
61-
IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
62-
}
63-
64-
/* Set RF_CNTL 0-3 output low level in sleep mode. */
65-
for (i = RF_CNTL_PINS_START; i <= RF_CNTL_PINS_END; i++) {
66-
IO_MUX_SetRfPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
67-
}
6845
#endif
6946

7047
#ifdef CONFIG_I2S_TEST_SEPARATE_DEVICES

soc/nxp/rw/soc.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,18 @@
1717
#include <fsl_clock.h>
1818
#include <fsl_common.h>
1919
#include <fsl_device_registers.h>
20+
#include <fsl_io_mux.h>
2021
#include "soc.h"
2122
#include "flexspi_clock_setup.h"
2223
#include "fsl_ocotp.h"
2324

25+
#define NON_AON_PINS_START 0
26+
#define NON_AON_PINS_BREAK 21
27+
#define NON_AON_PINS_RESTART 28
28+
#define NON_AON_PINS_END 63
29+
#define RF_CNTL_PINS_START 0
30+
#define RF_CNTL_PINS_END 3
31+
2432
extern void nxp_nbu_init(void);
2533
#ifdef CONFIG_NXP_RW6XX_BOOT_HEADER
2634
extern char z_main_stack[];
@@ -325,6 +333,20 @@ void soc_early_init_hook(void)
325333
#endif
326334
#if CONFIG_PM
327335
nxp_rw6xx_power_init();
336+
337+
int32_t i;
338+
/* Set all non-AON pins output low level in sleep mode. */
339+
for (i = NON_AON_PINS_START; i <= NON_AON_PINS_BREAK; i++) {
340+
IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
341+
}
342+
for (i = NON_AON_PINS_RESTART; i <= NON_AON_PINS_END; i++) {
343+
IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
344+
}
345+
346+
/* Set RF_CNTL 0-3 output low level in sleep mode. */
347+
for (i = RF_CNTL_PINS_START; i <= RF_CNTL_PINS_END; i++) {
348+
IO_MUX_SetRfPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow);
349+
}
328350
#endif
329351

330352
#if defined(CONFIG_BT) || defined(CONFIG_IEEE802154)

0 commit comments

Comments
 (0)