From db6ba5f4dd727a0fa2ccc5e20c6b1873df01a9f3 Mon Sep 17 00:00:00 2001 From: Owen_Ou Date: Fri, 27 Aug 2021 16:12:15 +0800 Subject: felwinter: Clear up unnecessary code felwinter doesn't need the brya p0 and p1, so delete it. BUG=b:197593632 BRANCH=none TEST=make -j BOARD=felwinter and flash brya p2 can boot. Signed-off-by: Owen_Ou Change-Id: I5babb2b629d59664f76e5c2d25f0dbf328404f42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3124480 Tested-by: Owen Ou Auto-Submit: Owen Ou Reviewed-by: Boris Mittelberg Reviewed-by: Elmo Lan Reviewed-by: YH Lin Commit-Queue: Boris Mittelberg --- board/felwinter/board.c | 63 +++---------------------------------------- board/felwinter/board.h | 2 -- board/felwinter/build.mk | 1 - board/felwinter/fw_config.c | 15 ----------- board/felwinter/gpio.inc | 8 +----- board/felwinter/tune_mp2964.c | 43 ----------------------------- 6 files changed, 4 insertions(+), 128 deletions(-) delete mode 100644 board/felwinter/tune_mp2964.c diff --git a/board/felwinter/board.c b/board/felwinter/board.c index c5109945b1..4481e5c125 100644 --- a/board/felwinter/board.c +++ b/board/felwinter/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); @@ -109,57 +101,8 @@ 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; + 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); -} -DECLARE_HOOK(HOOK_INIT, board_id_1_reclaim_adc, HOOK_PRIO_INIT_ADC + 1); diff --git a/board/felwinter/board.h b/board/felwinter/board.h index f4d8e1c9f8..845eb8c922 100644 --- a/board/felwinter/board.h +++ b/board/felwinter/board.h @@ -136,8 +136,6 @@ #define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define GPIO_WP_L GPIO_EC_WP_ODL -#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL - /* System has back-lit keyboard */ #define CONFIG_PWM_KBLIGHT diff --git a/board/felwinter/build.mk b/board/felwinter/build.mk index 6d1303a15a..df453187bf 100644 --- a/board/felwinter/build.mk +++ b/board/felwinter/build.mk @@ -22,5 +22,4 @@ board-y+=keyboard.o board-y+=led.o board-y+=pwm.o board-y+=sensors.o -board-y+=tune_mp2964.o board-y+=usbc_config.o diff --git a/board/felwinter/fw_config.c b/board/felwinter/fw_config.c index fb8acb635d..7afdae3837 100644 --- a/board/felwinter/fw_config.c +++ b/board/felwinter/fw_config.c @@ -32,21 +32,6 @@ void board_init_fw_config(void) CPRINTS("CBI: Read FW_CONFIG failed, using board defaults"); fw_config = fw_config_defaults; } - - if (get_board_id() == 0) { - /* - * Early boards have a zero'd out FW_CONFIG, so replace - * it with a sensible default value. If DB_USB_ABSENT2 - * was used as an alternate encoding of DB_USB_ABSENT to - * avoid the zero check, then fix it. - */ - if (fw_config.raw_value == 0) { - CPRINTS("CBI: FW_CONFIG is zero, using board defaults"); - fw_config = fw_config_defaults; - } else if (fw_config.usb_db == DB_USB_ABSENT2) { - fw_config.usb_db = DB_USB_ABSENT; - } - } } union brya_cbi_fw_config get_fw_config(void) diff --git a/board/felwinter/gpio.inc b/board/felwinter/gpio.inc index 2ffc05b10d..295f978e6c 100644 --- a/board/felwinter/gpio.inc +++ b/board/felwinter/gpio.inc @@ -128,6 +128,7 @@ UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */ UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */ UNUSED(PIN(6, 6)) /* GPIO66 */ UNUSED(PIN(C, 3)) /* GPIOC3 */ +UNUSED(PIN(E, 1)) /* GPIOE1 */ /* Pre-configured PSL balls: J8 K6 */ @@ -139,13 +140,6 @@ UNUSED(PIN(C, 3)) /* GPIOC3 */ */ 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. * diff --git a/board/felwinter/tune_mp2964.c b/board/felwinter/tune_mp2964.c deleted file mode 100644 index 198f06d8eb..0000000000 --- a/board/felwinter/tune_mp2964.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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. - */ - -/* Tune the MP2964 IMVP9.1 parameters for brya */ - -#include "common.h" -#include "compile_time_macros.h" -#include "console.h" -#include "hooks.h" -#include "mp2964.h" - -const static struct mp2964_reg_val rail_a[] = { - { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */ -}; -const static struct mp2964_reg_val rail_b[] = { - { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */ -}; - -static void mp2964_on_startup(void) -{ - static int chip_updated; - int status; - - if (get_board_id() != 1) - return; - - if (chip_updated) - return; - - chip_updated = 1; - - ccprintf("%s: attempting to tune PMIC\n", __func__); - - status = mp2964_tune(rail_a, ARRAY_SIZE(rail_a), - rail_b, ARRAY_SIZE(rail_b)); - if (status != EC_SUCCESS) - ccprintf("%s: could not update all settings\n", __func__); -} - -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, mp2964_on_startup, - HOOK_PRIO_FIRST); -- cgit v1.2.1