aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/gpio/gpio.c
diff options
context:
space:
mode:
authorSubrata Banik <subrata.banik@intel.com>2019-05-14 17:31:19 +0530
committerPatrick Georgi <pgeorgi@google.com>2019-05-20 14:49:54 +0000
commitabdc9bc8c8605f2865b7a9cc956cbcc4402c1c43 (patch)
tree15c229ca6e60130c1e408f1cc18339ac0e941963 /src/soc/intel/common/block/gpio/gpio.c
parent8ef6732b94148a39f8203cb3b4cf3388dc103199 (diff)
soc/intel/common/block/gpio: Add gpio_pm_configure() function
This patch adds new function to perform gpio power management programming as per EDS. BUG=b:130764684 TEST=Able to build and boot from fixed media on ICL and CML. Change-Id: I816a70ad92595f013740a235a9799912ad51665e Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32788 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/soc/intel/common/block/gpio/gpio.c')
-rw-r--r--src/soc/intel/common/block/gpio/gpio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c
index 3a0594cba1..d37601ce3b 100644
--- a/src/soc/intel/common/block/gpio/gpio.c
+++ b/src/soc/intel/common/block/gpio/gpio.c
@@ -609,3 +609,21 @@ void gpi_clear_int_cfg(void)
}
}
}
+
+/* The function performs GPIO Power Management programming. */
+void gpio_pm_configure(const uint8_t *misccfg_pm_values, size_t num)
+{
+ int i;
+ size_t gpio_communities;
+ uint8_t misccfg_pm_mask = MISCCFG_ENABLE_GPIO_PM_CONFIG;
+ const struct pad_community *comm;
+
+ comm = soc_gpio_get_community(&gpio_communities);
+ if (gpio_communities != num)
+ die("Incorrect GPIO community count!\n");
+
+ /* Program GPIO_MISCCFG */
+ for (i = 0; i < num; i++, comm++)
+ pcr_rmw8(comm->port, GPIO_MISCCFG,
+ misccfg_pm_mask, misccfg_pm_values[i]);
+}