summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/poppy/ramstage.c2
-rw-r--r--src/mainboard/google/poppy/variants/baseboard/gpio.c8
-rw-r--r--src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h3
-rw-r--r--src/mainboard/google/poppy/variants/nami/gpio.c31
-rw-r--r--src/mainboard/google/poppy/variants/nami/include/variant/sku.h24
-rw-r--r--src/mainboard/google/poppy/variants/nami/mainboard.c12
6 files changed, 70 insertions, 10 deletions
diff --git a/src/mainboard/google/poppy/ramstage.c b/src/mainboard/google/poppy/ramstage.c
index 5ef245180b..c038b4186e 100644
--- a/src/mainboard/google/poppy/ramstage.c
+++ b/src/mainboard/google/poppy/ramstage.c
@@ -25,6 +25,8 @@ void mainboard_silicon_init_params(FSP_SIL_UPD *params)
variant_devtree_update();
pads = variant_gpio_table(&num);
gpio_configure_pads(pads, num);
+ pads = variant_sku_gpio_table(&num);
+ gpio_configure_pads(pads, num);
}
void __attribute__((weak)) variant_devtree_update(void)
diff --git a/src/mainboard/google/poppy/variants/baseboard/gpio.c b/src/mainboard/google/poppy/variants/baseboard/gpio.c
index daa9004ea8..2fea253624 100644
--- a/src/mainboard/google/poppy/variants/baseboard/gpio.c
+++ b/src/mainboard/google/poppy/variants/baseboard/gpio.c
@@ -384,6 +384,14 @@ const struct pad_config * __attribute__((weak))
return early_gpio_table;
}
+/* override specific gpio by sku id */
+const struct pad_config * __attribute__((weak))
+ variant_sku_gpio_table(size_t *num)
+{
+ *num = 0;
+ return NULL;
+}
+
static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME),
CROS_GPIO_WP_AH(GPIO_PCH_WP, CROS_GPIO_DEVICE_NAME),
diff --git a/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h
index e051c735c1..e8a9b47ad1 100644
--- a/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h
@@ -28,6 +28,8 @@ const struct pad_config *variant_gpio_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);
const struct cros_gpio *variant_cros_gpios(size_t *num);
+/* Config gpio by different sku id */
+const struct pad_config *variant_sku_gpio_table(size_t *num);
enum memory_type {
MEMORY_LPDDR3,
@@ -51,6 +53,7 @@ struct memory_params {
void variant_memory_params(struct memory_params *p);
int variant_memory_sku(void);
void variant_devtree_update(void);
+uint16_t variant_board_sku(void);
struct nhlt;
void variant_nhlt_init(struct nhlt *nhlt);
diff --git a/src/mainboard/google/poppy/variants/nami/gpio.c b/src/mainboard/google/poppy/variants/nami/gpio.c
index 71e4cf7423..061c3115c3 100644
--- a/src/mainboard/google/poppy/variants/nami/gpio.c
+++ b/src/mainboard/google/poppy/variants/nami/gpio.c
@@ -16,6 +16,7 @@
#include <baseboard/gpio.h>
#include <baseboard/variants.h>
#include <commonlib/helpers.h>
+#include <variant/sku.h>
/* Pad configuration in ramstage */
/* Leave eSPI pins untouched from default settings */
@@ -194,8 +195,6 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_NC(GPP_D15),
/* D16 : ISH_UART0_CTS# ==> NC */
PAD_CFG_NC(GPP_D16),
- /* D17 : DMIC_CLK1 ==> SOC_DMIC_CLK1 */
- PAD_CFG_NF(GPP_D17, NONE, DEEP, NF1),
/* D18 : DMIC_DATA1 ==> SOC_DMIC_DATA1 */
PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1),
/* D19 : DMIC_CLK0 ==> SOC_DMIC_CLK0 */
@@ -386,3 +385,31 @@ const struct pad_config *variant_early_gpio_table(size_t *num)
*num = ARRAY_SIZE(early_gpio_table);
return early_gpio_table;
}
+
+static const struct pad_config nami_default_sku_gpio_table[] = {
+ /* D17 : DMIC_CLK1 ==> SOC_DMIC_CLK1 */
+ PAD_CFG_NF(GPP_D17, NONE, DEEP, NF1),
+};
+
+static const struct pad_config vayne_sku_gpio_table[] = {
+ /* D17 : DMIC_CLK1 ==> NC */
+ PAD_CFG_NC(GPP_D17),
+};
+
+const struct pad_config *variant_sku_gpio_table(size_t *num)
+{
+ uint16_t sku_id = variant_board_sku();
+ const struct pad_config *board_gpio_tables;
+ switch (sku_id) {
+ case SKU_1_VAYNE:
+ case SKU_2_VAYNE:
+ *num = ARRAY_SIZE(vayne_sku_gpio_table);
+ board_gpio_tables = vayne_sku_gpio_table;
+ break;
+ default:
+ *num = ARRAY_SIZE(nami_default_sku_gpio_table);
+ board_gpio_tables = nami_default_sku_gpio_table;
+ break;
+ }
+ return board_gpio_tables;
+}
diff --git a/src/mainboard/google/poppy/variants/nami/include/variant/sku.h b/src/mainboard/google/poppy/variants/nami/include/variant/sku.h
new file mode 100644
index 0000000000..b72f3497fe
--- /dev/null
+++ b/src/mainboard/google/poppy/variants/nami/include/variant/sku.h
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 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.
+ */
+
+#ifndef __MAINBOARD_SKU_H__
+#define __MAINBOARD_SKU_H__
+
+#define SKU_UNKNOWN 0xFFFF
+#define SKU_0_NAMI 0x3A7B
+#define SKU_1_VAYNE 0x3A63
+#define SKU_2_VAYNE 0x3A7F
+
+#endif /* __MAINBOARD_SKU_H__ */
diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c
index e2bc8958a3..f166088a8e 100644
--- a/src/mainboard/google/poppy/variants/nami/mainboard.c
+++ b/src/mainboard/google/poppy/variants/nami/mainboard.c
@@ -22,13 +22,9 @@
#include <smbios.h>
#include <soc/ramstage.h>
#include <string.h>
+#include <variant/sku.h>
-#define SKU_UNKNOWN 0xFFFF
-#define SKU_0_NAMI 0x3A7B
-#define SKU_1_VAYNE 0x3A63
-#define SKU_2_VAYNE 0x3A7F
-
-static uint16_t board_sku_id(void)
+uint16_t variant_board_sku(void)
{
static int sku_id = -1;
uint32_t id;
@@ -43,7 +39,7 @@ static uint16_t board_sku_id(void)
void variant_devtree_update(void)
{
/* Override dev tree settings per board */
- uint16_t sku_id = board_sku_id();
+ uint16_t sku_id = variant_board_sku();
device_t root = SA_DEV_ROOT;
config_t *cfg = root->chip_info;
switch (sku_id) {
@@ -59,7 +55,7 @@ const char *smbios_mainboard_sku(void)
{
static char sku_str[9]; /* sku{0..65535} (basically up to FFFF) */
- snprintf(sku_str, sizeof(sku_str), "sku%d", board_sku_id());
+ snprintf(sku_str, sizeof(sku_str), "sku%d", variant_board_sku());
return sku_str;
}