[coreboot-gerrit] Patch set updated for coreboot: [WIP]soc/intel/apollolake: Configure gpio ownership
Jagadish Krishnamoorthy (jagadish.krishnamoorthy@intel.com)
gerrit at coreboot.org
Mon Jul 25 23:16:58 CEST 2016
Jagadish Krishnamoorthy (jagadish.krishnamoorthy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15871
-gerrit
commit 17b8ab2fbcd40e12037d5391a00edc4acfac3368
Author: Jagadish Krishnamoorthy <jagadish.krishnamoorthy at intel.com>
Date: Mon Jul 25 13:59:44 2016 -0700
[WIP]soc/intel/apollolake: Configure gpio ownership
For the gpio based irq to work,
the ownership of the pad should be changed
to GPIO_DRIVER mode instead of the ACPI mode which is default.
BUG=chrome-os-partner:54371
TEST=none
Change-Id: I26d242d25d2034049340adf526045308fcdebbc0
Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy at intel.com>
---
src/soc/intel/apollolake/gpio.c | 10 ++++++++++
src/soc/intel/apollolake/include/soc/gpio.h | 8 ++++++++
src/soc/intel/apollolake/include/soc/gpio_defs.h | 1 +
3 files changed, 19 insertions(+)
diff --git a/src/soc/intel/apollolake/gpio.c b/src/soc/intel/apollolake/gpio.c
index a3ffb3d..0affd08 100644
--- a/src/soc/intel/apollolake/gpio.c
+++ b/src/soc/intel/apollolake/gpio.c
@@ -54,6 +54,12 @@ static const struct pad_community *gpio_get_community(uint16_t pad)
return map;
}
+static void gpio_configure_owner(const struct pad_config *cfg,
+ uint16_t port, uint16_t pad_cfg_offset)
+{
+ /* TBD : Configure HOSTSW_OWN_<BANK> register */
+}
+
static void gpio_configure_itss(const struct pad_config *cfg,
uint16_t port, uint16_t pad_cfg_offset)
{
@@ -87,10 +93,14 @@ void gpio_configure_pad(const struct pad_config *cfg)
{
const struct pad_community *comm = gpio_get_community(cfg->pad);
uint16_t config_offset = PAD_CFG_OFFSET(cfg->pad - comm->first_pad);
+
iosf_write(comm->port, config_offset, cfg->config0);
iosf_write(comm->port, config_offset + sizeof(uint32_t), cfg->config1);
gpio_configure_itss(cfg, comm->port, config_offset);
+ /* Use the RO bit in pad_config 1 register to indicate the ownership */
+ if(cfg->config1 & PAD_CFG1_GPIO_DRIVER)
+ gpio_configure_owner(cfg, comm->port, config_offset);
}
void gpio_configure_pads(const struct pad_config *cfg, size_t num_pads)
diff --git a/src/soc/intel/apollolake/include/soc/gpio.h b/src/soc/intel/apollolake/include/soc/gpio.h
index 1ebac2d..3e377c7 100644
--- a/src/soc/intel/apollolake/include/soc/gpio.h
+++ b/src/soc/intel/apollolake/include/soc/gpio.h
@@ -56,6 +56,14 @@ typedef uint32_t gpio_t;
PAD_FUNC(GPIO) | PAD_RESET(rst) | PAD_CFG0_TX_DISABLE, \
PAD_PULL(pull))
+/* General purpose input, Set Host Software Pad Owner to Gpio Driver mode.
+ * GPIO input event updates are routed to gpio driver.
+ * Default ownership is Acpi mode.
+ */
+#define PAD_CFG_GPI_GPIO_DRIVER(pad, pull, rst) \
+ _PAD_CFG_STRUCT(pad, \
+ PAD_FUNC(GPIO) | PAD_RESET(rst) | PAD_CFG0_TX_DISABLE, \
+ PAD_PULL(pull) | PAD_CFG1_GPIO_DRIVER)
/* No Connect configuration for unused pad.
* NC should be GPI with Term as PU20K, PD20K, NONE depending upon default Term
*/
diff --git a/src/soc/intel/apollolake/include/soc/gpio_defs.h b/src/soc/intel/apollolake/include/soc/gpio_defs.h
index 48e08e7..1aca9a5 100644
--- a/src/soc/intel/apollolake/include/soc/gpio_defs.h
+++ b/src/soc/intel/apollolake/include/soc/gpio_defs.h
@@ -77,6 +77,7 @@
#define PAD_CFG1_IRQ_MASK (0xff << 0)
#define PAD_CFG1_PULL_MASK (0xf << 10)
+#define PAD_CFG1_GPIO_DRIVER (0x1 << 0)
#define PAD_CFG1_PULL_NONE (0x0 << 10)
#define PAD_CFG1_PULL_DN_5K (0x2 << 10)
#define PAD_CFG1_PULL_DN_20K (0x4 << 10)
More information about the coreboot-gerrit
mailing list