Skip to content

Commit 26c38a4

Browse files
FRASTMMaureenHelm
authored andcommitted
soc: arm: uart: Add STM32G0X UART support
Add UART support for STM32G0X SoC series. Signed-off-by: Philippe Retornaz <[email protected]> Signed-off-by: Francois Ramu <[email protected]> Signed-off-by: Francois Ramu <[email protected]>
1 parent f9d2a41 commit 26c38a4

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

dts/arm/st/g0/stm32g0.dtsi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,24 @@
106106
};
107107
};
108108

109+
usart1: serial@40013800 {
110+
compatible = "st,stm32-usart", "st,stm32-uart";
111+
reg = <0x40013800 0x400>;
112+
clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>;
113+
interrupts = <27 0>;
114+
status = "disabled";
115+
label = "UART_1";
116+
};
117+
118+
usart2: serial@40004400 {
119+
compatible = "st,stm32-usart", "st,stm32-uart";
120+
reg = <0x40004400 0x400>;
121+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>;
122+
interrupts = <28 0>;
123+
status = "disabled";
124+
label = "UART_2";
125+
};
126+
109127
timers3: timers@40000400 {
110128
compatible = "st,stm32-timers";
111129
reg = <0x40000400 0x400>;

soc/arm/st_stm32/stm32g0/dts_fixup.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,23 @@
6161
#define DT_GPIO_STM32_GPIOF_CLOCK_BITS DT_ST_STM32_GPIO_50001400_CLOCK_BITS
6262
#define DT_GPIO_STM32_GPIOF_CLOCK_BUS DT_ST_STM32_GPIO_50001400_CLOCK_BUS
6363

64+
/* there is no reference to GPIOE, GPIOG and GPIOH in the dts files */
65+
66+
#define DT_UART_STM32_USART_1_BASE_ADDRESS DT_ST_STM32_USART_40013800_BASE_ADDRESS
67+
#define DT_UART_STM32_USART_1_BAUD_RATE DT_ST_STM32_USART_40013800_CURRENT_SPEED
68+
#define DT_UART_STM32_USART_1_IRQ_PRI DT_ST_STM32_USART_40013800_IRQ_0_PRIORITY
69+
#define DT_UART_STM32_USART_1_NAME DT_ST_STM32_USART_40013800_LABEL
70+
#define DT_USART_1_IRQ DT_ST_STM32_USART_40013800_IRQ_0
71+
#define DT_UART_STM32_USART_1_CLOCK_BITS DT_ST_STM32_USART_40013800_CLOCK_BITS
72+
#define DT_UART_STM32_USART_1_CLOCK_BUS DT_ST_STM32_USART_40013800_CLOCK_BUS
73+
74+
#define DT_UART_STM32_USART_2_BASE_ADDRESS DT_ST_STM32_USART_40004400_BASE_ADDRESS
75+
#define DT_UART_STM32_USART_2_BAUD_RATE DT_ST_STM32_USART_40004400_CURRENT_SPEED
76+
#define DT_UART_STM32_USART_2_IRQ_PRI DT_ST_STM32_USART_40004400_IRQ_0_PRIORITY
77+
#define DT_UART_STM32_USART_2_NAME DT_ST_STM32_USART_40004400_LABEL
78+
#define DT_USART_2_IRQ DT_ST_STM32_USART_40004400_IRQ_0
79+
#define DT_UART_STM32_USART_2_CLOCK_BITS DT_ST_STM32_USART_40004400_CLOCK_BITS
80+
#define DT_UART_STM32_USART_2_CLOCK_BUS DT_ST_STM32_USART_40004400_CLOCK_BUS
81+
#define DT_UART_STM32_USART_2_HW_FLOW_CONTROL DT_ST_STM32_USART_40004400_HW_FLOW_CONTROL
82+
6483
/* End of SoC Level DTS fixup file */

soc/arm/st_stm32/stm32g0/soc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
#include <stm32g0xx_ll_gpio.h>
4545
#endif
4646

47+
#ifdef CONFIG_SERIAL_HAS_DRIVER
48+
#include <stm32g0xx_ll_usart.h>
49+
#endif
50+
4751
#endif /* !_ASMLANGUAGE */
4852

4953
#endif /* _STM32G0_SOC_H_ */

0 commit comments

Comments
 (0)