google/herobrine: configure gpio to detect board ID

BUG=b:182963902, b:193807794
TEST=Validated on qualcomm sc7280 development board

Signed-off-by: Ravi Kumar Bokka <rbokka@codeaurora.org>
Change-Id: I6de2a7e7b11ecce8325e0fd44dc7221d73729390
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56642
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shelley Chen <shchen@google.com>
This commit is contained in:
Ravi Kumar Bokka 2021-07-27 19:29:18 +05:30 committed by Shelley Chen
parent bdad283237
commit 8b63dac061
2 changed files with 13 additions and 8 deletions

View File

@ -18,7 +18,6 @@
#define QCOM_SC7280_SKU1 0x0 #define QCOM_SC7280_SKU1 0x0
#define QCOM_SC7280_SKU2 0x1 #define QCOM_SC7280_SKU2 0x1
#define QCOM_SC7280_SKU3 0x2
/* Fingerprint-specific GPIOs. Only for fingerprint-enabled devices. */ /* Fingerprint-specific GPIOs. Only for fingerprint-enabled devices. */
#if CONFIG(HEROBRINE_HAS_FINGERPRINT) #if CONFIG(HEROBRINE_HAS_FINGERPRINT)

View File

@ -10,19 +10,25 @@
uint32_t board_id(void) uint32_t board_id(void)
{ {
static uint32_t id = UNDEFINED_STRAPPING_ID; static uint32_t id = UNDEFINED_STRAPPING_ID;
const gpio_t pins[] = {[2] = GPIO(50), [1] = GPIO(49), [0] = GPIO(48)}; gpio_t pins[3];
if (CONFIG(BOARD_GOOGLE_HEROBRINE)) {
pins[2] = GPIO(75);
pins[1] = GPIO(74);
pins[0] = GPIO(73);
} else if (CONFIG(BOARD_GOOGLE_PIGLIN) || CONFIG(BOARD_GOOGLE_HOGLIN)
|| CONFIG(BOARD_GOOGLE_SENOR)) {
pins[2] = GPIO(50);
pins[1] = GPIO(49);
pins[0] = GPIO(48);
}
if (id == UNDEFINED_STRAPPING_ID) if (id == UNDEFINED_STRAPPING_ID)
id = gpio_base3_value(pins, ARRAY_SIZE(pins)); id = gpio_base3_value(pins, ARRAY_SIZE(pins));
if ((id == QCOM_SC7280_SKU1) || (id == QCOM_SC7280_SKU2) || printk(BIOS_INFO, "BoardID :%d - "
(id == QCOM_SC7280_SKU3))
printk(BIOS_INFO, "BoardID :%d - "
"Machine model: " "Machine model: "
"Qualcomm Technologies, Inc. " "Qualcomm Technologies, Inc. "
"sc7280 IDP SKU%d platform\n", id, (id+1)); "sc7280 platform\n", id);
else
printk(BIOS_ERR, "Invalid BoardId : %d\n", id);
return id; return id;
} }