Skip to content

Commit 53adfb8

Browse files
author
Florian Vaussard
committed
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 ac77af3 commit 53adfb8

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(dir, pin)
2929
#define PINMUX_UART2(dir, pin)
30+
#define PINMUX_UART3(dir, pin)
31+
#define PINMUX_UART4(dir, pin)
32+
#define PINMUX_UART5(dir, pin)
33+
#define PINMUX_UART6(dir, pin)
34+
#define PINMUX_UART7(dir, pin)
35+
#define PINMUX_UART8(dir, pin)
36+
#define PINMUX_UART9(dir, pin)
37+
#define PINMUX_UART10(dir, pin)
3038

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

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

97+
/* Port A */
4998
static const stm32_pin_func_t pin_pa0_funcs[] = {
5099
PINMUX_PWM2(PA0, 1)
100+
PINMUX_UART_TX(PA0, 4)
101+
};
102+
103+
static const stm32_pin_func_t pin_pa1_funcs[] = {
104+
PINMUX_UART_RX(PA1, 4)
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_RX(PA3, 2)
59113
};
60114

115+
static const stm32_pin_func_t pin_pa8_funcs[] = {
116+
PINMUX_UART_RX(PA8, 7)
117+
};
118+
61119
static const stm32_pin_func_t pin_pa9_funcs[] = {
62120
PINMUX_UART_TX(PA9, 1)
63121
};
@@ -66,25 +124,267 @@ static const stm32_pin_func_t pin_pa10_funcs[] = {
66124
PINMUX_UART_RX(PA10, 1)
67125
};
68126

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

73161
static const stm32_pin_func_t pin_pb7_funcs[] = {
74162
PINMUX_UART_RX(PB7, 1)
75163
};
76164

165+
static const stm32_pin_func_t pin_pb8_funcs[] = {
166+
PINMUX_UART_RX(PB8, 5)
167+
};
168+
169+
static const stm32_pin_func_t pin_pb9_funcs[] = {
170+
PINMUX_UART_TX(PB9, 5)
171+
};
172+
173+
static const stm32_pin_func_t pin_pb10_funcs[] = {
174+
PINMUX_UART_TX(PB10, 3)
175+
};
176+
177+
static const stm32_pin_func_t pin_pb11_funcs[] = {
178+
PINMUX_UART_RX(PB11, 3)
179+
};
180+
181+
static const stm32_pin_func_t pin_pb12_funcs[] = {
182+
PINMUX_UART_RX(PB12, 5)
183+
};
184+
185+
static const stm32_pin_func_t pin_pb13_funcs[] = {
186+
PINMUX_UART_TX(PB13, 5)
187+
};
188+
189+
/* Port C */
190+
static const stm32_pin_func_t pin_pc5_funcs[] = {
191+
PINMUX_UART_RX(PC5, 3)
192+
};
193+
194+
static const stm32_pin_func_t pin_pc6_funcs[] = {
195+
PINMUX_UART_TX(PC6, 6)
196+
};
197+
198+
static const stm32_pin_func_t pin_pc7_funcs[] = {
199+
PINMUX_UART_RX(PC7, 6)
200+
};
201+
202+
static const stm32_pin_func_t pin_pc10_funcs[] = {
203+
PINMUX_UART_TX(PC10, 3)
204+
};
205+
206+
static const stm32_pin_func_t pin_pc11_funcs[] = {
207+
PINMUX_UART_RX(PC11, 3)
208+
PINMUX_UART_RX(PC11, 4)
209+
};
210+
211+
static const stm32_pin_func_t pin_pc12_funcs[] = {
212+
PINMUX_UART_TX(PC12, 5)
213+
};
214+
215+
/* Port D */
216+
static const stm32_pin_func_t pin_pd0_funcs[] = {
217+
PINMUX_UART_RX(PD0, 4)
218+
};
219+
220+
static const stm32_pin_func_t pin_pd2_funcs[] = {
221+
PINMUX_UART_RX(PD2, 5)
222+
};
223+
224+
static const stm32_pin_func_t pin_pd5_funcs[] = {
225+
PINMUX_UART_TX(PD5, 2)
226+
};
227+
228+
static const stm32_pin_func_t pin_pd6_funcs[] = {
229+
PINMUX_UART_RX(PD6, 2)
230+
};
231+
232+
static const stm32_pin_func_t pin_pd8_funcs[] = {
233+
PINMUX_UART_TX(PD8, 3)
234+
};
235+
236+
static const stm32_pin_func_t pin_pd9_funcs[] = {
237+
PINMUX_UART_RX(PD9, 3)
238+
};
239+
240+
static const stm32_pin_func_t pin_pd10_funcs[] = {
241+
PINMUX_UART_TX(PD10, 4)
242+
};
243+
244+
static const stm32_pin_func_t pin_pd14_funcs[] = {
245+
PINMUX_UART_RX(PD14, 9)
246+
};
247+
248+
static const stm32_pin_func_t pin_pd15_funcs[] = {
249+
PINMUX_UART_TX(PD15, 9)
250+
};
251+
252+
/* Port E */
253+
static const stm32_pin_func_t pin_pe0_funcs[] = {
254+
PINMUX_UART_RX(PE0, 8)
255+
};
256+
257+
static const stm32_pin_func_t pin_pe1_funcs[] = {
258+
PINMUX_UART_TX(PE1, 8)
259+
};
260+
261+
static const stm32_pin_func_t pin_pe2_funcs[] = {
262+
PINMUX_UART_RX(PE2, 10)
263+
};
264+
265+
static const stm32_pin_func_t pin_pe3_funcs[] = {
266+
PINMUX_UART_TX(PE3, 10)
267+
};
268+
269+
static const stm32_pin_func_t pin_pe7_funcs[] = {
270+
PINMUX_UART_RX(PE7, 7)
271+
};
272+
273+
static const stm32_pin_func_t pin_pe8_funcs[] = {
274+
PINMUX_UART_TX(PE8, 7)
275+
};
276+
277+
/* Port F */
278+
static const stm32_pin_func_t pin_pf6_funcs[] = {
279+
PINMUX_UART_RX(PF6, 7)
280+
};
281+
282+
static const stm32_pin_func_t pin_pf7_funcs[] = {
283+
PINMUX_UART_TX(PF7, 7)
284+
};
285+
286+
static const stm32_pin_func_t pin_pf8_funcs[] = {
287+
PINMUX_UART_RX(PF8, 8)
288+
};
289+
290+
static const stm32_pin_func_t pin_pf9_funcs[] = {
291+
PINMUX_UART_TX(PF9, 8)
292+
};
293+
294+
/* Port G */
295+
static const stm32_pin_func_t pin_pg0_funcs[] = {
296+
PINMUX_UART_RX(PG0, 9)
297+
};
298+
299+
static const stm32_pin_func_t pin_pg1_funcs[] = {
300+
PINMUX_UART_TX(PG1, 9)
301+
};
302+
303+
static const stm32_pin_func_t pin_pg9_funcs[] = {
304+
PINMUX_UART_RX(PG9, 6)
305+
};
306+
307+
static const stm32_pin_func_t pin_pg11_funcs[] = {
308+
PINMUX_UART_RX(PG11, 10)
309+
};
310+
311+
static const stm32_pin_func_t pin_pg12_funcs[] = {
312+
PINMUX_UART_TX(PG12, 10)
313+
};
314+
315+
static const stm32_pin_func_t pin_pg14_funcs[] = {
316+
PINMUX_UART_TX(PG14, 6)
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)