blob: efe6672435716fa28c9c473c2a24f389688296ba [file] [log] [blame]
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -08001/*
David Hendricks0d4f97e2013-02-03 18:09:58 -08002 * Copyright (C) 2012 Google Inc.
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -08003 *
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 Hendricks0d4f97e2013-02-03 18:09:58 -080020#include <stdlib.h>
21#include <gpio.h>
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -080022#include <device/device.h>
David Hendricks50c0a502013-01-31 17:05:50 -080023#include <console/console.h>
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -080024
David Hendricks0d4f97e2013-02-03 18:09:58 -080025#include <cpu/samsung/exynos5-common/gpio.h>
26#include <cpu/samsung/exynos5250/gpio.h>
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -080027
David Hendricks0d4f97e2013-02-03 18:09:58 -080028#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
33struct {
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
49int board_get_config(void)
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -080050{
David Hendricks0d4f97e2013-02-03 18:09:58 -080051 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. Minnichf89e6b22012-12-10 16:13:43 -080069}
70
David Hendricks0d4f97e2013-02-03 18:09:58 -080071#if 0
Ronald G. Minnichf89e6b22012-12-10 16:13:43 -080072struct chip_operations mainboard_ops = {
73 .name = "Samsung/Google ARM ChromeBook",
74 .enable_dev = mainboard_enable,
75};
David Hendricks0d4f97e2013-02-03 18:09:58 -080076#endif