tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / google / foster / chromeos.c
blobe04aff17bfe7ea64fbd91f50dcfbb992c41731a1
1 /*
2 * This file is part of the coreboot project.
4 * Copyright 2014 Google Inc.
5 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <boot/coreboot_tables.h>
18 #include <console/console.h>
19 #include <ec/google/chromeec/ec.h>
20 #include <ec/google/chromeec/ec_commands.h>
21 #include <gpio.h>
22 #include <string.h>
23 #include <vendorcode/google/chromeos/chromeos.h>
25 void fill_lb_gpios(struct lb_gpios *gpios)
27 int count = 0;
29 /* TBD(twarren@nvidia.com): Any analogs for these on Foster-FFD? */
31 /* Write Protect: active low */
32 gpios->gpios[count].port = -1;
33 gpios->gpios[count].polarity = ACTIVE_LOW;
34 gpios->gpios[count].value = get_write_protect_state();
35 strncpy((char *)gpios->gpios[count].name, "write protect",
36 GPIO_MAX_NAME_LENGTH);
37 count++;
39 /* Recovery: active high */
40 gpios->gpios[count].port = -1;
41 gpios->gpios[count].polarity = ACTIVE_HIGH;
42 gpios->gpios[count].value = get_recovery_mode_switch();
43 strncpy((char *)gpios->gpios[count].name, "recovery",
44 GPIO_MAX_NAME_LENGTH);
45 count++;
47 /* TODO: Power: active low / high depending on board id */
48 gpios->gpios[count].port = GPIO(X5);
49 gpios->gpios[count].polarity = ACTIVE_LOW;
50 gpios->gpios[count].value = -1;
51 strncpy((char *)gpios->gpios[count].name, "power",
52 GPIO_MAX_NAME_LENGTH);
53 count++;
55 /* Developer: virtual GPIO active high */
56 gpios->gpios[count].port = -1;
57 gpios->gpios[count].polarity = ACTIVE_HIGH;
58 gpios->gpios[count].value = get_developer_mode_switch();
59 strncpy((char *)gpios->gpios[count].name, "developer",
60 GPIO_MAX_NAME_LENGTH);
61 count++;
63 /* TODO: Reset: active low (output) */
64 gpios->gpios[count].port = GPIO(I5);
65 gpios->gpios[count].polarity = ACTIVE_LOW;
66 gpios->gpios[count].value = -1;
67 strncpy((char *)gpios->gpios[count].name, "reset",
68 GPIO_MAX_NAME_LENGTH);
69 count++;
71 gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
72 gpios->count = count;
74 printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
77 int get_developer_mode_switch(void)
79 return 0;
82 int get_recovery_mode_switch(void)
84 #if CONFIG_EC_GOOGLE_CHROMEEC
85 uint32_t ec_events;
87 ec_events = google_chromeec_get_events_b();
88 return !!(ec_events &
89 EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY));
90 #else
91 return 0;
92 #endif
95 int get_write_protect_state(void)
97 return 0;