[coreboot-gerrit] New patch to review for coreboot: 63d413d veyron: Fix TPM I2C initialization and sync boards

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Apr 14 02:39:52 CEST 2015


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9634

-gerrit

commit 63d413db095bfb7cd9cacb7de60bae4ae678a086
Author: Julius Werner <jwerner at chromium.org>
Date:   Wed Dec 17 17:38:38 2014 -0800

    veyron: Fix TPM I2C initialization and sync boards
    
    Due to a missing i2c_init(), we were actually running our TPM with
    default divisors at 660KHz. Oops.
    
    While it's commendable that both the TPM and our controller seem to have
    been running fine all this time at more than 1.5 times the maximum
    frequency they support, we should probably still get that fixed.
    
    Also sync Speedy back up to the other Veyron boards since it seems to
    have missed a recent SDMMC patch.
    
    BRANCH=None
    BUG=None
    TEST=Booted Pinky.
    
    Change-Id: I255c66624b21bf48b12f950208ba2c401a75c4e4
    Signed-off-by: Stefan Reinauer <reinauer at chromium.org>
    Original-Commit-Id: f2bd7c8579cd90d2f800c777c1981557d81a9b49
    Original-Change-Id: I43e6b5fe02aca605a5b243c5b876bd44b90b2bf9
    Original-Signed-off-by: Julius Werner <jwerner at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/236580
    Original-Reviewed-by: David Hendricks <dhendrix at chromium.org>
---
 src/mainboard/google/veyron_jerry/bootblock.c  |  1 +
 src/mainboard/google/veyron_jerry/mainboard.c  |  6 +-----
 src/mainboard/google/veyron_mighty/bootblock.c |  1 +
 src/mainboard/google/veyron_mighty/mainboard.c |  6 +-----
 src/mainboard/google/veyron_pinky/bootblock.c  |  1 +
 src/mainboard/google/veyron_pinky/mainboard.c  |  6 +-----
 src/mainboard/google/veyron_speedy/bootblock.c |  1 +
 src/mainboard/google/veyron_speedy/mainboard.c |  7 ++-----
 src/mainboard/google/veyron_speedy/romstage.c  | 12 +++++++++++-
 9 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/src/mainboard/google/veyron_jerry/bootblock.c b/src/mainboard/google/veyron_jerry/bootblock.c
index 4536f31..5571d45 100644
--- a/src/mainboard/google/veyron_jerry/bootblock.c
+++ b/src/mainboard/google/veyron_jerry/bootblock.c
@@ -64,6 +64,7 @@ void bootblock_mainboard_init(void)
 
 	/* i2c1 for tpm */
 	writel(IOMUX_I2C1, &rk3288_grf->iomux_i2c1);
+	i2c_init(1, 400*KHz);
 
 	/* spi2 for firmware ROM */
 	writel(IOMUX_SPI2_CSCLK, &rk3288_grf->iomux_spi2csclk);
diff --git a/src/mainboard/google/veyron_jerry/mainboard.c b/src/mainboard/google/veyron_jerry/mainboard.c
index 9d8bb5d..d995260 100644
--- a/src/mainboard/google/veyron_jerry/mainboard.c
+++ b/src/mainboard/google/veyron_jerry/mainboard.c
@@ -72,7 +72,7 @@ static void configure_emmc(void)
 static void configure_codec(void)
 {
 	writel(IOMUX_I2C2, &rk3288_grf->iomux_i2c2);	/* CODEC I2C */
-	i2c_init(2, 400000);	/* CODEC I2C */
+	i2c_init(2, 400*KHz);				/* CODEC I2C */
 
 	writel(IOMUX_I2S, &rk3288_grf->iomux_i2s);
 	writel(IOMUX_I2SCLK, &rk3288_grf->iomux_i2sclk);
@@ -108,10 +108,6 @@ static void configure_vop(void)
 
 static void mainboard_init(device_t dev)
 {
-	setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL); /* PMIC I2C */
-	setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA); /* PMIC I2C */
-	i2c_init(0, 400000);	/* PMIC I2C */
-
 	gpio_output(GPIO_RESET, 0);
 
 	configure_usb();
