Skip to content

Commit 2b1c87d

Browse files
Florian Vaussardgalak
authored andcommitted
pinmux: stm32f4: Add pinmux for more UARTs
Add defines and pinmux arrays to support more UARTs on STM32F4. Change-Id: Ib06c549bdb2b3d7065554a0a6d1a3d15441b29c9 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
1 parent 0fda994 commit 2b1c87d

File tree

2 files changed

+407
-0
lines changed

2 files changed

+407
-0
lines changed

arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c

Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
#define PINMUX_PWM2(pin, chan)
2828
#define PINMUX_UART1(pin, dir)
2929
#define PINMUX_UART2(pin, dir)
30+
#define PINMUX_UART3(pin, dir)
31+
#define PINMUX_UART4(pin, dir)
32+
#define PINMUX_UART5(pin, dir)
33+
#define PINMUX_UART6(pin, dir)
34+
#define PINMUX_UART7(pin, dir)
35+
#define PINMUX_UART8(pin, dir)
36+
#define PINMUX_UART9(pin, dir)
37+
#define PINMUX_UART10(pin, dir)
3038

3139
#ifdef CONFIG_PWM_STM32_2
3240
#undef PINMUX_PWM2
@@ -43,11 +51,57 @@
4351
#define PINMUX_UART2(pin, dir) _PINMUX_UART(pin, USART2, dir)
4452
#endif
4553

54+
#ifdef CONFIG_UART_STM32_PORT_3
55+
#undef PINMUX_UART3
56+
#define PINMUX_UART3(pin, dir) _PINMUX_UART(pin, USART3, dir)
57+
#endif
58+
59+
#ifdef CONFIG_UART_STM32_PORT_4
60+
#undef PINMUX_UART4
61+
#define PINMUX_UART4(pin, dir) _PINMUX_UART(pin, UART4, dir)
62+
#endif
63+
64+
#ifdef CONFIG_UART_STM32_PORT_5
65+
#undef PINMUX_UART5
66+
#define PINMUX_UART5(pin, dir) _PINMUX_UART(pin, UART5, dir)
67+
#endif
68+
69+
#ifdef CONFIG_UART_STM32_PORT_6
70+
#undef PINMUX_UART6
71+
#define PINMUX_UART6(pin, dir) _PINMUX_UART(pin, USART6, dir)
72+
#endif
73+
74+
#ifdef CONFIG_UART_STM32_PORT_7
75+
#undef PINMUX_UART7
76+
#define PINMUX_UART7(pin, dir) _PINMUX_UART(pin, UART7, dir)
77+
#endif
78+
79+
#ifdef CONFIG_UART_STM32_PORT_8
80+
#undef PINMUX_UART8
81+
#define PINMUX_UART8(pin, dir) _PINMUX_UART(pin, UART8, dir)
82+
#endif
83+
84+
#ifdef CONFIG_UART_STM32_PORT_9
85+
#undef PINMUX_UART9
86+
#define PINMUX_UART9(pin, dir) _PINMUX_UART(pin, UART9, dir)
87+
#endif
88+
89+
#ifdef CONFIG_UART_STM32_PORT_10
90+
#undef PINMUX_UART10
91+
#define PINMUX_UART10(pin, dir) _PINMUX_UART(pin, UART10, dir)
92+
#endif
93+
4694
#define PINMUX_PWM(pin, pwm, chan) PINMUX_##pwm(pin, chan)
4795
#define PINMUX_UART(pin, port, dir) PINMUX_##port(pin, dir)
4896

97+
/* Port A */
4998
static const stm32_pin_func_t pin_pa0_funcs[] = {
5099
PINMUX_PWM(PA0, PWM2, 1)
100+
PINMUX_UART(PA0, UART4, TX)
101+
};
102+
103+
static const stm32_pin_func_t pin_pa1_funcs[] = {
104+
PINMUX_UART(PA1, UART4, RX)
51105
};
52106

