summaryrefslogtreecommitdiff
path: root/src/mainboard/google/nyan/boardid.c
blob: 218bb3f774e0c04e9ba6f01d8dc6e626b94b5080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* SPDX-License-Identifier: GPL-2.0-only */

#include <boardid.h>
#include <console/console.h>
#include <gpio.h>

uint32_t board_id(void)
{
	static int id = -1;

	if (id < 0) {
		id = gpio_get(GPIO(Q3)) << 0 |
		     gpio_get(GPIO(T1)) << 1 |
		     gpio_get(GPIO(X1)) << 2 |
		     gpio_get(GPIO(X4)) << 3;
		printk(BIOS_SPEW, "Board ID: %#x.\n", id);
	}

	return id;
}