Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15561
-gerrit
commit 146dd7e9cfeda9530faebe266ffe264aa6905e07
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Jul 6 22:53:51 2016 -0500
mainboard/google/reef: add board_id() support
The board build version is provided by the EC on reef.
Provide the necessary functional support for coreboot
to differentiate the board versions.
BUG=chrome-os-partner:54959,chrome-os-partner:54960
BRANCH=None
TEST=Built and tested on reef.
Change-Id: I1b7e8b2f4142753cde736148ca9495bcc625f318
Signed-off-by: Aaron Durbin <adurbin(a)chromuim.org>
---
src/mainboard/google/reef/Makefile.inc | 2 ++
src/mainboard/google/reef/boardid.c | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/src/mainboard/google/reef/Makefile.inc b/src/mainboard/google/reef/Makefile.inc
index f8fbbf3..6db0f2f 100644
--- a/src/mainboard/google/reef/Makefile.inc
+++ b/src/mainboard/google/reef/Makefile.inc
@@ -2,7 +2,9 @@ bootblock-y += bootblock.c
bootblock-y += ec.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
+romstage-y += boardid.c
+ramstage-y += boardid.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += ec.c
ramstage-y += mainboard.c
diff --git a/src/mainboard/google/reef/boardid.c b/src/mainboard/google/reef/boardid.c
new file mode 100644
index 0000000..4eb9f48
--- /dev/null
+++ b/src/mainboard/google/reef/boardid.c
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Google Inc.
+ * Copyright (C) 2015 Intel Corporation
+ *
+ * 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.
+ */
+
+#include <boardid.h>
+#include <ec/google/chromeec/ec.h>
+
+uint8_t board_id(void)
+{
+ MAYBE_STATIC int id = -1;
+
+ if (id < 0)
+ id = google_chromeec_get_board_version();
+
+ return id;
+}
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15557
-gerrit
commit 6816e68e0994c1e1e0cd3e547d9a268eefcbcb35
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Jul 6 22:37:10 2016 -0500
lib/gpio: add pullup & pulldown gpio_base2_value() variants
Provide common implementations for gpio_base2_value() variants
which configure the gpio for internal pullups and pulldowns.
BUG=chrome-os-partner:54949
BRANCH=None
TEST=Built and used on reef for memory config.
Change-Id: I9be8813328e99d28eb4145501450caab25d51f37
Signed-off-by: Aaron Durbin <adurbin(a)chromuim.org>
---
src/include/gpio.h | 5 +++++
src/lib/gpio.c | 35 +++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/include/gpio.h b/src/include/gpio.h
index 69a0828..3a8951c 100644
--- a/src/include/gpio.h
+++ b/src/include/gpio.h
@@ -56,8 +56,13 @@ uint16_t gpio_acpi_pin(gpio_t gpio);
*
* gpio[]: pin positions to read. gpio[0] is less significant than gpio[1].
* num_gpio: number of pins to read.
+ *
+ * There are also pulldown and pullup variants which default each gpio to
+ * be configured with an internal pulldown and pullup, respectively.
*/
int gpio_base2_value(gpio_t gpio[], int num_gpio);
+int gpio_pulldown_base2_value(gpio_t gpio[], int num_gpio);
+int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio);
/*
* Read the value presented by the set of GPIOs, when each pin is interpreted
diff --git a/src/lib/gpio.c b/src/lib/gpio.c
index 81d6f6b..03cc455 100644
--- a/src/lib/gpio.c
+++ b/src/lib/gpio.c
@@ -19,13 +19,10 @@
#include <delay.h>
#include <gpio.h>
-int gpio_base2_value(gpio_t gpio[], int num_gpio)
+static int _gpio_base2_value(gpio_t gpio[], int num_gpio)
{
int i, result = 0;
- for (i = 0; i < num_gpio; i++)
- gpio_input(gpio[i]);
-
/* Wait until signals become stable */
udelay(10);
@@ -35,6 +32,36 @@ int gpio_base2_value(gpio_t gpio[], int num_gpio)
return result;
}
+int gpio_base2_value(gpio_t gpio[], int num_gpio)
+{
+ int i;
+
+ for (i = 0; i < num_gpio; i++)
+ gpio_input(gpio[i]);
+
+ return _gpio_base2_value(gpio, num_gpio);
+}
+
+int gpio_pulldown_base2_value(gpio_t gpio[], int num_gpio)
+{
+ int i;
+
+ for (i = 0; i < num_gpio; i++)
+ gpio_input_pulldown(gpio[i]);
+
+ return _gpio_base2_value(gpio, num_gpio);
+}
+
+int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio)
+{
+ int i;
+
+ for (i = 0; i < num_gpio; i++)
+ gpio_input_pullup(gpio[i]);
+
+ return _gpio_base2_value(gpio, num_gpio);
+}
+
int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first)
{
/*