diff --git a/drivers/gpio/gpio_esp32.c b/drivers/gpio/gpio_esp32.c index 3851200b181..7a1b6790388 100644 --- a/drivers/gpio/gpio_esp32.c +++ b/drivers/gpio/gpio_esp32.c @@ -20,7 +20,7 @@ #include #include #include -#ifdef CONFIG_SOC_SERIES_ESP32C3 +#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6) #include #else #include @@ -42,6 +42,15 @@ LOG_MODULE_REGISTER(gpio_esp32, CONFIG_LOG_DEFAULT_LEVEL); /* arch_curr_cpu() is not available for riscv based chips */ #define CPU_ID() 0 #define ISR_HANDLER isr_handler_t +#elif defined(CONFIG_SOC_SERIES_ESP32C6) +/* gpio structs in esp32c6 are also different */ +#define out out.out_data_orig +#define in in.in_data_next +#define out_w1ts out_w1ts.val +#define out_w1tc out_w1tc.val +/* arch_curr_cpu() is not available for riscv based chips */ +#define CPU_ID() 0 +#define ISR_HANDLER isr_handler_t #else #define CPU_ID() arch_curr_cpu()->id #define ISR_HANDLER intr_handler_t diff --git a/drivers/pinctrl/pinctrl_esp32.c b/drivers/pinctrl/pinctrl_esp32.c index 71049f5b1cb..581cc2b2dc6 100644 --- a/drivers/pinctrl/pinctrl_esp32.c +++ b/drivers/pinctrl/pinctrl_esp32.c @@ -18,6 +18,12 @@ #define in in.data #define out_w1ts out_w1ts.val #define out_w1tc out_w1tc.val +#elif CONFIG_SOC_SERIES_ESP32C6 +/* gpio structs in esp32c6 are also different */ +#define out out.out_data_orig +#define in in.in_data_next +#define out_w1ts out_w1ts.val +#define out_w1tc out_w1tc.val #endif #ifndef SOC_GPIO_SUPPORT_RTC_INDEPENDENT diff --git a/drivers/serial/Kconfig.esp32 b/drivers/serial/Kconfig.esp32 index f6fa5ac9d93..8f7f35a630c 100644 --- a/drivers/serial/Kconfig.esp32 +++ b/drivers/serial/Kconfig.esp32 @@ -7,7 +7,7 @@ config UART_ESP32 depends on DT_HAS_ESPRESSIF_ESP32_UART_ENABLED select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT - select SERIAL_SUPPORT_ASYNC if (SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32S3) + select SERIAL_SUPPORT_ASYNC if (SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 || SOC_SERIES_ESP32S3) select GPIO_ESP32 help Enable the ESP32 UART. @@ -20,7 +20,7 @@ config SERIAL_ESP32_USB select SERIAL_SUPPORT_INTERRUPT help Enable the built-in USB serial interface present in some Espressif - MCUs like the ESP32-C3. + MCUs like ESP32-Cx. This driver uses the peripheral called USB Serial/JTAG Controller (USB_SERIAL_JTAG), which acts as a CDC-ACM interface towards the diff --git a/drivers/serial/serial_esp32_usb.c b/drivers/serial/serial_esp32_usb.c index 14e4b798a8f..5b26ca00863 100644 --- a/drivers/serial/serial_esp32_usb.c +++ b/drivers/serial/serial_esp32_usb.c @@ -13,7 +13,7 @@ #include #include #include -#if defined(CONFIG_SOC_SERIES_ESP32C3) +#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6) #include #else #include @@ -22,7 +22,7 @@ #include #include -#ifdef CONFIG_SOC_SERIES_ESP32C3 +#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6) #define ISR_HANDLER isr_handler_t #else #define ISR_HANDLER intr_handler_t diff --git a/drivers/serial/uart_esp32.c b/drivers/serial/uart_esp32.c index 0bbc3fb4d2d..9bf0c3bb17c 100644 --- a/drivers/serial/uart_esp32.c +++ b/drivers/serial/uart_esp32.c @@ -25,6 +25,10 @@ #include #include #include +#elif defined(CONFIG_SOC_SERIES_ESP32C6) +#include +#include +#include #endif #ifdef CONFIG_UART_ASYNC_API #include @@ -43,19 +47,21 @@ #include #include -#ifndef CONFIG_SOC_SERIES_ESP32C3 -#include -#else +#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6) #include +#else +#include #endif + #include #include #include #include #include + LOG_MODULE_REGISTER(uart_esp32, CONFIG_UART_LOG_LEVEL); -#ifdef CONFIG_SOC_SERIES_ESP32C3 +#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6) #define ISR_HANDLER isr_handler_t #else #define ISR_HANDLER intr_handler_t @@ -257,7 +263,7 @@ static int uart_esp32_configure(const struct device *dev, const struct uart_conf clock_control_on(config->clock_dev, config->clock_subsys); - uart_hal_set_sclk(&data->hal, UART_SCLK_APB); + uart_hal_set_sclk(&data->hal, UART_SCLK_DEFAULT); uart_hal_set_rxfifo_full_thr(&data->hal, UART_RX_FIFO_THRESH); uart_hal_set_txfifo_empty_thr(&data->hal, UART_TX_FIFO_THRESH); uart_hal_rxfifo_rst(&data->hal); diff --git a/drivers/timer/Kconfig.esp32 b/drivers/timer/Kconfig.esp32 index 0634c3f0cb2..4dd289287e2 100644 --- a/drivers/timer/Kconfig.esp32 +++ b/drivers/timer/Kconfig.esp32 @@ -5,7 +5,7 @@ config ESP32_SYS_TIMER bool "ESP32 sys-timer support (ESP32Cx series)" - depends on SOC_SERIES_ESP32C3 + depends on SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 default y select TICKLESS_CAPABLE select TIMER_HAS_64BIT_CYCLE_COUNTER diff --git a/drivers/timer/esp32_sys_timer.c b/drivers/timer/esp32_sys_timer.c index 770a89edbdf..2eeb71d1524 100644 --- a/drivers/timer/esp32_sys_timer.c +++ b/drivers/timer/esp32_sys_timer.c @@ -5,9 +5,7 @@ */ #include #include -#include -#include -#include + #include #include #include