Skip to content

Commit add80d4

Browse files
committedOct 23, 2023
pinctrl: Add wake-up sources generation
The SAM SoC requires that SUPC be configured to enable specific pins to be used as wake-up sources. This add a new section denominated as wakeup. In that section the pinmux will be used to store the correct wkupX input to be used by the pinctrl driver to configure the gpio and supc accordingly. This update all pinconfigs, the pinctrl definitions, update the documentation and expand the current test to cover the changes. Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
1 parent 942d664 commit add80d4

36 files changed

+545
-454
lines changed
 

‎.github/workflows/test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- "3.8"
1414
- "3.9"
1515
- "3.10"
16+
- "3.11"
1617
steps:
1718
- uses: actions/checkout@v1
1819
- name: Set up Python

‎include/dt-bindings/pinctrl/atmel_sam_pinctrl.h

+68-50
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
* @{
1212
*/
1313

14-
#define SAM_PINMUX_PORT_a 0U
15-
#define SAM_PINMUX_PORT_b 1U
16-
#define SAM_PINMUX_PORT_c 2U
17-
#define SAM_PINMUX_PORT_d 3U
18-
#define SAM_PINMUX_PORT_e 4U
19-
#define SAM_PINMUX_PORT_f 5U
20-
#define SAM_PINMUX_PORT_g 6U
21-
#define SAM_PINMUX_PORT_h 7U
22-
#define SAM_PINMUX_PORT_i 8U
23-
#define SAM_PINMUX_PORT_j 9U
24-
#define SAM_PINMUX_PORT_k 10U
25-
#define SAM_PINMUX_PORT_l 11U
26-
#define SAM_PINMUX_PORT_m 12U
27-
#define SAM_PINMUX_PORT_n 13U
28-
#define SAM_PINMUX_PORT_o 14U
29-
#define SAM_PINMUX_PORT_p 15U
14+
#define SAM_PINMUX_PORT_a 0U
15+
#define SAM_PINMUX_PORT_b 1U
16+
#define SAM_PINMUX_PORT_c 2U
17+
#define SAM_PINMUX_PORT_d 3U
18+
#define SAM_PINMUX_PORT_e 4U
19+
#define SAM_PINMUX_PORT_f 5U
20+
#define SAM_PINMUX_PORT_g 6U
21+
#define SAM_PINMUX_PORT_h 7U
22+
#define SAM_PINMUX_PORT_i 8U
23+
#define SAM_PINMUX_PORT_j 9U
24+
#define SAM_PINMUX_PORT_k 10U
25+
#define SAM_PINMUX_PORT_l 11U
26+
#define SAM_PINMUX_PORT_m 12U
27+
#define SAM_PINMUX_PORT_n 13U
28+
#define SAM_PINMUX_PORT_o 14U
29+
#define SAM_PINMUX_PORT_p 15U
3030

3131
/** @} */
3232

@@ -36,29 +36,45 @@
3636
*/
3737

3838
/** GPIO */
39-
#define SAM_PINMUX_PERIPH_gpio 0U
39+
#define SAM_PINMUX_PERIPH_gpio 0U
4040
/** Peripherals */
41-
#define SAM_PINMUX_PERIPH_a 0U
42-
#define SAM_PINMUX_PERIPH_b 1U
43-
#define SAM_PINMUX_PERIPH_c 2U
44-
#define SAM_PINMUX_PERIPH_d 3U
45-
#define SAM_PINMUX_PERIPH_e 4U
46-
#define SAM_PINMUX_PERIPH_f 5U
47-
#define SAM_PINMUX_PERIPH_g 6U
48-
#define SAM_PINMUX_PERIPH_h 7U
49-
#define SAM_PINMUX_PERIPH_i 8U
50-
#define SAM_PINMUX_PERIPH_j 9U
51-
#define SAM_PINMUX_PERIPH_k 10U
52-
#define SAM_PINMUX_PERIPH_l 11U
53-
#define SAM_PINMUX_PERIPH_m 12U
54-
#define SAM_PINMUX_PERIPH_n 13U
41+
#define SAM_PINMUX_PERIPH_a 0U
42+
#define SAM_PINMUX_PERIPH_b 1U
43+
#define SAM_PINMUX_PERIPH_c 2U
44+
#define SAM_PINMUX_PERIPH_d 3U
45+
#define SAM_PINMUX_PERIPH_e 4U
46+
#define SAM_PINMUX_PERIPH_f 5U
47+
#define SAM_PINMUX_PERIPH_g 6U
48+
#define SAM_PINMUX_PERIPH_h 7U
49+
#define SAM_PINMUX_PERIPH_i 8U
50+
#define SAM_PINMUX_PERIPH_j 9U
51+
#define SAM_PINMUX_PERIPH_k 10U
52+
#define SAM_PINMUX_PERIPH_l 11U
53+
#define SAM_PINMUX_PERIPH_m 12U
54+
#define SAM_PINMUX_PERIPH_n 13U
5555
/** Extra */
56-
#define SAM_PINMUX_PERIPH_x 0U
56+
#define SAM_PINMUX_PERIPH_x 0U
5757
/** System */
58-
#define SAM_PINMUX_PERIPH_s 0U
58+
#define SAM_PINMUX_PERIPH_s 0U
5959
/** LPM */
60-
#define SAM_PINMUX_PERIPH_lpm 0U
61-
60+
#define SAM_PINMUX_PERIPH_lpm 0U
61+
/** Wake-up pin sources */
62+
#define SAM_PINMUX_PERIPH_wkup0 0U
63+
#define SAM_PINMUX_PERIPH_wkup1 1U
64+
#define SAM_PINMUX_PERIPH_wkup2 2U
65+
#define SAM_PINMUX_PERIPH_wkup3 3U
66+
#define SAM_PINMUX_PERIPH_wkup4 4U
67+
#define SAM_PINMUX_PERIPH_wkup5 5U
68+
#define SAM_PINMUX_PERIPH_wkup6 6U
69+
#define SAM_PINMUX_PERIPH_wkup7 7U
70+
#define SAM_PINMUX_PERIPH_wkup8 8U
71+
#define SAM_PINMUX_PERIPH_wkup9 9U
72+
#define SAM_PINMUX_PERIPH_wkup10 10U
73+
#define SAM_PINMUX_PERIPH_wkup11 11U
74+
#define SAM_PINMUX_PERIPH_wkup12 12U
75+
#define SAM_PINMUX_PERIPH_wkup13 13U
76+
#define SAM_PINMUX_PERIPH_wkup14 14U
77+
#define SAM_PINMUX_PERIPH_wkup15 15U
6278
/** @} */
6379

6480
/**
@@ -67,15 +83,17 @@
6783
*/
6884

6985
/** Selects pin to be used as GPIO */
70-
#define SAM_PINMUX_FUNC_gpio 0U
86+
#define SAM_PINMUX_FUNC_gpio 0U
7187
/** Selects pin to be used as by some peripheral */
72-
#define SAM_PINMUX_FUNC_periph 1U
88+
#define SAM_PINMUX_FUNC_periph 1U
7389
/** Selects pin to be used as extra function */
74-
#define SAM_PINMUX_FUNC_extra 2U
90+
#define SAM_PINMUX_FUNC_extra 2U
7591
/** Selects pin to be used as system function */
76-
#define SAM_PINMUX_FUNC_system 3U
92+
#define SAM_PINMUX_FUNC_system 3U
7793
/** Selects and configure pin to be used in Low Power Mode */
78-
#define SAM_PINMUX_FUNC_lpm 4U
94+
#define SAM_PINMUX_FUNC_lpm 4U
95+
/** Selects and configure wake-up pin sources Low Power Mode */
96+
#define SAM_PINMUX_FUNC_wakeup 5U
7997

8098
/** @} */
8199

@@ -85,26 +103,26 @@
85103
*/
86104

87105
/** Pinmux bit field position. */
88-
#define SAM_PINCTRL_PINMUX_POS (16U)
106+
#define SAM_PINCTRL_PINMUX_POS (16U)
89107
/** Pinmux bit field mask. */
90-
#define SAM_PINCTRL_PINMUX_MASK (0xFFFF)
108+
#define SAM_PINCTRL_PINMUX_MASK (0xFFFF)
91109

92110
/** Port field mask. */
93-
#define SAM_PINMUX_PORT_MSK (0xFU)
111+
#define SAM_PINMUX_PORT_MSK (0xFU)
94112
/** Port field position. */
95-
#define SAM_PINMUX_PORT_POS (0U)
113+
#define SAM_PINMUX_PORT_POS (0U)
96114
/** Pin field mask. */
97-
#define SAM_PINMUX_PIN_MSK (0x1FU)
115+
#define SAM_PINMUX_PIN_MSK (0x1FU)
98116
/** Pin field position. */
99-
#define SAM_PINMUX_PIN_POS (SAM_PINMUX_PORT_POS + 4U)
117+
#define SAM_PINMUX_PIN_POS (SAM_PINMUX_PORT_POS + 4U)
100118
/** Function field mask. */
101-
#define SAM_PINMUX_FUNC_MSK (0x7U)
119+
#define SAM_PINMUX_FUNC_MSK (0x7U)
102120
/** Function field position. */
103-
#define SAM_PINMUX_FUNC_POS (SAM_PINMUX_PIN_POS + 5U)
121+
#define SAM_PINMUX_FUNC_POS (SAM_PINMUX_PIN_POS + 5U)
104122
/** Peripheral field mask. */
105-
#define SAM_PINMUX_PERIPH_MSK (0xFU)
123+
#define SAM_PINMUX_PERIPH_MSK (0xFU)
106124
/** Peripheral field position. */
107-
#define SAM_PINMUX_PERIPH_POS (SAM_PINMUX_FUNC_POS + 3U)
125+
#define SAM_PINMUX_PERIPH_POS (SAM_PINMUX_FUNC_POS + 3U)
108126

109127
/** @} */
110128

‎include/dt-bindings/pinctrl/sam3AXc-pinctrl.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/* pa1x_supc_wkup0 */
3434
#define PA1X_SUPC_WKUP0 \
35-
SAM_PINMUX(a, 1, x, extra)
35+
SAM_PINMUX(a, 1, wkup0, wakeup)
3636

3737
/* pa2_gpio */
3838
#define PA2_GPIO \
@@ -64,7 +64,7 @@
6464

6565
/* pa3x_supc_wkup1 */
6666
#define PA3X_SUPC_WKUP1 \
67-
SAM_PINMUX(a, 3, x, extra)
67+
SAM_PINMUX(a, 3, wkup1, wakeup)
6868

6969
/* pa4_gpio */
7070
#define PA4_GPIO \
@@ -92,7 +92,7 @@
9292

9393
/* pa5x_supc_wkup2 */
9494
#define PA5X_SUPC_WKUP2 \
95-
SAM_PINMUX(a, 5, x, extra)
95+
SAM_PINMUX(a, 5, wkup2, wakeup)
9696

9797
/* pa6_gpio */
9898
#define PA6_GPIO \
@@ -116,7 +116,7 @@
116116

117117
/* pa7x_supc_wkup3 */
118118
#define PA7X_SUPC_WKUP3 \
119-
SAM_PINMUX(a, 7, x, extra)
119+
SAM_PINMUX(a, 7, wkup3, wakeup)
120120

121121
/* pa8_gpio */
122122
#define PA8_GPIO \
@@ -132,7 +132,7 @@
132132

133133
/* pa8x_supc_wkup4 */
134134
#define PA8X_SUPC_WKUP4 \
135-
SAM_PINMUX(a, 8, x, extra)
135+
SAM_PINMUX(a, 8, wkup4, wakeup)
136136

137137
/* pa9_gpio */
138138
#define PA9_GPIO \
@@ -160,7 +160,7 @@
160160

161161
/* pa10x_supc_wkup5 */
162162
#define PA10X_SUPC_WKUP5 \
163-
SAM_PINMUX(a, 10, x, extra)
163+
SAM_PINMUX(a, 10, wkup5, wakeup)
164164

165165
/* pa11_gpio */
166166
#define PA11_GPIO \
@@ -176,7 +176,7 @@
176176

177177
/* pa11x_supc_wkup6 */
178178
#define PA11X_SUPC_WKUP6 \
179-
SAM_PINMUX(a, 11, x, extra)
179+
SAM_PINMUX(a, 11, wkup6, wakeup)
180180

181181
/* pa12_gpio */
182182
#define PA12_GPIO \
@@ -192,7 +192,7 @@
192192

193193
/* pa12x_supc_wkup7 */
194194
#define PA12X_SUPC_WKUP7 \
195-
SAM_PINMUX(a, 12, x, extra)
195+
SAM_PINMUX(a, 12, wkup7, wakeup)
196196

197197
/* pa13_gpio */
198198
#define PA13_GPIO \
@@ -232,7 +232,7 @@
232232

233233
/* pa15x_supc_wkup8 */
234234
#define PA15X_SUPC_WKUP8 \
235-
SAM_PINMUX(a, 15, x, extra)
235+
SAM_PINMUX(a, 15, wkup8, wakeup)
236236

237237
/* pa16_gpio */
238238
#define PA16_GPIO \
@@ -272,7 +272,7 @@
272272

273273
/* pa18x_supc_wkup9 */
274274
#define PA18X_SUPC_WKUP9 \
275-
SAM_PINMUX(a, 18, x, extra)
275+
SAM_PINMUX(a, 18, wkup9, wakeup)
276276

277277
/* pa19_gpio */
278278
#define PA19_GPIO \
@@ -384,7 +384,7 @@
384384

385385
/* pa27x_supc_wkup10 */
386386
#define PA27X_SUPC_WKUP10 \
387-
SAM_PINMUX(a, 27, x, extra)
387+
SAM_PINMUX(a, 27, wkup10, wakeup)
388388

389389
/* pa28_gpio */
390390
#define PA28_GPIO \
@@ -400,7 +400,7 @@
400400

401401
/* pa28x_supc_wkup11 */
402402
#define PA28X_SUPC_WKUP11 \
403-
SAM_PINMUX(a, 28, x, extra)
403+
SAM_PINMUX(a, 28, wkup11, wakeup)
404404

405405
/* pa29_gpio */
406406
#define PA29_GPIO \
@@ -568,7 +568,7 @@
568568

569569
/* pb15x_supc_wkup10 */
570570
#define PB15X_SUPC_WKUP10 \
571-
SAM_PINMUX(b, 15, x, extra)
571+
SAM_PINMUX(b, 15, wkup10, wakeup)
572572

573573
/* pb16_gpio */
574574
#define PB16_GPIO \
@@ -668,7 +668,7 @@
668668

669669
/* pb21x_supc_wkup13 */
670670
#define PB21X_SUPC_WKUP13 \
671-
SAM_PINMUX(b, 21, x, extra)
671+
SAM_PINMUX(b, 21, wkup13, wakeup)
672672

673673
/* pb22_gpio */
674674
#define PB22_GPIO \
@@ -696,7 +696,7 @@
696696

697697
/* pb23x_supc_wkup14 */
698698
#define PB23X_SUPC_WKUP14 \
699-
SAM_PINMUX(b, 23, x, extra)
699+
SAM_PINMUX(b, 23, wkup14, wakeup)
700700

701701
/* pb24_gpio */
702702
#define PB24_GPIO \
@@ -732,7 +732,7 @@
732732

733733
/* pb26x_supc_wkup15 */
734734
#define PB26X_SUPC_WKUP15 \
735-
SAM_PINMUX(b, 26, x, extra)
735+
SAM_PINMUX(b, 26, wkup15, wakeup)
736736

737737
/* pb27_gpio */
738738
#define PB27_GPIO \

0 commit comments

Comments
 (0)
Please sign in to comment.