drivers: mcpwm: esp32c6: Add support

Add MCPWM support to ESP32C6

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
This commit is contained in:
Raffael Rostagno 2024-12-03 11:41:23 -03:00 committed by Benjamin Cabé
parent 87cec8551a
commit 0cb755a0e3
3 changed files with 1405 additions and 1298 deletions

View file

@ -19,11 +19,21 @@
#include <zephyr/drivers/clock_control.h>
#include <esp_clk_tree.h>
#ifdef CONFIG_PWM_CAPTURE
#if defined(CONFIG_RISCV)
#include <zephyr/drivers/interrupt_controller/intc_esp32c3.h>
#else
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
#endif
#endif /* CONFIG_PWM_CAPTURE */
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(mcpwm_esp32, CONFIG_PWM_LOG_LEVEL);
#if defined(CONFIG_RISCV)
#define ISR_HANDLER isr_handler_t
#else
#define ISR_HANDLER intr_handler_t
#endif
#ifdef CONFIG_PWM_CAPTURE
#define SKIP_IRQ_NUM 4U
#define CAP_INT_MASK 7U
@ -544,7 +554,7 @@ static DEVICE_API(pwm, mcpwm_esp32_api) = {
ESP_PRIO_TO_FLAGS(DT_INST_IRQ_BY_IDX(idx, 0, priority)) | \
ESP_INT_FLAGS_CHECK(DT_INST_IRQ_BY_IDX(idx, 0, flags)) | \
ESP_INTR_FLAG_IRAM, \
(intr_handler_t)mcpwm_esp32_isr, (void *)dev, NULL); \
(ISR_HANDLER)mcpwm_esp32_isr, (void *)dev, NULL); \
return ret; \
}
#define CAPTURE_INIT(idx) .irq_config_func = mcpwm_esp32_irq_config_func_##idx

View file

@ -241,5 +241,15 @@
clocks = <&rtc ESP32_LEDC_MODULE>;
status = "disabled";
};
mcpwm0: mcpwm@60014000 {
compatible = "espressif,esp32-mcpwm";
reg = <0x60014000 DT_SIZE_K(4)>;
interrupts = <MCPWM0_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
interrupt-parent = <&intc>;
clocks = <&rtc ESP32_MCPWM0_MODULE>;
#pwm-cells = <3>;
status = "disabled";
};
};
};

File diff suppressed because it is too large Load diff