blob: fc058e2b1ab6d6513f6b9d43b7626054b6eb25b9 [file] [log] [blame]
T Michael Turneyb97e6f72021-03-18 09:16:44 -07001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <boardid.h>
Philip Chen1158f712021-07-15 15:31:51 -07004#include <ec/google/chromeec/ec.h>
Ravi Kumar Bokka12184db2021-06-03 20:14:39 +05305#include "board.h"
6#include <commonlib/bsd/cb_err.h>
7#include <console/console.h>
T Michael Turneyb97e6f72021-03-18 09:16:44 -07008#include <gpio.h>
Sudheer Kumar Amrabadi1e811062022-07-19 16:32:27 +05309#include <soc/socinfo.h>
T Michael Turneyb97e6f72021-03-18 09:16:44 -070010
11uint32_t board_id(void)
12{
13 static uint32_t id = UNDEFINED_STRAPPING_ID;
Subrata Banikeb14a972022-01-05 12:39:36 +053014 gpio_t pins[3] = { 0 };
Shelley Chenf58ce3b2022-01-05 13:02:59 -080015 if (CONFIG(BOARD_GOOGLE_HEROBRINE_REV0)) {
Ravi Kumar Bokka8b63dac2021-07-27 19:29:18 +053016 pins[2] = GPIO(75);
17 pins[1] = GPIO(74);
18 pins[0] = GPIO(73);
Shelley Chenf58ce3b2022-01-05 13:02:59 -080019 } else {
Ravi Kumar Bokka8b63dac2021-07-27 19:29:18 +053020 pins[2] = GPIO(50);
21 pins[1] = GPIO(49);
22 pins[0] = GPIO(48);
23 }
Ravi Kumar Bokka12184db2021-06-03 20:14:39 +053024
25 if (id == UNDEFINED_STRAPPING_ID)
26 id = gpio_base3_value(pins, ARRAY_SIZE(pins));
27
Ravi Kumar Bokka8b63dac2021-07-27 19:29:18 +053028 printk(BIOS_INFO, "BoardID :%d - "
Ravi Kumar Bokka12184db2021-06-03 20:14:39 +053029 "Machine model: "
30 "Qualcomm Technologies, Inc. "
Ravi Kumar Bokka8b63dac2021-07-27 19:29:18 +053031 "sc7280 platform\n", id);
T Michael Turneyb97e6f72021-03-18 09:16:44 -070032
33 return id;
34}
35
36uint32_t ram_code(void)
37{
38 static uint32_t id = UNDEFINED_STRAPPING_ID;
39
40 return id;
41}
42
43uint32_t sku_id(void)
44{
Sudheer Kumar Amrabadi1e811062022-07-19 16:32:27 +053045 static uint32_t id = UNDEFINED_STRAPPING_ID;
Venkat Thogaru38ea9e32022-11-07 15:49:06 +053046
47 /* Update modem status in 9th bit of sku id */
Sudheer Kumar Amrabadi1e811062022-07-19 16:32:27 +053048 uint32_t mask = 1 << 9;
49 id = google_chromeec_get_board_sku();
50 id = ((id & ~mask) | (socinfo_modem_supported() << 9));
51 return id;
T Michael Turneyb97e6f72021-03-18 09:16:44 -070052}