From ca22ad5e5b319946945d32ed3322a4de7a4a6c43 Mon Sep 17 00:00:00 2001 From: Scott Chao Date: Tue, 14 Feb 2023 13:04:36 +0800 Subject: aurash: update EC related function - Support power on by HDMI/ DP monitor. - Remove third type-c port. - Update GPIO setting according to schematic. - Update power_monitor function according to aurash design. - Update ADC channel setting. - Update Barrel adapter to 90w and 135w. - Remove all fan related function. - Update thermal shutdown point from thermal team request. BUG=b:269212574 BRANCH=none TEST=make buildall Change-Id: Ic268884c9e633e65774394445ca24bcabf23614f Signed-off-by: Scott Chao Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4248461 Reviewed-by: Ricky Chang Commit-Queue: Ricky Chang --- board/aurash/board.c | 296 ++++++++++++++++++------------------------ board/aurash/board.h | 62 ++++----- board/aurash/build.mk | 3 +- board/aurash/ec.tasklist | 5 +- board/aurash/fans.c | 50 ------- board/aurash/fw_config.c | 36 +++-- board/aurash/fw_config.h | 34 +++-- board/aurash/gpio.inc | 123 +++++++++--------- board/aurash/i2c.c | 54 +++----- board/aurash/led.c | 95 ++++++++------ board/aurash/pwm.c | 24 +--- board/aurash/sensors.c | 70 +++++----- board/aurash/usbc_config.c | 119 ++++------------- board/aurash/usbc_config.h | 11 +- board/aurash/vif_override.xml | 126 ++++++++++++++++++ 15 files changed, 522 insertions(+), 586 deletions(-) delete mode 100644 board/aurash/fans.c diff --git a/board/aurash/board.c b/board/aurash/board.c index 742cb97ad9..64a8ca6015 100644 --- a/board/aurash/board.c +++ b/board/aurash/board.c @@ -2,11 +2,13 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "adc.h" #include "builtin/assert.h" #include "button.h" #include "charge_manager.h" #include "charge_state_v2.h" +#include "chipset.h" #include "common.h" #include "compile_time_macros.h" #include "console.h" @@ -30,6 +32,32 @@ static void power_monitor(void); DECLARE_DEFERRED(power_monitor); +/******************************************************************************/ +/* Power on by HDMI/ DP monitor */ +struct monitor_config { + enum gpio_signal gpio; + uint8_t state; +}; + +static struct monitor_config monitors[MONITOR_COUNT] = { + [HDMI1_MONITOR] = { + .gpio = GPIO_HDMI1_MONITOR_ON, + .state = MONITOR_OFF, + }, + + [HDMI2_MONITOR] = { + .gpio = GPIO_HDMI2_MONITOR_ON, + .state = MONITOR_OFF, + }, + + [OPTION_MONITOR] = { + .gpio = GPIO_OPTION_MONITOR_ON, + .state = MONITOR_OFF, + }, +}; + +/******************************************************************************/ + /******************************************************************************/ /* USB-A charging control */ @@ -88,7 +116,6 @@ int board_set_active_charge_port(int port) switch (port) { case CHARGE_PORT_TYPEC0: case CHARGE_PORT_TYPEC1: - case CHARGE_PORT_TYPEC2: gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1); break; case CHARGE_PORT_BARRELJACK: @@ -105,92 +132,6 @@ int board_set_active_charge_port(int port) } static uint8_t usbc_overcurrent; -static int32_t base_5v_power_s5; -static int32_t base_5v_power_z1; - -/* - * Power usage for each port as measured or estimated. - * Units are milliwatts (5v x ma current) - */ - -/* PP5000_S5 loads */ -#define PWR_S5_BASE_LOAD (5 * 1431) -#define PWR_S5_FRONT_HIGH (5 * 1737) -#define PWR_S5_FRONT_LOW (5 * 1055) -#define PWR_S5_REAR_HIGH (5 * 1737) -#define PWR_S5_REAR_LOW (5 * 1055) -#define PWR_S5_HDMI (5 * 580) -#define PWR_S5_MAX (5 * 10000) -#define FRONT_DELTA (PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW) -#define REAR_DELTA (PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW) - -/* PP5000_Z1 loads */ -#define PWR_Z1_BASE_LOAD (5 * 5) -#define PWR_Z1_C_HIGH (5 * 3600) -#define PWR_Z1_C_LOW (5 * 2000) -#define PWR_Z1_MAX (5 * 9000) -/* - * Update the 5V power usage, assuming no throttling, - * and invoke the power monitoring. - */ -static void update_5v_usage(void) -{ - int front_ports = 0; - int rear_ports = 0; - - /* - * Recalculate the 5V load, assuming no throttling. - */ - base_5v_power_s5 = PWR_S5_BASE_LOAD; - if (!gpio_get_level(GPIO_USB_A0_OC_ODL)) { - front_ports++; - base_5v_power_s5 += PWR_S5_FRONT_LOW; - } - if (!gpio_get_level(GPIO_USB_A1_OC_ODL)) { - front_ports++; - base_5v_power_s5 += PWR_S5_FRONT_LOW; - } - /* - * Only 1 front port can run higher power at a time. - */ - if (front_ports > 0) - base_5v_power_s5 += PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW; - - if (!gpio_get_level(GPIO_USB_A2_OC_ODL)) { - rear_ports++; - base_5v_power_s5 += PWR_S5_REAR_LOW; - } - if (!gpio_get_level(GPIO_USB_A3_OC_ODL)) { - rear_ports++; - base_5v_power_s5 += PWR_S5_REAR_LOW; - } - /* - * Only 1 rear port can run higher power at a time. - */ - if (rear_ports > 0) - base_5v_power_s5 += PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW; - if (!gpio_get_level(GPIO_HDMI_CONN_OC_ODL)) - base_5v_power_s5 += PWR_S5_HDMI; - base_5v_power_z1 = PWR_Z1_BASE_LOAD; - if (usbc_overcurrent) - base_5v_power_z1 += PWR_Z1_C_HIGH; - /* - * Invoke the power handler immediately. - */ - hook_call_deferred(&power_monitor_data, 0); -} -DECLARE_DEFERRED(update_5v_usage); -/* - * Start power monitoring after ADCs have been initialised. - */ -DECLARE_HOOK(HOOK_INIT, update_5v_usage, HOOK_PRIO_INIT_ADC + 1); - -static void port_ocp_interrupt(enum gpio_signal signal) -{ - hook_call_deferred(&update_5v_usage_data, 0); -} -/* Must come after other header files and interrupt handler declarations */ -#include "gpio_list.h" /******************************************************************************/ /* @@ -216,6 +157,7 @@ static void adp_connect_deferred(void) return; if (connected) ec_bj_power(&pi.voltage, &pi.current); + charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, DEDICATED_CHARGE_PORT, &pi); adp_connected = connected; @@ -247,12 +189,29 @@ DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1); static void board_init(void) { + int i; + gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_ODL); gpio_enable_interrupt(GPIO_HDMI_CONN_OC_ODL); - gpio_enable_interrupt(GPIO_USB_A0_OC_ODL); gpio_enable_interrupt(GPIO_USB_A1_OC_ODL); gpio_enable_interrupt(GPIO_USB_A2_OC_ODL); gpio_enable_interrupt(GPIO_USB_A3_OC_ODL); + gpio_enable_interrupt(GPIO_USB_A4_OC_ODL); + + if (ec_cfg_power_on_monitor() == POWER_ON_MONITOR_ENABLE) { + /* + * Only enable interrupt when fw_config set it as enable. + */ + gpio_enable_interrupt(GPIO_HDMI1_MONITOR_ON); + gpio_enable_interrupt(GPIO_HDMI2_MONITOR_ON); + gpio_enable_interrupt(GPIO_OPTION_MONITOR_ON); + + /* + * Initialize the monitor state to corresponding gpio state. + */ + for (i = 0; i < MONITOR_COUNT; i++) + monitors[i].state = gpio_get_level(monitors[i].gpio); + } } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -262,7 +221,6 @@ void board_overcurrent_event(int port, int is_overcurrented) if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) return; usbc_overcurrent = is_overcurrented; - update_5v_usage(); } /* * Power monitoring and management. @@ -307,7 +265,6 @@ void board_overcurrent_event(int port, int is_overcurrented) #define THROT_TYPE_A_REAR BIT(1) #define THROT_TYPE_C0 BIT(2) #define THROT_TYPE_C1 BIT(3) -#define THROT_TYPE_C2 BIT(4) #define THROT_PROCHOT BIT(5) /* @@ -324,6 +281,9 @@ void board_overcurrent_event(int port, int is_overcurrented) #define POWER_DELAY_MS 2 #define POWER_READINGS (10 / POWER_DELAY_MS) +/* Must come after other header files and interrupt handler declarations */ +#include "gpio_list.h" + static void power_monitor(void) { static uint32_t current_state; @@ -331,8 +291,6 @@ static void power_monitor(void) static uint8_t index; int32_t delay; uint32_t new_state = 0, diff; - int32_t headroom_5v_s5 = PWR_S5_MAX - base_5v_power_s5; - int32_t headroom_5v_z1 = PWR_Z1_MAX - base_5v_power_z1; /* * If CPU is off or suspended, no need to throttle @@ -408,7 +366,6 @@ static void power_monitor(void) */ if (gap <= 0) { new_state |= THROT_TYPE_A_REAR; - headroom_5v_s5 += REAR_DELTA; if (!(current_state & THROT_TYPE_A_REAR)) gap += POWER_GAIN_TYPE_A; } @@ -417,8 +374,7 @@ static void power_monitor(void) */ if (gap <= 0) { new_state |= THROT_TYPE_A_FRONT; - headroom_5v_s5 += FRONT_DELTA; - if (!(current_state & THROT_TYPE_A_REAR)) + if (!(current_state & THROT_TYPE_A_FRONT)) gap += POWER_GAIN_TYPE_A; } /* @@ -427,7 +383,6 @@ static void power_monitor(void) */ if (ppc_is_sourcing_vbus(0) && gap <= 0) { new_state |= THROT_TYPE_C0; - headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW; if (!(current_state & THROT_TYPE_C0)) gap += POWER_GAIN_TYPE_C; } @@ -437,20 +392,9 @@ static void power_monitor(void) */ if (ppc_is_sourcing_vbus(1) && gap <= 0) { new_state |= THROT_TYPE_C1; - headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW; if (!(current_state & THROT_TYPE_C1)) gap += POWER_GAIN_TYPE_C; } - /* - * If the type-C port is sourcing power, - * check whether it should be throttled. - */ - if (ppc_is_sourcing_vbus(2) && gap <= 0) { - new_state |= THROT_TYPE_C2; - headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW; - if (!(current_state & THROT_TYPE_C2)) - gap += POWER_GAIN_TYPE_C; - } /* * As a last resort, turn on PROCHOT to * throttle the CPU. @@ -459,60 +403,6 @@ static void power_monitor(void) new_state |= THROT_PROCHOT; } } - /* - * Check the 5v power usage and if necessary, - * adjust the throttles in priority order. - * - * Either throttle may have already been activated by - * the overall power control. - * - * We rely on the overcurrent detection to inform us - * if the port is in use. - * - * - If type C not already throttled: - * * If not overcurrent, prefer to limit type C [1]. - * * If in overcurrentuse: - * - limit type A first [2] - * - If necessary, limit type C [3]. - * - If type A not throttled, if necessary limit it [2]. - */ - if (headroom_5v_z1 < 0) { - /* - * Check whether type C is not throttled, - * and is not overcurrent. - */ - if (!((new_state & THROT_TYPE_C0) || usbc_overcurrent)) { - /* - * [1] Type C not in overcurrent, throttle it. - */ - headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW; - new_state |= THROT_TYPE_C0; - } - /* - * [2] If still under-budget, limit type C. - * No need to check if it is already throttled or not. - */ - if (headroom_5v_z1 < 0) - new_state |= THROT_TYPE_C0; - } - if (headroom_5v_s5 < 0) { - /* - * [1] If type A rear not already throttled, and power still - * needed, limit type A rear. - */ - if (!(new_state & THROT_TYPE_A_REAR) && headroom_5v_s5 < 0) { - headroom_5v_s5 += PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW; - new_state |= THROT_TYPE_A_REAR; - } - /* - * [2] If type A front not already throttled, and power still - * needed, limit type A front. - */ - if (!(new_state & THROT_TYPE_A_FRONT) && headroom_5v_s5 < 0) { - headroom_5v_s5 += PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW; - new_state |= THROT_TYPE_A_FRONT; - } - } /* * Turn the throttles on or off if they have changed. */ @@ -541,26 +431,88 @@ static void power_monitor(void) tcpm_select_rp_value(1, rp); pd_update_contract(1); } - if (diff & THROT_TYPE_C2) { - enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2) ? - TYPEC_RP_1A5 : - TYPEC_RP_3A0; - - ppc_set_vbus_source_current_limit(2, rp); - tcpm_select_rp_value(2, rp); - pd_update_contract(2); - } if (diff & THROT_TYPE_A_REAR) { int typea_bc = (new_state & THROT_TYPE_A_REAR) ? 1 : 0; - gpio_set_level(GPIO_USB_A_LOW_PWR0_OD, typea_bc); gpio_set_level(GPIO_USB_A_LOW_PWR1_OD, typea_bc); } if (diff & THROT_TYPE_A_FRONT) { int typea_bc = (new_state & THROT_TYPE_A_FRONT) ? 1 : 0; gpio_set_level(GPIO_USB_A_LOW_PWR2_OD, typea_bc); - gpio_set_level(GPIO_USB_A_LOW_PWR3_OD, typea_bc); } hook_call_deferred(&power_monitor_data, delay); } +/* + * Start power monitoring after ADCs have been initialised. + */ +DECLARE_HOOK(HOOK_INIT, power_monitor, HOOK_PRIO_INIT_ADC + 1); + +/******************************************************************************/ +/* + * System power on and wake up by monitor power button. + * + * After pressing power button of monitor for power on, monitor will send power + * on signal with 3.3V / 200ms to DT. If DT detect that pulse, there are three + * DT behavior: + * + * - Do nothing in state S0. + * - Wake up from state S0ix. + * - Power on from state S5 and G3. + */ + +/* Debounce time for HDMI power button press */ +#define MONITOR_DEBOUNCE_MS 100 + +static void monitor_irq_deferred(void); +DECLARE_DEFERRED(monitor_irq_deferred); + +static void monitor_irq_deferred(void) +{ + int i; + + for (i = 0; i < MONITOR_COUNT; i++) { + if (monitors[i].state && gpio_get_level(monitors[i].gpio)) { + /* + * System power on from state S5 and G3. + */ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) + chipset_power_on(); + /* + * System wake up from state S0ix. + */ + else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) + power_button_simulate_press(200); + } + monitors[i].state = MONITOR_OFF; + } +} + +/* Power on by HDMI/ DP monitor. */ +void monitor_interrupt(enum gpio_signal signal) +{ + /* + * Power on by HDMI/ DP monitor only works + * when system is not in S0. + */ + if (chipset_in_state(CHIPSET_STATE_ON)) + return; + + if (ec_cfg_power_on_monitor() == POWER_ON_MONITOR_ENABLE) { + switch (signal) { + case GPIO_HDMI1_MONITOR_ON: + monitors[HDMI1_MONITOR].state = MONITOR_ON; + break; + case GPIO_HDMI2_MONITOR_ON: + monitors[HDMI2_MONITOR].state = MONITOR_ON; + break; + case GPIO_OPTION_MONITOR_ON: + monitors[OPTION_MONITOR].state = MONITOR_ON; + break; + default: + break; + } + hook_call_deferred(&monitor_irq_deferred_data, + MONITOR_DEBOUNCE_MS * MSEC); + } +} diff --git a/board/aurash/board.h b/board/aurash/board.h index 3aa49a6189..3f3ba87e1d 100644 --- a/board/aurash/board.h +++ b/board/aurash/board.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* Brask board configuration */ +/* Aurash board configuration */ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H @@ -16,7 +16,7 @@ #define CONFIG_MP2964 /* Barrel Jack */ -#define DEDICATED_CHARGE_PORT 3 +#define DEDICATED_CHARGE_PORT 2 /* HDMI CEC */ #define CONFIG_CEC @@ -36,11 +36,10 @@ #define CONFIG_IO_EXPANDER_PORT_COUNT 2 #define CONFIG_USB_PD_PPC -#define CONFIG_USB_PD_TCPM_RT1715 #define CONFIG_USBC_RETIMER_INTEL_BB -#define CONFIG_USBC_RETIMER_KB800X -#define CONFIG_KB800X_CUSTOM_XBAR +#undef CONFIG_CMD_POWERINDEBUG + #define CONFIG_USBC_PPC_SYV682X #undef CONFIG_SYV682X_HV_ILIM #define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50 @@ -88,24 +87,19 @@ #define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL #define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL #define GPIO_WP_L GPIO_EC_WP_ODL -#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD -#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD +#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL +#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_ODL /* I2C Bus Configuration */ -#define I2C_PORT_DP_REDRIVER NPCX_I2C_PORT0_0 - -#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0 -#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 +#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0 -#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_A0_A1_MIX NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0 -#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0 #define I2C_PORT_QI NPCX_I2C_PORT5_0 #define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 @@ -115,8 +109,8 @@ #define I2C_ADDR_MP2964_FLAGS 0x20 -#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58 -#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59 +#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56 +#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57 /* Enabling Thunderbolt-compatible mode */ #define CONFIG_USB_PD_TBT_COMPAT_MODE @@ -137,12 +131,6 @@ /* ADC */ #define CONFIG_ADC -/* - * TODO(b/197478860): Enable the fan control. We need - * to check the sensor value and adjust the fan speed. - */ -#define CONFIG_FANS FAN_CH_COUNT - /* Include math_util for bitmask_uint64 used in pd_timers */ #define CONFIG_MATH_UTIL @@ -155,15 +143,13 @@ enum charge_port { CHARGE_PORT_TYPEC0, CHARGE_PORT_TYPEC1, - CHARGE_PORT_TYPEC2, CHARGE_PORT_BARRELJACK, CHARGE_PORT_ENUM_COUNT }; enum adc_channel { - ADC_TEMP_SENSOR_1_CPU, + ADC_TEMP_SENSOR_1_SSD, ADC_TEMP_SENSOR_2_CPU_VR, - ADC_TEMP_SENSOR_3_WIFI, ADC_TEMP_SENSOR_4_DIMM, ADC_VBUS, ADC_PPVAR_IMON, /* ADC3 */ @@ -171,27 +157,31 @@ enum adc_channel { }; enum temp_sensor_id { - TEMP_SENSOR_1_CPU, + TEMP_SENSOR_1_SSD, TEMP_SENSOR_2_CPU_VR, - TEMP_SENSOR_3_WIFI, TEMP_SENSOR_4_DIMM, TEMP_SENSOR_COUNT }; -enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C2_NCT38XX, IOEX_PORT_COUNT }; +enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT }; enum pwm_channel { - PWM_CH_LED_GREEN, /* PWM0 */ - PWM_CH_FAN, /* PWM5 */ - PWM_CH_LED_RED, /* PWM2 */ + PWM_CH_LED_AMBER, /* PWM0 */ + PWM_CH_LED_BLUE, /* PWM2 */ PWM_CH_COUNT }; -enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT }; +enum monitor_port { + HDMI1_MONITOR, + HDMI2_MONITOR, + OPTION_MONITOR, + MONITOR_COUNT +}; -enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT }; +enum monitor_state { MONITOR_OFF, MONITOR_ON }; extern void adp_connect_interrupt(enum gpio_signal signal); +extern void monitor_interrupt(enum gpio_signal signal); #endif /* !__ASSEMBLER__ */ diff --git a/board/aurash/build.mk b/board/aurash/build.mk index 2301983a1f..8f1b8bfc78 100644 --- a/board/aurash/build.mk +++ b/board/aurash/build.mk @@ -3,7 +3,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # -# Brask board specific files build +# Aurash board specific files build # CHIP:=npcx @@ -13,7 +13,6 @@ BASEBOARD:=brask board-y= board-y+=board.o -board-y+=fans.o board-y+=fw_config.o board-y+=i2c.o board-y+=led.o diff --git a/board/aurash/ec.tasklist b/board/aurash/ec.tasklist index 2d063fe252..a3189950ab 100644 --- a/board/aurash/ec.tasklist +++ b/board/aurash/ec.tasklist @@ -14,7 +14,6 @@ TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_MUX, usb_mux_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ @@ -22,7 +21,5 @@ TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C2, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, LARGER_TASK_STACK_SIZE) \ + TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(1) | BIT(0)), LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(CEC, cec_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/board/aurash/fans.c b/board/aurash/fans.c deleted file mode 100644 index ecc93bd330..0000000000 --- a/board/aurash/fans.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2023 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Physical fans. These are logically separate from pwm_channels. */ - -#include "common.h" -#include "compile_time_macros.h" -#include "console.h" -#include "fan.h" -#include "fan_chip.h" -#include "hooks.h" -#include "pwm.h" - -/* MFT channels. These are logically separate from pwm_channels. */ -const struct mft_t mft_channels[] = { - [MFT_CH_0] = { - .module = NPCX_MFT_MODULE_2, - .clk_src = TCKC_LFCLK, - .pwm_id = PWM_CH_FAN, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); - -static const struct fan_conf fan_conf_0 = { - .flags = FAN_USE_RPM_MODE, - .ch = MFT_CH_0, /* Use MFT id to control fan */ - .pgood_gpio = -1, - .enable_gpio = GPIO_EN_PP5000_FAN, -}; - -/* - * TOOD(b/197478860): need to update for real fan - * - * Prototype fan spins at about 7200 RPM at 100% PWM. - * Set minimum at around 30% PWM. - */ -static const struct fan_rpm fan_rpm_0 = { - .rpm_min = 2200, - .rpm_start = 2200, - .rpm_max = 7200, -}; - -const struct fan_t fans[FAN_CH_COUNT] = { - [FAN_CH_0] = { - .conf = &fan_conf_0, - .rpm = &fan_rpm_0, - }, -}; diff --git a/board/aurash/fw_config.c b/board/aurash/fw_config.c index 957a5c8c50..2c312acea6 100644 --- a/board/aurash/fw_config.c +++ b/board/aurash/fw_config.c @@ -12,16 +12,16 @@ #define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args) -static union brask_cbi_fw_config fw_config; +static union aurash_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); /* - * FW_CONFIG defaults for brask if the CBI.FW_CONFIG data is not + * FW_CONFIG defaults for aurash if the CBI.FW_CONFIG data is not * initialized. */ -static const union brask_cbi_fw_config fw_config_defaults = { - .audio = DB_NAU88L25B_I2S, - .bj_power = BJ_135W, +static const union aurash_cbi_fw_config fw_config_defaults = { + .bj_power = BJ_90W, + .po_mon = POWER_ON_MONITOR_ENABLE, }; /* @@ -31,18 +31,16 @@ static const struct { int voltage; int current; } bj_power[] = { - [BJ_135W] = { /* 0 - 135W (also default) */ - .voltage = 19500, - .current = 6920 - }, - [BJ_230W] = { /* 1 - 230W */ - .voltage = 19500, - .current = 11800 - } + [BJ_90W] = { /* 0 - 90W (also default) */ + .voltage = 19000, + .current = 4740 }, + [BJ_135W] = { /* 1 - 135W */ + .voltage = 19500, + .current = 6920 }, }; /**************************************************************************** - * Brask FW_CONFIG access + * Aurash FW_CONFIG access */ void board_init_fw_config(void) { @@ -52,6 +50,11 @@ void board_init_fw_config(void) } } +union aurash_cbi_fw_config get_fw_config(void) +{ + return fw_config; +} + void ec_bj_power(uint32_t *voltage, uint32_t *current) { unsigned int bj; @@ -63,3 +66,8 @@ void ec_bj_power(uint32_t *voltage, uint32_t *current) *voltage = bj_power[bj].voltage; *current = bj_power[bj].current; } + +enum ec_cfg_power_on_monitor ec_cfg_power_on_monitor(void) +{ + return fw_config.po_mon; +} diff --git a/board/aurash/fw_config.h b/board/aurash/fw_config.h index c2afd4c603..e498831966 100644 --- a/board/aurash/fw_config.h +++ b/board/aurash/fw_config.h @@ -3,25 +3,32 @@ * found in the LICENSE file. */ -#ifndef __BOARD_BRASK_FW_CONFIG_H_ -#define __BOARD_BRASK_FW_CONFIG_H_ +#ifndef __BOARD_AURASH_FW_CONFIG_H_ +#define __BOARD_AURASH_FW_CONFIG_H_ #include /**************************************************************************** - * CBI FW_CONFIG layout for Brask board. + * CBI FW_CONFIG layout for Aurash board. * - * Source of truth is the project/brask/brask/config.star configuration file. + * Source of truth is the project/brask/aurash/config.star configuration file. */ -enum ec_cfg_audio_type { DB_AUDIO_UNKNOWN = 0, DB_NAU88L25B_I2S = 1 }; -enum ec_cfg_bj_power { BJ_135W = 0, BJ_230W = 1 }; +enum ec_cfg_bj_power { BJ_90W = 0, BJ_135W = 1 }; -union brask_cbi_fw_config { +enum ec_cfg_power_on_monitor { + POWER_ON_MONITOR_ENABLE = 0, + POWER_ON_MONITOR_DISABLE = 1 +}; + +union aurash_cbi_fw_config { struct { - uint32_t audio : 3; uint32_t bj_power : 2; - uint32_t reserved_1 : 27; + uint32_t mlb_usb_tbt : 2; + uint32_t storage : 2; + uint32_t audio : 1; + enum ec_cfg_power_on_monitor po_mon : 1; + uint32_t reserved_1 : 24; }; uint32_t raw_value; }; @@ -31,11 +38,16 @@ union brask_cbi_fw_config { * * @return the FW_CONFIG for the board. */ -union brask_cbi_fw_config get_fw_config(void); +union aurash_cbi_fw_config get_fw_config(void); /** * Get the barrel-jack power from FW_CONFIG. */ void ec_bj_power(uint32_t *voltage, uint32_t *current); -#endif /* __BOARD_BRASK_FW_CONFIG_H_ */ +/** + * Get enable/disable power on by monitor from FW_CONFIG. + */ +enum ec_cfg_power_on_monitor ec_cfg_power_on_monitor(void); + +#endif /* __BOARD_AURASH_FW_CONFIG_H_ */ diff --git a/board/aurash/gpio.inc b/board/aurash/gpio.inc index 9a5b431848..702c79df25 100644 --- a/board/aurash/gpio.inc +++ b/board/aurash/gpio.inc @@ -6,7 +6,6 @@ */ /* INTERRUPT GPIOs: */ - GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH, extpower_interrupt) GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt) GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) @@ -18,22 +17,17 @@ GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_inte GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt) -GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event) +GPIO_INT(USB_C0_C1_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event) GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt) GPIO_INT(USB_C0_RT_INT_ODL, PIN(B, 1), GPIO_INT_FALLING, retimer_interrupt) -GPIO_INT(USB_C1_BC12_INT_ODL, PIN(5, 0), GPIO_INT_FALLING, bc12_interrupt) -GPIO_INT(USB_C1_PPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, ppc_interrupt) -GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event) -GPIO_INT(USB_C2_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_interrupt) -GPIO_INT(USB_C2_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt) -GPIO_INT(USB_C2_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt) GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt) -GPIO_INT(EC_RECOVERY_BTN_OD, PIN(2, 3), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(HDMI_CONN_OC_ODL, PIN(2, 4), GPIO_INPUT | GPIO_INT_BOTH, port_ocp_interrupt) -GPIO_INT(USB_A0_OC_ODL, PIN(3, 1), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt) -GPIO_INT(USB_A1_OC_ODL, PIN(3, 0), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt) -GPIO_INT(USB_A2_OC_ODL, PIN(2, 7), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt) -GPIO_INT(USB_A3_OC_ODL, PIN(2, 6), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt) +GPIO_INT(EC_RECOVERY_BTN_ODL, PIN(2, 3), GPIO_INT_BOTH, button_interrupt) +GPIO_INT(USB_C1_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt) +GPIO_INT(USB_C1_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_interrupt) +GPIO_INT(USB_C1_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt) +GPIO_INT(HDMI1_MONITOR_ON, PIN(B, 4), GPIO_INT_RISING, monitor_interrupt) +GPIO_INT(HDMI2_MONITOR_ON, PIN(B, 5), GPIO_INT_RISING, monitor_interrupt) +GPIO_INT(OPTION_MONITOR_ON, PIN(1, 0), GPIO_INT_RISING, monitor_interrupt) /* CCD */ GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) @@ -43,15 +37,11 @@ GPIO(EC_ENTERING_RW, PIN(0, 3), GPIO_OUT_LOW) GPIO(EC_GSC_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) /* Fan */ -GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH) +GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_LOW) /* ADC, need to check the usage */ GPIO(ANALOG_PPVAR_PWR_IN_IMON_EC, PIN(4, 2), GPIO_INPUT) -/* Display */ -GPIO(DP_CONN_OC_ODL, PIN(2, 5), GPIO_INPUT) - - /* BarrelJack */ GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 7), GPIO_OUT_LOW) @@ -72,7 +62,7 @@ GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT) /* Button */ GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH) -GPIO(GSC_EC_RECOVERY_BTN_OD, PIN(2, 2), GPIO_INPUT) +GPIO(GSC_EC_RECOVERY_BTN_ODL, PIN(2, 2), GPIO_INPUT) /* NFC */ /* TODO(b/194068530): Enable NFC */ @@ -82,8 +72,13 @@ GPIO(NFC_CARD_DET_L, PIN(A, 3), GPIO_INPUT) GPIO(EN_NFC_BUZZER, PIN(0, 5), GPIO_OUT_LOW) /* Wireless Charger */ -GPIO(EC_QI_PWR, PIN(D, 2), GPIO_OUT_LOW) -GPIO(QI_RESET_L, PIN(9, 3), GPIO_OUT_HIGH) +/* TODO(b/191418683): Implement Qi Driver */ +GPIO(EC_QI_PWR, PIN(D, 2), GPIO_OUT_HIGH) +GPIO(EC_I2C_QI_RESET_L, PIN(9, 3), GPIO_OUT_HIGH) +GPIO(EC_I2C_QI_INT_ODL, PIN(9, 6), GPIO_INPUT) + +/* HDMI */ +GPIO(HDMI_CONN_OC_ODL, PIN(2, 4), GPIO_INPUT) /* HDMI CEC */ /* TODO(b/197474873): Enable HDMI CEC */ @@ -94,55 +89,51 @@ GPIO(HDMI_CEC_PULL_UP, PIN(C, 2), GPIO_OUT_HIGH) /* I2C SCL/SDA */ GPIO(EC_I2C_QI_SCL, PIN(3, 3), GPIO_INPUT) GPIO(EC_I2C_QI_SDA, PIN(3, 6), GPIO_INPUT) -GPIO(EC_I2C_MISC_SCL_R, PIN(B, 3), GPIO_INPUT) -GPIO(EC_I2C_MISC_SDA_R, PIN(B, 2), GPIO_INPUT) -GPIO(EC_I2C_DP_SCL, PIN(B, 5), GPIO_INPUT) -GPIO(EC_I2C_DP_SDA, PIN(B, 4), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_PPC_SCL, PIN(9, 2), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_PPC_SDA, PIN(9, 1), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_RT_SCL, PIN(D, 1), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_RT_SDA, PIN(D, 0), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_TCPC_SCL, PIN(9, 0), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_TCPC_SDA, PIN(8, 7), GPIO_INPUT) -GPIO(EC_I2C_USB_C1_MIX_SCL, PIN(E, 4), GPIO_INPUT) -GPIO(EC_I2C_USB_C1_MIX_SDA, PIN(E, 3), GPIO_INPUT) -GPIO(EC_I2C_USB_C1_TCPC_SCL, PIN(F, 3), GPIO_INPUT) -GPIO(EC_I2C_USB_C1_TCPC_SDA, PIN(F, 2), GPIO_INPUT) +GPIO(EC_I2C_MISC_SCL, PIN(B, 3), GPIO_INPUT) +GPIO(EC_I2C_MISC_SDA, PIN(B, 2), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_C1_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_C1_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_C1_RT_SCL, PIN(D, 1), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_C1_RT_SDA, PIN(D, 0), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_C1_TCPC_SCL, PIN(9, 0), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_C1_TCPC_SDA, PIN(8, 7), GPIO_INPUT) +GPIO(EC_I2C_USB_A0_A1_MIX_SCL, PIN(E, 4), GPIO_INPUT) +GPIO(EC_I2C_USB_A0_A1_MIX_SDA, PIN(E, 3), GPIO_INPUT) /* USBA */ GPIO(EN_PP5000_USBA, PIN(D, 7), GPIO_OUT_LOW) -GPIO(USB_A0_STATUS_L, PIN(2, 1), GPIO_INPUT) GPIO(USB_A1_STATUS_L, PIN(2, 0), GPIO_INPUT) GPIO(USB_A2_STATUS_L, PIN(1, 7), GPIO_INPUT) -GPIO(USB_A3_STATUS_L, PIN(1, 6), GPIO_INPUT) -GPIO(USB_A_LOW_PWR0_OD, PIN(1, 5), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(USB_A_LOW_PWR1_OD, PIN(1, 4), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(USB_A_LOW_PWR2_OD, PIN(1, 1), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(USB_A_LOW_PWR3_OD, PIN(1, 0), GPIO_INPUT | GPIO_PULL_DOWN) +GPIO(USB_A_LOW_PWR1_OD, PIN(1, 4), GPIO_OUT_LOW) +GPIO(USB_A_LOW_PWR2_OD, PIN(1, 1), GPIO_OUT_LOW) GPIO(USB_A_OC_SOC_L, PIN(8, 0), GPIO_OUT_HIGH) +GPIO(USB_A1_OC_ODL, PIN(3, 0), GPIO_INPUT) +GPIO(USB_A2_OC_ODL, PIN(2, 7), GPIO_INPUT) +GPIO(USB_A3_OC_ODL, PIN(2, 6), GPIO_INPUT) +GPIO(USB_A4_OC_ODL, PIN(0, 6), GPIO_INPUT) + +/* USBC */ +GPIO(USB_C0_C1_TCPC_RST_ODL, PIN(F, 5), GPIO_ODR_LOW) + +/* LAN */ +GPIO(LAN_PWR_GOOD, PIN(0, 2), GPIO_INPUT) /* LED */ -/* TODO(b/197471359): LED implementation */ -GPIO(LED_GREEN_L, PIN(C, 3), GPIO_OUT_LOW) -GPIO(LED_RED_L, PIN(C, 4), GPIO_OUT_LOW) +GPIO(LED_ORANGE_CONTROL, PIN(3, 1), GPIO_ODR_LOW) +GPIO(LED_BLUE_CONTROL, PIN(2, 5), GPIO_ODR_LOW) -/* USBC */ -GPIO(USB_C0_C2_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW) -GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW) -GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT) -GPIO(USB_C1_RT_RST_R_L, PIN(0, 2), GPIO_OUT_LOW) +/* Option Board */ +GPIO(HDMI1_MONON_SIO, PIN(1, 6), GPIO_INPUT) +GPIO(HDMI2_MONON_SIO, PIN(1, 5), GPIO_INPUT) +GPIO(OPTION_MONON_SIO, PIN(2, 1), GPIO_INPUT) -/* GPIO02_P2 to PU */ -/* GPIO03_P2 to PU */ IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH) IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW) IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW) -IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 2), GPIO_ODR_LOW) -IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 3), GPIO_ODR_HIGH) -IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_ODR_HIGH) -IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_LOW) -/* GPIO07_P2 to PU */ +IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 4), GPIO_ODR_HIGH) +IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 2), GPIO_ODR_LOW) +IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_LOW) /* UART alternate functions */ ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */ @@ -152,18 +143,13 @@ ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* GPIO33/I2C5_SCL0 ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* GPIO87/I2C1_SDA0 */ ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* GPIO92/I2C2_SCL0, GPIO91/I2C2_SDA0, GPIO90/I2C1_SCL0 */ ALTERNATE(PIN_MASK(B, 0x0c), 0, MODULE_I2C, 0) /* GPIOB3/I2C7_SCL0/DCD_L, GPIOB2/I2C7_SDA0/DSR_L */ -ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, 0) /* GPIOB5/I2C0_SCL0, GPIOB4/I2C0_SDA0 */ ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* GPIOD1/I2C3_SCL0, GPIOD0/I2C3_SDA0 */ ALTERNATE(PIN_MASK(E, 0x18), 0, MODULE_I2C, 0) /* GPIOE4/I2C6_SCL1/I3C_SCL, GPIOE3/I2C6_SDA1/I3C_SDA */ -ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */ /* PWM alternate functions */ -ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* GPIO73/TA2 */ -ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */ ALTERNATE(PIN_MASK(C, 0x18), 0, MODULE_PWM, 0) /* GPIOC4/PWM2, GPIOC3/PWM0 */ /* ADC alternate functions */ -ALTERNATE(PIN_MASK(3, 0x10), 0, MODULE_ADC, 0) /* GPIO34/PS2_DAT2/ADC6 */ ALTERNATE(PIN_MASK(4, 0x38), 0, MODULE_ADC, 0) /* GPIO45/ADC0, GPIO44/ADC1, GPIO43/ADC2 */ ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */ @@ -175,8 +161,17 @@ UNUSED(PIN(6, 6)) /* GPIO66 */ UNUSED(PIN(8, 1)) /* GPIO81/PECI_DATA */ UNUSED(PIN(5, 6)) /* GPIO56/CLKRUN# */ UNUSED(PIN(9, 7)) /* GPIO97 */ -UNUSED(PIN(8, 6)) /* GPIO86/TXD/CR_SOUT2 */ +UNUSED(PIN(8, 6)) /* GPIO86/TXD/CR_SOUT2/FLPRG2_L */ UNUSED(PIN(1, 3)) /* KSO06/GPO13/GP_SEL# */ UNUSED(PIN(1, 2)) /* KSO07/GPO12/JEN# */ -UNUSED(PIN(0, 6)) /* KSO11/GPIO06/P80_CLK */ UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */ +UNUSED(PIN(A, 2)) /* F_SCLK/GPIOA2 */ +UNUSED(PIN(5, 0)) /* GPIO50 */ +UNUSED(PIN(9, 4)) /* GPIO94 */ +UNUSED(PIN(A, 0)) /* F_CS0_L/GPIOA0 */ +UNUSED(PIN(3, 4)) /* GPIO34/PS2_DAT2/ADC6 */ +UNUSED(PIN(F, 3)) /* GPIOF3/I2C4_SCL1 */ +UNUSED(PIN(F, 2)) /* GPIOF2/I2C4_SDA1 */ +UNUSED(PIN(A, 7)) /* GPIOA7/PS2_DAT3/TB2/F_DIO3 */ +UNUSED(PIN(B, 7)) /* GPIOB7/PWM5 */ +UNUSED(PIN(7, 3)) /* GPIO73/TA2 */ diff --git a/board/aurash/i2c.c b/board/aurash/i2c.c index a637f03717..5df3b5b7e7 100644 --- a/board/aurash/i2c.c +++ b/board/aurash/i2c.c @@ -9,45 +9,29 @@ /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { - { - /* I2C0 */ - .name = "dp_redriver", - .port = I2C_PORT_DP_REDRIVER, - .kbps = 400, - .scl = GPIO_EC_I2C_DP_SCL, - .sda = GPIO_EC_I2C_DP_SDA, - }, { /* I2C1 */ - .name = "tcpc0,2", - .port = I2C_PORT_USB_C0_C2_TCPC, + .name = "tcpc0,1", + .port = I2C_PORT_USB_C0_C1_TCPC, .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C0_C2_TCPC_SCL, - .sda = GPIO_EC_I2C_USB_C0_C2_TCPC_SDA, + .scl = GPIO_EC_I2C_USB_C0_C1_TCPC_SCL, + .sda = GPIO_EC_I2C_USB_C0_C1_TCPC_SDA, }, { /* I2C2 */ - .name = "ppc0,2", - .port = I2C_PORT_USB_C0_C2_PPC, + .name = "ppc0,1", + .port = I2C_PORT_USB_C0_C1_PPC, .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C0_C2_PPC_SCL, - .sda = GPIO_EC_I2C_USB_C0_C2_PPC_SDA, + .scl = GPIO_EC_I2C_USB_C0_C1_PPC_BC_SCL, + .sda = GPIO_EC_I2C_USB_C0_C1_PPC_BC_SDA, }, { /* I2C3 */ - .name = "retimer0,2", - .port = I2C_PORT_USB_C0_C2_MUX, + .name = "retimer0,1", + .port = I2C_PORT_USB_C0_C1_MUX, .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C0_C2_RT_SCL, - .sda = GPIO_EC_I2C_USB_C0_C2_RT_SDA, - }, - { - /* I2C4 C1 TCPC */ - .name = "tcpc1", - .port = I2C_PORT_USB_C1_TCPC, - .kbps = 400, - .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL, - .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA, + .scl = GPIO_EC_I2C_USB_C0_C1_RT_SCL, + .sda = GPIO_EC_I2C_USB_C0_C1_RT_SDA, }, { /* I2C5 */ @@ -59,19 +43,19 @@ const struct i2c_port_t i2c_ports[] = { }, { /* I2C6 */ - .name = "ppc1", - .port = I2C_PORT_USB_C1_PPC, - .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C1_MIX_SCL, - .sda = GPIO_EC_I2C_USB_C1_MIX_SDA, + .name = "usba_mix0,1", + .port = I2C_PORT_USB_A0_A1_MIX, + .kbps = 100, + .scl = GPIO_EC_I2C_USB_A0_A1_MIX_SCL, + .sda = GPIO_EC_I2C_USB_A0_A1_MIX_SDA, }, { /* I2C7 */ .name = "eeprom", .port = I2C_PORT_EEPROM, .kbps = 400, - .scl = GPIO_EC_I2C_MISC_SCL_R, - .sda = GPIO_EC_I2C_MISC_SDA_R, + .scl = GPIO_EC_I2C_MISC_SCL, + .sda = GPIO_EC_I2C_MISC_SDA, }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/aurash/led.c b/board/aurash/led.c index a8c725258b..21c4a2dafc 100644 --- a/board/aurash/led.c +++ b/board/aurash/led.c @@ -33,8 +33,8 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); enum led_color { LED_OFF = 0, - LED_RED, - LED_GREEN, + LED_BLUE, + LED_AMBER, /* Number of colors, not a color itself */ LED_COLOR_COUNT @@ -42,8 +42,8 @@ enum led_color { static int set_color_power(enum led_color color, int duty) { - int green = 0; - int red = 0; + int amber = 0; + int blue = 0; if (duty < 0 || 100 < duty) return EC_ERROR_UNKNOWN; @@ -51,25 +51,31 @@ static int set_color_power(enum led_color color, int duty) switch (color) { case LED_OFF: break; - case LED_GREEN: - green = 1; + case LED_AMBER: + amber = 1; break; - case LED_RED: - red = 1; + case LED_BLUE: + blue = 1; break; default: return EC_ERROR_UNKNOWN; } - if (red) - pwm_set_duty(PWM_CH_LED_RED, duty); - else - pwm_set_duty(PWM_CH_LED_RED, 0); + if (blue && duty) { + gpio_set_level(GPIO_LED_BLUE_CONTROL, 1); + pwm_set_duty(PWM_CH_LED_BLUE, duty); + } else { + gpio_set_level(GPIO_LED_BLUE_CONTROL, 0); + pwm_set_duty(PWM_CH_LED_BLUE, 0); + } - if (green) - pwm_set_duty(PWM_CH_LED_GREEN, duty); - else - pwm_set_duty(PWM_CH_LED_GREEN, 0); + if (amber && duty) { + gpio_set_level(GPIO_LED_ORANGE_CONTROL, 1); + pwm_set_duty(PWM_CH_LED_AMBER, duty); + } else { + gpio_set_level(GPIO_LED_ORANGE_CONTROL, 0); + pwm_set_duty(PWM_CH_LED_AMBER, 0); + } return EC_SUCCESS; } @@ -84,9 +90,11 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty) } } -#define LED_PULSE_US (2 * SECOND) -/* 40 msec for nice and smooth transition. */ -#define LED_PULSE_TICK_US (40 * MSEC) +#define LED_PERIOD (4 * SECOND) +#define LED_DUTY_CYCLE (25) +#define LED_PULSE_US (LED_PERIOD * LED_DUTY_CYCLE / 100 / 2) +/* 10 msec for nice and smooth transition. */ +#define LED_PULSE_TICK_US (10 * MSEC) /* * When pulsing is enabled, brightness is incremented by every @@ -98,17 +106,26 @@ static struct { int duty_inc; enum led_color color; int duty; + uint32_t time_off; } led_pulse; -#define CONFIG_TICK(interval, color) \ - config_tick((interval), 100 / (LED_PULSE_US / (interval)), (color)) +/* + * LED_PERIOD = time_on + time_off; + * time_on = LED_PULSE_US * 2; + * time_off = LED_PERIOD - LED_PULSE_US * 2; + */ +#define CONFIG_TICK(interval, period, color) \ + config_tick((interval), 100 / (LED_PULSE_US / (interval)), \ + LED_PERIOD - LED_PULSE_US * 2, (color)) -static void config_tick(uint32_t interval, int duty_inc, enum led_color color) +static void config_tick(uint32_t interval, int duty_inc, int time_off, + enum led_color color) { led_pulse.interval = interval; led_pulse.duty_inc = duty_inc; led_pulse.color = color; led_pulse.duty = 0; + led_pulse.time_off = time_off; } static void pulse_power_led(enum led_color color) @@ -133,12 +150,15 @@ static void led_tick(void) pulse_power_led(led_pulse.color); elapsed = get_time().le.lo - start; next = led_pulse.interval > elapsed ? led_pulse.interval - elapsed : 0; + next = (led_pulse.duty - led_pulse.duty_inc) ? + next : + next + led_pulse.time_off; hook_call_deferred(&led_tick_data, next); } static void led_suspend(void) { - CONFIG_TICK(LED_PULSE_TICK_US, LED_GREEN); + CONFIG_TICK(LED_PULSE_TICK_US, LED_PERIOD, LED_BLUE); led_tick(); } DECLARE_DEFERRED(led_suspend); @@ -178,7 +198,7 @@ static void led_resume(void) hook_call_deferred(&led_suspend_data, -1); hook_call_deferred(&led_shutdown_data, -1); if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - set_color(EC_LED_ID_POWER_LED, LED_GREEN, 100); + set_color(EC_LED_ID_POWER_LED, LED_BLUE, 100); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, led_resume, HOOK_PRIO_DEFAULT); @@ -186,7 +206,7 @@ void led_alert(int enable) { if (enable) { /* Overwrite the current signal */ - config_tick(1 * SECOND, 100, LED_RED); + config_tick(1 * SECOND, 100, 0, LED_AMBER); led_tick(); } else { /* Restore the previous signal */ @@ -203,7 +223,7 @@ void show_critical_error(void) { hook_call_deferred(&led_tick_data, -1); if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - set_color(EC_LED_ID_POWER_LED, LED_RED, 100); + set_color(EC_LED_ID_POWER_LED, LED_AMBER, 100); } static int command_led(int argc, const char **argv) @@ -218,10 +238,10 @@ static int command_led(int argc, const char **argv) ccprintf("o%s\n", led_auto_control_is_enabled(id) ? "ff" : "n"); } else if (!strcasecmp(argv[1], "off")) { set_color(id, LED_OFF, 0); - } else if (!strcasecmp(argv[1], "red")) { - set_color(id, LED_RED, 100); - } else if (!strcasecmp(argv[1], "green")) { - set_color(id, LED_GREEN, 100); + } else if (!strcasecmp(argv[1], "blue")) { + set_color(id, LED_BLUE, 100); + } else if (!strcasecmp(argv[1], "amber")) { + set_color(id, LED_AMBER, 100); } else if (!strcasecmp(argv[1], "alert")) { led_alert(1); } else if (!strcasecmp(argv[1], "crit")) { @@ -231,24 +251,25 @@ static int command_led(int argc, const char **argv) } return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|green|off|alert|crit]", +DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|blue|amber|off|alert|crit]", "Turn on/off LED."); void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { - brightness_range[EC_LED_COLOR_RED] = 100; - brightness_range[EC_LED_COLOR_GREEN] = 100; + brightness_range[EC_LED_COLOR_AMBER] = 100; + brightness_range[EC_LED_COLOR_BLUE] = 100; } int led_set_brightness(enum ec_led_id id, const uint8_t *brightness) { - if (brightness[EC_LED_COLOR_RED]) - return set_color(id, LED_RED, brightness[EC_LED_COLOR_RED]); - else if (brightness[EC_LED_COLOR_GREEN]) - return set_color(id, LED_GREEN, brightness[EC_LED_COLOR_GREEN]); + if (brightness[EC_LED_COLOR_BLUE]) + return set_color(id, LED_BLUE, brightness[EC_LED_COLOR_BLUE]); + else if (brightness[EC_LED_COLOR_AMBER]) + return set_color(id, LED_AMBER, brightness[EC_LED_COLOR_AMBER]); else return set_color(id, LED_OFF, 0); } + __override void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { diff --git a/board/aurash/pwm.c b/board/aurash/pwm.c index a53243ca5a..be400d2ea6 100644 --- a/board/aurash/pwm.c +++ b/board/aurash/pwm.c @@ -10,30 +10,20 @@ #include "pwm_chip.h" const struct pwm_t pwm_channels[] = { - [PWM_CH_LED_GREEN] = { .channel = 0, + [PWM_CH_LED_AMBER] = { .channel = 0, .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, .freq = 2000 }, - [PWM_CH_FAN] = { .channel = 5, - .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP, - .freq = 1000 }, - [PWM_CH_LED_RED] = { .channel = 2, - .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - .freq = 2000 }, + [PWM_CH_LED_BLUE] = { .channel = 2, + .flags = PWM_CONFIG_ACTIVE_LOW | + PWM_CONFIG_DSLEEP, + .freq = 2000 }, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); static void board_pwm_init(void) { - /* - * TODO(b/197478860): Turn on the fan at 100% by default - * We need to find tune the fan speed according to the - * thermal sensor value. - */ - pwm_enable(PWM_CH_FAN, 1); - pwm_set_duty(PWM_CH_FAN, 100); - - pwm_enable(PWM_CH_LED_RED, 1); - pwm_enable(PWM_CH_LED_GREEN, 1); + pwm_enable(PWM_CH_LED_BLUE, 1); + pwm_enable(PWM_CH_LED_AMBER, 1); } DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT); diff --git a/board/aurash/sensors.c b/board/aurash/sensors.c index 211faace1c..517a6ed905 100644 --- a/board/aurash/sensors.c +++ b/board/aurash/sensors.c @@ -12,8 +12,8 @@ /* ADC configuration */ const struct adc_t adc_channels[] = { - [ADC_TEMP_SENSOR_1_CPU] = { - .name = "TEMP_CPU", + [ADC_TEMP_SENSOR_1_SSD] = { + .name = "TEMP_SSD", .input_ch = NPCX_ADC_CH0, .factor_mul = ADC_MAX_VOLT, .factor_div = ADC_READ_MAX + 1, @@ -26,13 +26,6 @@ const struct adc_t adc_channels[] = { .factor_div = ADC_READ_MAX + 1, .shift = 0, }, - [ADC_TEMP_SENSOR_3_WIFI] = { - .name = "TEMP_WIFI", - .input_ch = NPCX_ADC_CH6, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, [ADC_TEMP_SENSOR_4_DIMM] = { .name = "TEMP_DIMM", .input_ch = NPCX_ADC_CH7, @@ -46,11 +39,11 @@ const struct adc_t adc_channels[] = { .factor_mul = ADC_MAX_VOLT * 39, .factor_div = (ADC_READ_MAX + 1) * 5, }, - [ADC_PPVAR_IMON] = { /* 872.3 mV/A */ + [ADC_PPVAR_IMON] = { /* 20/(20+8.66)*50/200 current divider */ .name = "PPVAR_IMON", .input_ch = NPCX_ADC_CH3, .factor_mul = ADC_MAX_VOLT * 1433, - .factor_div = (ADC_READ_MAX + 1) * 1250, + .factor_div = (ADC_READ_MAX + 1) * 250, }, }; @@ -58,18 +51,14 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* Temperature sensor configuration */ const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_1_CPU] = { .name = "CPU", + [TEMP_SENSOR_1_SSD] = { .name = "SSD", .type = TEMP_SENSOR_TYPE_BOARD, .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_1_CPU }, + .idx = ADC_TEMP_SENSOR_1_SSD }, [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR", .type = TEMP_SENSOR_TYPE_BOARD, .read = get_temp_3v3_30k9_47k_4050b, .idx = ADC_TEMP_SENSOR_2_CPU_VR }, - [TEMP_SENSOR_3_WIFI] = { .name = "WIFI", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_3_WIFI }, [TEMP_SENSOR_4_DIMM] = { .name = "DIMM", .type = TEMP_SENSOR_TYPE_BOARD, .read = get_temp_3v3_30k9_47k_4050b, @@ -77,38 +66,37 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -/* - * TODO(b/180681346): update for Alder Lake/brya - * - * Tiger Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at - * 130 C. However, sensor is located next to DDR, so we need to use the lower - * DDR temperature limit (85 C) - */ -/* - * TODO(b/202062363): Remove when clang is fixed. - */ -#define THERMAL_CPU \ - { \ - .temp_host = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ - [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ - }, \ - .temp_host_release = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ - }, \ - .temp_fan_off = C_TO_K(35), \ - .temp_fan_max = C_TO_K(50), \ +#define THERMAL_SSD \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_ssd = THERMAL_SSD; + +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HALT] = C_TO_K(125), \ + }, \ } __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; +#define THERMAL_DIMM \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HALT] = C_TO_K(95), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_dimm = + THERMAL_DIMM; /* * TODO(b/197478860): add the thermal sensor setting */ /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CPU] = THERMAL_CPU, + [TEMP_SENSOR_1_SSD] = THERMAL_SSD, [TEMP_SENSOR_2_CPU_VR] = THERMAL_CPU, - [TEMP_SENSOR_3_WIFI] = THERMAL_CPU, - [TEMP_SENSOR_4_DIMM] = THERMAL_CPU, + [TEMP_SENSOR_4_DIMM] = THERMAL_DIMM, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/aurash/usbc_config.c b/board/aurash/usbc_config.c index a7a7cf682f..68a08a2d45 100644 --- a/board/aurash/usbc_config.c +++ b/board/aurash/usbc_config.c @@ -9,9 +9,7 @@ #include "driver/bc12/pi3usb9201_public.h" #include "driver/ppc/syv682x_public.h" #include "driver/retimer/bb_retimer_public.h" -#include "driver/retimer/kb800x.h" #include "driver/tcpm/nct38xx.h" -#include "driver/tcpm/rt1715.h" #include "driver/tcpm/tcpci.h" #include "ec_commands.h" #include "gpio.h" @@ -40,7 +38,7 @@ const struct tcpc_config_t tcpc_config[] = { [USBC_PORT_C0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { - .port = I2C_PORT_USB_C0_C2_TCPC, + .port = I2C_PORT_USB_C0_C1_TCPC, .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS, }, .drv = &nct38xx_tcpm_drv, @@ -50,15 +48,7 @@ const struct tcpc_config_t tcpc_config[] = { [USBC_PORT_C1] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { - .port = I2C_PORT_USB_C1_TCPC, - .addr_flags = RT1715_I2C_ADDR_FLAGS, - }, - .drv = &rt1715_tcpm_drv, - }, - [USBC_PORT_C2] = { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_USB_C0_C2_TCPC, + .port = I2C_PORT_USB_C0_C1_TCPC, .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS, }, .drv = &nct38xx_tcpm_drv, @@ -71,17 +61,12 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT); /* USBC PPC configuration */ struct ppc_config_t ppc_chips[] = { [USBC_PORT_C0] = { - .i2c_port = I2C_PORT_USB_C0_C2_PPC, + .i2c_port = I2C_PORT_USB_C0_C1_PPC, .i2c_addr_flags = SYV682X_ADDR0_FLAGS, .drv = &syv682x_drv, }, [USBC_PORT_C1] = { - .i2c_port = I2C_PORT_USB_C1_PPC, - .i2c_addr_flags = SYV682X_ADDR0_FLAGS, - .drv = &syv682x_drv, - }, - [USBC_PORT_C2] = { - .i2c_port = I2C_PORT_USB_C0_C2_PPC, + .i2c_port = I2C_PORT_USB_C0_C1_PPC, .i2c_addr_flags = SYV682X_ADDR2_FLAGS, .drv = &syv682x_drv, }, @@ -99,6 +84,7 @@ static const struct usb_mux_chain usbc0_tcss_usb_mux = { .hpd_update = &virtual_hpd_update, }, }; + static const struct usb_mux_chain usbc1_tcss_usb_mux = { .mux = &(const struct usb_mux){ @@ -107,31 +93,6 @@ static const struct usb_mux_chain usbc1_tcss_usb_mux = { .hpd_update = &virtual_hpd_update, }, }; -static const struct usb_mux_chain usbc2_tcss_usb_mux = { - .mux = - &(const struct usb_mux){ - .usb_port = USBC_PORT_C2, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - }, -}; - -struct kb800x_control_t kb800x_control[] = { - [USBC_PORT_C0] = { - }, - [USBC_PORT_C1] = { - .retimer_rst_gpio = GPIO_USB_C1_RT_RST_R_L, - .ss_lanes = { - [KB800X_A0] = KB800X_TX0, [KB800X_A1] = KB800X_RX0, - [KB800X_B0] = KB800X_RX1, [KB800X_B1] = KB800X_TX1, - [KB800X_C0] = KB800X_RX0, [KB800X_C1] = KB800X_TX0, - [KB800X_D0] = KB800X_TX1, [KB800X_D1] = KB800X_RX1, - } - }, - [USBC_PORT_C2] = { - }, -}; -BUILD_ASSERT(ARRAY_SIZE(kb800x_control) == USBC_PORT_COUNT); const struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C0] = { @@ -139,7 +100,7 @@ const struct usb_mux_chain usb_muxes[] = { .usb_port = USBC_PORT_C0, .driver = &bb_usb_retimer, .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C0_C2_MUX, + .i2c_port = I2C_PORT_USB_C0_C1_MUX, .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, }, .next = &usbc0_tcss_usb_mux, @@ -147,21 +108,12 @@ const struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C1] = { .mux = &(const struct usb_mux) { .usb_port = USBC_PORT_C1, - .driver = &kb800x_usb_mux_driver, - .i2c_port = I2C_PORT_USB_C1_MUX, - .i2c_addr_flags = KB800X_I2C_ADDR0_FLAGS, - }, - .next = &usbc1_tcss_usb_mux, - }, - [USBC_PORT_C2] = { - .mux = &(const struct usb_mux) { - .usb_port = USBC_PORT_C2, .driver = &bb_usb_retimer, .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C0_C2_MUX, - .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR, + .i2c_port = I2C_PORT_USB_C0_C1_MUX, + .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, }, - .next = &usbc2_tcss_usb_mux, + .next = &usbc1_tcss_usb_mux, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -169,15 +121,11 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); /* BC1.2 charger detect configuration */ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { [USBC_PORT_C0] = { - .i2c_port = I2C_PORT_USB_C0_C2_BC12, + .i2c_port = I2C_PORT_USB_C0_C1_BC12, .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, }, [USBC_PORT_C1] = { - .i2c_port = I2C_PORT_USB_C1_BC12, - .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, - }, - [USBC_PORT_C2] = { - .i2c_port = I2C_PORT_USB_C0_C2_BC12, + .i2c_port = I2C_PORT_USB_C0_C1_BC12, .i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS, }, }; @@ -194,13 +142,13 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); struct ioexpander_config_t ioex_config[] = { [IOEX_C0_NCT38XX] = { - .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC, + .i2c_host_port = I2C_PORT_USB_C0_C1_TCPC, .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS, .drv = &nct38xx_ioexpander_drv, .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED, }, - [IOEX_C2_NCT38XX] = { - .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC, + [IOEX_C1_NCT38XX] = { + .i2c_host_port = I2C_PORT_USB_C0_C1_TCPC, .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS, .drv = &nct38xx_ioexpander_drv, .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED, @@ -214,8 +162,8 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) if (me->usb_port == USBC_PORT_C0) { rst_signal = IOEX_USB_C0_RT_RST_ODL; - } else if (me->usb_port == USBC_PORT_C2) { - rst_signal = IOEX_USB_C2_RT_RST_ODL; + } else if (me->usb_port == USBC_PORT_C1) { + rst_signal = IOEX_USB_C1_RT_RST_ODL; } else { return EC_ERROR_INVAL; } @@ -263,14 +211,13 @@ void board_reset_pd_mcu(void) { enum gpio_signal tcpc_rst; - tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL; + tcpc_rst = GPIO_USB_C0_C1_TCPC_RST_ODL; /* * TODO(b/179648104): figure out correct timing */ gpio_set_level(tcpc_rst, 0); - gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 0); /* * delay for power-on to reset-off and min. assertion time @@ -279,7 +226,6 @@ void board_reset_pd_mcu(void) msleep(20); gpio_set_level(tcpc_rst, 1); - gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 1); /* wait for chips to come up */ @@ -299,22 +245,19 @@ static void board_tcpc_init(void) /* * These IO expander pins are implemented using the - * C0/C2 TCPC, so they must be set up after the TCPC has + * C0/C1 TCPC, so they must be set up after the TCPC has * been taken out of reset. */ enable_ioex(IOEX_C0_NCT38XX); - enable_ioex(IOEX_C2_NCT38XX); + enable_ioex(IOEX_C1_NCT38XX); } /* Enable PPC interrupts. */ gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C2_PPC_INT_ODL); + gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL); /* Enable TCPC interrupts. */ - gpio_enable_interrupt(GPIO_USB_C0_C2_TCPC_INT_ODL); - - gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL); + gpio_enable_interrupt(GPIO_USB_C0_C1_TCPC_INT_ODL); } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET); @@ -322,11 +265,8 @@ uint16_t tcpc_get_alert_status(void) { uint16_t status = 0; - if (gpio_get_level(GPIO_USB_C0_C2_TCPC_INT_ODL) == 0) - status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_2; - - if (gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL) == 0) - status |= PD_STATUS_TCPC_ALERT_1; + if (gpio_get_level(GPIO_USB_C0_C1_TCPC_INT_ODL) == 0) + status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_1; return status; } @@ -337,20 +277,15 @@ int ppc_get_alert_status(int port) return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0; else if (port == USBC_PORT_C1) return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0; - else if (port == USBC_PORT_C2) - return gpio_get_level(GPIO_USB_C2_PPC_INT_ODL) == 0; return 0; } void tcpc_alert_event(enum gpio_signal signal) { switch (signal) { - case GPIO_USB_C0_C2_TCPC_INT_ODL: + case GPIO_USB_C0_C1_TCPC_INT_ODL: schedule_deferred_pd_interrupt(USBC_PORT_C0); break; - case GPIO_USB_C1_TCPC_INT_ODL: - schedule_deferred_pd_interrupt(USBC_PORT_C1); - break; default: break; } @@ -365,9 +300,6 @@ void bc12_interrupt(enum gpio_signal signal) case GPIO_USB_C1_BC12_INT_ODL: usb_charger_task_set_event(1, USB_CHG_EVENT_BC12); break; - case GPIO_USB_C2_BC12_INT_ODL: - usb_charger_task_set_event(2, USB_CHG_EVENT_BC12); - break; default: break; } @@ -382,9 +314,6 @@ void ppc_interrupt(enum gpio_signal signal) case GPIO_USB_C1_PPC_INT_ODL: syv682x_interrupt(USBC_PORT_C1); break; - case GPIO_USB_C2_PPC_INT_ODL: - syv682x_interrupt(USBC_PORT_C2); - break; default: break; } diff --git a/board/aurash/usbc_config.h b/board/aurash/usbc_config.h index 778ca51a0d..28e43d0e9d 100644 --- a/board/aurash/usbc_config.h +++ b/board/aurash/usbc_config.h @@ -3,18 +3,13 @@ * found in the LICENSE file. */ -/* Brya board-specific USB-C configuration */ +/* Aurash board-specific USB-C configuration */ #ifndef __CROS_EC_USBC_CONFIG_H #define __CROS_EC_USBC_CONFIG_H -#define CONFIG_USB_PD_PORT_MAX_COUNT 3 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 -enum usbc_port { - USBC_PORT_C0 = 0, - USBC_PORT_C1, - USBC_PORT_C2, - USBC_PORT_COUNT -}; +enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT }; #endif /* __CROS_EC_USBC_CONFIG_H */ diff --git a/board/aurash/vif_override.xml b/board/aurash/vif_override.xml index 32736caf64..9fc397cd40 100644 --- a/board/aurash/vif_override.xml +++ b/board/aurash/vif_override.xml @@ -1,3 +1,129 @@ + + + + 2 + 0 + + + + + + + + + + + + + 8087 + + + + + + TBT3 Compatible + + + + 8087 + 8086 + 463E + + + + + + + + + + Gen 3 (40Gb) + + + + + + + + HBR3 + 4 Lanes + + + + USB 3.2 Gen 2x1 + + + + + + + + 3A @ 5V + + + + + 50 msec + 3600 mA + + + + + + + + + + PSD + PDUSB Host + + + + + + + + Gen 3 (40Gb) + + + + + + + + HBR3 + 4 Lanes + + + + USB 3.2 Gen 2x1 + + + + + + + + 3A @ 5V + + + + + 50 msec + 3600 mA + + + + + + + + + + PSD + PDUSB Host + + -- cgit v1.2.1