summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorTyler Wang <tyler.wang@quanta.corp-partner.google.com>2023-09-05 14:21:19 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-09-15 13:45:24 +0000
commit77d8e0bec69f67e2eea84aeeee64abe7b470ef71 (patch)
treeac22854b1ef7dd8bc383310ad156294e1df195e1 /src/mainboard
parentc152006aa6c9e61c7ab76e973601ffa3fd06a525 (diff)
mb/google/rex/var/karis: Disable stylus/FP module based on fw_config
There are going to be skus without stylus and fingerprint module. Disable stylus and fingerprint module based on fw_config. BUG=b:290689824 TEST=emerge-rex coreboot Change-Id: I047aae06c4a915d0392edc836757b882a261c178 Signed-off-by: Tyler Wang <tyler.wang@quanta.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/77647 Reviewed-by: Kapil Porwal <kapilporwal@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/rex/variants/karis/Makefile.inc3
-rw-r--r--src/mainboard/google/rex/variants/karis/fw_config.c45
2 files changed, 46 insertions, 2 deletions
diff --git a/src/mainboard/google/rex/variants/karis/Makefile.inc b/src/mainboard/google/rex/variants/karis/Makefile.inc
index a49954cc35..263854084b 100644
--- a/src/mainboard/google/rex/variants/karis/Makefile.inc
+++ b/src/mainboard/google/rex/variants/karis/Makefile.inc
@@ -1,7 +1,6 @@
## SPDX-License-Identifier: GPL-2.0-only
bootblock-y += gpio.c
-
romstage-y += gpio.c
-
+ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-y += gpio.c
diff --git a/src/mainboard/google/rex/variants/karis/fw_config.c b/src/mainboard/google/rex/variants/karis/fw_config.c
new file mode 100644
index 0000000000..7211d8ae76
--- /dev/null
+++ b/src/mainboard/google/rex/variants/karis/fw_config.c
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <baseboard/variants.h>
+#include <bootstate.h>
+#include <console/console.h>
+#include <fw_config.h>
+#include <gpio.h>
+
+#define GPIO_PADBASED_OVERRIDE(b, a) gpio_padbased_override(b, a, ARRAY_SIZE(a))
+
+static const struct pad_config fp_disable_pads[] = {
+ /* GPP_B11 : [] ==> EN_FP_PWR */
+ PAD_NC(GPP_B11, NONE),
+ /* GPP_C22 : [] ==> SOC_FP_BOOT0 */
+ PAD_NC(GPP_C22, NONE),
+ /* GPP_C23 : [] ==> FP_RST_ODL */
+ PAD_NC(GPP_C23, NONE),
+ /* GPP_E10 : [] ==> SOC_FPMCU_INT_L */
+ PAD_NC(GPP_E10, NONE),
+ /* GPP_F11 : GSP1_SOC_CLK_R */
+ PAD_NC(GPP_F11, NONE),
+ /* GPP_F12 : GSPI1_SOC_DO_FPMCU_DI_R */
+ PAD_NC(GPP_F12, NONE),
+ /* GPP_F13 : GSPI1_SOC_DI_FPMCU_DO_LS_R */
+ PAD_NC(GPP_F13, NONE),
+ /* GPP_F17 : [] ==> GSPI1_SOC_CS_L */
+ PAD_NC(GPP_F17, NONE),
+};
+
+static const struct pad_config stylus_disable_pads[] = {
+ /* GPP_E04 : SOC_PEN_DETECT */
+ PAD_NC(GPP_E04, NONE),
+};
+
+void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
+{
+ if (fw_config_probe(FW_CONFIG(STYLUS, STYLUS_ABSENT))) {
+ printk(BIOS_INFO, "Configure GPIOs for no stylus.\n");
+ GPIO_PADBASED_OVERRIDE(padbased_table, stylus_disable_pads);
+ }
+ if (fw_config_probe(FW_CONFIG(FP_MCU, FP_ABSENT))) {
+ printk(BIOS_INFO, "Configure GPIOs for no FP module.\n");
+ GPIO_PADBASED_OVERRIDE(padbased_table, fp_disable_pads);
+ }
+}