From d0a6a38bb7902324f87fd3111b48ba30d1817cb6 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Mon, 8 Jul 2013 14:18:01 -0700 Subject: chromeec: Allow get_board_version to be called from romstage. We will soon need to call google_chromeec_get_board_version to determine correct DDR SPD. We must do so before DDR is initialized, so allow this function to be called from romstage. Signed-off-by: Shawn Nematbakhsh Change-Id: I882d84e38d11bf66067193a6f408f941f2cf8a81 Reviewed-on: https://gerrit.chromium.org/gerrit/61191 Reviewed-by: Aaron Durbin Tested-by: Shawn Nematbakhsh Commit-Queue: Shawn Nematbakhsh Reviewed-on: http://review.coreboot.org/4351 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/ec/google/chromeec/ec.c | 34 +++++++++++++++++----------------- src/ec/google/chromeec/ec.h | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/ec/google') diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 7546a82ee8..f1cefae4f2 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -132,6 +132,23 @@ void google_chromeec_early_init(void) hlt(); } } + +u16 google_chromeec_get_board_version(void) +{ + struct chromeec_command cmd; + struct ec_response_board_version board_v; + + cmd.cmd_code = EC_CMD_GET_BOARD_VERSION; + cmd.cmd_version = 0; + cmd.cmd_size_in = 0; + cmd.cmd_size_out = sizeof(board_v); + cmd.cmd_data_out = &board_v; + + if (google_chromeec_command(&cmd) != 0) + return 0; + + return board_v.board_version; +} #endif /* ! __SMM__ */ #ifndef __PRE_RAM__ @@ -308,23 +325,6 @@ void google_chromeec_log_events(u32 mask) #endif } -u16 google_chromeec_get_board_version(void) -{ - struct chromeec_command cmd; - struct ec_response_board_version board_v; - - cmd.cmd_code = EC_CMD_GET_BOARD_VERSION; - cmd.cmd_version = 0; - cmd.cmd_size_in = 0; - cmd.cmd_size_out = sizeof(board_v); - cmd.cmd_data_out = &board_v; - - if (google_chromeec_command(&cmd) != 0) - return 0; - - return board_v.board_version; -} - int google_chromeec_set_usb_charge_mode(u8 port_id, enum usb_charge_mode mode) { struct chromeec_command cmd; diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index f661d311a8..a037d0147d 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -33,12 +33,12 @@ int google_chromeec_set_smi_mask(u32 mask); int google_chromeec_set_wake_mask(u32 mask); u8 google_chromeec_get_event(void); int google_ec_running_ro(void); -u16 google_chromeec_get_board_version(void); void google_chromeec_init(void); #endif void google_chromeec_early_init(void); uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size); +u16 google_chromeec_get_board_version(void); u32 google_chromeec_get_events_b(void); int google_chromeec_kbbacklight(int percent); void google_chromeec_post(u8 postcode); -- cgit v1.2.3