drivers: Update to add support for esp32c6

Changes to bring support for esp32c6 SoC.
- clock control
- gpio
- pinctrl
- serial
- timer

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
This commit is contained in:
Lucas Tamborrino 2023-06-07 08:58:25 -03:00 committed by Anas Nashif
parent 861c2890a6
commit a62423f391
7 changed files with 33 additions and 14 deletions

View file

@ -20,7 +20,7 @@
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>
#ifdef CONFIG_SOC_SERIES_ESP32C3
#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6)
#include <zephyr/drivers/interrupt_controller/intc_esp32c3.h>
#else
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
@ -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

View file

@ -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

View file

@ -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

View file

@ -13,7 +13,7 @@
#include <errno.h>
#include <soc.h>
#include <zephyr/drivers/uart.h>
#if defined(CONFIG_SOC_SERIES_ESP32C3)
#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6)
#include <zephyr/drivers/interrupt_controller/intc_esp32c3.h>
#else
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
@ -22,7 +22,7 @@
#include <zephyr/sys/util.h>
#include <esp_attr.h>
#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

View file

@ -25,6 +25,10 @@
#include <esp32c3/rom/ets_sys.h>
#include <esp32c3/rom/gpio.h>
#include <zephyr/dt-bindings/clock/esp32c3_clock.h>
#elif defined(CONFIG_SOC_SERIES_ESP32C6)
#include <esp32c6/rom/ets_sys.h>
#include <esp32c6/rom/gpio.h>
#include <zephyr/dt-bindings/clock/esp32c6_clock.h>
#endif
#ifdef CONFIG_UART_ASYNC_API
#include <zephyr/drivers/dma.h>
@ -43,19 +47,21 @@
#include <soc.h>
#include <zephyr/drivers/uart.h>
#ifndef CONFIG_SOC_SERIES_ESP32C3
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
#else
#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6)
#include <zephyr/drivers/interrupt_controller/intc_esp32c3.h>
#else
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
#endif
#include <zephyr/drivers/clock_control.h>
#include <errno.h>
#include <zephyr/sys/util.h>
#include <esp_attr.h>
#include <zephyr/logging/log.h>
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);

View file

@ -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

View file

@ -5,9 +5,7 @@
*/
#include <soc/soc_caps.h>
#include <soc/soc.h>
#include <soc/interrupt_core0_reg.h>
#include <soc/periph_defs.h>
#include <soc/system_reg.h>
#include <hal/systimer_hal.h>
#include <hal/systimer_ll.h>
#include <esp_private/systimer.h>