diff options
author | Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> | 2022-08-26 17:07:34 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-01 02:34:21 +0000 |
commit | 4ebd39c76300382b14f6614cc5d7993545d4b99e (patch) | |
tree | 1b05b9e5fdb7d1e5f63b353fce4041a6b4b810ea /zephyr | |
parent | 52e2c367a9c61c22201a8f477c76ed5d9467e8fe (diff) | |
download | chrome-ec-4ebd39c76300382b14f6614cc5d7993545d4b99e.tar.gz |
morthal: Initial EC image
Create the initial Zephyr EC image for the morthal variant by copying
the skyrim reference board EC files.
More changes will be added later.
BUG=none
TEST=zmake build morthal
BRANCH=none
Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Change-Id: I358b649c4674003c8531bcef4f7ea8727293141b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3858969
Reviewed-by: Moises Garcia <moisesgarcia@google.com>
Tested-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Auto-Submit: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/projects/skyrim/BUILD.py | 14 | ||||
-rw-r--r-- | zephyr/projects/skyrim/CMakeLists.txt | 7 | ||||
-rw-r--r-- | zephyr/projects/skyrim/Kconfig | 6 | ||||
-rw-r--r-- | zephyr/projects/skyrim/battery_morthal.dts | 15 | ||||
-rw-r--r-- | zephyr/projects/skyrim/led_pins_morthal.dts | 63 | ||||
-rw-r--r-- | zephyr/projects/skyrim/led_policy_morthal.dts | 103 | ||||
-rw-r--r-- | zephyr/projects/skyrim/morthal.dts | 235 | ||||
-rw-r--r-- | zephyr/projects/skyrim/prj_morthal.conf | 23 |
8 files changed, 466 insertions, 0 deletions
diff --git a/zephyr/projects/skyrim/BUILD.py b/zephyr/projects/skyrim/BUILD.py index 394afcc10d..7a7f209e07 100644 --- a/zephyr/projects/skyrim/BUILD.py +++ b/zephyr/projects/skyrim/BUILD.py @@ -32,6 +32,20 @@ def register_skyrim_project( register_skyrim_project( + project_name="morthal", + extra_dts_overlays=[ + here / "morthal.dts", + here / "battery_morthal.dts", + here / "led_pins_morthal.dts", + here / "led_policy_morthal.dts", + ], + extra_kconfig_files=[ + here / "prj_morthal.conf", + ], +) + + +register_skyrim_project( project_name="skyrim", extra_dts_overlays=[ here / "skyrim.dts", diff --git a/zephyr/projects/skyrim/CMakeLists.txt b/zephyr/projects/skyrim/CMakeLists.txt index 8b706417e4..24d0138bc9 100644 --- a/zephyr/projects/skyrim/CMakeLists.txt +++ b/zephyr/projects/skyrim/CMakeLists.txt @@ -17,6 +17,13 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT "stt.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "fan.c") +if(DEFINED CONFIG_BOARD_MORTHAL) + project(morthal) + zephyr_library_sources( + "usbc_config.c" +) +endif() + if(DEFINED CONFIG_BOARD_SKYRIM) project(skyrim) cros_ec_library_include_directories_ifdef(CONFIG_BOARD_SKYRIM include) diff --git a/zephyr/projects/skyrim/Kconfig b/zephyr/projects/skyrim/Kconfig index d5612d91d5..36e8b5a659 100644 --- a/zephyr/projects/skyrim/Kconfig +++ b/zephyr/projects/skyrim/Kconfig @@ -2,6 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +config BOARD_MORTHAL + bool "Google Morthal Board" + help + Build Google Morthal reference board. This board uses an AMD SoC + and NPCX9 EC + config BOARD_SKYRIM bool "Google Skyrim Board" help diff --git a/zephyr/projects/skyrim/battery_morthal.dts b/zephyr/projects/skyrim/battery_morthal.dts new file mode 100644 index 0000000000..b9fc0d1090 --- /dev/null +++ b/zephyr/projects/skyrim/battery_morthal.dts @@ -0,0 +1,15 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + batteries { + default_battery: aec_5477109 { + compatible = "aec,5477109", "battery-smart"; + }; + smp_l20m3pg1 { + compatible = "smp,l20m3pg1", "battery-smart"; + }; + }; +}; diff --git a/zephyr/projects/skyrim/led_pins_morthal.dts b/zephyr/projects/skyrim/led_pins_morthal.dts new file mode 100644 index 0000000000..1c6bf60375 --- /dev/null +++ b/zephyr/projects/skyrim/led_pins_morthal.dts @@ -0,0 +1,63 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + pwm_pins { + compatible = "cros-ec,pwm-pin-config"; + + pwm_y: pwm_y { + #led-pin-cells = <1>; + pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>; + }; + + pwm_w: pwm_w { + #led-pin-cells = <1>; + pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>; + }; + }; + + pwm-led-pins { + compatible = "cros-ec,pwm-led-pins"; + + color_off: color-off { + led-color = "LED_OFF"; + led-id = "EC_LED_ID_BATTERY_LED"; + led-pins = <&pwm_y 0>, + <&pwm_w 0>; + }; + + color_amber: color-amber { + led-color = "LED_AMBER"; + led-id = "EC_LED_ID_BATTERY_LED"; + br-color = "EC_LED_COLOR_AMBER"; + led-pins = <&pwm_y 100>, + <&pwm_w 0>; + }; + + color_white: color-white { + led-color = "LED_WHITE"; + led-id = "EC_LED_ID_BATTERY_LED"; + br-color = "EC_LED_COLOR_BLUE"; + led-pins = <&pwm_y 0>, + <&pwm_w 100>; + }; + }; +}; + +/* Amber "battery charging" LED */ +&pwm2 { + status = "okay"; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; + pinctrl-0 = <&pwm2_gpc4>; + pinctrl-names = "default"; +}; + +/* White "battery full" LED */ +&pwm3 { + status = "okay"; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; + pinctrl-0 = <&pwm3_gp80>; + pinctrl-names = "default"; +}; diff --git a/zephyr/projects/skyrim/led_policy_morthal.dts b/zephyr/projects/skyrim/led_policy_morthal.dts new file mode 100644 index 0000000000..a075c6b0d2 --- /dev/null +++ b/zephyr/projects/skyrim/led_policy_morthal.dts @@ -0,0 +1,103 @@ +#include <dt-bindings/battery.h> + +/ { + led-colors { + compatible = "cros-ec,led-policy"; + + power-state-charge { + charge-state = "PWR_STATE_CHARGE"; + + color-0 { + led-color = <&color_amber>; + }; + }; + + power-state-discharge-s0 { + charge-state = "PWR_STATE_DISCHARGE"; + chipset-state = "POWER_S0"; + /* Battery percent range (> Low, <= Full) */ + batt-lvl = <(BATTERY_LEVEL_LOW + 1) BATTERY_LEVEL_FULL>; + + color-0 { + led-color = <&color_white>; + }; + }; + + power-state-discharge-s0-batt-low { + charge-state = "PWR_STATE_DISCHARGE"; + chipset-state = "POWER_S0"; + /* Battery percent range (>= Empty, <= Low) */ + batt-lvl = <BATTERY_LEVEL_EMPTY BATTERY_LEVEL_LOW>; + + /* White 2 sec, off 1 sec */ + color-0 { + led-color = <&color_white>; + period-ms = <2000>; + }; + color-1 { + led-color = <&color_off>; + period-ms = <1000>; + }; + }; + + power-state-discharge-s3 { + charge-state = "PWR_STATE_DISCHARGE"; + chipset-state = "POWER_S3"; + + /* White 1 sec, off 1 sec */ + color-0 { + led-color = <&color_white>; + period-ms = <1000>; + }; + color-1 { + led-color = <&color_off>; + period-ms = <1000>; + }; + }; + + power-state-discharge-s5 { + charge-state = "PWR_STATE_DISCHARGE"; + chipset-state = "POWER_S5"; + + color-0 { + led-color = <&color_off>; + }; + }; + + power-state-error { + charge-state = "PWR_STATE_ERROR"; + + /* Amber 1 sec, off 1 sec */ + color-0 { + led-color = <&color_amber>; + period-ms = <1000>; + }; + color-1 { + led-color = <&color_off>; + period-ms = <1000>; + }; + }; + + power-state-near-full { + charge-state = "PWR_STATE_CHARGE_NEAR_FULL"; + + color-0 { + led-color = <&color_white>; + }; + }; + + power-state-forced-idle { + charge-state = "PWR_STATE_FORCED_IDLE"; + + /* Amber 2 sec, White 2 sec */ + color-0 { + led-color = <&color_amber>; + period-ms = <2000>; + }; + color-1 { + led-color = <&color_white>; + period-ms = <2000>; + }; + }; + }; +}; diff --git a/zephyr/projects/skyrim/morthal.dts b/zephyr/projects/skyrim/morthal.dts new file mode 100644 index 0000000000..8d4b99a81b --- /dev/null +++ b/zephyr/projects/skyrim/morthal.dts @@ -0,0 +1,235 @@ +/* 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. + */ + +/ { + aliases { + gpio-wp = &gpio_wp; + gpio-cbi-wp = &gpio_cbi_wp; + gpio-kbd-kso2 = &gpio_ec_kso_02_inv; + }; + + named-gpios { + /* Morthal-specific GPIO customizations */ + gpio_usb_fault_odl: usb_fault_odl { + gpios = <&gpio5 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>; + }; + gpio_en_pwr_s3: en_pwr_s3 { + gpios = <&gpio7 4 GPIO_OUTPUT_LOW>; + }; + gpio_pg_groupc_s0_od: pg_groupc_s0_od { + gpios = <&gpiof 0 GPIO_INPUT>; + }; + gpio_ec_i2c_usbc_pd_int: ec_i2c_usbc_pd_int { + gpios = <&gpioa 3 GPIO_INPUT>; + }; + gpio_soc_thermtrip_odl: soc_thermtrip_odl { + gpios = <&gpio9 5 GPIO_INPUT>; + }; + gpio_hub_rst: hub_rst { + gpios = <&gpio6 6 GPIO_OUTPUT_HIGH>; + }; + ec_soc_int_l { + gpios = <&gpioa 1 GPIO_OUTPUT_HIGH>; + enum-name = "GPIO_EC_INT_L"; + }; + gpio_ec_soc_pwr_good: ec_soc_pwr_good { + gpios = <&gpiod 3 GPIO_OUTPUT_LOW>; + }; + /* TODO: Add interrupt handler to shut down */ + pcore_ocp_r_l { + gpios = <&gpioa 5 GPIO_INPUT>; + }; + gpio_usb_hub_fault_q_odl: usb_hub_fault_q_odl { + gpios = <&gpioe 5 GPIO_INPUT_PULL_UP>; + }; + gpio_pg_lpddr5_s3_od: pg_lpddr5_s3_od { + gpios = <&gpio7 3 GPIO_INPUT>; + }; + 3axis_int_l { + gpios = <&gpioa 2 GPIO_INPUT_PULL_UP>; + }; + gpio_ec_soc_pwr_btn_l: ec_soc_pwr_btn_l { + gpios = <&gpioa 7 GPIO_OUTPUT_HIGH>; + enum-name = "GPIO_PCH_PWRBTN_L"; + }; + gpio_volup_btn_odl: volup_btn_odl { + gpios = <&gpio6 7 GPIO_INPUT_PULL_UP>; + enum-name = "GPIO_VOLUME_UP_L"; + }; + gpio_voldn_btn_odl: voldn_btn_odl { + gpios = <&gpio7 0 GPIO_INPUT_PULL_UP>; + enum-name = "GPIO_VOLUME_DOWN_L"; + }; + ec_sc_rst { + gpios = <&gpiob 0 GPIO_OUTPUT_LOW>; + }; + gpio_cbi_wp: ec_cbi_wp { + gpios = <&gpio8 1 GPIO_OUTPUT_LOW>; + }; + gpio_wp: ec_wp_l { + gpios = <&gpiod 7 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; + }; + gpio_pg_lpddr5_s0_od: pg_lpddr5_s0_od { + gpios = <&gpio6 0 GPIO_INPUT>; + }; + ec_espi_rst_l { + gpios = <&gpio5 4 GPIO_PULL_DOWN>; + }; + gpio_accel_gyro_int_l: accel_gyro_int_l { + gpios = <&gpioa 0 GPIO_INPUT>; + }; + /* unimplemented GPIOs */ + entering-rw { + enum-name = "GPIO_ENTERING_RW"; + }; + pch-sys-prwok { + enum-name = "GPIO_PCH_SYS_PWROK"; + }; + }; + + named-temp-sensors { + soc-pct2075 { + compatible = "cros-ec,temp-sensor-pct2075", + "cros-ec,temp-sensor"; + enum-name = "TEMP_SENSOR_SOC"; + pct2075-name = "PCT2075_SOC"; + port = <&i2c_sensor>; + i2c-addr-flags = "PCT2075_I2C_ADDR_FLAGS0"; + temp_host_high = <100>; + temp_host_halt = <105>; + temp_host_release_high = <80>; + temp_host_release_halt = <80>; + temp_fan_off = <0>; + temp_fan_max = <70>; + power-good-pin = <&gpio_pg_pwr_s5>; + }; + amb-pct2075 { + compatible = "cros-ec,temp-sensor-pct2075", + "cros-ec,temp-sensor"; + enum-name = "TEMP_SENSOR_AMB"; + pct2075-name = "PCT2075_AMB"; + port = <&i2c_sensor>; + i2c-addr-flags = "PCT2075_I2C_ADDR_FLAGS7"; + power-good-pin = <&gpio_pg_pwr_s5>; + }; + }; + + gpio-interrupts { + compatible = "cros-ec,gpio-interrupts"; + + int_pg_lpddr_s3: pg_lpddr_s3 { + irq-pin = <&gpio_pg_lpddr5_s3_od>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "baseboard_set_en_pwr_pcore"; + }; + int_pg_lpddr_s0: pg_lpddr_s0 { + irq-pin = <&gpio_pg_lpddr5_s0_od>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "baseboard_set_soc_pwr_pgood"; + }; + int_s0_pgood: s0_pgood { + irq-pin = <&gpio_s0_pgood>; + flags = <GPIO_INT_EDGE_BOTH>; + handler = "baseboard_s0_pgood"; + }; + }; + + /* + * Note this is expected to vary per-board, so we keep it in the board + * dts files. + */ + morthal-fw-config { + compatible = "cros-ec,cbi-fw-config"; + + form-factor { + enum-name = "FW_FORM_FACTOR"; + start = <0>; + size = <1>; + + ff-clamshell { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_FF_CLAMSHELL"; + value = <0>; + }; + ff-convertible { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_FF_CONVERTIBLE"; + value = <1>; + default; + }; + }; + io-db { + enum-name = "FW_IO_DB"; + start = <6>; + size = <2>; + + io-db-ps8811-ps8818 { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_IO_DB_PS8811_PS8818"; + value = <0>; + }; + io-db-none-anx7483 { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_IO_DB_NONE_ANX7483"; + value = <1>; + default; + }; + }; + + /* + * FW_CONFIG field to enable fan or not. + */ + fan { + enum-name = "FW_FAN"; + start = <10>; + size = <1>; + + no-fan { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_FAN_NOT_PRESENT"; + value = <0>; + }; + fan-present { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_FAN_PRESENT"; + value = <1>; + /* + * Set as default so that unprovisioned + * configs will run the fan regardless. + */ + default; + }; + }; + }; + + /* Rotation matrices for motion sensors. */ + motionsense-rotation-ref { + compatible = "cros-ec,motionsense-rotation-ref"; + lid_rot_ref: lid-rotation-ref { + mat33 = <0 (-1) 0 + 1 0 0 + 0 0 1>; + }; + + lid_rot_ref1: lid-rotation-ref1 { + mat33 = <0 1 0 + (-1) 0 0 + 0 0 1>; + }; + + base_rot_ref: base-rotation-ref { + mat33 = <0 1 0 + (-1) 0 0 + 0 0 1>; + }; + }; +}; + +/* host interface */ +&espi0 { + status = "okay"; + pinctrl-0 = <&espi_lpc_gp46_47_51_52_53_54_55_57>; + pinctrl-names = "default"; +}; diff --git a/zephyr/projects/skyrim/prj_morthal.conf b/zephyr/projects/skyrim/prj_morthal.conf new file mode 100644 index 0000000000..28c118ff12 --- /dev/null +++ b/zephyr/projects/skyrim/prj_morthal.conf @@ -0,0 +1,23 @@ +# 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. + +# Morthal reference-board-specific Kconfig settings. +CONFIG_BOARD_MORTHAL=y + +# TODO(b/215404321): Remove later in board development +CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y +CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y + +# LED +CONFIG_PLATFORM_EC_LED_DT=y + +# Morthal is capable of sinking 100W +CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=100000 +CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=5000 +CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=20000 + +# Only Morthal has the PCT2075 +CONFIG_PLATFORM_EC_TEMP_SENSOR_PCT2075=y + +CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y |