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 <shawnn@chromium.org>

Change-Id: I882d84e38d11bf66067193a6f408f941f2cf8a81
Reviewed-on: https://gerrit.chromium.org/gerrit/61191
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: http://review.coreboot.org/4351
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Shawn Nematbakhsh 2013-07-08 14:18:01 -07:00 committed by Stefan Reinauer
parent a367892c98
commit d0a6a38bb7
2 changed files with 18 additions and 18 deletions

View File

@ -132,6 +132,23 @@ void google_chromeec_early_init(void)
hlt(); 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__ */ #endif /* ! __SMM__ */
#ifndef __PRE_RAM__ #ifndef __PRE_RAM__
@ -308,23 +325,6 @@ void google_chromeec_log_events(u32 mask)
#endif #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) int google_chromeec_set_usb_charge_mode(u8 port_id, enum usb_charge_mode mode)
{ {
struct chromeec_command cmd; struct chromeec_command cmd;

View File

@ -33,12 +33,12 @@ int google_chromeec_set_smi_mask(u32 mask);
int google_chromeec_set_wake_mask(u32 mask); int google_chromeec_set_wake_mask(u32 mask);
u8 google_chromeec_get_event(void); u8 google_chromeec_get_event(void);
int google_ec_running_ro(void); int google_ec_running_ro(void);
u16 google_chromeec_get_board_version(void);
void google_chromeec_init(void); void google_chromeec_init(void);
#endif #endif
void google_chromeec_early_init(void); void google_chromeec_early_init(void);
uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size); 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); u32 google_chromeec_get_events_b(void);
int google_chromeec_kbbacklight(int percent); int google_chromeec_kbbacklight(int percent);
void google_chromeec_post(u8 postcode); void google_chromeec_post(u8 postcode);