diff options
Diffstat (limited to 'zephyr/projects/npcx_evb')
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/BUILD.py | 11 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/CMakeLists.txt | 10 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/fan.dts | 39 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/gpio.dts | 68 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/interrupts.dts | 26 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/keyboard.dts | 42 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/prj.conf | 60 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/BUILD.py | 16 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/CMakeLists.txt | 10 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/fan.dts | 39 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/gpio.dts | 72 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/interrupts.dts | 26 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/keyboard.dts | 42 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/prj.conf | 64 |
14 files changed, 525 insertions, 0 deletions
diff --git a/zephyr/projects/npcx_evb/npcx7/BUILD.py b/zephyr/projects/npcx_evb/npcx7/BUILD.py new file mode 100644 index 0000000000..baa6774595 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/BUILD.py @@ -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. + +"""Define zmake projects for npcx7_evb.""" + +register_npcx_project( + project_name="npcx7", + zephyr_board="npcx7_evb", + dts_overlays=["gpio.dts", "interrupts.dts", "fan.dts", "keyboard.dts"], +) diff --git a/zephyr/projects/npcx_evb/npcx7/CMakeLists.txt b/zephyr/projects/npcx_evb/npcx7/CMakeLists.txt new file mode 100644 index 0000000000..64429d586e --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/CMakeLists.txt @@ -0,0 +1,10 @@ +# 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(npcx7) + +zephyr_include_directories(include) diff --git a/zephyr/projects/npcx_evb/npcx7/fan.dts b/zephyr/projects/npcx_evb/npcx7/fan.dts new file mode 100644 index 0000000000..dc4debdcb9 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/fan.dts @@ -0,0 +1,39 @@ +/* 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. + */ + +/ { + fans { + compatible = "cros-ec,fans"; + + fan_0 { + pwms = <&pwm0 0 PWM_KHZ(25) PWM_POLARITY_NORMAL>; + rpm_min = <1000>; + rpm_start = <1000>; + rpm_max = <5200>; + tach = <&tach1>; + pgood_gpio = <&gpio_pgood_fan>; + }; + }; +}; + +/* Tachometer for fan speed measurement */ +&tach1 { + status = "okay"; + pinctrl-0 = <&ta1_1_in_gp40>; + pinctrl-names = "default"; + port = <NPCX_TACH_PORT_A>; /* port-A is selected */ + sample-clk = <NPCX_TACH_FREQ_LFCLK>; /* Use LFCLK as sampling clock */ + pulses-per-round = <2>; /* number of pulses per round of encoder */ +}; + +&pwm0_gpc3 { + drive-open-drain; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_gpc3>; + pinctrl-names = "default"; +}; diff --git a/zephyr/projects/npcx_evb/npcx7/gpio.dts b/zephyr/projects/npcx_evb/npcx7/gpio.dts new file mode 100644 index 0000000000..d44927609d --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/gpio.dts @@ -0,0 +1,68 @@ +/* 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. + */ + +/ { + aliases { + gpio-wp = &gpio_wp; + }; + + named-gpios { + compatible = "named-gpios"; + + recovery_l { + gpios = <&gpio0 3 GPIO_INPUT_PULL_UP>; + }; + gpio_wp: wp_l { + gpios = <&gpio9 3 (GPIO_INPUT_PULL_UP | + GPIO_ACTIVE_LOW)>; + }; + gpio_ac_present: ac_present { + gpios = <&gpiod 2 GPIO_INPUT>; + enum-name = "GPIO_AC_PRESENT"; + }; + gpio_power_button_l: power_button_l { + gpios = <&gpio0 0 GPIO_INPUT>; + enum-name = "GPIO_POWER_BUTTON_L"; + }; + gpio_lid_open: lid_open { + gpios = <&gpio0 1 GPIO_INPUT>; + enum-name = "GPIO_LID_OPEN"; + }; + entering_rw { + gpios = <&gpio3 6 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_ENTERING_RW"; + }; + gpio_ec_pch_wake_odl: pch_wake_l { + gpios = <&gpio5 0 GPIO_OUTPUT_HIGH>; + }; + gpio_pgood_fan: pgood_fan { + gpios = <&gpioc 7 GPIO_INPUT_PULL_UP>; + }; + spi_cs_l { + gpios = <&gpioa 5 GPIO_OUTPUT_HIGH>; + }; + board_version1 { + gpios = <&gpio6 4 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION1"; + }; + board_version2 { + gpios = <&gpio6 5 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION2"; + }; + board_version3 { + gpios = <&gpio6 6 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION3"; + }; + }; + + hibernate-wake-pins { + compatible = "cros-ec,hibernate-wake-pins"; + wakeup-irqs = < + &int_ac_present + &int_power_button + &int_lid_open + >; + }; +}; diff --git a/zephyr/projects/npcx_evb/npcx7/interrupts.dts b/zephyr/projects/npcx_evb/npcx7/interrupts.dts new file mode 100644 index 0000000000..3e92428ef4 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/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_ac_present: ac_present { + irq-pin = <&gpio_ac_present>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "extpower_interrupt"; + }; + int_lid_open: lid_open { + irq-pin = <&gpio_lid_open>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "lid_interrupt"; + }; + int_power_button: power_button { + irq-pin = <&gpio_power_button_l>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "power_button_interrupt"; + }; + }; +}; diff --git a/zephyr/projects/npcx_evb/npcx7/keyboard.dts b/zephyr/projects/npcx_evb/npcx7/keyboard.dts new file mode 100644 index 0000000000..3fb6986f1a --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/keyboard.dts @@ -0,0 +1,42 @@ +/* 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. + */ + +/ { + cros-keyscan { + compatible = "cros-keyscan"; + + output-settle = <40>; + debounce-down = <6000>; + scan-period = <1500>; + poll-timeout = <1000000>; + + actual-key-mask = < + 0x14 /* C0 */ + 0xff /* C1 */ + 0xff /* C2 */ + 0xff /* C3 */ + 0xff /* C4 */ + 0xf5 /* C5 */ + 0xff /* C6 */ + 0xa4 /* C7 */ + 0xff /* C8 */ + 0xf6 /* C9 */ + 0x55 /* C10 */ + 0xfa /* C11 */ + 0xc8 /* C12 */ + >; + }; + + kblight { + compatible = "cros-ec,kblight-pwm"; + pwms = <&pwm2 0 PWM_KHZ(10) PWM_POLARITY_NORMAL>; + }; +}; + +&pwm2 { + status = "okay"; + pinctrl-0 = <&pwm2_gpc4>; + pinctrl-names = "default"; +}; diff --git a/zephyr/projects/npcx_evb/npcx7/prj.conf b/zephyr/projects/npcx_evb/npcx7/prj.conf new file mode 100644 index 0000000000..5f1fc03f88 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/prj.conf @@ -0,0 +1,60 @@ +# 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_PLATFORM_EC_BRINGUP=y +CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y +CONFIG_PLATFORM_EC_LID_SWITCH=y +CONFIG_PLATFORM_EC_POWER_BUTTON=y +CONFIG_SHIMMED_TASKS=y + +CONFIG_PLATFORM_EC_BACKLIGHT_LID=n +CONFIG_PLATFORM_EC_SWITCH=n +CONFIG_PLATFORM_EC_VBOOT_EFS2=n +CONFIG_PLATFORM_EC_VSTORE=n + +# Board version is selected over GPIO board ID pins. +CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y + +# PWM +CONFIG_PWM=y + +# Sensors +CONFIG_SENSOR=y +CONFIG_SENSOR_SHELL=n + +# Console command +CONFIG_PLATFORM_EC_CONSOLE_CMD_SCRATCHPAD=y + +CONFIG_TRACING=y +CONFIG_TRACING_ISR=y +CONFIG_TRACING_USER=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_IRQ=y + +# eSPI +CONFIG_ESPI=y +CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S3=y +CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S4=y + +# Keyboard +CONFIG_CROS_KB_RAW_NPCX_KSO_HIGH_DRIVE=y + +# RTC +CONFIG_PLATFORM_EC_RTC=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC=y + +# USB-C +CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n +CONFIG_PLATFORM_EC_USB_PD_USB4=n + +# Zephyr feature +CONFIG_ASSERT=y +CONFIG_SHELL_MINIMAL=n +CONFIG_LOG=y + +# Avoid underflow info from tachometer +CONFIG_SENSOR_LOG_LEVEL_ERR=y + +CONFIG_SYSCON=y diff --git a/zephyr/projects/npcx_evb/npcx9/BUILD.py b/zephyr/projects/npcx_evb/npcx9/BUILD.py new file mode 100644 index 0000000000..335f410d9b --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/BUILD.py @@ -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. + +"""Define zmake projects for npcx9_evb.""" + +register_npcx_project( + project_name="npcx9", + zephyr_board="npcx9_evb", + dts_overlays=[ + "gpio.dts", + "interrupts.dts", + "fan.dts", + "keyboard.dts", + ], +) diff --git a/zephyr/projects/npcx_evb/npcx9/CMakeLists.txt b/zephyr/projects/npcx_evb/npcx9/CMakeLists.txt new file mode 100644 index 0000000000..ef734c06f6 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/CMakeLists.txt @@ -0,0 +1,10 @@ +# 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(npcx9) + +zephyr_include_directories(include) diff --git a/zephyr/projects/npcx_evb/npcx9/fan.dts b/zephyr/projects/npcx_evb/npcx9/fan.dts new file mode 100644 index 0000000000..dc4debdcb9 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/fan.dts @@ -0,0 +1,39 @@ +/* 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. + */ + +/ { + fans { + compatible = "cros-ec,fans"; + + fan_0 { + pwms = <&pwm0 0 PWM_KHZ(25) PWM_POLARITY_NORMAL>; + rpm_min = <1000>; + rpm_start = <1000>; + rpm_max = <5200>; + tach = <&tach1>; + pgood_gpio = <&gpio_pgood_fan>; + }; + }; +}; + +/* Tachometer for fan speed measurement */ +&tach1 { + status = "okay"; + pinctrl-0 = <&ta1_1_in_gp40>; + pinctrl-names = "default"; + port = <NPCX_TACH_PORT_A>; /* port-A is selected */ + sample-clk = <NPCX_TACH_FREQ_LFCLK>; /* Use LFCLK as sampling clock */ + pulses-per-round = <2>; /* number of pulses per round of encoder */ +}; + +&pwm0_gpc3 { + drive-open-drain; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_gpc3>; + pinctrl-names = "default"; +}; diff --git a/zephyr/projects/npcx_evb/npcx9/gpio.dts b/zephyr/projects/npcx_evb/npcx9/gpio.dts new file mode 100644 index 0000000000..9a32112471 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/gpio.dts @@ -0,0 +1,72 @@ +/* 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. + */ + +/ { + aliases { + gpio-wp = &gpio_wp; + }; + + named-gpios { + compatible = "named-gpios"; + + recovery_l { + gpios = <&gpio0 3 GPIO_INPUT_PULL_UP>; + }; + gpio_wp: wp_l { + gpios = <&gpio9 3 (GPIO_INPUT_PULL_UP | + GPIO_ACTIVE_LOW)>; + }; + gpio_ac_present: ac_present { + gpios = <&gpiod 2 GPIO_INPUT>; + enum-name = "GPIO_AC_PRESENT"; + }; + gpio_power_button_l: power_button_l { + gpios = <&gpio0 0 GPIO_INPUT>; + enum-name = "GPIO_POWER_BUTTON_L"; + }; + gpio_lid_open: lid_open { + gpios = <&gpio0 1 GPIO_INPUT>; + enum-name = "GPIO_LID_OPEN"; + }; + entering_rw { + gpios = <&gpio3 6 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_ENTERING_RW"; + }; + gpio_ec_pch_wake_odl: pch_wake_l { + gpios = <&gpio5 0 GPIO_OUTPUT_HIGH>; + }; + gpio_pgood_fan: pgood_fan { + gpios = <&gpioc 7 GPIO_INPUT_PULL_UP>; + }; + spi_cs_l { + gpios = <&gpioa 5 GPIO_OUTPUT_HIGH>; + }; + board_version1 { + gpios = <&gpio6 4 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION1"; + }; + board_version2 { + gpios = <&gpio6 5 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION2"; + }; + board_version3 { + gpios = <&gpio6 6 GPIO_INPUT>; + enum-name = "GPIO_BOARD_VERSION3"; + }; + }; +}; + +/* A falling edge detection type for PSL_IN2 */ +&psl_in2_gp00 { + psl-in-mode = "edge"; + psl-in-pol = "low-falling"; +}; + +/* Power domain device controlled by PSL (Power Switch Logic) IO pads */ +&power_ctrl_psl { + status = "okay"; + pinctrl-names = "sleep"; + pinctrl-0 = <&psl_in2_gp00>; +}; diff --git a/zephyr/projects/npcx_evb/npcx9/interrupts.dts b/zephyr/projects/npcx_evb/npcx9/interrupts.dts new file mode 100644 index 0000000000..3e92428ef4 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/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_ac_present: ac_present { + irq-pin = <&gpio_ac_present>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "extpower_interrupt"; + }; + int_lid_open: lid_open { + irq-pin = <&gpio_lid_open>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "lid_interrupt"; + }; + int_power_button: power_button { + irq-pin = <&gpio_power_button_l>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "power_button_interrupt"; + }; + }; +}; diff --git a/zephyr/projects/npcx_evb/npcx9/keyboard.dts b/zephyr/projects/npcx_evb/npcx9/keyboard.dts new file mode 100644 index 0000000000..3fb6986f1a --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/keyboard.dts @@ -0,0 +1,42 @@ +/* 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. + */ + +/ { + cros-keyscan { + compatible = "cros-keyscan"; + + output-settle = <40>; + debounce-down = <6000>; + scan-period = <1500>; + poll-timeout = <1000000>; + + actual-key-mask = < + 0x14 /* C0 */ + 0xff /* C1 */ + 0xff /* C2 */ + 0xff /* C3 */ + 0xff /* C4 */ + 0xf5 /* C5 */ + 0xff /* C6 */ + 0xa4 /* C7 */ + 0xff /* C8 */ + 0xf6 /* C9 */ + 0x55 /* C10 */ + 0xfa /* C11 */ + 0xc8 /* C12 */ + >; + }; + + kblight { + compatible = "cros-ec,kblight-pwm"; + pwms = <&pwm2 0 PWM_KHZ(10) PWM_POLARITY_NORMAL>; + }; +}; + +&pwm2 { + status = "okay"; + pinctrl-0 = <&pwm2_gpc4>; + pinctrl-names = "default"; +}; diff --git a/zephyr/projects/npcx_evb/npcx9/prj.conf b/zephyr/projects/npcx_evb/npcx9/prj.conf new file mode 100644 index 0000000000..827b6366c6 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/prj.conf @@ -0,0 +1,64 @@ +# 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_PLATFORM_EC_BRINGUP=y +CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y +CONFIG_PLATFORM_EC_LID_SWITCH=y +CONFIG_PLATFORM_EC_POWER_BUTTON=y +CONFIG_SHIMMED_TASKS=y + +CONFIG_PLATFORM_EC_BACKLIGHT_LID=n +CONFIG_PLATFORM_EC_SWITCH=n +CONFIG_PLATFORM_EC_VBOOT_EFS2=n +CONFIG_PLATFORM_EC_VSTORE=n + +# Workaround npcx9 A1 chip's bug for download_from_flash API in th booter. +# This can be removed when A2 chip is available. +CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y + +# Board version is selected over GPIO board ID pins. +CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y + +# PWM +CONFIG_PWM=y + +# Sensors +CONFIG_SENSOR=y +CONFIG_SENSOR_SHELL=n + +# Console command +CONFIG_PLATFORM_EC_CONSOLE_CMD_SCRATCHPAD=y + +CONFIG_TRACING=y +CONFIG_TRACING_ISR=y +CONFIG_TRACING_USER=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_IRQ=y + +# eSPI +CONFIG_ESPI=y +CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S3=y +CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S4=y + +# Keyboard +CONFIG_CROS_KB_RAW_NPCX_KSO_HIGH_DRIVE=y + +# RTC +CONFIG_PLATFORM_EC_RTC=y +CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC=y + +# USB-C +CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n +CONFIG_PLATFORM_EC_USB_PD_USB4=n + +# Zephyr feature +CONFIG_ASSERT=y +CONFIG_SHELL_MINIMAL=n +CONFIG_LOG=y + +# Avoid underflow info from tachometer +CONFIG_SENSOR_LOG_LEVEL_ERR=y + +CONFIG_SYSCON=y |