From 74d3fa01ba48bebda990e505652c8f978279437b Mon Sep 17 00:00:00 2001 From: Neill Corlett Date: Tue, 12 Jan 2021 12:15:57 -0500 Subject: board/genesis: Totally remove CONFIG_CHARGE_MANAGER and CONFIG_USB_POWER_DELIVERY. Hardcode extpower_is_present() to 1 as the barrel jack is the only means of powering the board. BUG=b:173566595 TEST=Flashed to my Endeavour-C EVT1; reaches "Starting kernel" Change-Id: Ie456646bae2ca7ff5249d66bf0848fdd08caa6b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2624927 Tested-by: Neill Corlett Commit-Queue: Neill Corlett Reviewed-by: Matthew Ziegelbaum --- board/genesis/board.c | 418 +----------------------------------------- board/genesis/board.h | 57 +----- board/genesis/build.mk | 1 - board/genesis/ec.tasklist | 4 +- board/genesis/gpio.inc | 4 - board/genesis/usb_pd_policy.c | 84 --------- 6 files changed, 6 insertions(+), 562 deletions(-) delete mode 100644 board/genesis/usb_pd_policy.c (limited to 'board/genesis') diff --git a/board/genesis/board.c b/board/genesis/board.c index e45a3b5390..58ed667002 100644 --- a/board/genesis/board.c +++ b/board/genesis/board.c @@ -8,17 +8,11 @@ #include "adc.h" #include "adc_chip.h" #include "button.h" -#include "charge_manager.h" -#include "charge_state_v2.h" #include "chipset.h" #include "common.h" #include "core/cortex-m/cpu.h" #include "cros_board_info.h" #include "driver/ina3221.h" -#include "driver/ppc/sn5s330.h" -#include "driver/tcpm/anx7447.h" -#include "driver/tcpm/ps8xxx.h" -#include "driver/tcpm/tcpci.h" #include "ec_commands.h" #include "extpower.h" #include "fan.h" @@ -40,65 +34,15 @@ #include "thermal.h" #include "thermistor.h" #include "uart.h" -#include "usb_charge.h" #include "usb_common.h" -#include "usb_pd.h" -#include "usbc_ppc.h" #include "util.h" -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) +#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args) static void power_monitor(void); DECLARE_DEFERRED(power_monitor); -static void ppc_interrupt(enum gpio_signal signal) -{ - if (signal == GPIO_USB_C0_TCPPC_INT_ODL) - sn5s330_interrupt(0); -} - -int ppc_get_alert_status(int port) -{ - return gpio_get_level(GPIO_USB_C0_TCPPC_INT_ODL) == 0; -} - -static void tcpc_alert_event(enum gpio_signal signal) -{ - if (signal == GPIO_USB_C0_TCPC_INT_ODL) - schedule_deferred_pd_interrupt(0); -} - -uint16_t tcpc_get_alert_status(void) -{ - uint16_t status = 0; - int level; - - /* - * Check which port has the ALERT line set and ignore if that TCPC has - * its reset line active. - */ - if (!gpio_get_level(GPIO_USB_C0_TCPC_INT_ODL)) { - level = !!(tcpc_config[USB_PD_PORT_TCPC_0].flags & - TCPC_FLAGS_RESET_ACTIVE_HIGH); - if (gpio_get_level(GPIO_USB_C0_TCPC_RST) != level) - status |= PD_STATUS_TCPC_ALERT_0; - } - - return status; -} - -/* Called when the charge manager has switched to a new port. */ -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) -{ - /* Blink alert if insufficient power per system_can_boot_ap(). */ - int insufficient_power = - (charge_ma * charge_mv) < - (CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000); - led_alert(insufficient_power); -} - static uint8_t usbc_overcurrent; static int32_t base_5v_power; @@ -168,86 +112,6 @@ static void port_ocp_interrupt(enum gpio_signal signal) } /******************************************************************************/ -/* - * Barrel jack power supply handling - * - * EN_PPVAR_BJ_ADP_L must default active to ensure we can power on when the - * barrel jack is connected, and the USB-C port can bring the EC up fine in - * dead-battery mode. Both the USB-C and barrel jack switches do reverse - * protection, so we're safe to turn one on then the other off- but we should - * only do that if the system is off since it might still brown out. - */ - -/* - * Barrel-jack power adapter ratings. - */ -static const struct { - int voltage; - int current; -} bj_power[] = { - { /* 0 - 65W (also default) */ - .voltage = 19000, - .current = 3420 - }, - { /* 1 - 90W */ - .voltage = 19000, - .current = 4740 - }, - { /* 2 - 240W */ - .voltage = 19000, - .current = 4740 - }, -}; - -#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */ -/* Debounced connection state of the barrel jack */ -static int8_t adp_connected = -1; -static void adp_connect_deferred(void) -{ - struct charge_port_info pi = { 0 }; - unsigned int bj = ec_config_get_bj_power(); - - pi.voltage = bj_power[bj].voltage; - pi.current = bj_power[bj].current; - - charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, - DEDICATED_CHARGE_PORT, &pi); - adp_connected = 1; -} -DECLARE_DEFERRED(adp_connect_deferred); - -/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */ -void adp_connect_interrupt(enum gpio_signal signal) -{ - hook_call_deferred(&adp_connect_deferred_data, ADP_DEBOUNCE_MS * MSEC); -} - -static void adp_state_init(void) -{ - struct charge_port_info pi = { 0 }; - unsigned int bj = ec_config_get_bj_power(); - - /* - * Initialize all charge suppliers to 0. The charge manager waits until - * all ports have reported in before doing anything. - */ - for (int i = 0; i < CHARGE_PORT_COUNT; i++) { - for (int j = 0; j < CHARGE_SUPPLIER_COUNT; j++) - charge_manager_update_charge(j, i, NULL); - } - - /* Report charge state from the barrel jack. */ - adp_connect_deferred(); - - pi.voltage = bj_power[bj].voltage; - pi.current = bj_power[bj].current; - - charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, - DEDICATED_CHARGE_PORT, &pi); - adp_connected = 1; -} -DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_CHARGE_MANAGER_INIT + 1); - #include "gpio_list.h" /* Must come after other header files. */ @@ -273,27 +137,6 @@ const struct pwm_t pwm_channels[] = { .freq = 2000 }, }; -/******************************************************************************/ -/* USB-C TCPC Configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - [USB_PD_PORT_TCPC_0] = { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_TCPC0, - .addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS, - }, - .drv = &anx7447_tcpm_drv, - .flags = TCPC_FLAGS_RESET_ACTIVE_HIGH, - }, -}; -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - [USB_PD_PORT_TCPC_0] = { - .usb_port = USB_PD_PORT_TCPC_0, - .driver = &anx7447_usb_mux_driver, - .hpd_update = &anx7447_tcpc_update_hpd_status, - }, -}; - /******************************************************************************/ /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { @@ -478,8 +321,6 @@ static void board_init(void) */ cpu_set_interrupt_priority(NPCX_IRQ_WKINTC_0, 2); - gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_L); - /* Always claim AC is online, because we don't have a battery. */ memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG); *memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT; @@ -492,168 +333,22 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); -static void board_chipset_startup(void) -{ - /* - * Workaround to restore VBUS on PPC. - * PP1 is sourced from PP5000_A, and when the CPU shuts down and - * this rail drops, the PPC will internally turn off PP1_EN. - * When the CPU starts again, and the rail is restored, the PPC - * does not turn PP1_EN on again, causing VBUS to stay turned off. - * The workaround is to check whether the PPC is sourcing VBUS, and - * if so, make sure it is enabled. - */ - if (ppc_is_sourcing_vbus(0)) - ppc_vbus_source_enable(0, 1); -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, - HOOK_PRIO_DEFAULT); /******************************************************************************/ -/* USB-C PPC Configuration */ -struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = { - [USB_PD_PORT_TCPC_0] = { - .i2c_port = I2C_PORT_PPC0, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv - }, -}; -unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); - /* USB-A port control */ const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_PP5000_USB_VBUS, }; -/* Power Delivery and charging functions */ -static void board_tcpc_init(void) -{ - /* - * Reset TCPC if we have had a system reset. - * With EFSv2, it is possible to be in RW without - * having reset the TCPC. - */ - if (system_get_reset_flags() & EC_RESET_FLAG_POWER_ON) - board_reset_pd_mcu(); - /* Enable TCPC interrupts. */ - gpio_enable_interrupt(GPIO_USB_C0_TCPPC_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL); - /* Enable other overcurrent interrupts */ - gpio_enable_interrupt(GPIO_HDMI_CONN0_OC_ODL); - gpio_enable_interrupt(GPIO_HDMI_CONN1_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); - if (ec_config_get_usb4_present()) { - /* - * By default configured as output low. - */ - gpio_set_flags(GPIO_USB_A4_OC_ODL, - GPIO_INPUT | GPIO_INT_BOTH); - gpio_enable_interrupt(GPIO_USB_A4_OC_ODL); - } else { - /* Ensure no interrupts from pin */ - gpio_disable_interrupt(GPIO_USB_A4_OC_ODL); - } - -} -/* Make sure this is called after fw_config is initialised */ -DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2); - int64_t get_time_dsw_pwrok(void) { /* DSW_PWROK is turned on before EC was powered. */ return -20 * MSEC; } -void board_reset_pd_mcu(void) -{ - int level = !!(tcpc_config[USB_PD_PORT_TCPC_0].flags & - TCPC_FLAGS_RESET_ACTIVE_HIGH); - - gpio_set_level(GPIO_USB_C0_TCPC_RST, level); - msleep(BOARD_TCPC_C0_RESET_HOLD_DELAY); - gpio_set_level(GPIO_USB_C0_TCPC_RST, !level); - if (BOARD_TCPC_C0_RESET_POST_DELAY) - msleep(BOARD_TCPC_C0_RESET_POST_DELAY); -} - -int board_set_active_charge_port(int port) -{ - CPRINTS("Requested charge port change to %d", port); - - /* - * The charge manager may ask us to switch to no charger if we're - * running off USB-C only but upstream doesn't support PD. It requires - * that we accept this switch otherwise it triggers an assert and EC - * reset; it's not possible to boot the AP anyway, but we want to avoid - * resetting the EC so we can continue to do the "low power" LED blink. - */ - if (port == CHARGE_PORT_NONE) - return EC_SUCCESS; - - if (port < 0 || CHARGE_PORT_COUNT <= port) - return EC_ERROR_INVAL; - - if (port == charge_manager_get_active_charge_port()) - return EC_SUCCESS; - - /* Don't charge from a source port */ - if (board_vbus_source_enabled(port)) - return EC_ERROR_INVAL; - - if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) { - int bj_active, bj_requested; - - if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE) - /* Change is only permitted while the system is off */ - return EC_ERROR_INVAL; - - /* - * Current setting is no charge port but the AP is on, so the - * charge manager is out of sync (probably because we're - * reinitializing after sysjump). Reject requests that aren't - * in sync with our outputs. - */ - bj_active = !gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L); - bj_requested = port == CHARGE_PORT_BARRELJACK; - if (bj_active != bj_requested) - return EC_ERROR_INVAL; - } - - CPRINTS("New charger p%d", port); - - switch (port) { - case CHARGE_PORT_TYPEC0: - /* Genesis doesn't support power over Type-C */ - return EC_ERROR_INVAL; - break; - case CHARGE_PORT_BARRELJACK: - /* - * No need to check GPIO_ADP_PRESENT_L before pulling this - * low as the only power source available on Genesis is BJ. - */ - gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1); - break; - default: - return EC_ERROR_INVAL; - } - - return EC_SUCCESS; -} - -void board_overcurrent_event(int port, int is_overcurrented) -{ - /* Check that port number is valid. */ - if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) - return; - usbc_overcurrent = is_overcurrented; - update_5v_usage(); -} - int extpower_is_present(void) { - return adp_connected; + /* genesis: If the EC is running, then there is external power */ + return 1; } int board_is_c10_gate_enabled(void) @@ -672,16 +367,6 @@ void board_enable_s0_rails(int enable) gpio_set_level(GPIO_EN_PP5000_HDMI, enable); } -unsigned int ec_config_get_bj_power(void) -{ - unsigned int bj = - (fw_config & EC_CFG_BJ_POWER_MASK) >> EC_CFG_BJ_POWER_L; - /* Out of range value defaults to 0 */ - if (bj >= ARRAY_SIZE(bj_power)) - bj = 0; - return bj; -} - int ec_config_get_usb4_present(void) { return !(fw_config & EC_CFG_NO_USB4_MASK); @@ -771,8 +456,6 @@ DECLARE_HOOK(HOOK_INIT, setup_thermal, HOOK_PRIO_DEFAULT - 1); static void power_monitor(void) { static uint32_t current_state; - static uint32_t history[POWER_READINGS]; - static uint8_t index; int32_t delay; uint32_t new_state = 0, diff; int32_t headroom_5v = PWR_MAX - base_5v_power; @@ -787,93 +470,8 @@ static void power_monitor(void) * Slow down monitoring, assume no throttling required. */ delay = 20 * MSEC; - /* - * Clear the first entry of the power table so that - * it is re-initilalised when the CPU starts. - */ - history[0] = 0; } else { - int32_t charger_mw; - delay = POWER_DELAY_MS * MSEC; - /* - * Get current charger limit (in mw). - * If not configured yet, skip. - */ - charger_mw = charge_manager_get_power_limit_uw() / 1000; - if (charger_mw != 0) { - int32_t gap, total, max, power; - int i; - - /* - * Read power usage. - */ - power = (adc_read_channel(ADC_VBUS) * - adc_read_channel(ADC_PPVAR_IMON)) / - 1000; - /* Init power table */ - if (history[0] == 0) { - for (i = 0; i < POWER_READINGS; i++) - history[i] = power; - } - /* - * Update the power readings and - * calculate the average and max. - */ - history[index] = power; - index = (index + 1) % POWER_READINGS; - total = 0; - max = history[0]; - for (i = 0; i < POWER_READINGS; i++) { - total += history[i]; - if (history[i] > max) - max = history[i]; - } - /* - * For Type-C power supplies, there is - * less tolerance for exceeding the rating, - * so use the max power that has been measured - * over the measuring period. - * For barrel-jack supplies, the rating can be - * exceeded briefly, so use the average. - */ - if (charge_manager_get_supplier() == - CHARGE_SUPPLIER_PD) - power = max; - else - power = total / POWER_READINGS; - /* - * Calculate gap, and if negative, power - * demand is exceeding configured power budget, so - * throttling is required to reduce the demand. - */ - gap = charger_mw - power; - /* - * Limiting type-A power. - */ - if (gap <= 0) { - new_state |= THROT_TYPE_A; - headroom_5v += PWR_FRONT_HIGH - PWR_FRONT_LOW; - if (!(current_state & THROT_TYPE_A)) - gap += POWER_GAIN_TYPE_A; - } - /* - * If the type-C port is sourcing power, - * check whether it should be throttled. - */ - if (ppc_is_sourcing_vbus(0) && gap <= 0) { - new_state |= THROT_TYPE_C; - headroom_5v += PWR_C_HIGH - PWR_C_LOW; - if (!(current_state & THROT_TYPE_C)) - gap += POWER_GAIN_TYPE_C; - } - /* - * As a last resort, turn on PROCHOT to - * throttle the CPU. - */ - if (gap <= 0) - new_state |= THROT_PROCHOT; - } } /* * Check the 5v power usage and if necessary, @@ -929,14 +527,6 @@ static void power_monitor(void) gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot); } - if (diff & THROT_TYPE_C) { - enum tcpc_rp_value rp = (new_state & THROT_TYPE_C) - ? TYPEC_RP_1A5 : TYPEC_RP_3A0; - - ppc_set_vbus_source_current_limit(0, rp); - tcpm_select_rp_value(0, rp); - pd_update_contract(0); - } if (diff & THROT_TYPE_A) { int typea_bc = (new_state & THROT_TYPE_A) ? 1 : 0; diff --git a/board/genesis/board.h b/board/genesis/board.h index fdc4ff3405..3b16a45573 100644 --- a/board/genesis/board.h +++ b/board/genesis/board.h @@ -87,11 +87,6 @@ #define CONFIG_CHIPSET_RESET_HOOK #define CONFIG_CPU_PROCHOT_ACTIVE_LOW -/* Dedicated barreljack charger port */ -#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT -#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1 -#define DEDICATED_CHARGE_PORT 1 - #define CONFIG_POWER_BUTTON #define CONFIG_POWER_BUTTON_IGNORE_LID #define CONFIG_POWER_BUTTON_X86 @@ -106,16 +101,6 @@ #define CONFIG_POWER_TRACK_HOST_SLEEP_STATE #define CONFIG_INA3221 -/* b/143501304 */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */ -#define PD_VCONN_SWAP_DELAY 8000 /* us */ - -#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON -#define PD_MAX_POWER_MW 100000 -#define PD_MAX_CURRENT_MA 5000 -#define PD_MAX_VOLTAGE_MV 20000 - /* Fan and temp. */ #define CONFIG_FANS 1 #undef CONFIG_FAN_INIT_SPEED @@ -126,41 +111,7 @@ #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B #define CONFIG_THROTTLE_AP -/* Charger */ -#define CONFIG_CHARGE_MANAGER -/* Less than this much blocks AP power-on. */ -#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 30000 -#undef CONFIG_CHARGE_MANAGER_SAFE_MODE - -/* USB type C */ -#define CONFIG_USB_PD_TCPMV2 /* Use TCPMv2 */ -#define CONFIG_USB_PD_REV30 /* Enable PD 3.0 functionality */ -#define CONFIG_USB_PD_DECODE_SOP -#undef CONFIG_USB_CHARGER -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PID 0x5040 -#define CONFIG_USB_PD_ALT_MODE -#define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USB_PD_DISCHARGE_PPC -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_LOGGING -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_VBUS_DETECT_PPC -#define CONFIG_USBC_PPC_SN5S330 -#define CONFIG_USBC_PPC_DEDICATED_INT -#define CONFIG_USB_PD_TCPM_MUX -#define CONFIG_USB_PD_TCPM_TCPCI -#define CONFIG_USB_PD_TCPM_ANX7447 -#define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_DRP_ACC_TRYSRC -#define CONFIG_USBC_SS_MUX -#define CONFIG_USBC_SS_MUX_DFP_ONLY -#define CONFIG_USBC_VCONN -#define CONFIG_USBC_VCONN_SWAP - -#define USB_PD_PORT_TCPC_0 0 -#define BOARD_TCPC_C0_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS -#define BOARD_TCPC_C0_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS +#define CONFIG_USB_PD_PORT_MAX_COUNT 0 /* USB Type A Features */ #define CONFIG_USB_PORT_POWER_DUMB @@ -184,11 +135,6 @@ #include "gpio_signal.h" #include "registers.h" -enum charge_port { - CHARGE_PORT_TYPEC0, - CHARGE_PORT_BARRELJACK, -}; - enum adc_channel { ADC_SNS_PP3300, /* ADC2 */ ADC_SNS_PP1050, /* ADC7 */ @@ -253,7 +199,6 @@ void show_critical_error(void); #define EC_CFG_THERMAL_H 7 #define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L) -unsigned int ec_config_get_bj_power(void); int ec_config_get_usb4_present(void); unsigned int ec_config_get_thermal_solution(void); diff --git a/board/genesis/build.mk b/board/genesis/build.mk index 0f55c45f77..7e10dc26b9 100644 --- a/board/genesis/build.mk +++ b/board/genesis/build.mk @@ -11,5 +11,4 @@ CHIP_FAMILY:=npcx7 CHIP_VARIANT:=npcx7m6fc board-y=board.o -board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o board-y+=led.o diff --git a/board/genesis/ec.tasklist b/board/genesis/ec.tasklist index f820cf903c..3828142c55 100644 --- a/board/genesis/ec.tasklist +++ b/board/genesis/ec.tasklist @@ -12,6 +12,4 @@ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 2048) \ TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, TASK_STACK_SIZE) + TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/board/genesis/gpio.inc b/board/genesis/gpio.inc index 9d718bb110..f68b406513 100644 --- a/board/genesis/gpio.inc +++ b/board/genesis/gpio.inc @@ -37,9 +37,6 @@ GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(IMVP8_VRRDY_OD, PIN(1, 6), GPIO_INT_BOTH, power_signal_interrupt) -/* Other interrupts */ -GPIO_INT(USB_C0_TCPPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt) -GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event) /* * Directly connected recovery button (not available on some boards). */ @@ -48,7 +45,6 @@ GPIO_INT(EC_RECOVERY_BTN_ODL, PIN(F, 1), GPIO_INT_BOTH, button_interrupt) * Recovery button input from H1. */ GPIO_INT(H1_EC_RECOVERY_BTN_ODL, PIN(2, 4), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(BJ_ADP_PRESENT_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt) /* Port power control interrupts */ GPIO_INT(HDMI_CONN0_OC_ODL, PIN(0, 7), GPIO_INT_BOTH, port_ocp_interrupt) diff --git a/board/genesis/usb_pd_policy.c b/board/genesis/usb_pd_policy.c deleted file mode 100644 index 5bc754453a..0000000000 --- a/board/genesis/usb_pd_policy.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2020 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. - */ - -/* Shared USB-C policy for Puff boards */ - -#include "charge_manager.h" -#include "common.h" -#include "compile_time_macros.h" -#include "console.h" -#include "ec_commands.h" -#include "gpio.h" -#include "system.h" -#include "tcpm/tcpci.h" -#include "tcpm/tcpm.h" -#include "usb_mux.h" -#include "usb_pd.h" -#include "usbc_ppc.h" -#include "util.h" - -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) -#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) - - -int pd_check_vconn_swap(int port) -{ - /* Only allow vconn swap if pp5000_A rail is enabled */ - return gpio_get_level(GPIO_EN_PP5000_A); -} - -void pd_power_supply_reset(int port) -{ - int prev_en; - - prev_en = ppc_is_sourcing_vbus(port); - - /* Disable VBUS. */ - ppc_vbus_source_enable(port, 0); - - /* Enable discharge if we were previously sourcing 5V */ - if (prev_en) - pd_set_vbus_discharge(port, 1); - - /* Notify host of power info change. */ - pd_send_host_event(PD_EVENT_POWER_CHANGE); -} - -int pd_set_power_supply_ready(int port) -{ - int rv; - - /* Disable charging. */ - rv = ppc_vbus_sink_enable(port, 0); - if (rv) - return rv; - - pd_set_vbus_discharge(port, 0); - - /* Provide Vbus. */ - rv = ppc_vbus_source_enable(port, 1); - if (rv) - return rv; - - /* Notify host of power info change. */ - pd_send_host_event(PD_EVENT_POWER_CHANGE); - - return EC_SUCCESS; -} - -#ifdef CONFIG_USB_PD_VBUS_DETECT_PPC -int pd_snk_is_vbus_provided(int port) -{ - return ppc_is_vbus_present(port); -} -#endif - -int board_vbus_source_enabled(int port) -{ - /* Ignore non-PD ports (the barrel jack). */ - if (port >= CONFIG_USB_PD_PORT_MAX_COUNT) - return 0; - return ppc_is_sourcing_vbus(port); -} -- cgit v1.2.1