stm32f4: add serial print port
Subsystems (2)
PATCH v2 1/1 stm32f4: add serial print port
Add the stm32F4 board's serial ports support. User can use it easily.
The user only need to edit the number of the usart. The patch also fix the serial print out.
Last, this version of patch fix the first patch checkpatch.pl error. Thanks to Kamil Lulko.
--- arch/arm/include/asm/arch-stm32f4/gpio.h | 32 +++++++++ board/st/stm32f429-discovery/stm32f429-discovery.c | 16 ++--- drivers/serial/serial_stm32.c | 75 ++++++++++++++++++---- include/configs/stm32f429-discovery.h | 10 ++- 4 files changed, 111 insertions(+), 22 deletions(-)
arch/arm/include/asm/arch-stm32f4/gpio.h +32 -0
@@ -11,6 +11,38 @@#ifndef _STM32_GPIO_H_#define _STM32_GPIO_H_ +#if (CONFIG_STM32_USART ==1 ) +#define STM32_GPIO_PORT_X STM32_GPIO_PORT_A +#define STM32_GPIO_PIN_TX STM32_GPIO_PIN_9 +#define STM32_GPIO_PIN_RX STM32_GPIO_PIN_10 +#define STM32_GPIO_USART STM32_GPIO_AF7 + +#elif (CONFIG_STM32_USART ==2 ) +#define STM32_GPIO_PORT_X STM32_GPIO_PORT_D +#define STM32_GPIO_PIN_TX STM32_GPIO_PIN_5 +#define STM32_GPIO_PIN_RX STM32_GPIO_PIN_6 +#define STM32_GPIO_USART STM32_GPIO_AF7 + +#elif (CONFIG_STM32_USART ==3 ) +#define STM32_GPIO_PORT_X STM32_GPIO_PORT_C +#define STM32_GPIO_PIN_TX STM32_GPIO_PIN_10 +#define STM32_GPIO_PIN_RX STM32_GPIO_PIN_11 +#define STM32_GPIO_USART STM32_GPIO_AF7 + +#elif (CONFIG_STM32_USART ==6 ) +#define STM32_GPIO_PORT_X STM32_GPIO_PORT_G +#define STM32_GPIO_PIN_TX STM32_GPIO_PIN_14 +#define STM32_GPIO_PIN_RX STM32_GPIO_PIN_9 +#define STM32_GPIO_USART STM32_GPIO_AF8 + +#else +#define STM32_GPIO_PORT_X STM32_GPIO_PORT_A +#define STM32_GPIO_PIN_TX STM32_GPIO_PIN_9 +#define STM32_GPIO_PIN_RX STM32_GPIO_PIN_10 +#define STM32_GPIO_USART STM32_GPIO_AF7 + +#endif +enum stm32_gpio_port {STM32_GPIO_PORT_A =0 , STM32_GPIO_PORT_B,
board/st/stm32f429-discovery/stm32f429-discovery.c +8 -8
@@ -33,21 +33,21 @@ const struct stm32_gpio_ctl gpio_ctl_usart = { .otype = STM32_GPIO_OTYPE_PP, .speed = STM32_GPIO_SPEED_50M, .pupd = STM32_GPIO_PUPD_UP, - .af = STM32_GPIO_AF7 + .af = STM32_GPIO_USART }; -static const struct stm32_gpio_dsc usart1_gpio[] = { - {STM32_GPIO_PORT_A ,STM32_GPIO_PIN_9 },/* TX */ - {STM32_GPIO_PORT_A ,STM32_GPIO_PIN_10 },/* RX */ +static const struct stm32_gpio_dsc usart_gpio[] = { + {STM32_GPIO_PORT_X ,STM32_GPIO_PIN_TX },/* TX */ + {STM32_GPIO_PORT_X ,STM32_GPIO_PIN_RX },/* RX */ }; -int uart1_setup_gpio (void ) +int uart_setup_gpio (void ) {int i;int rv =0 ; -for (i =0 ; i <ARRAY_SIZE (usart1_gpio); i++) { - rv =stm32_gpio_config (&usart1_gpio[i], &gpio_ctl_usart); +for (i =0 ; i <ARRAY_SIZE (usart_gpio); i++) { + rv =stm32_gpio_config (&usart_gpio[i], &gpio_ctl_usart);if (rv) goto out; }
@@ -272,7 +272,7 @@ int board_early_init_f(void) {int res; - res =uart1_setup_gpio (); + res =uart_setup_gpio ();if (res)return res;
drivers/serial/serial_stm32.c +63 -12
115 lines not on this page · raw message
include/configs/stm32f429-discovery.h +8 -2
@@ -50,8 +50,14 @@#define CONFIG_STM32_GPIO #define CONFIG_STM32_SERIAL - -#define CONFIG_STM32_USART1 +/* +* Configuration of the USART +* 1: TX:PA9 PX:PA10 +* 2: TX:PD5 RX:PD6 +* 3: TX:PC10 RX:PC11 +* 6: TX:PC6 RX:PC7 +*/ +#define CONFIG_STM32_USART 1#define CONFIG_STM32_HSE_HZ 8000000
Signature · 1 line
1.9.1
PATCH v2 1/1 stm32f4: add serial print port
Quoted 9 lines · kunhuahuang
Add the stm32F4 board's serial ports support. User can use it easily.
The user only need to edit the number of the usart. The patch also fix the serial print out.Last, this version of patch fix the first patch checkpatch.pl error. Thanks to Kamil Lulko.
Signed-off-by kunhuahuang <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150510/995e031c/attachment.sig>
PATCH v2 1/1 stm32f4: add serial print port
Hi~
Sorry about the mistake of this patch.
This patch has already include "[PATCH v2] stm32f4: fix serial output". If adopt this patch, patch "[PATCH v2] stm32f4: fix serial output" need to be discarded.
Quoted 7 lines · Tom Rini
Quoted 5 lines · kunhuahuang
Add the stm32F4 board's serial ports support. User can use it easily.
The user only need to edit the number of the usart. The patch also fix the serial print out.
Quoted 9 lines
Quoted 4 lines
Last, this version of patch fix the first patch checkpatch.pl error. Thanks to Kamil Lulko.
Signed-off-by kunhuahuang <[email protected]>Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Thanks.
PATCH v2 1/1 stm32f4: add serial print port
Quoted 6 lines · kunhuauang
Hi~
Sorry about the mistake of this patch.
This patch has already include "[PATCH v2] stm32f4: fix serial output". If adopt this patch, patch "[PATCH v2] stm32f4: fix serial output" need to be discarded.
OK I'll fix it, thanks!
Quoted 25 lines · Tom Rini
Quoted 7 lines · kunhuahuang
Quoted 6 lines
Add the stm32F4 board's serial ports support. User can use it easily.
The user only need to edit the number of the usart. The patch also fix the serial print out.Quoted 9 lines
Quoted 4 lines
Last, this version of patch fix the first patch checkpatch.pl error. Thanks to Kamil Lulko.
Signed-off-by kunhuahuang <[email protected]>Applied to u-boot/master, thanks!
Signature · 1 line
TomThanks.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150510/79ce54fb/attachment.sig>