Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9403
-gerrit
commit 9374d4290a3ff040bad3dde51d7d85e3143a0e17
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Wed Oct 22 17:39:24 2014 -0700
chromeos: add another VPD access API
The new API allows to find VPD objects in the VPD cache. There is no
need for the caller to allocate or free the per object memory.
The existing API (cros_vpd_gets) now uses the new function as well.
BRANCH=storm
BUG=chrome-os-partner:32611
TEST=verified that MAC addresses still show up in the device tree on
the booted storm device
Change-Id: Id06be315981cdaa2285fc1ec61b96b62b1178a4b
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 99a34344448a5521cee8ad3918aefb1fde28417d
Original-Change-Id: I6c0b11bb844d6235930124d642da632319142d88
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/225258
Original-Reviewed-by: Hung-Te Lin <hungte(a)chromium.org>
---
src/vendorcode/google/chromeos/cros_vpd.c | 26 +++++++++++++++++++++-----
src/vendorcode/google/chromeos/cros_vpd.h | 16 ++++++++++++++++
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/src/vendorcode/google/chromeos/cros_vpd.c b/src/vendorcode/google/chromeos/cros_vpd.c
index df2b5bf..c0e4830 100644
--- a/src/vendorcode/google/chromeos/cros_vpd.c
+++ b/src/vendorcode/google/chromeos/cros_vpd.c
@@ -99,7 +99,7 @@ static int vpd_gets_callback(const uint8_t *key, int32_t key_len,
return VPD_FAIL;
}
-char *cros_vpd_gets(const char *key, char *buffer, int size)
+const void *cros_vpd_find(const char *key, int *size)
{
uint8_t *vpd_address = NULL;
int32_t vpd_size = 0;
@@ -121,10 +121,26 @@ char *cros_vpd_gets(const char *key, char *buffer, int size)
if (!arg.matched)
return NULL;
- if (size < arg.value_len + 1)
- size = arg.value_len + 1;
- memcpy(buffer, arg.value, size - 1);
- buffer[size - 1] = '\0';
+ *size = arg.value_len;
+ return arg.value;
+}
+
+char *cros_vpd_gets(const char *key, char *buffer, int size)
+{
+ const void *string_address;
+ int string_size;
+
+ string_address = cros_vpd_find(key, &string_size);
+
+ if (!string_address)
+ return NULL;
+
+ if (size > (string_size + 1)) {
+ strcpy(buffer, string_address);
+ } else {
+ memcpy(buffer, string_address, size - 1);
+ buffer[size - 1] = '\0';
+ }
return buffer;
}
diff --git a/src/vendorcode/google/chromeos/cros_vpd.h b/src/vendorcode/google/chromeos/cros_vpd.h
index 674dbf6..19658c2 100644
--- a/src/vendorcode/google/chromeos/cros_vpd.h
+++ b/src/vendorcode/google/chromeos/cros_vpd.h
@@ -18,4 +18,20 @@
*/
char *cros_vpd_gets(const char *key, char *buffer, int size);
+/*
+ * Find VPD value by key.
+ *
+ * Searches for a VPD entry in the VPD cache. If found, places the size of the
+ * entry into '*size' and returns the pointer to the entry data.
+ *
+ * This function presumes that VPD is cached in DRAM (which is the case in the
+ * current implementation) and as such returns the pointer into the cache. The
+ * user is not supposed to modify the data, and does not have to free the
+ * memory.
+ *
+ * Returns NULL if key is not found.
+ */
+
+const void *cros_vpd_find(const char *key, int *size);
+
#endif /* __CROS_VPD_H__ */
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9401
-gerrit
commit 9ce4d8c415b864bc4f87ca1278b70b148d5f800b
Author: Julius Werner <jwerner(a)chromium.org>
Date: Wed Sep 24 15:40:49 2014 -0700
gpio: Remove non-ternary tristate mode, make ternaries easier
The function to read board IDs from tristate GPIOs currently supports
two output modes: a normal base-3 integer, or a custom format where
every two bits represent one tristate pin. Each board decides which
representation to use on its own, which is inconsistent and provides
another possible gotcha to trip over when reading unfamiliar code.
The two-bits-per-pin format creates the additional problem that a
complete list of IDs (such as some boards use to build board-ID tables)
necessarily has "holes" in them (since 0b11 does not correspond to a
possible pin state), which makes them extremely tricky to write, read
and expand. It's also very unintuitive in my opinion, although it was
intended to make it easier to read individual pin states from a hex
representation.
This patch switches all boards over to base-3 and removes the other
format to improve consistency. The tristate reading function will just
print the pin states as they are read to make it easier to debug them,
and we add a new BASE3() macro that can generate ternary numbers from
pin states. Also change the order of all static initializers of board ID
pin lists to write the most significant bit first, hoping that this can
help clear up confusion about the endianness of the pins.
CQ-DEPEND=CL:219902
BUG=None
TEST=Booted on a Nyan_Blaze (with board ID 1, unfortunately the only one
I have). Compiled on Daisy, Peach_Pit, Nyan, Nyan_Big, Nyan_Blaze, Rush,
Rush_Ryu, Storm, Veryon_Pinky and Falco for good measure.
Change-Id: I3ce5a0829f260db7d7df77e6788c2c6d13901b8f
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 2fa9545ac431c9af111ee4444d593ee4cf49554d
Original-Change-Id: I6133cdaf01ed6590ae07e88d9e85a33dc013211a
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/219901
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/base3.h | 48 +++++++++++++++++++++++++++++
src/include/gpio.h | 14 +++------
src/lib/tristate_gpios.c | 15 +++++----
src/mainboard/google/nyan_big/boardid.c | 8 ++---
src/mainboard/google/nyan_blaze/boardid.c | 8 ++---
src/mainboard/google/rush_ryu/boardid.c | 46 ++++++++-------------------
src/mainboard/google/storm/boardid.c | 4 +--
src/mainboard/google/veyron_pinky/boardid.c | 10 ++----
8 files changed, 87 insertions(+), 66 deletions(-)
diff --git a/src/include/base3.h b/src/include/base3.h
new file mode 100644
index 0000000..e92cc8b
--- /dev/null
+++ b/src/include/base3.h
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __SRC_INCLUDE_BASE3_H__
+#define __SRC_INCLUDE_BASE3_H__
+
+/* We translate a floating pin (Z) as the ternary digit 2. */
+#define Z 2
+
+/*
+ * This provides a variadic macro BASE3() that can be used to translate a set of
+ * pin states into its base-3 integer representation, even in the context of a
+ * static initializer. You can call it with any number of up to 6 arguments,
+ * e.g. BASE3(1, Z) -> 5 or BASE3(0, Z, 1, 0) -> 21. Just don't look too closely
+ * at how the sausage is made. (Pay extra attention to typos when expanding it!)
+ */
+#define _BASE3_IMPL_1(arg0, arg1, arg2, arg3, arg4, arg5) arg0
+#define _BASE3_IMPL_2(arg0, arg1, arg2, arg3, arg4, arg5) \
+ (arg1 + (3 * _BASE3_IMPL_1(arg0, arg1, arg2, arg3, arg4, arg5)))
+#define _BASE3_IMPL_3(arg0, arg1, arg2, arg3, arg4, arg5) \
+ (arg2 + (3 * _BASE3_IMPL_2(arg0, arg1, arg2, arg3, arg4, arg5)))
+#define _BASE3_IMPL_4(arg0, arg1, arg2, arg3, arg4, arg5) \
+ (arg3 + (3 * _BASE3_IMPL_3(arg0, arg1, arg2, arg3, arg4, arg5)))
+#define _BASE3_IMPL_5(arg0, arg1, arg2, arg3, arg4, arg5) \
+ (arg4 + (3 * _BASE3_IMPL_4(arg0, arg1, arg2, arg3, arg4, arg5)))
+#define _BASE3_IMPL_6(arg0, arg1, arg2, arg3, arg4, arg5) \
+ (arg5 + (3 * _BASE3_IMPL_5(arg0, arg1, arg2, arg3, arg4, arg5)))
+#define _BASE3_IMPL(arg0, arg1, arg2, arg3, arg4, arg5, NARGS, ...) \
+ _BASE3_IMPL##NARGS(arg0, arg1, arg2, arg3, arg4, arg5)
+#define BASE3(...) _BASE3_IMPL(__VA_ARGS__, _6, _5, _4, _3, _2, _1)
+
+#endif /* __SRC_INCLUDE_BASE3_H__ */
diff --git a/src/include/gpio.h b/src/include/gpio.h
index af06697..b2a341d 100644
--- a/src/include/gpio.h
+++ b/src/include/gpio.h
@@ -36,17 +36,13 @@ void gpio_output(gpio_t gpio, int value);
/*
* Read the value presented by the set of GPIOs, when each pin is interpreted
- * as a number in 0..2 range depending on the external pullup situation.
+ * as a base-3 digit (LOW = 0, HIGH = 1, Z/floating = 2).
+ * Example: X1 = Z, X2 = 1 -> gpio_get_tristates({GPIO(X1), GPIO(X2)}) = 5
+ * BASE3() from <base3.h> can generate numbers to compare the result to.
*
- * Depending on the third parameter, the return value is either a set of two
- * bit fields, each representing one GPIO value, or a number where each GPIO is
- * included multiplied by 3^gpio_num, resulting in a true tertiary value.
- *
- * gpio[]: pin positions to read. little-endian (less significant value first).
+ * gpio[]: pin positions to read. gpio[0] is less significant than gpio[1].
* num_gpio: number of pins to read.
- * tertiary: 1: pins are interpreted as a quad coded tertiary.
- * 0: pins are interpreted as a set of two bit fields.
*/
-int gpio_get_tristates(gpio_t gpio[], int num_gpio, int tertiary);
+int gpio_get_tristates(gpio_t gpio[], int num_gpio);
#endif /* __SRC_INCLUDE_GPIO_H__ */
diff --git a/src/lib/tristate_gpios.c b/src/lib/tristate_gpios.c
index 5ee5580..0967a8f 100644
--- a/src/lib/tristate_gpios.c
+++ b/src/lib/tristate_gpios.c
@@ -17,10 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <base3.h>
+#include <console/console.h>
#include <delay.h>
#include <gpio.h>
-int gpio_get_tristates(gpio_t gpio[], int num_gpio, int tertiary)
+int gpio_get_tristates(gpio_t gpio[], int num_gpio)
{
/*
* GPIOs which are tied to stronger external pull up or pull down
@@ -31,6 +33,7 @@ int gpio_get_tristates(gpio_t gpio[], int num_gpio, int tertiary)
* internally pulled to.
*/
+ static const char tristate_char[] = {[0] = '0', [1] = '1', [Z] = 'Z'};
int temp;
int index;
int id = 0;
@@ -62,14 +65,14 @@ int gpio_get_tristates(gpio_t gpio[], int num_gpio, int tertiary)
* 1: pull up
* 2: floating
*/
+ printk(BIOS_DEBUG, "Reading tristate GPIOs: ");
for (index = num_gpio - 1; index >= 0; --index) {
- if (tertiary)
- id *= 3;
- else
- id <<= 2;
temp = gpio_get(gpio[index]);
- id += ((value[index] ^ temp) << 1) | temp;
+ temp |= ((value[index] ^ temp) << 1);
+ printk(BIOS_DEBUG, "%c ", tristate_char[temp]);
+ id = (id * 3) + temp;
}
+ printk(BIOS_DEBUG, "= %d\n", id);
/* Disable pull up / pull down to conserve power */
for (index = 0; index < num_gpio; ++index)
diff --git a/src/mainboard/google/nyan_big/boardid.c b/src/mainboard/google/nyan_big/boardid.c
index 00f646d..b420f5a 100644
--- a/src/mainboard/google/nyan_big/boardid.c
+++ b/src/mainboard/google/nyan_big/boardid.c
@@ -25,13 +25,13 @@
uint8_t board_id(void)
{
static int id = -1;
+ gpio_t gpio[] = {[3] = GPIO(X4), [2] = GPIO(X1), /* X4 is MSB */
+ [1] = GPIO(T1), [0] = GPIO(Q3),}; /* Q3 is LSB */
if (id < 0) {
- gpio_t gpio[] = {GPIO(Q3), GPIO(T1), GPIO(X1), GPIO(X4)};
+ id = gpio_get_tristates(gpio, ARRAY_SIZE(gpio));
- id = gpio_get_tristates(gpio, ARRAY_SIZE(gpio), 0);
-
- printk(BIOS_SPEW, "Board TRISTATE ID: %#x.\n", id);
+ printk(BIOS_SPEW, "Board TRISTATE ID: %d.\n", id);
}
return id;
diff --git a/src/mainboard/google/nyan_blaze/boardid.c b/src/mainboard/google/nyan_blaze/boardid.c
index 00f646d..b420f5a 100644
--- a/src/mainboard/google/nyan_blaze/boardid.c
+++ b/src/mainboard/google/nyan_blaze/boardid.c
@@ -25,13 +25,13 @@
uint8_t board_id(void)
{
static int id = -1;
+ gpio_t gpio[] = {[3] = GPIO(X4), [2] = GPIO(X1), /* X4 is MSB */
+ [1] = GPIO(T1), [0] = GPIO(Q3),}; /* Q3 is LSB */
if (id < 0) {
- gpio_t gpio[] = {GPIO(Q3), GPIO(T1), GPIO(X1), GPIO(X4)};
+ id = gpio_get_tristates(gpio, ARRAY_SIZE(gpio));
- id = gpio_get_tristates(gpio, ARRAY_SIZE(gpio), 0);
-
- printk(BIOS_SPEW, "Board TRISTATE ID: %#x.\n", id);
+ printk(BIOS_SPEW, "Board TRISTATE ID: %d.\n", id);
}
return id;
diff --git a/src/mainboard/google/rush_ryu/boardid.c b/src/mainboard/google/rush_ryu/boardid.c
index ba3a4be..5b4c1cd 100644
--- a/src/mainboard/google/rush_ryu/boardid.c
+++ b/src/mainboard/google/rush_ryu/boardid.c
@@ -17,35 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <base3.h>
#include <boardid.h>
#include <console/console.h>
#include <stdlib.h>
#include "gpio.h"
-/*
- * +------------------+---------+
- * | BD_ID_STRAP[1:0] | PHASE |
- * +------------------+---------+
- * | 00 | PROTO0 |
- * +------------------+---------+
- * | 01 | PROTO1 |
- * +------------------+---------+
- * | 0Z | EVT |
- * +------------------+---------+
- * | 10 | DVT |
- * +------------------+---------+
- * | 11 | PVT |
- * +------------------+---------+
- * | 1Z | MP |
- * +------------------+---------+
- * | Z0 | |
- * +------------------+---------+
- * | Z1 | |
- * +------------------+---------+
- * | ZZ | |
- * +------------------+---------+
- */
struct id_to_str {
const char *str;
int tri_state_value;
@@ -53,15 +31,15 @@ struct id_to_str {
};
static const struct id_to_str bdid_map[] = {
- { "PROTO 0", 0x00, BOARD_ID_PROTO_0 },
- { "PROTO 1", 0x01, BOARD_ID_PROTO_1 },
- { "EVT", 0x02, BOARD_ID_EVT },
- { "DVT", 0x04, BOARD_ID_DVT },
- { "PVT", 0x05, BOARD_ID_PVT },
- { "MP", 0x06, BOARD_ID_MP },
- { "Z0", 0x08, -1 },
- { "Z1", 0x09, -1 },
- { "ZZ", 0x0a, -1 },
+ { "PROTO 0", BASE3(0, 0), BOARD_ID_PROTO_0 },
+ { "PROTO 1", BASE3(0, 1), BOARD_ID_PROTO_1 },
+ { "EVT", BASE3(0, Z), BOARD_ID_EVT },
+ { "DVT", BASE3(1, 0), BOARD_ID_DVT },
+ { "PVT", BASE3(1, 1), BOARD_ID_PVT },
+ { "MP", BASE3(1, Z), BOARD_ID_MP },
+ { "Z0", BASE3(Z, 0), -1 },
+ { "Z1", BASE3(Z, 1), -1 },
+ { "ZZ", BASE3(Z, Z), -1 },
};
uint8_t board_id(void)
@@ -72,9 +50,9 @@ uint8_t board_id(void)
const char *idstr = "Unknown";
int i;
int tristate_id;
- gpio_t gpio[] = { BD_ID0, BD_ID1 };
+ gpio_t gpio[] = {[1] = BD_ID1, [0] = BD_ID0}; /* ID0 is LSB */
- tristate_id = gpio_get_tristates(gpio, ARRAY_SIZE(gpio), 0);
+ tristate_id = gpio_get_tristates(gpio, ARRAY_SIZE(gpio));
for (i = 0; i < ARRAY_SIZE(bdid_map); i++) {
if (tristate_id != bdid_map[i].tri_state_value)
diff --git a/src/mainboard/google/storm/boardid.c b/src/mainboard/google/storm/boardid.c
index 878598b..c32567e 100644
--- a/src/mainboard/google/storm/boardid.c
+++ b/src/mainboard/google/storm/boardid.c
@@ -42,10 +42,10 @@ static int board_id_value = -1;
static uint8_t get_board_id(void)
{
uint8_t bid;
- gpio_t hw_rev_gpios[] = {29, 30, 68};
+ gpio_t hw_rev_gpios[] = {[2] = 68, [1] = 30, [0] = 29}; /* 29 is LSB */
int offset = 19;
- bid = gpio_get_tristates(hw_rev_gpios, ARRAY_SIZE(hw_rev_gpios), 1);
+ bid = gpio_get_tristates(hw_rev_gpios, ARRAY_SIZE(hw_rev_gpios));
bid = (bid + offset) % 27;
printk(BIOS_INFO, "Board ID %d\n", bid);
diff --git a/src/mainboard/google/veyron_pinky/boardid.c b/src/mainboard/google/veyron_pinky/boardid.c
index d8f4a3d..8d3e183 100644
--- a/src/mainboard/google/veyron_pinky/boardid.c
+++ b/src/mainboard/google/veyron_pinky/boardid.c
@@ -25,12 +25,8 @@
uint8_t board_id(void)
{
static int id = -1;
- static const gpio_t pins[] = {
- { .port = 2, .bank = GPIO_A, .idx = 0 },
- { .port = 2, .bank = GPIO_A, .idx = 1 },
- { .port = 2, .bank = GPIO_A, .idx = 2 },
- { .port = 2, .bank = GPIO_A, .idx = 7 },
- };
+ static const gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
+ [1] = GPIO(2, A, 1), [0] = GPIO(2, A, 0)}; /* GPIO2_A0 is LSB */
if (id < 0) {
int i;
@@ -40,7 +36,7 @@ uint8_t board_id(void)
gpio_input(pins[i]);
id |= gpio_get(pins[i]) << i;
}
- printk(BIOS_SPEW, "Board ID: %#x.\n", id);
+ printk(BIOS_SPEW, "Board ID: %d.\n", id);
}
return id;
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9399
-gerrit
commit 3fbfecf856dc6c6697dba8d9f577ec2d0cf7f009
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Thu Oct 16 13:26:59 2014 -0700
storm: retrieve MAC address from VPD
Retrieving MAC address from VPD should be the board responsibility,
add a call to the recently introduced function.
BRANCH=storm
BUG=chromium:417117
TEST=verified that MAC addresses still show up in the device tree on
storm
Change-Id: Ib8ddc88ccd859e0b36e65aaaeb5c9473077c8c02
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 285cb256e619ef41c7f11680b3fa5310b1d93cf1
Original-Change-Id: I3913b10a425d8e8621b832567871ed4861756381
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/223797
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/mainboard/google/storm/mainboard.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/mainboard/google/storm/mainboard.c b/src/mainboard/google/storm/mainboard.c
index acadce5..552f968 100644
--- a/src/mainboard/google/storm/mainboard.c
+++ b/src/mainboard/google/storm/mainboard.c
@@ -136,6 +136,11 @@ void lb_board(struct lb_header *header)
dma->size = sizeof(*dma);
dma->range_start = (uintptr_t)_dma_coherent;
dma->range_size = _dma_coherent_size;
+
+#if IS_ENABLED(CONFIG_CHROMEOS)
+ /* Retrieve the switch interface MAC addressses. */
+ lb_table_add_macs_from_vpd(header);
+#endif
}
static int read_gpio(gpio_t gpio_num)
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9408
-gerrit
commit 37465b5014c6fa31b1df799adfe54bfcb202c97b
Author: huang lin <hl(a)rock-chips.com>
Date: Fri Oct 31 16:40:42 2014 +0800
rk3288: slowly raise to max cpu voltage to prevent overshoot
slowly raise to max cpu voltage to prevent overshoot,
and in our experience,when cpu run in 1.8GHz,the
vdd_cpu must up to 1.4V
BUG=chrome-os-partner:32716, chrome-os-partner:31896
TEST=Boot on veyron_pinky rev2,check the rk808 buck1 voltage 1400mv
and measure the overshoot is 1440mv
Change-Id: I759840bd8cf57a5589bf1862d04803f80f804164
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 567f616ff091883ed3275b407859c9399db981b2
Original-Change-Id: I9bb739b49ae4b4f7a60133fa38b0fe51b95c0d78
Original-Signed-off-by: huang lin <hl(a)rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/226753
Original-Reviewed-by: Doug Anderson <dianders(a)chromium.org>
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/mainboard/google/veyron_pinky/bootblock.c | 13 +++++++++++--
src/soc/rockchip/rk3288/rk808.c | 1 -
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/mainboard/google/veyron_pinky/bootblock.c b/src/mainboard/google/veyron_pinky/bootblock.c
index b34199d..99719c4 100644
--- a/src/mainboard/google/veyron_pinky/bootblock.c
+++ b/src/mainboard/google/veyron_pinky/bootblock.c
@@ -27,16 +27,25 @@
#include <soc/rk808.h>
#include <soc/spi.h>
#include <vendorcode/google/chromeos/chromeos.h>
+#include <delay.h>
#include "board.h"
void bootblock_mainboard_init(void)
{
- /* cpu frequency will up to 1.8GHz, so the buck1 must up to 1.3v */
+ /* cpu frequency will up to 1.8GHz,
+ * in our experience the buck1
+ * must up to 1.4v
+ */
setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL);
setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA);
i2c_init(PMIC_BUS, 400*KHz);
- rk808_configure_buck(PMIC_BUS, 1, 1300);
+
+ /* Slowly raise to max CPU voltage to prevent overshoot */
+ rk808_configure_buck(PMIC_BUS, 1, 1200);
+ udelay(175);/* Must wait for voltage to stabilize,2mV/us */
+ rk808_configure_buck(PMIC_BUS, 1, 1400);
+ udelay(100);/* Must wait for voltage to stabilize,2mV/us */
rkclk_configure_cpu();
/* i2c1 for tpm */
diff --git a/src/soc/rockchip/rk3288/rk808.c b/src/soc/rockchip/rk3288/rk808.c
index aa39b8d..fea64e5 100644
--- a/src/soc/rockchip/rk3288/rk808.c
+++ b/src/soc/rockchip/rk3288/rk808.c
@@ -98,5 +98,4 @@ void rk808_configure_buck(uint8_t bus, int buck, int millivolts)
}
rk808_clrsetbits(bus, buck_reg, 0x3f, vsel);
rk808_clrsetbits(bus, DCDC_EN, 0, 1 << (buck - 1));
- udelay(225);/* Must wait for voltage to stabilize */
}
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9409
-gerrit
commit e6e694fc0d45ae19038d8cd5c4bf8b6a33ee36be
Author: huang lin <hl(a)rock-chips.com>
Date: Fri Nov 7 10:56:35 2014 +0800
rk3288: don't log LAST_TSHUT bit
Since the LAST_THSUT bit is uncertain value when it cold-reboot,
we remove the printout about this status bit in coreboot.
BUG=chrome-os-partner:33521
TEST=Boot on veyron_pinky rev2
Change-Id: I3b9791ffdffeff0721e3d86378db6255c5abc9ea
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 16464d3229ad1001952ef1b50fe3e606d1583462
Original-Change-Id: I258750797e32c28f86e73a01eede005e890a6906
Original-Signed-off-by: huang lin <hl(a)rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/228391
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/soc/rockchip/rk3288/tsadc.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/soc/rockchip/rk3288/tsadc.c b/src/soc/rockchip/rk3288/tsadc.c
index b7d8e9d..a2d6ec4 100644
--- a/src/soc/rockchip/rk3288/tsadc.c
+++ b/src/soc/rockchip/rk3288/tsadc.c
@@ -88,11 +88,7 @@ void tsadc_init(void)
{
rkclk_configure_tsadc(TSADC_CLOCK_HZ);
- if (readl(&rk3288_tsadc->auto_con) & LAST_TSHUT) {
- printk(BIOS_WARNING, "last shutdown/rebot was caused "
- "by over-temperature hardware trigger!\n");
- setbits_le32(&rk3288_tsadc->auto_con, LAST_TSHUT);
- }
+ setbits_le32(&rk3288_tsadc->auto_con, LAST_TSHUT);
setbits_le32(&rk3288_tsadc->int_en,
TSHUT_CRU_EN_SRC2 | TSHUT_CRU_EN_SRC1 |