T Michael Turney | b97e6f7 | 2021-03-18 09:16:44 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <boardid.h> |
Philip Chen | 1158f71 | 2021-07-15 15:31:51 -0700 | [diff] [blame] | 4 | #include <ec/google/chromeec/ec.h> |
Ravi Kumar Bokka | 12184db | 2021-06-03 20:14:39 +0530 | [diff] [blame] | 5 | #include "board.h" |
| 6 | #include <commonlib/bsd/cb_err.h> |
| 7 | #include <console/console.h> |
T Michael Turney | b97e6f7 | 2021-03-18 09:16:44 -0700 | [diff] [blame] | 8 | #include <gpio.h> |
Sudheer Kumar Amrabadi | 1e81106 | 2022-07-19 16:32:27 +0530 | [diff] [blame] | 9 | #include <soc/socinfo.h> |
T Michael Turney | b97e6f7 | 2021-03-18 09:16:44 -0700 | [diff] [blame] | 10 | |
| 11 | uint32_t board_id(void) |
| 12 | { |
| 13 | static uint32_t id = UNDEFINED_STRAPPING_ID; |
Subrata Banik | eb14a97 | 2022-01-05 12:39:36 +0530 | [diff] [blame] | 14 | gpio_t pins[3] = { 0 }; |
Shelley Chen | f58ce3b | 2022-01-05 13:02:59 -0800 | [diff] [blame] | 15 | if (CONFIG(BOARD_GOOGLE_HEROBRINE_REV0)) { |
Ravi Kumar Bokka | 8b63dac | 2021-07-27 19:29:18 +0530 | [diff] [blame] | 16 | pins[2] = GPIO(75); |
| 17 | pins[1] = GPIO(74); |
| 18 | pins[0] = GPIO(73); |
Shelley Chen | f58ce3b | 2022-01-05 13:02:59 -0800 | [diff] [blame] | 19 | } else { |
Ravi Kumar Bokka | 8b63dac | 2021-07-27 19:29:18 +0530 | [diff] [blame] | 20 | pins[2] = GPIO(50); |
| 21 | pins[1] = GPIO(49); |
| 22 | pins[0] = GPIO(48); |
| 23 | } |
Ravi Kumar Bokka | 12184db | 2021-06-03 20:14:39 +0530 | [diff] [blame] | 24 | |
| 25 | if (id == UNDEFINED_STRAPPING_ID) |
| 26 | id = gpio_base3_value(pins, ARRAY_SIZE(pins)); |
| 27 | |
Ravi Kumar Bokka | 8b63dac | 2021-07-27 19:29:18 +0530 | [diff] [blame] | 28 | printk(BIOS_INFO, "BoardID :%d - " |
Ravi Kumar Bokka | 12184db | 2021-06-03 20:14:39 +0530 | [diff] [blame] | 29 | "Machine model: " |
| 30 | "Qualcomm Technologies, Inc. " |
Ravi Kumar Bokka | 8b63dac | 2021-07-27 19:29:18 +0530 | [diff] [blame] | 31 | "sc7280 platform\n", id); |
T Michael Turney | b97e6f7 | 2021-03-18 09:16:44 -0700 | [diff] [blame] | 32 | |
| 33 | return id; |
| 34 | } |
| 35 | |
| 36 | uint32_t ram_code(void) |
| 37 | { |
| 38 | static uint32_t id = UNDEFINED_STRAPPING_ID; |
| 39 | |
| 40 | return id; |
| 41 | } |
| 42 | |
| 43 | uint32_t sku_id(void) |
| 44 | { |
Sudheer Kumar Amrabadi | 1e81106 | 2022-07-19 16:32:27 +0530 | [diff] [blame] | 45 | static uint32_t id = UNDEFINED_STRAPPING_ID; |
| 46 | /*Update modem status in 9th bit of sku id*/ |
| 47 | uint32_t mask = 1 << 9; |
| 48 | id = google_chromeec_get_board_sku(); |
| 49 | id = ((id & ~mask) | (socinfo_modem_supported() << 9)); |
| 50 | return id; |
T Michael Turney | b97e6f7 | 2021-03-18 09:16:44 -0700 | [diff] [blame] | 51 | } |