Skip to content

Commit

Permalink
drivers: pwm: Add STM32G0XX pwm support
Browse files Browse the repository at this point in the history
Add pwm support for STM32G0X SoC series.

Signed-off-by: Philippe Retornaz <philippe@shapescale.com
Signed-off-by: Francois Ramu <francois.ramu@st.com>
  • Loading branch information
FRASTM authored and MaureenHelm committed Jul 5, 2019
1 parent 624c566 commit da48451
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pwm/pwm_stm32.c
Expand Up @@ -35,7 +35,7 @@ static u32_t __get_tim_clk(u32_t bus_clk,
if (pclken->bus == STM32_CLOCK_BUS_APB1) {
apb_psc = CONFIG_CLOCK_STM32_APB1_PRESCALER;
}
#ifndef CONFIG_SOC_SERIES_STM32F0X
#if !defined(CONFIG_SOC_SERIES_STM32F0X) && !defined(CONFIG_SOC_SERIES_STM32G0X)
else {
apb_psc = CONFIG_CLOCK_STM32_APB2_PRESCALER;
}
Expand Down
16 changes: 16 additions & 0 deletions dts/arm/st/g0/stm32g0.dtsi
Expand Up @@ -54,6 +54,22 @@
label = "STM32_CLK_RCC";
};

timers3: timers@40000400 {
compatible = "st,stm32-timers";
reg = <0x40000400 0x400>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>;
status = "disabled";
label = "TIMERS_3";

pwm {
compatible = "st,stm32-pwm";
status = "disabled";
st,prescaler = <10000>;
label = "PWM_3";
#pwm-cells = <2>;
};
};

};
};

Expand Down
3 changes: 3 additions & 0 deletions soc/arm/st_stm32/stm32g0/dts_fixup.h
Expand Up @@ -11,4 +11,7 @@
#define DT_FLASH_DEV_BASE_ADDRESS DT_ST_STM32G0_FLASH_CONTROLLER_40022000_BASE_ADDRESS
#define DT_FLASH_DEV_NAME DT_ST_STM32G0_FLASH_CONTROLLER_40022000_LABEL

#define DT_PWM_STM32_3_DEV_NAME DT_ST_STM32_PWM_40000400_PWM_LABEL
#define DT_PWM_STM32_3_PRESCALER DT_ST_STM32_PWM_40000400_PWM_ST_PRESCALER

/* End of SoC Level DTS fixup file */

0 comments on commit da48451

Please sign in to comment.