summaryrefslogtreecommitdiff
path: root/zephyr/projects/it8xxx2_evb
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/it8xxx2_evb')
-rw-r--r--zephyr/projects/it8xxx2_evb/BUILD.py18
-rw-r--r--zephyr/projects/it8xxx2_evb/CMakeLists.txt11
-rw-r--r--zephyr/projects/it8xxx2_evb/adc.dts41
-rw-r--r--zephyr/projects/it8xxx2_evb/fan.dts27
-rw-r--r--zephyr/projects/it8xxx2_evb/gpio.dts169
-rw-r--r--zephyr/projects/it8xxx2_evb/i2c.dts59
-rw-r--r--zephyr/projects/it8xxx2_evb/include/i2c_map.h16
-rw-r--r--zephyr/projects/it8xxx2_evb/interrupts.dts26
-rw-r--r--zephyr/projects/it8xxx2_evb/prj.conf44
-rw-r--r--zephyr/projects/it8xxx2_evb/pwm.dts31
10 files changed, 442 insertions, 0 deletions
diff --git a/zephyr/projects/it8xxx2_evb/BUILD.py b/zephyr/projects/it8xxx2_evb/BUILD.py
new file mode 100644
index 0000000000..ee89c75390
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/BUILD.py
@@ -0,0 +1,18 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Define zmake projects for it8xxx2_evb."""
+
+register_raw_project(
+ project_name="it8xxx2_evb",
+ zephyr_board="it81302bx",
+ dts_overlays=[
+ "adc.dts",
+ "fan.dts",
+ "gpio.dts",
+ "i2c.dts",
+ "interrupts.dts",
+ "pwm.dts",
+ ],
+)
diff --git a/zephyr/projects/it8xxx2_evb/CMakeLists.txt b/zephyr/projects/it8xxx2_evb/CMakeLists.txt
new file mode 100644
index 0000000000..170606a52d
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+cmake_minimum_required(VERSION 3.13.1)
+
+find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
+project(it8xxx2_evb)
+
+# Include board specific header files
+zephyr_include_directories(include)
diff --git a/zephyr/projects/it8xxx2_evb/adc.dts b/zephyr/projects/it8xxx2_evb/adc.dts
new file mode 100644
index 0000000000..509c9b9daf
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/adc.dts
@@ -0,0 +1,41 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+
+ adc_vbussa: vbussa {
+ enum-name = "ADC_VBUS";
+ io-channels = <&adc0 0>;
+ };
+ adc_vbussb: vbussb {
+ enum-name = "ADC_PSYS";
+ io-channels = <&adc0 1>;
+ };
+ adc_evb_ch_13: evb_ch_13 {
+ enum-name = "ADC_AMON_BMON";
+ io-channels = <&adc0 2>;
+ };
+ adc_evb_ch_14: evb_ch_14 {
+ enum-name = "ADC_TEMP_SENSOR_FAN";
+ io-channels = <&adc0 3>;
+ };
+ adc_evb_ch_15: evb_ch_15 {
+ enum-name = "ADC_TEMP_SENSOR_DDR_SOC";
+ io-channels = <&adc0 4>;
+ };
+ adc_evb_ch_16: evb_ch_16 {
+ enum-name = "ADC_TEMP_SENSOR_CHARGER";
+ io-channels = <&adc0 5>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_ch3_gpi3_default>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/it8xxx2_evb/fan.dts b/zephyr/projects/it8xxx2_evb/fan.dts
new file mode 100644
index 0000000000..2551507ec3
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/fan.dts
@@ -0,0 +1,27 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ fans {
+ compatible = "cros-ec,fans";
+
+ fan_0 {
+ pwms = <&pwm7 PWM_CHANNEL_7 PWM_KHZ(30) PWM_POLARITY_NORMAL>;
+ tach = <&tach0>;
+ rpm_min = <1500>;
+ rpm_start = <1500>;
+ rpm_max = <6500>;
+ };
+ };
+};
+
+/* fan tachometer sensor */
+&tach0 {
+ status = "okay";
+ channel = <IT8XXX2_TACH_CHANNEL_A>;
+ pulses-per-round = <2>;
+ pinctrl-0 = <&tach0a_gpd6_default>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/it8xxx2_evb/gpio.dts b/zephyr/projects/it8xxx2_evb/gpio.dts
new file mode 100644
index 0000000000..85bb45d7a0
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/gpio.dts
@@ -0,0 +1,169 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/gpio_defines.h>
+
+/ {
+ aliases {
+ gpio-wp = &gpio_wp;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ power_button_l: power_button_l {
+ gpios = <&gpioe 4 GPIO_INPUT_PULL_UP>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ lid_open: lid_open {
+ gpios = <&gpioe 2 GPIO_INPUT_PULL_UP>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ gpio_wp: wp_l {
+ gpios = <&gpioi 4 (GPIO_INPUT_PULL_UP |
+ GPIO_ACTIVE_LOW)>;
+ };
+ pch_pltrst_l {
+ gpios = <&gpioe 3 GPIO_INPUT_PULL_UP>;
+ enum-name = "GPIO_PCH_RSMRST_L";
+ };
+ sys_reset_l {
+ gpios = <&gpiob 6 GPIO_OUTPUT_HIGH>;
+ enum-name = "GPIO_SYS_RESET_L";
+ };
+ gpio_ec_pch_wake_odl: pch_wake_l {
+ gpios = <&gpiob 7 GPIO_OUTPUT_HIGH>;
+ };
+ spi0_cs: spi0_cs {
+ gpios = <&gpiom 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ /* unimplemented GPIOs */
+ entering-rw {
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <&int_power_button
+ &int_lid_open>;
+ };
+
+ unused-pins {
+ compatible = "unused-gpios";
+
+ unused-gpios =
+ /* gpioa1 */
+ <&gpioa 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpioa2 */
+ <&gpioa 2 GPIO_INPUT_PULL_DOWN>,
+ /* gpioa3 */
+ <&gpioa 3 GPIO_INPUT_PULL_DOWN>,
+ /* gpioa4 */
+ <&gpioa 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpioa5 */
+ <&gpioa 5 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpiob2 */
+ <&gpiob 2 GPIO_INPUT_PULL_DOWN>,
+ /* gpiob5 */
+ <&gpiob 5 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpioc0 */
+ <&gpioc 0 GPIO_INPUT_PULL_DOWN>,
+ /* gpioc4 */
+ <&gpioc 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpioc6 */
+ <&gpioc 6 GPIO_INPUT_PULL_DOWN>,
+ /* gpioc7 */
+ <&gpioc 7 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpiod0 */
+ <&gpiod 0 GPIO_INPUT_PULL_DOWN>,
+ /* gpiod1 */
+ <&gpiod 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpiod2 */
+ <&gpiod 2 GPIO_INPUT_PULL_DOWN>,
+ /* gpiod3 */
+ <&gpiod 3 GPIO_INPUT_PULL_DOWN>,
+ /* gpiod4 */
+ <&gpiod 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpiod5 */
+ <&gpiod 5 GPIO_INPUT_PULL_DOWN>,
+ /* gpiod7 */
+ <&gpiod 7 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpioe1 */
+ <&gpioe 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpioe5 */
+ <&gpioe 5 GPIO_INPUT_PULL_DOWN>,
+ /* gpioe6 */
+ <&gpioe 6 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpiof0 */
+ <&gpiof 0 GPIO_INPUT_PULL_DOWN>,
+ /* gpiof1 */
+ <&gpiof 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpiof2 */
+ <&gpiof 2 GPIO_INPUT_PULL_DOWN>,
+ /* gpiof3 */
+ <&gpiof 3 GPIO_INPUT_PULL_DOWN>,
+ /* gpiof4 */
+ <&gpiof 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpiof5 */
+ <&gpiof 5 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpiog1 */
+ <&gpiog 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpiog6 */
+ <&gpiog 6 GPIO_INPUT_PULL_UP>,
+
+ /* gpioh0 */
+ <&gpioh 0 GPIO_INPUT_PULL_DOWN>,
+ /* gpioh3 */
+ <&gpioh 3 GPIO_INPUT_PULL_DOWN>,
+ /* gpioh4 */
+ <&gpioh 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpioh5 */
+ <&gpioh 5 GPIO_INPUT_PULL_DOWN>,
+ /* gpioh6 */
+ <&gpioh 6 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpioi6 */
+ <&gpioi 6 GPIO_INPUT_PULL_DOWN>,
+ /* gpioi7 */
+ <&gpioi 7 GPIO_INPUT_PULL_DOWN>,
+
+ /* gpioj0 */
+ <&gpioj 0 GPIO_INPUT_PULL_DOWN>,
+ /* gpioj1 */
+ <&gpioj 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpioj2 */
+ <&gpioj 2 GPIO_INPUT_PULL_DOWN>,
+ /* gpioj3 */
+ <&gpioj 3 GPIO_INPUT_PULL_DOWN>,
+ /* gpioj4 */
+ <&gpioj 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpioj5 */
+ <&gpioj 5 GPIO_INPUT_PULL_DOWN>,
+ /* gpioj6 */
+ <&gpioj 6 GPIO_OUTPUT_LOW>,
+ /* gpioj7 */
+ <&gpioj 7 GPIO_OUTPUT_LOW>,
+
+ /* gpiom0 */
+ <&gpiom 0 GPIO_INPUT_PULL_DOWN>,
+ /* gpiom1 */
+ <&gpiom 1 GPIO_INPUT_PULL_DOWN>,
+ /* gpiom2 */
+ <&gpiom 2 GPIO_INPUT_PULL_DOWN>,
+ /* gpiom3 */
+ <&gpiom 3 GPIO_INPUT_PULL_DOWN>,
+ /* gpiom4 */
+ <&gpiom 4 GPIO_INPUT_PULL_DOWN>,
+ /* gpiom6 */
+ <&gpiom 6 GPIO_INPUT_PULL_DOWN>;
+ };
+};
diff --git a/zephyr/projects/it8xxx2_evb/i2c.dts b/zephyr/projects/it8xxx2_evb/i2c.dts
new file mode 100644
index 0000000000..c08c543e44
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/i2c.dts
@@ -0,0 +1,59 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ named-i2c-ports {
+ compatible = "named-i2c-ports";
+
+ battery {
+ i2c-port = <&i2c2>;
+ enum-names = "I2C_PORT_BATTERY";
+ };
+ evb-1 {
+ i2c-port = <&i2c0>;
+ enum-names = "I2C_PORT_EVB_1";
+ };
+ evb-2 {
+ i2c-port = <&i2c1>;
+ enum-names = "I2C_PORT_EVB_2";
+ };
+ opt-4 {
+ i2c-port = <&i2c4>;
+ enum-names = "I2C_PORT_OPT_4";
+ };
+ };
+};
+
+&i2c0 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+ pinctrl-0 = <&i2c0_clk_gpb3_default
+ &i2c0_data_gpb4_default>;
+ pinctrl-names = "default";
+};
+
+&i2c1 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+ pinctrl-0 = <&i2c1_clk_gpc1_default
+ &i2c1_data_gpc2_default>;
+ pinctrl-names = "default";
+};
+
+&i2c2 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+ pinctrl-0 = <&i2c2_clk_gpf6_default
+ &i2c2_data_gpf7_default>;
+ pinctrl-names = "default";
+};
+
+&i2c4 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+ pinctrl-0 = <&i2c4_clk_gpe0_default
+ &i2c4_data_gpe7_default>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/it8xxx2_evb/include/i2c_map.h b/zephyr/projects/it8xxx2_evb/include/i2c_map.h
new file mode 100644
index 0000000000..e83a238d3a
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/include/i2c_map.h
@@ -0,0 +1,16 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __ZEPHYR_CHROME_I2C_MAP_H
+#define __ZEPHYR_CHROME_I2C_MAP_H
+
+#include <zephyr/devicetree.h>
+
+#include "config.h"
+
+/* We need registers.h to get the chip specific defines for now */
+#include "i2c/i2c.h"
+
+#endif /* __ZEPHYR_CHROME_I2C_MAP_H */
diff --git a/zephyr/projects/it8xxx2_evb/interrupts.dts b/zephyr/projects/it8xxx2_evb/interrupts.dts
new file mode 100644
index 0000000000..07fc0ed339
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/interrupts.dts
@@ -0,0 +1,26 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_power_button: power_button {
+ irq-pin = <&power_button_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-pin = <&lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_spi0_cs: spi0_cs {
+ irq-pin = <&spi0_cs>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "spi_event";
+ };
+ };
+};
diff --git a/zephyr/projects/it8xxx2_evb/prj.conf b/zephyr/projects/it8xxx2_evb/prj.conf
new file mode 100644
index 0000000000..d6d422e490
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/prj.conf
@@ -0,0 +1,44 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+CONFIG_CROS_EC=y
+CONFIG_PLATFORM_EC=y
+CONFIG_SHIMMED_TASKS=y
+
+# SoC configuration
+CONFIG_AP=y
+CONFIG_AP_ARM_MTK_MT8192=y
+
+# Lid switch
+CONFIG_PLATFORM_EC_LID_SWITCH=y
+
+# Logging
+CONFIG_LOG=y
+
+# Fan
+CONFIG_SENSOR=y
+
+# I2C
+CONFIG_I2C=y
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
+# Power Button
+CONFIG_PLATFORM_EC_POWER_BUTTON=y
+
+# TODO(b:185202623): bring these features up
+CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=n
+CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=n
+CONFIG_PLATFORM_EC_KEYBOARD=n
+CONFIG_CROS_KB_RAW_ITE=n
+CONFIG_PLATFORM_EC_SWITCH=n
+CONFIG_PLATFORM_EC_VBOOT_EFS2=n
+CONFIG_PLATFORM_EC_VBOOT_HASH=n
+
+# USB-C
+CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n
+CONFIG_PLATFORM_EC_USB_PD_USB4=n
diff --git a/zephyr/projects/it8xxx2_evb/pwm.dts b/zephyr/projects/it8xxx2_evb/pwm.dts
new file mode 100644
index 0000000000..c566e5c029
--- /dev/null
+++ b/zephyr/projects/it8xxx2_evb/pwm.dts
@@ -0,0 +1,31 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ pwmleds {
+ compatible = "pwm-leds";
+
+ /* NOTE: &pwm number needs same with channel number */
+ pwm_led_test: pwm_led_test {
+ pwms = <&pwm0 PWM_CHANNEL_0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
+ };
+ };
+};
+
+/* pwm for test */
+&pwm0 {
+ status = "okay";
+ prescaler-cx = <PWM_PRESCALER_C6>;
+ pinctrl-0 = <&pwm0_gpa0_default>;
+ pinctrl-names = "default";
+};
+
+/* pwm for fan */
+&pwm7 {
+ status = "okay";
+ prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm7_gpa7_default>;
+ pinctrl-names = "default";
+};