mb/google/brox: Disable Touchscreen for hardware board version 1

On board version 1 and later, touchscreen is not stuffed. Hence
configure the relevant GPIOs as not connected, disable the concerned I2C
bus in the devicetree as well as SoC chip config for board version 1.

BUG=b:347333500
TEST=Build Brox BIOS image and boot to OS. Ensure that there are no
peripherals detected in I2C 1 bus through i2cdetect tool. Ensure that no
touchscreen devices are exported through ACPI SSDT table. Ensure that
other I2C peripherals - eg. Trackpad and Ti50 are functional. Ensure
that the device is able to suspend and resume for 25 cycles.

Change-Id: Ia0578b90b0e8158ae28bcc51add637844ba6acf6
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83199
Reviewed-by: Shelley Chen <shchen@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/mainboard/google/brox/variants/brox/gpio.c b/src/mainboard/google/brox/variants/brox/gpio.c
index 5af3552..3f6767e 100644
--- a/src/mainboard/google/brox/variants/brox/gpio.c
+++ b/src/mainboard/google/brox/variants/brox/gpio.c
@@ -1,11 +1,34 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
+#include <baseboard/gpio.h>
 #include <baseboard/variants.h>
 #include <boardid.h>
 #include <soc/gpio.h>
 
+/* Pad configuration in ramstage */
+static const struct pad_config override_gpio_table[] = {
+	/* GPP_F7 : [NF6: USB_C_GPP_F7] ==> NC */
+	PAD_NC(GPP_F7, NONE),
+	/* GPP_F16 : [NF1: GSXCLK NF3: THC1_SPI2_CS# NF4: GSPI1_CS0# NF6: USB_C_GPP_F16] ==> NC */
+	PAD_NC(GPP_F16, NONE),
+	/* GPP_F17 : [NF3: THC1_SPI2_RST# NF6: USB_C_GPP_F17] ==> NC */
+	PAD_NC(GPP_F17, NONE),
+	/* GPP_F18 : [NF3: THC1_SPI2_INT# NF6: USB_C_GPP_F18] ==> NC */
+	PAD_NC(GPP_F18, NONE),
+	/* GPP_H6 : [NF1: I2C1_SDA NF6: USB_C_GPP_H6] ==> NC */
+	PAD_NC(GPP_H6, NONE),
+	/* GPP_H7 : [NF1: I2C1_SCL NF6: USB_C_GPP_H7] ==> NC */
+	PAD_NC(GPP_H7, NONE),
+};
+
 const struct pad_config *variant_gpio_override_table(size_t *num)
 {
+	uint32_t board_version = board_id();
+
 	*num = 0;
+	if (board_version >= 1) {
+		*num = ARRAY_SIZE(override_gpio_table);
+		return override_gpio_table;
+	}
 	return NULL;
 }
diff --git a/src/mainboard/google/brox/variants/brox/ramstage.c b/src/mainboard/google/brox/variants/brox/ramstage.c
index 86418da..c81dd7e 100644
--- a/src/mainboard/google/brox/variants/brox/ramstage.c
+++ b/src/mainboard/google/brox/variants/brox/ramstage.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include <baseboard/variants.h>
+#include <boardid.h>
 #include <device/pci_ids.h>
 #include <ec/google/chromeec/ec.h>
 #include <intelblocks/power_limit.h>
@@ -44,6 +45,7 @@
 
 void __weak variant_devtree_update(void)
 {
+	uint32_t board_version = board_id();
 	printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
 
 	const struct cpu_power_limits *limits = performance_efficient_limits;
@@ -51,4 +53,12 @@
 
 	variant_update_power_limits(limits, limits_size);
 	variant_update_psys_power_limits(limits, sys_limits, limits_size, &psys_config);
+
+	/* Disable I2C bus device for Touchscreen */
+	if (board_version >= 1) {
+		struct device *i2c1_dev = DEV_PTR(i2c1);
+
+		if (i2c1_dev)
+			i2c1_dev->enabled = false;
+	}
 }
diff --git a/src/mainboard/google/brox/variants/brox/variant.c b/src/mainboard/google/brox/variants/brox/variant.c
index e085a86..332d152 100644
--- a/src/mainboard/google/brox/variants/brox/variant.c
+++ b/src/mainboard/google/brox/variants/brox/variant.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <assert.h>
+#include <boardid.h>
 #include <baseboard/variants.h>
 #include <chip.h>
 #include <fw_config.h>
@@ -8,10 +9,16 @@
 
 void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config)
 {
+	uint32_t board_version = board_id();
+
 	if (fw_config_probe(FW_CONFIG(WIFI_BT, WIFI_BT_CNVI))) {
 		printk(BIOS_INFO, "CNVi bluetooth enabled by fw_config\n");
 		config->cnvi_bt_core = true;
 	}
+
+	/* Disable I2C bus device for Touchscreen for board version 1*/
+	if (board_version >= 1)
+		config->serial_io_i2c_mode[PchSerialIoIndexI2C1] = PchSerialIoDisabled;
 }
 
 const char *get_wifi_sar_cbfs_filename(void)