Patrick Georgi | 4d6ad83 | 2015-06-22 19:43:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2015 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. |
Patrick Georgi | 4d6ad83 | 2015-06-22 19:43:18 +0200 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <boardid.h> |
| 17 | #include <console/console.h> |
| 18 | #include <soc/sdram.h> |
| 19 | #include <stdlib.h> |
| 20 | |
| 21 | #include "gpio.h" |
| 22 | |
| 23 | uint8_t board_id(void) |
| 24 | { |
| 25 | static int id = -1; |
| 26 | |
| 27 | if (id < 0) { |
| 28 | gpio_t gpio[] = {[1] = BD_ID1, [0] = BD_ID0}; /* ID0 is LSB */ |
| 29 | |
| 30 | id = gpio_base3_value(gpio, ARRAY_SIZE(gpio)); |
| 31 | } |
| 32 | |
| 33 | return id; |
| 34 | } |
| 35 | |
| 36 | uint32_t ram_code(void) |
| 37 | { |
| 38 | return sdram_get_ram_code(); |
| 39 | } |