chromeos: Simplify fill_lb_gpios even further
A long time ago many Chrome OS boards had pages full of duplicated boilerplate code for the fill_lb_gpios() function, and we spent a lot of time bikeshedding a proper solution that passes a table of lb_gpio structs which can be concisely written with a static struct initializer in http://crosreview.com/234648. Unfortunately we never really finished that patch and in the mean time a different solution using the fill_lb_gpio() helper got standardized onto most boards. Still, that solution is not quite as clean and concise as the one we had already designed, and it also wasn't applied consistently to all recent boards (causing more boards with bad code to get added afterwards). This patch switches all boards newer than Link to the better solution and also adds some nicer debug output for the GPIOs while I'm there. If more boards need to be converted from fill_lb_gpio() to this model later (e.g. from a branch), it's quite easy to do with: s/fill_lb_gpio(gpio++,\n\?\s*\([^,]*\),\n\?\s*\([^,]*\),\n\?\s*\([^,]*\),\n\?\s*\([^,]*\));/\t{\1, \2, \4, \3},/ Based on a patch by Furquan Shaikh <furquan@google.com>. BUG=None BRANCH=None TEST=Booted on Oak. Ran abuild -x. Change-Id: I449974d1c75c8ed187f5e10935495b2f03725811 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/14226 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
committed by
David Hendricks
parent
e036270953
commit
c445b4fc77
@ -2,6 +2,7 @@
|
||||
#define COREBOOT_TABLES_H
|
||||
|
||||
#include <commonlib/coreboot_tables.h>
|
||||
#include <stddef.h>
|
||||
/* function prototypes for building the coreboot table */
|
||||
|
||||
unsigned long write_coreboot_table(
|
||||
@ -9,8 +10,8 @@ unsigned long write_coreboot_table(
|
||||
unsigned long rom_table_start, unsigned long rom_table_end);
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios);
|
||||
void fill_lb_gpio(struct lb_gpio *gpio, int num,
|
||||
int polarity, const char *name, int value);
|
||||
void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table,
|
||||
size_t count);
|
||||
|
||||
void uart_fill_lb(void *data);
|
||||
void lb_add_serial(struct lb_serial *serial, void *data);
|
||||
|
@ -148,27 +148,53 @@ void __attribute__((weak)) lb_framebuffer(struct lb_header *header)
|
||||
#endif
|
||||
}
|
||||
|
||||
void fill_lb_gpio(struct lb_gpio *gpio, int num,
|
||||
int polarity, const char *name, int value)
|
||||
void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table,
|
||||
size_t count)
|
||||
{
|
||||
memset(gpio, 0, sizeof(*gpio));
|
||||
gpio->port = num;
|
||||
gpio->polarity = polarity;
|
||||
if (value >= 0)
|
||||
gpio->value = value;
|
||||
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
|
||||
size_t table_size = count * sizeof(struct lb_gpio);
|
||||
|
||||
memcpy(&gpios->gpios[gpios->count], gpio_table, table_size);
|
||||
gpios->count += count;
|
||||
gpios->size += table_size;
|
||||
}
|
||||
|
||||
#if CONFIG_CHROMEOS
|
||||
static void lb_gpios(struct lb_header *header)
|
||||
{
|
||||
struct lb_gpios *gpios;
|
||||
struct lb_gpio *g;
|
||||
|
||||
gpios = (struct lb_gpios *)lb_new_record(header);
|
||||
gpios->tag = LB_TAG_GPIO;
|
||||
gpios->size = sizeof(*gpios);
|
||||
gpios->count = 0;
|
||||
fill_lb_gpios(gpios);
|
||||
|
||||
printk(BIOS_INFO, "Passing %u GPIOs to payload:\n"
|
||||
" NAME | PORT | POLARITY | VALUE\n",
|
||||
gpios->count);
|
||||
for (g = &gpios->gpios[0]; g < &gpios->gpios[gpios->count]; g++) {
|
||||
printk(BIOS_INFO, "%16s | ", g->name);
|
||||
if (g->port == -1)
|
||||
printk(BIOS_INFO, " undefined | ");
|
||||
else
|
||||
printk(BIOS_INFO, "%#.8x | ", g->port);
|
||||
if (g->polarity == ACTIVE_HIGH)
|
||||
printk(BIOS_INFO, " high | ");
|
||||
else
|
||||
printk(BIOS_INFO, " low | ");
|
||||
switch (g->value) {
|
||||
case 0:
|
||||
printk(BIOS_INFO, " high\n");
|
||||
break;
|
||||
case 1:
|
||||
printk(BIOS_INFO, " low\n");
|
||||
break;
|
||||
default:
|
||||
printk(BIOS_INFO, "undefined\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void lb_vdat(struct lb_header *header)
|
||||
|
@ -29,38 +29,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
/*static void fill_lb_gpio(struct lb_gpio *gpio, int num,
|
||||
int polarity, const char *name, int force)
|
||||
{
|
||||
memset(gpio, 0, sizeof(*gpio));
|
||||
gpio->port = num;
|
||||
gpio->polarity = polarity;
|
||||
if (force >= 0)
|
||||
gpio->value = force;
|
||||
else if (num >= 0)
|
||||
gpio->value = get_gpio(num);
|
||||
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
|
||||
}
|
||||
*/
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, CROS_WP_GPIO, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{CROS_WP_GPIO, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -29,25 +29,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, CROS_WP_GPIO, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{CROS_WP_GPIO, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -32,25 +32,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, CROS_WP_GPIO, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{CROS_WP_GPIO, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -33,24 +33,17 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *start_gpio = gpios->gpios;
|
||||
struct lb_gpio *gpio = start_gpio;
|
||||
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
fill_lb_gpio(gpio++, GPIO_EC_IN_RW, ACTIVE_HIGH, "EC in RW",
|
||||
gpio_get(GPIO_EC_IN_RW));
|
||||
|
||||
gpios->count = gpio - start_gpio;
|
||||
gpios->size = sizeof(*gpios) + (gpios->count * sizeof(*gpio));
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
{GPIO_EC_IN_RW, ACTIVE_HIGH,
|
||||
gpio_get(GPIO_EC_IN_RW), "EC in RW"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
|
@ -33,27 +33,20 @@
|
||||
#if ENV_RAMSTAGE
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
#define ACTIVE_LOW 0
|
||||
#define ACTIVE_HIGH 1
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
recovery_mode_enabled());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, recovery_mode_enabled(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
|
@ -29,25 +29,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, 58, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{58, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -33,24 +33,17 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *start_gpio = gpios->gpios;
|
||||
struct lb_gpio *gpio = start_gpio;
|
||||
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
fill_lb_gpio(gpio++, GPIO_EC_IN_RW, ACTIVE_HIGH, "EC in RW",
|
||||
gpio_get(GPIO_EC_IN_RW));
|
||||
|
||||
gpios->count = gpio - start_gpio;
|
||||
gpios->size = sizeof(*gpios) + (gpios->count * sizeof(*gpio));
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
{GPIO_EC_IN_RW, ACTIVE_HIGH,
|
||||
gpio_get(GPIO_EC_IN_RW), "EC in RW"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
|
@ -33,24 +33,18 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, GPIO_SPI_WP, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, GPIO_REC_MODE, ACTIVE_LOW, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_SPI_WP, ACTIVE_HIGH, 0, "write protect"},
|
||||
{GPIO_REC_MODE, ACTIVE_LOW,
|
||||
get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, 1, "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -33,25 +33,19 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, GPIO_SPI_WP, ACTIVE_HIGH, "write protect",
|
||||
get_gpio(GPIO_SPI_WP));
|
||||
fill_lb_gpio(gpio++, GPIO_REC_MODE, ACTIVE_LOW, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_SPI_WP, ACTIVE_HIGH,
|
||||
get_gpio(GPIO_SPI_WP), "write protect"},
|
||||
{GPIO_REC_MODE, ACTIVE_LOW,
|
||||
get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, 1, "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -33,24 +33,17 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *start_gpio = gpios->gpios;
|
||||
struct lb_gpio *gpio = start_gpio;
|
||||
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
fill_lb_gpio(gpio++, GPIO_EC_IN_RW, ACTIVE_HIGH, "EC in RW",
|
||||
gpio_get(GPIO_EC_IN_RW));
|
||||
|
||||
gpios->count = gpio - start_gpio;
|
||||
gpios->size = sizeof(*gpios) + (gpios->count * sizeof(*gpio));
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
{GPIO_EC_IN_RW, ACTIVE_HIGH,
|
||||
gpio_get(GPIO_EC_IN_RW), "EC in RW"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
|
@ -24,67 +24,16 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = GPIO(U4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO(R1), ACTIVE_LOW, gpio_get(GPIO(R1)), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{GPIO(R4), ACTIVE_HIGH, -1, "lid"},
|
||||
{GPIO(Q0), ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO(U4), ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{GPIO(I5), ACTIVE_LOW, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -24,67 +24,16 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = GPIO(U4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO(R1), ACTIVE_LOW, gpio_get(GPIO(R1)), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{GPIO(R4), ACTIVE_HIGH, -1, "lid"},
|
||||
{GPIO(Q0), ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO(U4), ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{GPIO(I5), ACTIVE_LOW, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -28,67 +28,16 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = GPIO(U4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO(R1), ACTIVE_LOW, gpio_get(GPIO(R1)), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{GPIO(R4), ACTIVE_HIGH, -1, "lid"},
|
||||
{GPIO(Q0), ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO(U4), ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{GPIO(I5), ACTIVE_LOW, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -37,67 +37,17 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write protect : active low */
|
||||
gpios->gpios[count].port = WRITE_PROTECT;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(WRITE_PROTECT);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = LID;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active high */
|
||||
gpios->gpios[count].port = POWER_BUTTON;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = EC_IN_RW;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC interrupt: GPIO active low */
|
||||
gpios->gpios[count].port = EC_IRQ;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC interrupt",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{WRITE_PROTECT, ACTIVE_LOW,
|
||||
gpio_get(WRITE_PROTECT), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{LID, ACTIVE_HIGH, -1, "lid"},
|
||||
{POWER_BUTTON, ACTIVE_HIGH, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{EC_IN_RW, ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{EC_IRQ, ACTIVE_LOW, -1, "EC interrupt"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -32,24 +32,18 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, GPIO_SPI_WP, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, GPIO_REC_MODE, ACTIVE_LOW, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_SPI_WP, ACTIVE_HIGH, 0, "write protect"},
|
||||
{GPIO_REC_MODE, ACTIVE_LOW,
|
||||
get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, 1, "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -29,25 +29,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, 58, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{58, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -31,25 +31,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
recovery_mode_enabled());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, recovery_mode_enabled(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -23,59 +23,16 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO(R1), ACTIVE_LOW, gpio_get(GPIO(R1)), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{GPIO(R4), ACTIVE_HIGH, -1, "lid"},
|
||||
{GPIO(Q0), ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO(I5), ACTIVE_LOW, -1, "reset"},
|
||||
};
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -33,62 +33,18 @@ static inline uint32_t get_pwr_btn_polarity(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = WRITE_PROTECT_L;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(WRITE_PROTECT_L);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{WRITE_PROTECT_L, ACTIVE_LOW, gpio_get(WRITE_PROTECT_L),
|
||||
"write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
/* TODO(adurbin): add lid switch */
|
||||
{POWER_BUTTON, get_pwr_btn_polarity(), -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{EC_IN_RW, ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{AP_SYS_RESET_L, ACTIVE_LOW, -1, "reset"},
|
||||
};
|
||||
|
||||
/* Power: active low / high depending on board id */
|
||||
gpios->gpios[count].port = POWER_BUTTON;
|
||||
gpios->gpios[count].polarity = get_pwr_btn_polarity();
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = EC_IN_RW;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = AP_SYS_RESET_L;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -31,25 +31,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, CROS_WP_GPIO, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{CROS_WP_GPIO, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -29,25 +29,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, 58, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{58, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -25,62 +25,16 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = WRITE_PROTECT_L;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(WRITE_PROTECT_L);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* TODO(furquan): add lid switch */
|
||||
|
||||
/* Power: active low / high depending on board id */
|
||||
gpios->gpios[count].port = POWER_BUTTON;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: virtual GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = EC_IN_RW;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = AP_SYS_RESET_L;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{WRITE_PROTECT_L, ACTIVE_LOW,
|
||||
gpio_get(WRITE_PROTECT_L), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{POWER_BUTTON, ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{EC_IN_RW, ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{AP_SYS_RESET_L, ACTIVE_LOW, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -42,18 +42,14 @@ static int read_gpio(gpio_t gpio_num)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
const int GPIO_COUNT = 5;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, DEV_SW, ACTIVE_LOW, "developer", read_gpio(DEV_SW));
|
||||
fill_lb_gpio(gpio++, REC_SW, ACTIVE_LOW, "recovery", read_gpio(REC_SW));
|
||||
fill_lb_gpio(gpio++, WP_SW, ACTIVE_LOW, "write protect", read_gpio(WP_SW));
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_LOW, "power", 1);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_LOW, "lid", 0);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{DEV_SW, ACTIVE_LOW, read_gpio(DEV_SW), "developer"},
|
||||
{REC_SW, ACTIVE_LOW, read_gpio(REC_SW), "recovery"},
|
||||
{WP_SW, ACTIVE_LOW, read_gpio(WP_SW), "write protect"},
|
||||
{-1, ACTIVE_LOW, 1, "power"},
|
||||
{-1, ACTIVE_LOW, 0, "lid"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -33,24 +33,18 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, GPIO_SPI_WP, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, GPIO_REC_MODE, ACTIVE_LOW, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_SPI_WP, ACTIVE_HIGH, 0, "write protect"},
|
||||
{GPIO_REC_MODE, ACTIVE_LOW,
|
||||
get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, 1, "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -41,83 +41,19 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
gpios->gpios[count].port = GPIO_RECOVERY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_LID.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power:GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_ECINRW.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC interrupt: GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_ECIRQ.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC interrupt",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Backlight: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_BACKLIGHT.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "backlight",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
{GPIO_RECOVERY.raw, ACTIVE_LOW,
|
||||
get_recovery_mode_switch(), "recovery"},
|
||||
{GPIO_LID.raw, ACTIVE_HIGH, -1, "lid"},
|
||||
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO_ECINRW.raw, ACTIVE_HIGH, -1, "EC in RW"},
|
||||
{GPIO_ECIRQ.raw, ACTIVE_LOW, -1, "EC interrupt"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
{GPIO_BACKLIGHT.raw, ACTIVE_HIGH, -1, "backlight"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -34,52 +34,15 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
gpios->gpios[count].port = GPIO_RECOVERY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_RECOVERY);
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power Button: GPIO active low */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
{GPIO_RECOVERY.raw, ACTIVE_LOW,
|
||||
gpio_get(GPIO_RECOVERY), "recovery"},
|
||||
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -36,52 +36,16 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
gpios->gpios[count].port = GPIO_RECOVERY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_RECOVERY);
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power Button: GPIO active low */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: Danger has a physical dev switch that is active low */
|
||||
gpios->gpios[count].port = GPIO_DEV_MODE.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
{GPIO_RECOVERY.raw, ACTIVE_LOW,
|
||||
gpio_get(GPIO_RECOVERY), "recovery"},
|
||||
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
|
||||
{GPIO_DEV_MODE.raw, ACTIVE_HIGH,
|
||||
get_developer_mode_switch(), "developer"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -32,44 +32,14 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
gpios->gpios[count].port = GPIO_RECOVERY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_RECOVERY);
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
{GPIO_RECOVERY.raw, ACTIVE_LOW,
|
||||
gpio_get(GPIO_RECOVERY), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -32,44 +32,14 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
gpios->gpios[count].port = GPIO_RECOVERY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_RECOVERY);
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
{GPIO_RECOVERY.raw, ACTIVE_LOW,
|
||||
gpio_get(GPIO_RECOVERY), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -37,55 +37,17 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
/* Note for early development, we want to support both servo and
|
||||
* pushkey recovery buttons in firmware boot stages.
|
||||
*/
|
||||
gpios->gpios[count].port = GPIO_RECOVERY_PUSHKEY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = !get_recovery_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power Button: GPIO active low */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
/* Note for early development, we want to support both servo
|
||||
* and pushkey recovery buttons in firmware boot stages. */
|
||||
{GPIO_RECOVERY_PUSHKEY.raw, ACTIVE_LOW,
|
||||
!get_recovery_mode_switch(), "recovery"},
|
||||
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -34,52 +34,15 @@ void setup_chromeos_gpios(void)
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_WP.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_WP);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Recovery: active low */
|
||||
gpios->gpios[count].port = GPIO_RECOVERY.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_RECOVERY);
|
||||
strncpy((char *)gpios->gpios[count].name, "recovery",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power Button: GPIO active low */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Developer: GPIO active high */
|
||||
gpios->gpios[count].port = -1;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = get_developer_mode_switch();
|
||||
strncpy((char *)gpios->gpios[count].name, "developer",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
printk(BIOS_ERR, "Added %d GPIOS size %d\n", count, gpios->size);
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"},
|
||||
{GPIO_RECOVERY.raw, ACTIVE_LOW,
|
||||
gpio_get(GPIO_RECOVERY), "recovery"},
|
||||
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
|
||||
int get_developer_mode_switch(void)
|
||||
|
@ -33,24 +33,17 @@
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *start_gpio = gpios->gpios;
|
||||
struct lb_gpio *gpio = start_gpio;
|
||||
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
get_recovery_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid",
|
||||
get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
fill_lb_gpio(gpio++, GPIO_EC_IN_RW, ACTIVE_HIGH, "EC in RW",
|
||||
gpio_get(GPIO_EC_IN_RW));
|
||||
|
||||
gpios->count = gpio - start_gpio;
|
||||
gpios->size = sizeof(*gpios) + (gpios->count * sizeof(*gpio));
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
{GPIO_EC_IN_RW, ACTIVE_HIGH,
|
||||
gpio_get(GPIO_EC_IN_RW), "EC in RW"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
|
@ -32,27 +32,20 @@
|
||||
#if ENV_RAMSTAGE
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
#define ACTIVE_LOW 0
|
||||
#define ACTIVE_HIGH 1
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect",
|
||||
get_write_protect_state());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery",
|
||||
recovery_mode_enabled());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer",
|
||||
get_developer_mode_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch());
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
|
||||
{-1, ACTIVE_HIGH, recovery_mode_enabled(), "recovery"},
|
||||
{-1, ACTIVE_HIGH, get_developer_mode_switch(), "developer"},
|
||||
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
|
@ -27,22 +27,17 @@
|
||||
#ifndef __PRE_RAM__
|
||||
#include <boot/coreboot_tables.h>
|
||||
|
||||
#define GPIO_COUNT 6
|
||||
|
||||
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||
{
|
||||
struct lb_gpio *gpio;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio));
|
||||
gpios->count = GPIO_COUNT;
|
||||
|
||||
gpio = gpios->gpios;
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "write protect", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "recovery", REC_MODE_SETTING);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer", DEV_MODE_SETTING);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1); // force open
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0);
|
||||
fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_get_init_done());
|
||||
struct lb_gpio chromeos_gpios[] = {
|
||||
{-1, ACTIVE_HIGH, 0, "write protect"},
|
||||
{-1, ACTIVE_HIGH, REC_MODE_SETTING, "recovery"},
|
||||
{-1, ACTIVE_HIGH, DEV_MODE_SETTING, "developer"},
|
||||
{-1, ACTIVE_HIGH, 1, "lid"}, // force open
|
||||
{-1, ACTIVE_HIGH, 0, "power"},
|
||||
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
|
||||
};
|
||||
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user