Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 1 | /* |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 2 | * Copyright (C) 2012 Google Inc. |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; version 2 of |
| 7 | * the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 17 | * MA 02111-1307 USA |
| 18 | */ |
| 19 | |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 20 | #include <stdlib.h> |
| 21 | #include <gpio.h> |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 22 | #include <device/device.h> |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 23 | #include <console/console.h> |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 24 | |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 25 | #include <cpu/samsung/exynos5-common/gpio.h> |
| 26 | #include <cpu/samsung/exynos5250/gpio.h> |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 27 | |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 28 | #include "mainboard.h" |
| 29 | |
| 30 | #define SNOW_BOARD_ID0_GPIO 88 /* GPD0, pin 0 */ |
| 31 | #define SNOW_BOARD_ID1_GPIO 89 /* GPD0, pin 1 */ |
| 32 | |
| 33 | struct { |
| 34 | enum mvl3 id0, id1; |
| 35 | enum snow_board_config config; |
| 36 | } snow_id_map[] = { |
| 37 | /* ID0 ID1 config */ |
| 38 | { LOGIC_0, LOGIC_0, SNOW_CONFIG_SAMSUNG_MP }, |
| 39 | { LOGIC_0, LOGIC_1, SNOW_CONFIG_ELPIDA_MP }, |
| 40 | { LOGIC_1, LOGIC_0, SNOW_CONFIG_SAMSUNG_DVT }, |
| 41 | { LOGIC_1, LOGIC_1, SNOW_CONFIG_ELPIDA_DVT }, |
| 42 | { LOGIC_0, LOGIC_Z, SNOW_CONFIG_SAMSUNG_PVT }, |
| 43 | { LOGIC_1, LOGIC_Z, SNOW_CONFIG_ELPIDA_PVT }, |
| 44 | { LOGIC_Z, LOGIC_0, SNOW_CONFIG_SAMSUNG_MP }, |
| 45 | { LOGIC_Z, LOGIC_Z, SNOW_CONFIG_ELPIDA_MP }, |
| 46 | { LOGIC_Z, LOGIC_1, SNOW_CONFIG_RSVD }, |
| 47 | }; |
| 48 | |
| 49 | int board_get_config(void) |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 50 | { |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 51 | int i; |
| 52 | int id0, id1; |
| 53 | enum snow_board_config config = SNOW_CONFIG_UNKNOWN; |
| 54 | |
| 55 | id0 = gpio_read_mvl3(SNOW_BOARD_ID0_GPIO); |
| 56 | id1 = gpio_read_mvl3(SNOW_BOARD_ID1_GPIO); |
| 57 | if (id0 < 0 || id1 < 0) |
| 58 | return -1; |
| 59 | printk(BIOS_DEBUG, "%s: id0: %u, id1: %u\n", __func__, id0, id1); |
| 60 | |
| 61 | for (i = 0; i < ARRAY_SIZE(snow_id_map); i++) { |
| 62 | if (id0 == snow_id_map[i].id0 && id1 == snow_id_map[i].id1) { |
| 63 | config = snow_id_map[i].config; |
| 64 | break; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | return config; |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 69 | } |
| 70 | |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 71 | #if 0 |
Ronald G. Minnich | f89e6b2 | 2012-12-10 16:13:43 -0800 | [diff] [blame] | 72 | struct chip_operations mainboard_ops = { |
| 73 | .name = "Samsung/Google ARM ChromeBook", |
| 74 | .enable_dev = mainboard_enable, |
| 75 | }; |
David Hendricks | 0d4f97e | 2013-02-03 18:09:58 -0800 | [diff] [blame^] | 76 | #endif |