drivers: counter: Add STM32G4X counter support

Add counter driver support for STM32G4X SoC series.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
This commit is contained in:
Richard Osterloh 2019-09-04 09:47:06 +01:00 committed by Andrew Boie
commit c678d4508d
5 changed files with 26 additions and 2 deletions

View file

@ -14,7 +14,7 @@ menuconfig COUNTER_RTC_STM32
select USE_STM32_LL_EXTI
select NEWLIB_LIBC
help
Build RTC driver for STM32 SoCs. Tested on STM32 F3, F4, L4, F7 series
Build RTC driver for STM32 SoCs. Tested on STM32 F3, F4, L4, F7, G4 series
choice COUNTER_RTC_STM32_CLOCK_SRC
bool "RTC clock source"

View file

@ -29,7 +29,8 @@ LOG_MODULE_REGISTER(counter_rtc_stm32, CONFIG_COUNTER_LOG_LEVEL);
#elif defined(CONFIG_SOC_SERIES_STM32F4X) \
|| defined(CONFIG_SOC_SERIES_STM32F3X) \
|| defined(CONFIG_SOC_SERIES_STM32F7X) \
|| defined(CONFIG_SOC_SERIES_STM32WBX)
|| defined(CONFIG_SOC_SERIES_STM32WBX) \
|| defined(CONFIG_SOC_SERIES_STM32G4X)
#define RTC_EXTI_LINE LL_EXTI_LINE_17
#endif

View file

@ -399,6 +399,16 @@
};
};
rtc: rtc@40002800 {
compatible = "st,stm32-rtc";
reg = <0x40002800 0x400>;
interrupts = <41 0>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>;
prescaler = <32768>;
status = "disabled";
label = "RTC_0";
};
};
};

View file

@ -149,6 +149,13 @@
#define DT_I2C_3_CLOCK_BITS DT_ST_STM32_I2C_V2_40007800_CLOCK_BITS
#define DT_I2C_3_CLOCK_BUS DT_ST_STM32_I2C_V2_40007800_CLOCK_BUS
#define DT_RTC_0_BASE_ADDRESS DT_ST_STM32_RTC_40002800_BASE_ADDRESS
#define DT_RTC_0_IRQ_PRI DT_ST_STM32_RTC_40002800_IRQ_0_PRIORITY
#define DT_RTC_0_IRQ DT_ST_STM32_RTC_40002800_IRQ_0
#define DT_RTC_0_NAME DT_ST_STM32_RTC_40002800_LABEL
#define DT_RTC_0_CLOCK_BITS DT_ST_STM32_RTC_40002800_CLOCK_BITS
#define DT_RTC_0_CLOCK_BUS DT_ST_STM32_RTC_40002800_CLOCK_BUS
#define DT_SPI_1_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40013000_BASE_ADDRESS
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_FIFO_40013000_IRQ_0_PRIORITY
#define DT_SPI_1_NAME DT_ST_STM32_SPI_FIFO_40013000_LABEL

View file

@ -60,6 +60,12 @@
#include <stm32g4xx_ll_adc.h>
#endif
#if defined(CONFIG_COUNTER_RTC_STM32)
#include <stm32g4xx_ll_rtc.h>
#include <stm32g4xx_ll_exti.h>
#include <stm32g4xx_ll_pwr.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32G4_SOC_H_ */