summaryrefslogtreecommitdiff
path: root/src/soc/intel/apollolake/include/soc/gpio.h
diff options
context:
space:
mode:
authorShaunak Saha <shaunak.saha@intel.com>2016-07-24 20:50:12 -0700
committerMartin Roth <martinroth@google.com>2016-08-10 21:10:59 +0200
commit09115a92f6ac6123a6f1ed435c05fe60dc01d58c (patch)
tree9c6b16087c872cb140c5b447c33ebae3a78e2e23 /src/soc/intel/apollolake/include/soc/gpio.h
parenta46ee4d34d6b7ce7d47882779c7fb36270ccbda1 (diff)
downloadcoreboot-09115a92f6ac6123a6f1ed435c05fe60dc01d58c.tar.xz
soc/apollolake: add GPIO SMI support
GPIOs which trigger SMIs set the GPIO_SMI_STS status bits in SMI_STS register. This patch also sets the SMI_EN bit in enable register for each community based on GPIOROUTSMI bit in gpio pad. When SMI on a gpio happens status needs to be gathered on gpio number which is done by reading the GPI_SMI_STS and GPI_SMI_EN registers. BUG=chrome-os-partner:54977 TEST=When system is in firmware mode executing the command lidclose from ec console shuts down the system. Change-Id: Id89a526106d1989c2bd3416ab81913e6cf743d17 Signed-off-by: Shaunak Saha <shaunak.saha@intel.com> Reviewed-on: https://review.coreboot.org/15833 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/soc/intel/apollolake/include/soc/gpio.h')
-rw-r--r--src/soc/intel/apollolake/include/soc/gpio.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/soc/intel/apollolake/include/soc/gpio.h b/src/soc/intel/apollolake/include/soc/gpio.h
index 8ef74bb70a..00894448c8 100644
--- a/src/soc/intel/apollolake/include/soc/gpio.h
+++ b/src/soc/intel/apollolake/include/soc/gpio.h
@@ -25,6 +25,25 @@
typedef uint32_t gpio_t;
+/*
+ * Structure to represent GPI status for GPE and SMI. Use helper
+ * functions for interrogating particular GPIs. Here the number of
+ * array elements is total number of groups that can be present in all
+ * the communities.
+ */
+struct gpi_status {
+ uint32_t grp[NUM_GPI_STATUS_REGS];
+};
+
+/*
+ * Clear GPI SMI status and fill in the structure representing enabled
+ * and set status.
+ */
+void gpi_clear_get_smi_status(struct gpi_status *sts);
+
+/* Return 1 if gpio is set in the gpi_status struct. Otherwise 0. */
+int gpi_status_get(const struct gpi_status *sts, gpio_t gpi);
+
#define PAD_FUNC(value) PAD_CFG0_MODE_##value
#define PAD_RESET(value) PAD_CFG0_RESET_##value
#define PAD_PULL(value) PAD_CFG1_PULL_##value