[coreboot-gerrit] Patch set updated for coreboot: soc/intel/apollolake: Add iosstate macros for GPIO
Venkateswarlu V Vinjamuri (venkateswarlu.v.vinjamuri@intel.com)
gerrit at coreboot.org
Fri Jul 29 18:35:47 CEST 2016
Venkateswarlu V Vinjamuri (venkateswarlu.v.vinjamuri at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15776
-gerrit
commit d636da0f36b22ec226646ec307df11f8b31aae13
Author: Shankar, Vaibhav <vaibhav.shankar at intel.com>
Date: Wed Jul 13 14:00:08 2016 -0700
soc/intel/apollolake: Add iosstate macros for GPIO
IO Standby State (IOSSTATE): The I/O Standby State defines
which state the pad should be parked in when the I/O is in a
standby state. Iosstate set to 15 means IO-Standby is ignored
for this pin (same as functional mode), So that pin keeps on
functioning in S3/S0iX.
Change-Id: Ie51ff86a2ea63fa6535407fcc2df7a137ee43e8b
Signed-off-by: Venkateswarlu Vinjamuri <venkateswarlu.v.vinjamuri at intel.com>
Signed-off-by: Shankar, Vaibhav <vaibhav.shankar at intel.com>
---
src/soc/intel/apollolake/gpio.c | 12 +++++++++++-
src/soc/intel/apollolake/include/soc/gpio.h | 6 ++++++
src/soc/intel/apollolake/include/soc/gpio_defs.h | 3 +++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/apollolake/gpio.c b/src/soc/intel/apollolake/gpio.c
index a3ffb3d..4fd7538 100644
--- a/src/soc/intel/apollolake/gpio.c
+++ b/src/soc/intel/apollolake/gpio.c
@@ -85,10 +85,20 @@ static void gpio_configure_itss(const struct pad_config *cfg,
void gpio_configure_pad(const struct pad_config *cfg)
{
+ uint32_t dw1;
const struct pad_community *comm = gpio_get_community(cfg->pad);
uint16_t config_offset = PAD_CFG_OFFSET(cfg->pad - comm->first_pad);
+
+ /* Iostandby bits are tentatively stored in [3:0] bits (RO) of config1.
+ * dw1 is used to extract the bits of Iostandby.
+ * This is done to preserve config1 size as unit16 in gpio.h.
+ */
+ dw1 = cfg->config1;
+ dw1 |= (cfg->config1 & PAD_CFG1_IOSSTATE_IGNORE_MASK) << PAD_CFG1_IOSSTATE_SET;
+ dw1 &= ~PAD_CFG1_IOSSTATE_IGNORE_MASK;
+
iosf_write(comm->port, config_offset, cfg->config0);
- iosf_write(comm->port, config_offset + sizeof(uint32_t), cfg->config1);
+ iosf_write(comm->port, config_offset + sizeof(uint32_t), dw1);
gpio_configure_itss(cfg, comm->port, config_offset);
}
diff --git a/src/soc/intel/apollolake/include/soc/gpio.h b/src/soc/intel/apollolake/include/soc/gpio.h
index 1ebac2d..61d1b74 100644
--- a/src/soc/intel/apollolake/include/soc/gpio.h
+++ b/src/soc/intel/apollolake/include/soc/gpio.h
@@ -28,6 +28,7 @@ typedef uint32_t gpio_t;
#define PAD_FUNC(value) PAD_CFG0_MODE_##value
#define PAD_RESET(value) PAD_CFG0_RESET_##value
#define PAD_PULL(value) PAD_CFG1_PULL_##value
+#define PAD_IOSSTATE(value) PAD_CFG1_IOSSTATE_##value
#define PAD_IRQ_CFG(route, trig, inv) \
(PAD_CFG0_ROUTE_##route | \
PAD_CFG0_TRIG_##trig | \
@@ -44,6 +45,11 @@ typedef uint32_t gpio_t;
#define PAD_CFG_NF(pad, pull, rst, func) \
_PAD_CFG_STRUCT(pad, PAD_RESET(rst) | PAD_FUNC(func), PAD_PULL(pull))
+/* Native function configuration for standby state */
+#define PAD_CFG_NF_IOSTATE(pad, pull, rst, func, iostate) \
+ _PAD_CFG_STRUCT(pad, PAD_RESET(rst) | PAD_FUNC(func), (PAD_PULL(pull) | \
+ PAD_IOSSTATE(iostate)))
+
/* General purpose output, no pullup/down. */
#define PAD_CFG_GPO(pad, val, rst) \
_PAD_CFG_STRUCT(pad, \
diff --git a/src/soc/intel/apollolake/include/soc/gpio_defs.h b/src/soc/intel/apollolake/include/soc/gpio_defs.h
index 48e08e7..92c44ee 100644
--- a/src/soc/intel/apollolake/include/soc/gpio_defs.h
+++ b/src/soc/intel/apollolake/include/soc/gpio_defs.h
@@ -76,6 +76,7 @@
#define PAD_CFG0_RESET_RSMRST (3 << 30)
#define PAD_CFG1_IRQ_MASK (0xff << 0)
+#define PAD_CFG1_IOSSTATE_IGNORE (0xf << 0) /* Ignore Iostandby */
#define PAD_CFG1_PULL_MASK (0xf << 10)
#define PAD_CFG1_PULL_NONE (0x0 << 10)
#define PAD_CFG1_PULL_DN_5K (0x2 << 10)
@@ -86,6 +87,8 @@
#define PAD_CFG1_PULL_UP_20K (0xc << 10)
#define PAD_CFG1_PULL_UP_667 (0xd << 10)
#define PAD_CFG1_PULL_NATIVE (0xf << 10)
+#define PAD_CFG1_IOSSTATE_SET 14 /* set Ignore Iostandby */
+#define PAD_CFG1_IOSSTATE_IGNORE_MASK 0xf /* mask to extract Ignore Iostandby */
#define PAD_CFG_BASE 0x500
#define PAD_CFG_OFFSET(pad) (PAD_CFG_BASE + ((pad) * 8))
More information about the coreboot-gerrit
mailing list