aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/zork/variants/baseboard
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-08-04 20:16:55 -0700
committerFurquan Shaikh <furquan@google.com>2020-08-06 19:09:03 +0000
commitcc6c41f8d8b6880a7ad4947599350758cd18f85f (patch)
treed47ce96bb7a3c021e11d59b55078859475d293a4 /src/mainboard/google/zork/variants/baseboard
parent55fefbe39d9637e93031efe7b59746df8ebf733a (diff)
mb/google/zork: Switch USI_RESET to active low polarity for v3.6+
v3.6 of reference schematics have switched the polarity of reset signal to touchscreen controller from active high to active low. This change updates the default configuration in baseboard gpio tables to set the reset GPIO to output low and override tables in variants to set the reset GPIO to output high. Additionally, devicetree by default exposes ACTIVE_LOW configuration for reset GPIO. In order to support pre-v3.6 boards, reset GPIO is updated to ACTIVE_HIGH based on board version. BUG=b:161937506 Change-Id: I092f274d8eb1920a1cd6d3eccbe8f26b0b28928a Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44192 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/mainboard/google/zork/variants/baseboard')
-rw-r--r--src/mainboard/google/zork/variants/baseboard/gpio_baseboard_dalboz.c4
-rw-r--r--src/mainboard/google/zork/variants/baseboard/gpio_baseboard_trembyle.c4
-rw-r--r--src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h2
-rw-r--r--src/mainboard/google/zork/variants/baseboard/ramstage_common.c53
4 files changed, 58 insertions, 5 deletions
diff --git a/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_dalboz.c b/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_dalboz.c
index a07529ff9d..268c70fe61 100644
--- a/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_dalboz.c
+++ b/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_dalboz.c
@@ -150,8 +150,8 @@ static const struct soc_amd_gpio gpio_set_stage_ram[] = {
PAD_NF(GPIO_138, UART0_TXD, PULL_NONE),
/* DEV_BEEP_BCLK */
PAD_GPI(GPIO_139, PULL_NONE),
- /* USI_RESET */
- PAD_GPO(GPIO_140, HIGH),
+ /* USI_RESET_L */
+ PAD_GPO(GPIO_140, LOW),
/* USB_HUB_RST_L */
PAD_GPO(GPIO_141, HIGH),
/* SD_AUX_RESET_L */
diff --git a/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_trembyle.c b/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_trembyle.c
index c6c728e08f..1fb0cde30a 100644
--- a/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_trembyle.c
+++ b/src/mainboard/google/zork/variants/baseboard/gpio_baseboard_trembyle.c
@@ -164,8 +164,8 @@ static const struct soc_amd_gpio gpio_set_stage_ram[] = {
PAD_NF(GPIO_138, UART0_TXD, PULL_NONE),
/* DEV_BEEP_BCLK */
PAD_GPI(GPIO_139, PULL_NONE),
- /* USI_RESET */
- PAD_GPO(GPIO_140, HIGH),
+ /* USI_RESET_L */
+ PAD_GPO(GPIO_140, LOW),
/* UART1_RXD - FPMCU */
PAD_NF(GPIO_141, UART1_RXD, PULL_NONE),
/* SD_AUX_RESET_L */
diff --git a/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h
index 8770944993..93aad0ff5a 100644
--- a/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h
@@ -37,6 +37,8 @@ void variant_devtree_update(void);
void variant_audio_update(void);
/* Update bluetooth configuration in devicetree during ramstage. */
void variant_bluetooth_update(void);
+/* Update touchscreen configuration in devicetree during ramstage. */
+void variant_touchscreen_update(void);
/* Configure PCIe GPIOs as per variant sequencing requirements. */
void variant_pcie_gpio_configure(void);
diff --git a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c
index 8a6fa47ceb..a55bdf2c81 100644
--- a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c
+++ b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c
@@ -6,14 +6,16 @@
#include <device/device.h>
#include <drivers/amd/i2s_machine_dev/chip.h>
#include <drivers/i2c/generic/chip.h>
+#include <drivers/i2c/hid/chip.h>
#include <drivers/usb/acpi/chip.h>
#include <ec/google/chromeec/ec.h>
#include <soc/gpio.h>
+#include <soc/iomap.h>
#include <soc/pci_devs.h>
extern struct chip_operations drivers_amd_i2s_machine_dev_ops;
extern struct chip_operations drivers_i2c_generic_ops;
-
+extern struct chip_operations drivers_i2c_hid_ops;
static void update_hp_int_odl(void)
{
@@ -202,3 +204,52 @@ void variant_bluetooth_update(void)
baseboard_remove_bluetooth_reset_gpio();
}
+
+void variant_touchscreen_update(void)
+{
+ DEVTREE_CONST struct device *mmio_dev = NULL;
+ struct device *child = NULL;
+
+ /*
+ * By default, devicetree/overridetree entries for touchscreen device are configured to
+ * match v3.6 of reference schematics. So, if the board is using v3.6+ schematics, no
+ * additional work is required here. For maintaining support for pre-v3.6 boards, rest
+ * of the code in this function finds all entries that correspond to touchscreen
+ * devices (identified by reset_gpio being set to GPIO_140) and updates them as per
+ * pre-v3.6 version of schematics:
+ * 1. reset_gpio is marked as active high.
+ */
+ if (variant_uses_v3_6_schematics())
+ return;
+
+ while (1) {
+ mmio_dev = dev_find_path(mmio_dev, DEVICE_PATH_MMIO);
+ if (mmio_dev == NULL)
+ break;
+ if (mmio_dev->path.mmio.addr == APU_I2C2_BASE)
+ break;
+ }
+
+ if (mmio_dev == NULL)
+ return;
+
+ while ((child = dev_bus_each_child(mmio_dev->link_list, child)) != NULL) {
+ struct drivers_i2c_generic_config *cfg;
+
+ if (child->chip_ops == &drivers_i2c_generic_ops) {
+ cfg = config_of(child);
+ } else if (child->chip_ops == &drivers_i2c_hid_ops) {
+ struct drivers_i2c_hid_config *hid_cfg;
+ hid_cfg = config_of(child);
+ cfg = &hid_cfg->generic;
+ } else {
+ continue;
+ }
+
+ /* If reset_gpio is set to GPIO_140, assume that this is touchscreen device. */
+ if (cfg->reset_gpio.pins[0] != GPIO_140)
+ continue;
+
+ cfg->reset_gpio.active_low = 0;
+ }
+}