summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-stm32.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-07-31 08:45:50 -0600
committerTom Rini <trini@konsulko.com>2025-07-31 10:04:32 -0600
commitf5e968a28e7cdc2c4365f5a382e02f074ee03fac (patch)
tree2f988c7102a977da562c28075e94e875ab5bcb94 /drivers/pwm/pwm-stm32.c
parenteef444c38994aee9cd3c6e4df5791b5f7209c8d8 (diff)
parente064db5fe77caaddb21a7793f266119ad89dd79a (diff)
Merge tag 'u-boot-stm32-20250731' of https://source.denx.de/u-boot/custodians/u-boot-stm
CI: https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/27236 - Add support for STM32 TIMERS and STM32 PWM on STM32MP25 - Add STM32MP13xx SPL and OpTee-OS start support - Fix header misuse in stm32 reset drivers - Fix STMicroelectronics spelling - Fix clk-stm32h7 wrong macros used in register read - Fix PRE_CON_BUF_ADDR on STM32MP13 - Fix clock identifier passed to struct scmi_clk_parent_set_in - Fix stm32 reset for STM32F4/F7 and H7 - Enable OF_UPSTREAM_BUILD_VENDOR for stm32mp13_defconfig - Add STM32MP23 SoC and stm32mp235f-dk board support
Diffstat (limited to 'drivers/pwm/pwm-stm32.c')
-rw-r--r--drivers/pwm/pwm-stm32.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 5fa649b5903..a691f75e4a7 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -12,6 +12,7 @@
#include <asm/io.h>
#include <asm/arch/timers.h>
#include <dm/device_compat.h>
+#include <linux/bitfield.h>
#include <linux/time.h>
#define CCMR_CHANNEL_SHIFT 8
@@ -157,7 +158,14 @@ static void stm32_pwm_detect_complementary(struct udevice *dev)
{
struct stm32_timers_plat *plat = dev_get_plat(dev_get_parent(dev));
struct stm32_pwm_priv *priv = dev_get_priv(dev);
- u32 ccer;
+ u32 ccer, val;
+
+ if (plat->ipidr) {
+ /* Simply read from HWCFGR the number of complementary outputs (MP25). */
+ val = readl(plat->base + TIM_HWCFGR1);
+ priv->have_complementary_output = !!FIELD_GET(TIM_HWCFGR1_NB_OF_DT, val);
+ return;
+ }
/*
* If complementary bit doesn't exist writing 1 will have no
@@ -192,6 +200,7 @@ static const struct pwm_ops stm32_pwm_ops = {
static const struct udevice_id stm32_pwm_ids[] = {
{ .compatible = "st,stm32-pwm" },
+ { .compatible = "st,stm32mp25-pwm" },
{ }
};