diff --git a/src/mainboard/google/veyron_mighty/bootblock.c b/src/mainboard/google/veyron_mighty/bootblock.c
index 4536f31..5571d45 100644
--- a/src/mainboard/google/veyron_mighty/bootblock.c
+++ b/src/mainboard/google/veyron_mighty/bootblock.c
@@ -64,6 +64,7 @@ void bootblock_mainboard_init(void)
 
 	/* i2c1 for tpm */
 	writel(IOMUX_I2C1, &rk3288_grf->iomux_i2c1);
+	i2c_init(1, 400*KHz);
 
 	/* spi2 for firmware ROM */
 	writel(IOMUX_SPI2_CSCLK, &rk3288_grf->iomux_spi2csclk);
diff --git a/src/mainboard/google/veyron_mighty/mainboard.c b/src/mainboard/google/veyron_mighty/mainboard.c
index dd22748..c7d51cc 100644
--- a/src/mainboard/google/veyron_mighty/mainboard.c
+++ b/src/mainboard/google/veyron_mighty/mainboard.c
@@ -72,7 +72,7 @@ static void configure_emmc(void)
 static void configure_codec(void)
 {
 	writel(IOMUX_I2C2, &rk3288_grf->iomux_i2c2);	/* CODEC I2C */
-	i2c_init(2, 400000);	/* CODEC I2C */
+	i2c_init(2, 400*KHz);				/* CODEC I2C */
 
 	writel(IOMUX_I2S, &rk3288_grf->iomux_i2s);
 	writel(IOMUX_I2SCLK, &rk3288_grf->iomux_i2sclk);
@@ -108,10 +108,6 @@ static void configure_vop(void)
 
 static void mainboard_init(device_t dev)
 {
-	setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL); /* PMIC I2C */
-	setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA); /* PMIC I2C */
-	i2c_init(0, 400000);	/* PMIC I2C */
-
 	gpio_output(GPIO_RESET, 0);
 
 	configure_usb();
diff --git a/src/mainboard/google/veyron_pinky/bootblock.c b/src/mainboard/google/veyron_pinky/bootblock.c
index 4536f31..5571d45 100644
--- a/src/mainboard/google/veyron_pinky/bootblock.c
+++ b/src/mainboard/google/veyron_pinky/bootblock.c
@@ -64,6 +64,7 @@ void bootblock_mainboard_init(void)
 
 	/* i2c1 for tpm */
 	writel(IOMUX_I2C1, &rk3288_grf->iomux_i2c1);
+	i2c_init(1, 400*KHz);
 
 	/* spi2 for firmware ROM */
 	writel(IOMUX_SPI2_CSCLK, &rk3288_grf->iomux_spi2csclk);
diff --git a/src/mainboard/google/veyron_pinky/mainboard.c b/src/mainboard/google/veyron_pinky/mainboard.c
index 4752547..0266965 100644
--- a/src/mainboard/google/veyron_pinky/mainboard.c
+++ b/src/mainboard/google/veyron_pinky/mainboard.c
@@ -103,7 +103,7 @@ static void configure_emmc(void)
 static void configure_codec(void)
 {
 	writel(IOMUX_I2C2, &rk3288_grf->iomux_i2c2);	/* CODEC I2C */
-	i2c_init(2, 400000);	/* CODEC I2C */
+	i2c_init(2, 400*KHz);				/* CODEC I2C */
 
 	writel(IOMUX_I2S, &rk3288_grf->iomux_i2s);
 	writel(IOMUX_I2SCLK, &rk3288_grf->iomux_i2sclk);
@@ -152,10 +152,6 @@ static void configure_vop(void)
 
 static void mainboard_init(device_t dev)
 {
-	setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL); /* PMIC I2C */
-	setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA); /* PMIC I2C */
-	i2c_init(0, 400000);	/* PMIC I2C */
-
 	gpio_output(GPIO_RESET, 0);
 
 	configure_usb();
