Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dts: esp32c6: add i2c support #82941

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/seeed/xiao_esp32c6/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ The Zephyr ``xiao_esp32c6`` board target supports the following hardware feature
+------------+------------+-------------------------------------+
| SPI Master | on-chip | spi |
+------------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+------------+------------+-------------------------------------+
| Watchdog | on-chip | watchdog |
+------------+------------+-------------------------------------+
| LEDC | on-chip | pwm |
Expand Down
1 change: 1 addition & 0 deletions boards/seeed/xiao_esp32c6/seeed_xiao_connector.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
};
};

xiao_i2c: &i2c0 {};
xiao_spi: &spi2 {};
xiao_serial: &uart0 {};
10 changes: 10 additions & 0 deletions boards/seeed/xiao_esp32c6/xiao_esp32c6-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@
output-low;
};
};

i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_GPIO22>,
<I2C0_SCL_GPIO23>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
};
7 changes: 7 additions & 0 deletions boards/seeed/xiao_esp32c6/xiao_esp32c6.dts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
status = "okay";
};

&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
};

&spi2 {
#address-cells = <1>;
#size-cells = <0>;
Expand Down
1 change: 1 addition & 0 deletions boards/seeed/xiao_esp32c6/xiao_esp32c6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ supported:
- dma
- spi
- entropy
- i2c
testing:
ignore_tags:
- net
Expand Down
12 changes: 12 additions & 0 deletions dts/riscv/espressif/esp32c6/esp32c6_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <mem.h>
#include <freq.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/i2c/i2c.h>
#include <zephyr/dt-bindings/interrupt-controller/esp-esp32c6-intmux.h>
#include <zephyr/dt-bindings/clock/esp32c6_clock.h>
#include <dt-bindings/pinctrl/esp32c6-pinctrl.h>
Expand Down Expand Up @@ -193,6 +194,17 @@
ngpios = <30>; /* 0..29 */
};

i2c0: i2c@60004000 {
compatible = "espressif,esp32-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x60004000 0x1000>;
interrupts = <I2C_EXT0_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
interrupt-parent = <&intc>;
clocks = <&rtc ESP32_I2C0_MODULE>;
status = "disabled";
};

uart0: uart@60000000 {
compatible = "espressif,esp32-uart";
reg = <0x60000000 DT_SIZE_K(4)>;
Expand Down
146 changes: 146 additions & 0 deletions include/zephyr/dt-bindings/pinctrl/esp32c6-pinctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,152 @@
#ifndef INC_DT_BINDS_PINCTRL_ESP32C6_PINCTRL_HAL_H_
#define INC_DT_BINDS_PINCTRL_ESP32C6_PINCTRL_HAL_H_

/* I2C0_SCL */
#define I2C0_SCL_GPIO0 \
ESP32_PINMUX(0, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO1 \
ESP32_PINMUX(1, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO2 \
ESP32_PINMUX(2, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO3 \
ESP32_PINMUX(3, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO4 \
ESP32_PINMUX(4, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO5 \
ESP32_PINMUX(5, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO6 \
ESP32_PINMUX(6, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO7 \
ESP32_PINMUX(7, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO8 \
ESP32_PINMUX(8, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO9 \
ESP32_PINMUX(9, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO10 \
ESP32_PINMUX(10, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO11 \
ESP32_PINMUX(11, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO12 \
ESP32_PINMUX(12, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO13 \
ESP32_PINMUX(13, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO14 \
ESP32_PINMUX(14, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO15 \
ESP32_PINMUX(15, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO16 \
ESP32_PINMUX(16, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO17 \
ESP32_PINMUX(17, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO18 \
ESP32_PINMUX(18, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO19 \
ESP32_PINMUX(19, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO20 \
ESP32_PINMUX(20, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO21 \
ESP32_PINMUX(21, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO22 \
ESP32_PINMUX(22, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

#define I2C0_SCL_GPIO23 \
ESP32_PINMUX(23, ESP_I2CEXT0_SCL_IN, ESP_I2CEXT0_SCL_OUT)

/* I2C0_SDA */
#define I2C0_SDA_GPIO0 \
ESP32_PINMUX(0, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO1 \
ESP32_PINMUX(1, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO2 \
ESP32_PINMUX(2, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO3 \
ESP32_PINMUX(3, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO4 \
ESP32_PINMUX(4, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO5 \
ESP32_PINMUX(5, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO6 \
ESP32_PINMUX(6, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO7 \
ESP32_PINMUX(7, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO8 \
ESP32_PINMUX(8, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO9 \
ESP32_PINMUX(9, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO10 \
ESP32_PINMUX(10, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO11 \
ESP32_PINMUX(11, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO12 \
ESP32_PINMUX(12, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO13 \
ESP32_PINMUX(13, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO14 \
ESP32_PINMUX(14, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO15 \
ESP32_PINMUX(15, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO16 \
ESP32_PINMUX(16, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO17 \
ESP32_PINMUX(17, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO18 \
ESP32_PINMUX(18, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO19 \
ESP32_PINMUX(19, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO20 \
ESP32_PINMUX(20, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO21 \
ESP32_PINMUX(21, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO22 \
ESP32_PINMUX(22, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

#define I2C0_SDA_GPIO23 \
ESP32_PINMUX(23, ESP_I2CEXT0_SDA_IN, ESP_I2CEXT0_SDA_OUT)

/* LEDC_CH0 */
#define LEDC_CH0_GPIO0 \
ESP32_PINMUX(0, ESP_NOSIG, ESP_LEDC_LS_SIG_OUT0)
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ manifest:
groups:
- hal
- name: hal_espressif
revision: f73ee95251b75635ab899d73c3cabebe70f43c09
revision: 9fbf519573e713bd92bb8222bcfef77e7219584b
path: modules/hal/espressif
west-commands: west/west-commands.yml
groups:
Expand Down
Loading