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> |
| 9 | |
| 10 | uint32_t board_id(void) |
| 11 | { |
| 12 | static uint32_t id = UNDEFINED_STRAPPING_ID; |
Subrata Banik | eb14a97 | 2022-01-05 12:39:36 +0530 | [diff] [blame] | 13 | gpio_t pins[3] = { 0 }; |
Ravi Kumar Bokka | 8b63dac | 2021-07-27 19:29:18 +0530 | [diff] [blame] | 14 | if (CONFIG(BOARD_GOOGLE_HEROBRINE)) { |
| 15 | pins[2] = GPIO(75); |
| 16 | pins[1] = GPIO(74); |
| 17 | pins[0] = GPIO(73); |
| 18 | } else if (CONFIG(BOARD_GOOGLE_PIGLIN) || CONFIG(BOARD_GOOGLE_HOGLIN) |
| 19 | || CONFIG(BOARD_GOOGLE_SENOR)) { |
| 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 | { |
Philip Chen | 1158f71 | 2021-07-15 15:31:51 -0700 | [diff] [blame] | 45 | return google_chromeec_get_board_sku(); |
T Michael Turney | b97e6f7 | 2021-03-18 09:16:44 -0700 | [diff] [blame] | 46 | } |