Skip to content

Commit da48451

Browse files
FRASTMMaureenHelm
authored andcommitted
drivers: pwm: Add STM32G0XX pwm support
Add pwm support for STM32G0X SoC series. Signed-off-by: Philippe Retornaz <[email protected] Signed-off-by: Francois Ramu <[email protected]>
1 parent 624c566 commit da48451

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

drivers/pwm/pwm_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static u32_t __get_tim_clk(u32_t bus_clk,
3535
if (pclken->bus == STM32_CLOCK_BUS_APB1) {
3636
apb_psc = CONFIG_CLOCK_STM32_APB1_PRESCALER;
3737
}
38-
#ifndef CONFIG_SOC_SERIES_STM32F0X
38+
#if !defined(CONFIG_SOC_SERIES_STM32F0X) && !defined(CONFIG_SOC_SERIES_STM32G0X)
3939
else {
4040
apb_psc = CONFIG_CLOCK_STM32_APB2_PRESCALER;
4141
}

dts/arm/st/g0/stm32g0.dtsi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@
5454
label = "STM32_CLK_RCC";
5555
};
5656

57+
timers3: timers@40000400 {
58+
compatible = "st,stm32-timers";
59+
reg = <0x40000400 0x400>;
60+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>;
61+
status = "disabled";
62+
label = "TIMERS_3";
63+
64+
pwm {
65+
compatible = "st,stm32-pwm";
66+
status = "disabled";
67+
st,prescaler = <10000>;
68+
label = "PWM_3";
69+
#pwm-cells = <2>;
70+
};
71+
};
72+
5773
};
5874
};
5975

soc/arm/st_stm32/stm32g0/dts_fixup.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
#define DT_FLASH_DEV_BASE_ADDRESS DT_ST_STM32G0_FLASH_CONTROLLER_40022000_BASE_ADDRESS
1212
#define DT_FLASH_DEV_NAME DT_ST_STM32G0_FLASH_CONTROLLER_40022000_LABEL
1313

14+
#define DT_PWM_STM32_3_DEV_NAME DT_ST_STM32_PWM_40000400_PWM_LABEL
15+
#define DT_PWM_STM32_3_PRESCALER DT_ST_STM32_PWM_40000400_PWM_ST_PRESCALER
16+
1417
/* End of SoC Level DTS fixup file */

0 commit comments

Comments
 (0)