gru: Instantiate SPI TPM driver at startup.
authorVadim Bendebury <vbendeb@chromium.org>
Thu, 23 Jun 2016 02:17:09 +0000 (19:17 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 1 Jul 2016 03:13:44 +0000 (20:13 -0700)
This adds code which creates structures for the SPI interface and the
TPM driver on Gru and Kevin boards.

CQ-DEPEND=CL:356595
BRANCH=none
BUG=chrome-os-partner:50645
TEST=with the rest of the patches applied; attempts of vboot_firmware
     to communicate with the TPM trigger proper TPM initialization
     (which indicates that SPI interface is operational and is plugged
     in properly). Chrome OS boots properly too.

Change-Id: Iedd70bde1f933046de86628844d531e7721dbe79
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/356594
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
src/board/gru/board.c

index 2f575be..15a587c 100644 (file)
@@ -27,7 +27,6 @@
 #include "drivers/bus/usb/usb.h"
 #include "drivers/ec/cros/spi.h"
 #include "drivers/flash/spi.h"
-#include "drivers/flash/spi.h"
 #include "drivers/gpio/rockchip.h"
 #include "drivers/gpio/sysinfo.h"
 #include "drivers/sound/i2s.h"
@@ -36,6 +35,7 @@
 #include "drivers/storage/dw_mmc.h"
 #include "drivers/storage/rk_dwmmc.h"
 #include "drivers/storage/sdhci.h"
+#include "drivers/tpm/spi.h"
 #include "drivers/video/display.h"
 #include "vboot/util/flag.h"
 
@@ -113,8 +113,12 @@ static GpioOps *power_btn_gpio(void)
 
 static int board_setup(void)
 {
-       RkSpi *spi1 = new_rockchip_spi(0xff1d0000);
+       // TPM on Gru is connected to SPI bus #0
+       RkSpi *spi0 = new_rockchip_spi(0xff1c0000);
+       tpm_set_ops(&new_tpm_spi(&spi0->ops)->ops);
 
+       // Flash on Gru is connected to SPI bus #1.
+       RkSpi *spi1 = new_rockchip_spi(0xff1d0000);
        flash_set_ops(&new_spi_flash(&spi1->ops)->ops);
 
        // EC is connected to SPI bus #5