herobrine: get boardid from GPIO configuration

Getting boardid information for the different SKU variants

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

Signed-off-by: Ravi Kumar Bokka <rbokka@codeaurora.org>
Change-Id: I2b7625f9b98563438d1ac20e6f29411ef1058cf4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55950
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shelley Chen <shchen@google.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Ravi Kumar Bokka 2021-06-03 20:14:39 +05:30 committed by Shelley Chen
parent 1cfb599992
commit 12184db008
2 changed files with 20 additions and 0 deletions

View File

@ -8,6 +8,10 @@
#define GPIO_SD_CD_L GPIO(91) #define GPIO_SD_CD_L GPIO(91)
#define QCOM_SC7280_SKU1 0x0
#define QCOM_SC7280_SKU2 0x1
#define QCOM_SC7280_SKU3 0x2
void setup_chromeos_gpios(void); void setup_chromeos_gpios(void);
#endif /* _COREBOOT_SRC_MAINBOARD_GOOGLE_HEROBRINE_BOARD_H_ */ #endif /* _COREBOOT_SRC_MAINBOARD_GOOGLE_HEROBRINE_BOARD_H_ */

View File

@ -2,11 +2,27 @@
#include <boardid.h> #include <boardid.h>
#include <ec/google/chromeec/ec.h> #include <ec/google/chromeec/ec.h>
#include "board.h"
#include <commonlib/bsd/cb_err.h>
#include <console/console.h>
#include <gpio.h> #include <gpio.h>
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)};
if (id == UNDEFINED_STRAPPING_ID)
id = gpio_base3_value(pins, ARRAY_SIZE(pins));
if ((id == QCOM_SC7280_SKU1) || (id == QCOM_SC7280_SKU2) ||
(id == QCOM_SC7280_SKU3))
printk(BIOS_INFO, "BoardID :%d - "
"Machine model: "
"Qualcomm Technologies, Inc. "
"sc7280 IDP SKU%d platform\n", id, (id+1));
else
printk(BIOS_ERR, "Invalid BoardId : %d\n", id);
return id; return id;
} }