diff --git a/src/mainboard/google/veyron_speedy/bootblock.c b/src/mainboard/google/veyron_speedy/bootblock.c
index 4536f31..5571d45 100644
--- a/src/mainboard/google/veyron_speedy/bootblock.c
+++ b/src/mainboard/google/veyron_speedy/bootblock.c
@@ -64,6 +64,7 @@ void bootblock_mainboard_init(void)
 
 	/* i2c1 for tpm */
 	writel(IOMUX_I2C1, &rk3288_grf->iomux_i2c1);
+	i2c_init(1, 400*KHz);
 
 	/* spi2 for firmware ROM */
 	writel(IOMUX_SPI2_CSCLK, &rk3288_grf->iomux_spi2csclk);
diff --git a/src/mainboard/google/veyron_speedy/mainboard.c b/src/mainboard/google/veyron_speedy/mainboard.c
index 73595d7..8efc65d 100644
--- a/src/mainboard/google/veyron_speedy/mainboard.c
+++ b/src/mainboard/google/veyron_speedy/mainboard.c
@@ -53,6 +53,7 @@ static void configure_sdmmc(void)
 	/* use sdmmc0 io, disable JTAG function */
 	writel(RK_CLRBITS(1 << 12), &rk3288_grf->soc_con0);
 
+	/* Note: these power rail definitions are copied in romstage.c */
 	rk808_configure_ldo(PMIC_BUS, 4, 3300); /* VCCIO_SD */
 	rk808_configure_ldo(PMIC_BUS, 5, 3300); /* VCC33_SD */
 
@@ -71,7 +72,7 @@ static void configure_emmc(void)
 static void configure_codec(void)
 {
 	writel(IOMUX_I2C2, &rk3288_grf->iomux_i2c2);	/* CODEC I2C */
-	i2c_init(2, 400000);	/* CODEC I2C */
+	i2c_init(2, 400*KHz);				/* CODEC I2C */
 
 	writel(IOMUX_I2S, &rk3288_grf->iomux_i2s);
 	writel(IOMUX_I2SCLK, &rk3288_grf->iomux_i2sclk);
@@ -97,10 +98,6 @@ static void configure_vop(void)
 
 static void mainboard_init(device_t dev)
 {
-	setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL); /* PMIC I2C */
-	setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA); /* PMIC I2C */
-	i2c_init(0, 400000);	/* PMIC I2C */
-
 	gpio_output(GPIO_RESET, 0);
 
 	configure_usb();
diff --git a/src/mainboard/google/veyron_speedy/romstage.c b/src/mainboard/google/veyron_speedy/romstage.c
index 958b4df..64a00a9 100644
--- a/src/mainboard/google/veyron_speedy/romstage.c
+++ b/src/mainboard/google/veyron_speedy/romstage.c
@@ -31,6 +31,7 @@
 #include <soc/clock.h>
 #include <soc/pwm.h>
 #include <soc/grf.h>
+#include <soc/rk808.h>
 #include <soc/tsadc.h>
 #include <stdlib.h>
 #include <symbols.h>
@@ -38,7 +39,7 @@
 #include <types.h>
 #include <vendorcode/google/chromeos/chromeos.h>
 
-#include "timer.h"
+#include "board.h"
 
 static void regulate_vdd_log(unsigned int mv)
 {
@@ -76,6 +77,12 @@ static void configure_l2ctlr(void)
 	write_l2ctlr(l2ctlr);
 }
 
+static void sdmmc_power_off(void)
+{
+	rk808_configure_ldo(PMIC_BUS, 4, 0); /* VCCIO_SD */
+	rk808_configure_ldo(PMIC_BUS, 5, 0); /* VCC33_SD */
+}
+
 void main(void)
 {
 	void *entry;
@@ -86,6 +93,9 @@ void main(void)
 	configure_l2ctlr();
 	tsadc_init();
 
+	/* Need to power cycle SD card to ensure it is properly reset. */
+	sdmmc_power_off();
+
 	/* vdd_log 1200mv is enough for ddr run 666Mhz */
 	regulate_vdd_log(1200);
 	timestamp_add_now(TS_BEFORE_INITRAM);



More information about the coreboot-gerrit mailing list