From 5e0a2e2d33433b564d121a20e5ab7726c74713ec Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 27 Jul 2015 23:18:15 +0200 Subject: google/butterfly: Implement functions required by CHROMEOS BRANCH=none BUG=chromium:513990 TEST=google/butterfly builds Change-Id: Ia678ca4b0778ee4a2e55ba44a5d89ac6dd691b35 Signed-off-by: Patrick Georgi Original-Commit-Id: 0d82ea2090fae9c66f41ee05cc20a9b22d3641c0 Original-Change-Id: I2fea10c17b769ca76b9d0b80978b4c512ed8c680 Original-Signed-off-by: Patrick Georgi Original-Reviewed-on: https://chromium-review.googlesource.com/288851 Original-Reviewed-by: Stefan Reinauer Reviewed-on: http://review.coreboot.org/11062 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/butterfly/chromeos.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/butterfly/chromeos.c b/src/mainboard/google/butterfly/chromeos.c index fd7ef4ec82..c23f827136 100644 --- a/src/mainboard/google/butterfly/chromeos.c +++ b/src/mainboard/google/butterfly/chromeos.c @@ -56,7 +56,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Write Protect: GPIO active Low */ gpios->gpios[0].port = WP_GPIO; gpios->gpios[0].polarity = ACTIVE_LOW; - gpios->gpios[0].value = get_pch_gpio(WP_GPIO); + gpios->gpios[0].value = !get_write_protect_state(); strncpy((char *)gpios->gpios[0].name,"write protect", GPIO_MAX_NAME_LENGTH); @@ -74,10 +74,9 @@ void fill_lb_gpios(struct lb_gpios *gpios) GPIO_MAX_NAME_LENGTH); /* lid switch value from EC */ - lidswitch = (ec_mem_read(EC_HW_GPI_STATUS) >> EC_GPI_LID_STAT_BIT) & 1; gpios->gpios[3].port = -1; gpios->gpios[3].polarity = ACTIVE_HIGH; - gpios->gpios[3].value = lidswitch; + gpios->gpios[3].value = get_lid_switch(); strncpy((char *)gpios->gpios[3].name,"lid", GPIO_MAX_NAME_LENGTH); printk(BIOS_DEBUG,"LID SWITCH FROM EC: %x\n", lidswitch); @@ -126,6 +125,16 @@ int get_pch_gpio(unsigned char gpio_num) return retval; } +int get_write_protect_state(void) +{ + return !get_pch_gpio(WP_GPIO); +} + +int get_lid_switch(void) +{ + return (ec_mem_read(EC_HW_GPI_STATUS) >> EC_GPI_LID_STAT_BIT) & 1; +} + int get_developer_mode_switch(void) { int dev_mode = 0; -- cgit v1.2.3