diff options
-rw-r--r-- | board/redrix/board.c | 66 | ||||
-rw-r--r-- | board/redrix/gpio.inc | 18 | ||||
-rw-r--r-- | board/redrix/usbc_config.c | 30 |
3 files changed, 6 insertions, 108 deletions
diff --git a/board/redrix/board.c b/board/redrix/board.c index c5109945b1..94c7b4f2c6 100644 --- a/board/redrix/board.c +++ b/board/redrix/board.c @@ -52,11 +52,7 @@ __override void board_cbi_init(void) static void board_chipset_resume(void) { /* Allow keyboard backlight to be enabled */ - - if (get_board_id() == 1) - gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 1); - else - gpio_set_level(GPIO_EC_KB_BL_EN_L, 0); + gpio_set_level(GPIO_EC_KB_BL_EN_L, 0); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -64,11 +60,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); static void board_chipset_suspend(void) { /* Turn off the keyboard backlight if it's on. */ - - if (get_board_id() == 1) - gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 0); - else - gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); + gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -108,58 +100,6 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state) enum battery_present battery_hw_present(void) { - enum gpio_signal batt_pres; - - if (get_board_id() == 1) - batt_pres = GPIO_ID_1_EC_BATT_PRES_ODL; - else - batt_pres = GPIO_EC_BATT_PRES_ODL; - /* The GPIO is low when the battery is physically present */ - return gpio_get_level(batt_pres) ? BP_NO : BP_YES; -} - -/* - * Explicitly apply the board ID 1 *gpio.inc settings to pins that - * were reassigned on current boards. - */ - -static void set_board_id_1_gpios(void) -{ - if (get_board_id() != 1) - return; - - gpio_set_flags(GPIO_ID_1_EC_KB_BL_EN, GPIO_OUT_LOW); -} -DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST); - -/* - * Reclaim GPIO pins on board ID 1 that are used as ADC inputs on - * current boards. ALT function group MODULE_ADC pins are set in - * HOOK_PRIO_INIT_ADC and can be reclaimed right after the hook runs. - */ - -static void board_id_1_reclaim_adc(void) -{ - if (get_board_id() != 1) - return; - - /* - * GPIO_ID_1_USB_C0_C2_TCPC_RST_ODL is on GPIO34 - * - * The TCPC has already been reset by board_tcpc_init() executed - * from HOOK_PRIO_INIT_CHIPSET. Later, the pin gets set to ADC6 - * in HOOK_PRIO_INIT_ADC, so we simply need to set the pin back - * to GPIO34. - */ - gpio_set_flags(GPIO_ID_1_USB_C0_C2_TCPC_RST_ODL, GPIO_ODR_HIGH); - gpio_set_alternate_function(GPIO_PORT_3, BIT(4), GPIO_ALT_FUNC_NONE); - - /* - * The pin gets set to ADC7 in HOOK_PRIO_INIT_ADC, so we simply - * need to set it back to GPIOE1. - */ - gpio_set_flags(GPIO_ID_1_EC_BATT_PRES_ODL, GPIO_INPUT); - gpio_set_alternate_function(GPIO_PORT_E, BIT(1), GPIO_ALT_FUNC_NONE); + return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES; } -DECLARE_HOOK(HOOK_INIT, board_id_1_reclaim_adc, HOOK_PRIO_INIT_ADC + 1); diff --git a/board/redrix/gpio.inc b/board/redrix/gpio.inc index de1db7b12c..f4011e2249 100644 --- a/board/redrix/gpio.inc +++ b/board/redrix/gpio.inc @@ -135,24 +135,6 @@ UNUSED(PIN(6, 6)) /* GPO66/ARM_L_x86 */ */ GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW) -/* - * GPIOE1 is an ALT function ADC INPUT on board ID 2 and a GPIO INPUT on - * board ID 1. This declaration gives us a signal name to use on board - * ID 1. - */ -GPIO(ID_1_EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT) - -/* - * GPIO34 is an INPUT on board ID 2 and ODR_LOW on board ID 1. - * - * Since this pin is pulled up to 3.3V through a 30.9K ohm resistor on - * board ID 2, we will leak about 0.3mW until the pin is put in ALT mode - * when MODULE_ADC configuration runs. Initializing the pin to ODR_LOW - * gives us full control on both boards. - */ -GPIO(ID_1_USB_C0_C2_TCPC_RST_ODL, PIN(3, 4), GPIO_ODR_LOW) - -IOEX(ID_1_USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 2), GPIO_ODR_LOW) IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_LOW) IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_ODR_HIGH) IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW) diff --git a/board/redrix/usbc_config.c b/board/redrix/usbc_config.c index 4c84b814aa..8307d18b84 100644 --- a/board/redrix/usbc_config.c +++ b/board/redrix/usbc_config.c @@ -203,10 +203,7 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) enum ioex_signal rst_signal; if (me->usb_port == USBC_PORT_C0) { - if (get_board_id() == 1) - rst_signal = IOEX_ID_1_USB_C0_RT_RST_ODL; - else - rst_signal = IOEX_USB_C0_RT_RST_ODL; + 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 { @@ -231,20 +228,6 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) * which powers I2C controller within retimer */ msleep(1); - if (get_board_id() == 1) { - int val; - - /* - * Check if we were able to deassert - * reset. Board ID 1 uses a GPIO that is - * uncontrollable when a debug accessory is - * connected. - */ - if (ioex_get_level(rst_signal, &val) != EC_SUCCESS) - return EC_ERROR_UNKNOWN; - if (val != 1) - return EC_ERROR_NOT_POWERED; - } } else { ioex_set_level(rst_signal, 0); msleep(1); @@ -254,18 +237,11 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) void board_reset_pd_mcu(void) { - enum gpio_signal tcpc_rst; - - if (get_board_id() == 1) - tcpc_rst = GPIO_ID_1_USB_C0_C2_TCPC_RST_ODL; - else - tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL; - /* * TODO(b/179648104): figure out correct timing */ - gpio_set_level(tcpc_rst, 0); + gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 0); if (ec_cfg_usb_db_type() != DB_USB_ABSENT) { gpio_set_level(GPIO_USB_C1_RST_ODL, 0); gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0); @@ -277,7 +253,7 @@ void board_reset_pd_mcu(void) msleep(20); - gpio_set_level(tcpc_rst, 1); + gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 1); if (ec_cfg_usb_db_type() != DB_USB_ABSENT) { gpio_set_level(GPIO_USB_C1_RST_ODL, 1); gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1); |