Use i2c_hal functions to enable support for multiple SoCs. Use DT compat to enable I2C from device tree configuration Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
158 lines
3.4 KiB
Text
158 lines
3.4 KiB
Text
/*
|
|
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include <mem.h>
|
|
#include <dt-bindings/gpio/gpio.h>
|
|
#include <dt-bindings/i2c/i2c.h>
|
|
#include <dt-bindings/interrupt-controller/esp-esp32c3-intmux.h>
|
|
#include <dt-bindings/clock/esp32c3_clock.h>
|
|
|
|
/ {
|
|
#address-cells = <1>;
|
|
#size-cells = <1>;
|
|
|
|
chosen {
|
|
zephyr,entropy = &trng0;
|
|
zephyr,flash-controller = &flash;
|
|
};
|
|
|
|
cpus {
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
|
|
cpu0: cpu@0 {
|
|
device_type = "cpu";
|
|
compatible = "esp,riscv";
|
|
reg = <0>;
|
|
};
|
|
};
|
|
|
|
soc {
|
|
#address-cells = <1>;
|
|
#size-cells = <1>;
|
|
compatible = "simple-bus";
|
|
ranges;
|
|
|
|
sram0: memory@3fc7c000 {
|
|
compatible = "mmio-sram";
|
|
reg = <0x3fc7c000 0x50000>;
|
|
};
|
|
|
|
pinmux: pinmux@60009000 {
|
|
compatible = "espressif,esp32-pinmux";
|
|
reg = <0x60009000 0x800>;
|
|
};
|
|
|
|
intc: interrupt-controller@600c2000 {
|
|
#interrupt-cells = <1>;
|
|
compatible = "espressif,esp32-intc";
|
|
interrupt-controller;
|
|
reg = <0x600c2000 0x198>;
|
|
label = "INTC_0";
|
|
status = "okay";
|
|
};
|
|
|
|
systimer0: systimer@60023000 {
|
|
compatible = "espressif,esp32-systimer";
|
|
reg = <0x60023000 0x80>;
|
|
interrupts = <SYSTIMER_TARGET0_EDGE_INTR_SOURCE>;
|
|
interrupt-parent = <&intc>;
|
|
label = "SYSTIMER_0";
|
|
status = "okay";
|
|
};
|
|
|
|
rtc: rtc@60008000 {
|
|
compatible = "espressif,esp32-rtc";
|
|
reg = <0x60008000 0x1000>;
|
|
label = "RTC";
|
|
xtal-freq = <ESP32_CLK_XTAL_40M>;
|
|
#clock-cells = <1>;
|
|
status = "ok";
|
|
};
|
|
|
|
flash: flash-controller@60002000 {
|
|
compatible = "espressif,esp32-flash-controller";
|
|
label = "FLASH_CTRL";
|
|
reg = <0x60002000 0x1000>;
|
|
|
|
#address-cells = <1>;
|
|
#size-cells = <1>;
|
|
|
|
flash0: flash@0 {
|
|
compatible = "soc-nv-flash";
|
|
label = "FLASH_ESP32C3";
|
|
reg = <0 0x400000>;
|
|
erase-block-size = <4096>;
|
|
write-block-size = <4>;
|
|
};
|
|
};
|
|
|
|
gpio0: gpio@60004000 {
|
|
compatible = "espressif,esp32-gpio";
|
|
gpio-controller;
|
|
#gpio-cells = <2>;
|
|
reg = <0x60004000 0x800>;
|
|
interrupts = <GPIO_INTR_SOURCE>;
|
|
interrupt-parent = <&intc>;
|
|
label = "GPIO_0";
|
|
ngpios = <32>; /* 0..31 */
|
|
};
|
|
|
|
i2c0: i2c@60013000 {
|
|
compatible = "espressif,esp32-i2c";
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
reg = <0x60013000 0x1000>;
|
|
interrupts = <I2C_EXT0_INTR_SOURCE>;
|
|
interrupt-parent = <&intc>;
|
|
label = "I2C_0";
|
|
clocks = <&rtc ESP32_I2C0_MODULE>;
|
|
status = "disabled";
|
|
};
|
|
|
|
uart0: uart@60000000 {
|
|
compatible = "espressif,esp32-uart";
|
|
reg = <0x60000000 0x400>;
|
|
label = "UART_0";
|
|
interrupts = <UART0_INTR_SOURCE>;
|
|
interrupt-parent = <&intc>;
|
|
clocks = <&rtc ESP32_UART0_MODULE>;
|
|
current-speed = <115200>;
|
|
status = "okay";
|
|
tx-pin = <21>;
|
|
rx-pin = <20>;
|
|
};
|
|
|
|
uart1: uart@60010000 {
|
|
compatible = "espressif,esp32-uart";
|
|
reg = <0x60010000 0x400>;
|
|
label = "UART_1";
|
|
status = "disabled";
|
|
interrupts = <UART1_INTR_SOURCE>;
|
|
interrupt-parent = <&intc>;
|
|
clocks = <&rtc ESP32_UART1_MODULE>;
|
|
current-speed = <115200>;
|
|
};
|
|
|
|
trng0: trng@3ff700b0 {
|
|
compatible = "espressif,esp32-trng";
|
|
reg = <0x3FF700B0 0x4>;
|
|
label = "TRNG_0";
|
|
status = "disabled";
|
|
};
|
|
|
|
spi2: spi@60024000 {
|
|
compatible = "espressif,esp32-spi";
|
|
reg = <0x60024000 DT_SIZE_K(4)>;
|
|
interrupts = <SPI2_INTR_SOURCE>;
|
|
interrupt-parent = <&intc>;
|
|
label = "SPI_2";
|
|
clocks = <&rtc ESP32_SPI2_MODULE>;
|
|
status = "disabled";
|
|
use-iomux;
|
|
};
|
|
};
|
|
|
|
};
|