blob: 513754f04857e672a211681ca917146ad89da571 [file] [log] [blame]
Julius Werner72001e72014-09-10 15:30:49 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
Julius Werner72001e72014-09-10 15:30:49 -070020#include <boardid.h>
Julius Werner7a453eb2014-10-20 13:14:55 -070021#include <console/console.h>
Julius Wernereaa9c452014-09-24 15:40:49 -070022#include <gpio.h>
Julius Werner7a453eb2014-10-20 13:14:55 -070023#include <stdlib.h>
Julius Werner72001e72014-09-10 15:30:49 -070024
25uint8_t board_id(void)
26{
27 static int id = -1;
David Hendricksa0abd512014-11-07 13:48:49 -080028 static gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
Julius Werner886d29b2014-09-24 15:40:49 -070029 [1] = GPIO(2, A, 1), [0] = GPIO(2, A, 0)}; /* GPIO2_A0 is LSB */
Julius Werner72001e72014-09-10 15:30:49 -070030
31 if (id < 0) {
David Hendricksa0abd512014-11-07 13:48:49 -080032 id = gpio_base2_value(pins, ARRAY_SIZE(pins));
Julius Werner886d29b2014-09-24 15:40:49 -070033 printk(BIOS_SPEW, "Board ID: %d.\n", id);
Julius Werner72001e72014-09-10 15:30:49 -070034 }
35
36 return id;
37}
David Hendricks539e8562014-11-06 16:51:02 -080038
39uint32_t ram_code(void)
40{
41 uint32_t code;
42 static gpio_t pins[] = {[3] = GPIO(8, A, 3), [2] = GPIO(8, A, 2),
43 [1] = GPIO(8, A, 1), [0] = GPIO(8, A, 0)}; /* GPIO8_A0 is LSB */
44
45 code = gpio_base2_value(pins, ARRAY_SIZE(pins));
46 printk(BIOS_SPEW, "RAM Config: %u.\n", code);
47
48 return code;
49}