blob: b240b84efe4e36247c0843977bc09687cb82db3c [file] [log] [blame]
Duncan Laurieafad0562013-01-14 08:50:03 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 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
20#include <string.h>
Kyösti Mälkki16455892014-04-28 23:41:06 +030021#include <bootmode.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080022#include <arch/io.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080023#include <device/device.h>
24#include <device/pci.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070025#include <soc/gpio.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080026
Aaron Durbin93a66652013-03-19 15:25:46 -050027/* Compile-time settings for developer and recovery mode. */
28#define DEV_MODE_SETTING 1
29#define REC_MODE_SETTING 0
30
Duncan Laurieafad0562013-01-14 08:50:03 -080031#ifndef __PRE_RAM__
32#include <boot/coreboot_tables.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080033
34#define GPIO_COUNT 6
Duncan Laurieafad0562013-01-14 08:50:03 -080035
36void fill_lb_gpios(struct lb_gpios *gpios)
37{
38 struct lb_gpio *gpio;
39
40 gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
41 gpios->count = GPIO_COUNT;
42
43 gpio = gpios->gpios;
44 fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect", 0);
Aaron Durbin93a66652013-03-19 15:25:46 -050045 fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery", REC_MODE_SETTING);
46 fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer", DEV_MODE_SETTING);
Duncan Laurieafad0562013-01-14 08:50:03 -080047 fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1); // force open
48 fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
Kyösti Mälkkiab56b3b2013-11-28 16:44:51 +020049 fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
Duncan Laurieafad0562013-01-14 08:50:03 -080050}
51#endif
52
53int get_developer_mode_switch(void)
54{
Aaron Durbin93a66652013-03-19 15:25:46 -050055 return DEV_MODE_SETTING;
Duncan Laurieafad0562013-01-14 08:50:03 -080056}
57
58int get_recovery_mode_switch(void)
59{
Aaron Durbin93a66652013-03-19 15:25:46 -050060 return REC_MODE_SETTING;
Duncan Laurieafad0562013-01-14 08:50:03 -080061}
Aaron Durbin0df4de92013-03-01 17:38:59 -060062
63int get_write_protect_state(void)
64{
65 return 0;
66}