53107
static const stm32_pin_func_t pin_pa2_funcs[] = {
@@ -58,6 +112,10 @@ static const stm32_pin_func_t pin_pa3_funcs[] = {
58112
PINMUX_UART(PA3, UART2, RX)
59113
};
60114

115+
static const stm32_pin_func_t pin_pa8_funcs[] = {
116+
PINMUX_UART(PA8, UART7, RX)
117+
};
118+
61119
static const stm32_pin_func_t pin_pa9_funcs[] = {
62120
PINMUX_UART(PA9, UART1, TX)
63121
};
@@ -66,25 +124,267 @@ static const stm32_pin_func_t pin_pa10_funcs[] = {
66124
PINMUX_UART(PA10, UART1, RX)
67125
};
68126

127+
static const stm32_pin_func_t pin_pa11_funcs[] = {
128+
PINMUX_UART(PA11, UART6, TX)
129+
PINMUX_UART(PA11, UART4, RX)
130+
};
131+
132+
static const stm32_pin_func_t pin_pa12_funcs[] = {
133+
PINMUX_UART(PA12, UART6, RX)
134+
PINMUX_UART(PA12, UART4, TX)
135+
};
136+
137+
static const stm32_pin_func_t pin_pa15_funcs[] = {
138+
PINMUX_UART(PA15, UART1, TX)
139+
PINMUX_UART(PA15, UART7, TX)
140+
};
141+
142+
/* Port B */
143+
static const stm32_pin_func_t pin_pb3_funcs[] = {
144+
PINMUX_UART(PB3, UART1, RX)
145+
PINMUX_UART(PB3, UART7, RX)
146+
};
147+
148+
static const stm32_pin_func_t pin_pb4_funcs[] = {
149+
PINMUX_UART(PB4, UART7, TX)
150+
};
151+
152+
static const stm32_pin_func_t pin_pb5_funcs[] = {
153+
PINMUX_UART(PB5, UART5, RX)
154+
};
155+
69156
static const stm32_pin_func_t pin_pb6_funcs[] = {
70157
PINMUX_UART(PB6, UART1, TX)
158+
PINMUX_UART(PB6, UART5, TX)
71159
};
72160

73161
static const stm32_pin_func_t pin_pb7_funcs[] = {
74162
PINMUX_UART(PB7, UART1, RX)
75163
};
76164

165+
static const stm32_pin_func_t pin_pb8_funcs[] = {
166+
PINMUX_UART(PB8, UART5, RX)
167+
};
168+
169+
static const stm32_pin_func_t pin_pb9_funcs[] = {
170+
PINMUX_UART(PB9, UART5, TX)
171+
};
172+
173+
static const stm32_pin_func_t pin_pb10_funcs[] = {
174+
PINMUX_UART(PB10, UART3, TX)
175+
};
176+
177+
static const stm32_pin_func_t pin_pb11_funcs[] = {
178+
PINMUX_UART(PB11, UART3, RX)
179+
};
180+
181+
static const stm32_pin_func_t pin_pb12_funcs[] = {
182+
PINMUX_UART(PB12, UART5, RX)
183+
};
184+
185+
static const stm32_pin_func_t pin_pb13_funcs[] = {
186+
PINMUX_UART(PB13, UART5, TX)
187+
};
188+
189+
/* Port C */
190+
static const stm32_pin_func_t pin_pc5_funcs[] = {
191+
PINMUX_UART(PC5, UART3, RX)
192+
};
193+
194+
static const stm32_pin_func_t pin_pc6_funcs[] = {
195+
PINMUX_UART(PC6, UART6, TX)
196+
};
197+
198+
static const stm32_pin_func_t pin_pc7_funcs[] = {
199+
PINMUX_UART(PC7, UART6, RX)
200+
};
201+
202+
static const stm32_pin_func_t pin_pc10_funcs[] = {
203+
PINMUX_UART(PC10, UART3, TX)
204+
};
205+
206+
static const stm32_pin_func_t pin_pc11_funcs[] = {
207+
PINMUX_UART(PC11, UART3, RX)
208+
PINMUX_UART(PC11, UART4, RX)
209+
};
210+
211+
static const stm32_pin_func_t pin_pc12_funcs[] = {
212+
PINMUX_UART(PC12, UART5, TX)
213+
};
214+
215+
/* Port D */
216+
static const stm32_pin_func_t pin_pd0_funcs[] = {
217+
PINMUX_UART(PD0, UART4, RX)
218+
};
219+
220+
static const stm32_pin_func_t pin_pd2_funcs[] = {
221+
PINMUX_UART(PD2, UART5, RX)
222+
};
223+
224+
static const stm32_pin_func_t pin_pd5_funcs[] = {
225+
PINMUX_UART(PD5, UART2, TX)
226+
};
227+
228+
static const stm32_pin_func_t pin_pd6_funcs[] = {
229+
PINMUX_UART(PD6, UART2, RX)
230+
};
231+
232+
static const stm32_pin_func_t pin_pd8_funcs[] = {
233+
PINMUX_UART(PD8, UART3, TX)
234+
};
235+
236+
static const stm32_pin_func_t pin_pd9_funcs[] = {
237+
PINMUX_UART(PD9, UART3, RX)
238+
};
239+
240+
static const stm32_pin_func_t pin_pd10_funcs[] = {
241+
PINMUX_UART(PD10, UART4, TX)
242+
};
243+
244+
static const stm32_pin_func_t pin_pd14_funcs[] = {
245+
PINMUX_UART(PD14, UART9, RX)
246+
};
247+
248+
static const stm32_pin_func_t pin_pd15_funcs[] = {
249+
PINMUX_UART(PD15, UART9, TX)
250+
};
251+
252+
/* Port E */
253+
static const stm32_pin_func_t pin_pe0_funcs[] = {
254+
PINMUX_UART(PE0, UART8, RX)
255+
};
256+
257+
static const stm32_pin_func_t pin_pe1_funcs[] = {
258+
PINMUX_UART(PE1, UART8, TX)
259+
};
260+
261+
static const stm32_pin_func_t pin_pe2_funcs[] = {
262+
PINMUX_UART(PE2, UART10, RX)
263+
};
264+
265+
static const stm32_pin_func_t pin_pe3_funcs[] = {
266+
PINMUX_UART(PE3, UART10, TX)
267+
};
268+
269+
static const stm32_pin_func_t pin_pe7_funcs[] = {
270+
PINMUX_UART(PE7, UART7, RX)
271+
};
272+
273+
static const stm32_pin_func_t pin_pe8_funcs[] = {
274+
PINMUX_UART(PE8, UART7, TX)
275+
};
276+
277+
/* Port F */
278+
static const stm32_pin_func_t pin_pf6_funcs[] = {
279+
PINMUX_UART(PF6, UART7, RX)
280+
};
281+
282+
static const stm32_pin_func_t pin_pf7_funcs[] = {
283+
PINMUX_UART(PF7, UART7, TX)
284+
};
285+
286+
static const stm32_pin_func_t pin_pf8_funcs[] = {
287+
PINMUX_UART(PF8, UART8, RX)
288+
};
289+
290+
static const stm32_pin_func_t pin_pf9_funcs[] = {
291+
PINMUX_UART(PF9, UART8, TX)
292+
};
293+
294+
/* Port G */
295+
static const stm32_pin_func_t pin_pg0_funcs[] = {
296+
PINMUX_UART(PG0, UART9, RX)
297+
};
298+
299+
static const stm32_pin_func_t pin_pg1_funcs[] = {
300+
PINMUX_UART(PG1, UART9, TX)
301+
};
302+
303+
static const stm32_pin_func_t pin_pg9_funcs[] = {
304+
PINMUX_UART(PG9, UART6, RX)
305+
};
306+
307+
static const stm32_pin_func_t pin_pg11_funcs[] = {
308+
PINMUX_UART(PG11, UART10, RX)
309+
};
310+
311+
static const stm32_pin_func_t pin_pg12_funcs[] = {
312+
PINMUX_UART(PG12, UART10, TX)
313+
};
314+
315+
static const stm32_pin_func_t pin_pg14_funcs[] = {
316+
PINMUX_UART(PG14, UART6, TX)
317+
};
318+
77319
/**
78320
* @brief pin configuration
79321
*/
80322
static const struct stm32_pinmux_conf pins[] = {
323+
/* Port A */
81324
STM32_PIN_CONF(STM32_PIN_PA0, pin_pa0_funcs),
325+
STM32_PIN_CONF(STM32_PIN_PA1, pin_pa1_funcs),
82326
STM32_PIN_CONF(STM32_PIN_PA2, pin_pa2_funcs),
83327
STM32_PIN_CONF(STM32_PIN_PA3, pin_pa3_funcs),
328+
STM32_PIN_CONF(STM32_PIN_PA8, pin_pa8_funcs),
84329
STM32_PIN_CONF(STM32_PIN_PA9, pin_pa9_funcs),
85330
STM32_PIN_CONF(STM32_PIN_PA10, pin_pa10_funcs),
331+
STM32_PIN_CONF(STM32_PIN_PA11, pin_pa11_funcs),
332+
STM32_PIN_CONF(STM32_PIN_PA12, pin_pa12_funcs),
333+
STM32_PIN_CONF(STM32_PIN_PA15, pin_pa15_funcs),
334+
335+
/* Port B */
336+
STM32_PIN_CONF(STM32_PIN_PB3, pin_pb3_funcs),
337+
STM32_PIN_CONF(STM32_PIN_PB4, pin_pb4_funcs),
338+
STM32_PIN_CONF(STM32_PIN_PB5, pin_pb5_funcs),
86339
STM32_PIN_CONF(STM32_PIN_PB6, pin_pb6_funcs),
87340
STM32_PIN_CONF(STM32_PIN_PB7, pin_pb7_funcs),
341+
STM32_PIN_CONF(STM32_PIN_PB8, pin_pb8_funcs),
342+
STM32_PIN_CONF(STM32_PIN_PB9, pin_pb9_funcs),
343+
STM32_PIN_CONF(STM32_PIN_PB10, pin_pb10_funcs),
344+
STM32_PIN_CONF(STM32_PIN_PB11, pin_pb11_funcs),
345+
STM32_PIN_CONF(STM32_PIN_PB12, pin_pb12_funcs),
346+
STM32_PIN_CONF(STM32_PIN_PB13, pin_pb13_funcs),
347+
348+
/* Port C */
349+
STM32_PIN_CONF(STM32_PIN_PC5, pin_pc5_funcs),
350+
STM32_PIN_CONF(STM32_PIN_PC6, pin_pc6_funcs),
351+
STM32_PIN_CONF(STM32_PIN_PC7, pin_pc7_funcs),
352+
STM32_PIN_CONF(STM32_PIN_PC10, pin_pc10_funcs),
353+
STM32_PIN_CONF(STM32_PIN_PC11, pin_pc11_funcs),
354+
STM32_PIN_CONF(STM32_PIN_PC12, pin_pc12_funcs),
355+
356+
/* Port D */
357+
STM32_PIN_CONF(STM32_PIN_PD0, pin_pd0_funcs),
358+
STM32_PIN_CONF(STM32_PIN_PD2, pin_pd2_funcs),
359+
STM32_PIN_CONF(STM32_PIN_PD5, pin_pd5_funcs),
360+
STM32_PIN_CONF(STM32_PIN_PD6, pin_pd6_funcs),
361+
STM32_PIN_CONF(STM32_PIN_PD8, pin_pd8_funcs),
362+
STM32_PIN_CONF(STM32_PIN_PD9, pin_pd9_funcs),
363+
STM32_PIN_CONF(STM32_PIN_PD10, pin_pd10_funcs),
364+
STM32_PIN_CONF(STM32_PIN_PD14, pin_pd14_funcs),
365+
STM32_PIN_CONF(STM32_PIN_PD15, pin_pd15_funcs),
366+
367+
/* Port E */
368+
STM32_PIN_CONF(STM32_PIN_PE0, pin_pe0_funcs),
369+
STM32_PIN_CONF(STM32_PIN_PE1, pin_pe1_funcs),
370+
STM32_PIN_CONF(STM32_PIN_PE2, pin_pe2_funcs),
371+
STM32_PIN_CONF(STM32_PIN_PE3, pin_pe3_funcs),
372+
STM32_PIN_CONF(STM32_PIN_PE7, pin_pe7_funcs),
373+
STM32_PIN_CONF(STM32_PIN_PE8, pin_pe8_funcs),
374+
375+
/* Port F */
376+
STM32_PIN_CONF(STM32_PIN_PF6, pin_pf6_funcs),
377+
STM32_PIN_CONF(STM32_PIN_PF7, pin_pf7_funcs),
378+
STM32_PIN_CONF(STM32_PIN_PF8, pin_pf8_funcs),
379+
STM32_PIN_CONF(STM32_PIN_PF9, pin_pf9_funcs),
380+
381+
/* Port G */
382+
STM32_PIN_CONF(STM32_PIN_PG0, pin_pg0_funcs),
383+
STM32_PIN_CONF(STM32_PIN_PG1, pin_pg1_funcs),
384+
STM32_PIN_CONF(STM32_PIN_PG9, pin_pg9_funcs),
385+
STM32_PIN_CONF(STM32_PIN_PG11, pin_pg11_funcs),
386+
STM32_PIN_CONF(STM32_PIN_PG12, pin_pg12_funcs),
387+
STM32_PIN_CONF(STM32_PIN_PG14, pin_pg14_funcs),
88388
};
89389

90390
int stm32_get_pin_config(int pin, int func)

0 commit comments

Comments
 (0)