aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/glados/spd/spd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/google/glados/spd/spd.c')
-rw-r--r--src/mainboard/google/glados/spd/spd.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/mainboard/google/glados/spd/spd.c b/src/mainboard/google/glados/spd/spd.c
index 5ee12f5f57..1882fa7494 100644
--- a/src/mainboard/google/glados/spd/spd.c
+++ b/src/mainboard/google/glados/spd/spd.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <soc/gpio.h>
#include <soc/pei_data.h>
+#include <soc/pcr.h>
#include <soc/romstage.h>
#include "spd.h"
@@ -84,6 +85,42 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
char *spd_file;
size_t spd_file_len;
int spd_index;
+ int spd_gpio[4];
+
+ /*************************************************************
+ * FIXME: Remove when real GPIO support is ready.
+ */
+ GPIO_PAD gpio_set[4] = {
+ GPIO_LP_GPP_C12, /* PCH_MEM_CONFIG[0] */
+ GPIO_LP_GPP_C13, /* PCH_MEM_CONFIG[1] */
+ GPIO_LP_GPP_C14, /* PCH_MEM_CONFIG[2] */
+ GPIO_LP_GPP_C15, /* PCH_MEM_CONFIG[3] */
+ };
+ int index;
+
+ for (index = 0; index < ARRAY_SIZE(gpio_set); index++) {
+ u32 number = GPIO_GET_PAD_NUMBER(gpio_set[index]);
+ u32 cfgreg = 8 * number + R_PCH_PCR_GPIO_GPP_C_PADCFG_OFFSET;
+ /*
+ * Set GPIO mode and enable input
+ * Clear PMODE0 | PMODE1 | GPIORXDIS
+ */
+ u32 dw0mask = (1 << 10) | (1 << 11) | (1 << 9);
+ u32 dw0reg = 0;
+ pcr_andthenor32(PID_GPIOCOM1, cfgreg, ~dw0mask, dw0reg);
+
+ /* Read current input value */
+ pcr_read32(PID_GPIOCOM1, cfgreg, &dw0reg);
+ spd_gpio[index] = !!(dw0reg & (1 << 1));
+ }
+ /*************************************************************/
+
+ spd_index = (spd_gpio[3] << 3) | (spd_gpio[2] << 2) |
+ (spd_gpio[1] << 1) | spd_gpio[0];
+
+ printk(BIOS_DEBUG,
+ "SPD: index %d (GPP_C15=%d GPP_C14=%d GPP_C13=%d GPP_C12=%d)\n",
+ spd_index, spd_gpio[3], spd_gpio[2], spd_gpio[1], spd_gpio[0]);
/* Load SPD data from CBFS */
spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
@@ -95,13 +132,10 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
if (spd_file_len < SPD_LEN)
die("Missing SPD data.");
- /* Add board SKU detection here. Currently we only support one. */
- spd_index = 0;
-
/* Make sure we did not overrun the buffer */
if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
- printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
- spd_index = 0;
+ printk(BIOS_ERR, "SPD index override to 1 - old hardware?\n");
+ spd_index = 1;
}
/* Assume same memory in both channels */