Attention is currently required from: Patrick Rudolph. Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52588 )
Change subject: soc/intel/common: Add GPIO virtual wire ID support ......................................................................
soc/intel/common: Add GPIO virtual wire ID support
A virtual wire is some kind of internal ID for groups of GPIOs, and it can be useful to have a way to keep track of this information.
1) Add a new macro INTEL_GPP_BASE_VW which can be used to add a virtual wire index to groups of GPIOs. The default for this field when unassigned will be VW_INDEX_NONE, which happens via modification of the INTEL_GPP_BASE macro. 2) Add a function to return this information for a given GPIO pad.
Change-Id: I87adf0ca06cb5b7969bb2c258d6daebd44bb9748 Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/soc/intel/common/block/gpio/gpio.c M src/soc/intel/common/block/include/intelblocks/gpio.h 2 files changed, 31 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/52588/1
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index 4398c9f..9719a1b2 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -682,6 +682,18 @@ return gpio_within_group(comm, pin); }
+int gpio_get_vw_index(gpio_t pad) +{ + const struct pad_community *comm; + size_t pin, i; + + comm = gpio_get_community(pad); + pin = relative_pad_in_comm(comm, pad); + i = gpio_group_index(comm, pin); + + return comm->groups[i].virtual_wire_index; +} + static uint32_t *snapshot;
static void *allocate_snapshot_space(void) diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h index a7419dc..aa28b6a 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio.h @@ -27,6 +27,9 @@ #include <types.h> #include <device/device.h>
+/* A virtual wire index of -1 indicates unknown or unspecified */ +#define VW_INDEX_NONE -1 + /* * GPIO numbers may not be contiguous and instead will have a different * starting pin number for each pad group. @@ -37,6 +40,7 @@ .first_pad = (start_of_group) - (first_of_community), \ .size = (end_of_group) - (start_of_group) + 1, \ .acpi_pad_base = (group_pad_base), \ + .virtual_wire_index = VW_INDEX_NONE, \ }
/* @@ -50,6 +54,16 @@ INTEL_GPP_BASE(first_of_community, start_of_group, end_of_group,\ PAD_BASE_NONE)
+/* GPIO group with virtual wire index specified */ +#define INTEL_GPP_BASE_VW(first_of_community, start_of_group, end_of_group,\ + group_pad_base, vw_index) \ + { \ + .first_pad = (start_of_group) - (first_of_community), \ + .size = (end_of_group) - (start_of_group) + 1, \ + .acpi_pad_base = (group_pad_base), \ + .virtual_wire_index = (vw_index), \ + } + /* * Following should be defined in soc/gpio.h * GPIO_MISCCFG - offset to GPIO MISCCFG Register @@ -94,6 +108,8 @@ * PAD_BASE_NONE and use contiguous numbering for ACPI. */ int acpi_pad_base; + /* Index of the virtual wire for this (sub-)group */ + int virtual_wire_index; };
/* This structure will be used to describe a community or each group within a @@ -237,5 +253,8 @@
size_t gpio_get_index_in_group(gpio_t pad);
+/* Returns virtual wire index for the pad; can be VW_INDEX_NONE */ +int gpio_get_vw_index(gpio_t pad); + #endif #endif /* _SOC_INTELBLOCKS_GPIO_H_ */