diff options
author | Scott <scollyer@chromium.org> | 2016-07-21 11:08:11 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-03 19:40:55 -0700 |
commit | d67f3aa1f60ff9abd4f03c58a103ab4eecf99e7f (patch) | |
tree | 3269a2071be1819469005dacd61a96bf19b7c276 /chip | |
parent | 96e05799536c264b63d11604429ed760a4e019d2 (diff) | |
download | chrome-ec-d67f3aa1f60ff9abd4f03c58a103ab4eecf99e7f.tar.gz |
Cr50: Sample slave configuration pins at POR
There is just one version of Cr50 firmware for all boards
that it's used on. However, on some boards the AP communicates
to the TPM via a SPI interface (i.e. Kevin) and on others, the
AP communicates via an I2C interface (i.e. Reef). In order to
dynamically discover which interface to configure, there are
strapping resistors added to the board which enables the Cr50
to detect which configuration to implement.
This CL is a first pass and is only looking at DIOA1 which is
pulled high for SPI and pulled low for I2C configurations.
The strapping resistor should be read when the AP is in reset
prior to it attempting to drive any of the lines used for
strapping. To ensure this condition is met, Cr50 will only
check the strapping options following a POR (power on reset).
Once the configuration type is discovered, a 'long_life'
register is used to hold the result so that the result can
always be available. The long_life register contents remain
unchanged until a subsequent power down event.
BRANCH=none
BUG=chrome-os-partner:50728
TEST=manual
Tested on Kevin and Reef. Verfifed by reading the stored value
that the SPI configuraiton is detected for Kevin and the I2C
interface is detected on Reef. In addition, verified on Kevin
that the Cr50 FW version is correctly reported to the AP which
means that TPM register reads via the slave SPI are functioning.
Change-Id: Ibd7624ad8e3b4126f6346dce0bc72f62a3cc6d18
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363014
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/sps.c | 8 | ||||
-rw-r--r-- | chip/g/system.c | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/chip/g/sps.c b/chip/g/sps.c index 6d21b06358..0ce1d6be41 100644 --- a/chip/g/sps.c +++ b/chip/g/sps.c @@ -9,6 +9,7 @@ #include "pmu.h" #include "registers.h" #include "sps.h" +#include "system.h" #include "task.h" #include "timer.h" #include "watchdog.h" @@ -238,6 +239,13 @@ int sps_unregister_rx_handler(void) static void sps_init(void) { + /* + * Check to see if slave SPI interface is required by the board before + * initializing it. If SPI option is not set, then just return. + */ + if (!(system_get_board_properties() & BOARD_SLAVE_CONFIG_SPI)) + return; + pmu_clock_en(PERIPH_SPS); /* The pinmux connections are preset, but we have to set IN/OUT */ diff --git a/chip/g/system.c b/chip/g/system.c index 80b55601d9..7071e2680b 100644 --- a/chip/g/system.c +++ b/chip/g/system.c @@ -352,3 +352,12 @@ int system_process_retry_counter(void) } #endif +uint32_t system_get_board_properties(void) +{ + uint32_t properties = 0; + +#ifdef BOARD_CR50 + properties = system_board_properties_callback(); +#endif + return properties; +} |