mb/dell: Use gpio_base2_value

Instead of open coding what gpio_base2_value() does use the
function to get the GPIO states of the ID pins.

Change-Id: Ib09993998f7e8ee2a7e5295f49ed14058a095eb0
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88505
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Patrick Rudolph 2025-07-21 08:11:03 +02:00 committed by Matt DeVillier
commit 55bed620a4
3 changed files with 12 additions and 16 deletions

View file

@ -269,8 +269,8 @@ static uint8_t get_chassis_type(void)
uint8_t gpio_chassis_type;
// Read chassis type from GPIO
gpio_chassis_type = gpio_get(70) << 3 | gpio_get(38) << 2 |
gpio_get(17) << 1 | gpio_get(1);
const gpio_t chassis_id_pins[] = {1, 17, 38, 70};
gpio_chassis_type = gpio_base2_value(chassis_id_pins, ARRAY_SIZE(chassis_id_pins));
printk(BIOS_DEBUG, "GPIO chassis type = %#x\n", gpio_chassis_type);

View file

@ -56,10 +56,9 @@ static void mainboard_enable(struct device *dev)
GMA_INT15_PANEL_FIT_DEFAULT,
GMA_INT15_BOOT_DISPLAY_DEFAULT, 0);
pin_sts = gpio_get(GPIO_CHASSIS_ID0);
pin_sts |= gpio_get(GPIO_CHASSIS_ID1) << 1;
pin_sts |= gpio_get(GPIO_CHASSIS_ID2) << 2;
pin_sts |= gpio_get(GPIO_FRONT_PANEL_CHASSIS_DET_L) << 3;
const gpio_t chassis_id_pins[] = {GPIO_CHASSIS_ID0, GPIO_CHASSIS_ID1,
GPIO_CHASSIS_ID2, GPIO_FRONT_PANEL_CHASSIS_DET_L};
pin_sts = gpio_base2_value(chassis_id_pins, ARRAY_SIZE(chassis_id_pins));
printk(BIOS_DEBUG, "Chassis type: ");
switch (pin_sts) {
@ -88,15 +87,13 @@ static void mainboard_enable(struct device *dev)
break;
}
pin_sts = gpio_get(GPIO_BOARD_REV0);
pin_sts |= gpio_get(GPIO_BOARD_REV1) << 1;
pin_sts |= gpio_get(GPIO_BOARD_REV2) << 2;
const gpio_t board_id_pins[] = {GPIO_BOARD_REV0, GPIO_BOARD_REV1, GPIO_BOARD_REV2};
pin_sts = gpio_base2_value(board_id_pins, ARRAY_SIZE(board_id_pins));
printk(BIOS_DEBUG, "Board revision: %d\n", pin_sts);
pin_sts = gpio_get(GPIO_SKU0);
pin_sts |= gpio_get(GPIO_SKU1) << 1;
pin_sts |= gpio_get(GPIO_SKU2) << 2;
const gpio_t sku_id_pins[] = {GPIO_SKU0, GPIO_SKU1, GPIO_SKU2};
pin_sts = gpio_base2_value(sku_id_pins, ARRAY_SIZE(sku_id_pins));
printk(BIOS_DEBUG, "SKU ID is %d:", pin_sts);
switch (pin_sts) {

View file

@ -300,10 +300,9 @@ static uint8_t get_chassis_type(void)
{
uint8_t chassis_id;
chassis_id = gpio_get(GPIO_CHASSIS_ID0);
chassis_id |= gpio_get(GPIO_CHASSIS_ID1) << 1;
chassis_id |= gpio_get(GPIO_CHASSIS_ID2) << 2;
chassis_id |= gpio_get(GPIO_FRONT_PANEL_CHASSIS_DET_L) << 3;
const gpio_t chassis_id_pins[] = {GPIO_CHASSIS_ID0, GPIO_CHASSIS_ID1,
GPIO_CHASSIS_ID2, GPIO_FRONT_PANEL_CHASSIS_DET_L};
chassis_id = gpio_base2_value(chassis_id_pins, ARRAY_SIZE(chassis_id_pins));
/* This mapping will determine which EC init sequence to use */
switch (chassis_id) {