Aaron Durbin (adurbin@chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11280
-gerrit
commit e052d34b51ce756e0584f41196b0630b5bda9a31 Author: Duncan Laurie dlaurie@chromium.org Date: Thu Aug 13 12:52:08 2015 -0700
chromeec: Add helper function to read EC switch state
Add a helper function to read the EC switch state on LPC based ECs instead of having each board need to understand and use the specific EC LPC IO method that is required.
BUG=chrome-os-partner:43515 BRANCH=none TEST=build and boot on glados
Original-Change-Id: Id046c7ddf3a1689d4bf2241be5da31184c32c0e1 Original-Signed-off-by: Duncan Laurie dlaurie@chromium.org Original-Reviewed-on: https://chromium-review.googlesource.com/293514 Original-Reviewed-by: Aaron Durbin adurbin@chromium.org
Change-Id: Id11009e0711b13823e4f76dc9db9c9c20abf4809 Signed-off-by: Duncan Laurie dlaurie@chromium.org --- src/ec/google/chromeec/ec.h | 1 + src/ec/google/chromeec/ec_lpc.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 8dfefd4..3bc62c9 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -53,6 +53,7 @@ int google_chromeec_kbbacklight(int percent); void google_chromeec_post(u8 postcode); void google_chromeec_log_events(u32 mask); int google_chromeec_vbnv_context(int is_read, uint8_t *data, int len); +uint8_t google_chromeec_get_switches(void);
/* For MEC, access ranges 0x800 thru 0x9ff using EMI interface instead of LPC */ #define MEC_EMI_RANGE_START EC_HOST_CMD_REGION0 diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c index 9d1121b..003a5f2 100644 --- a/src/ec/google/chromeec/ec_lpc.c +++ b/src/ec/google/chromeec/ec_lpc.c @@ -364,6 +364,12 @@ static int google_chromeec_command_v1(struct chromeec_command *cec_command) return 0; }
+/* Return the byte of EC switch states */ +uint8_t google_chromeec_get_switches(void) +{ + return read_byte(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); +} + #ifdef __PRE_RAM__
int google_chromeec_command(struct chromeec_command *cec_command)