summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCliff Huang <cliff.huang@intel.com>2024-08-20 11:27:34 -0700
committerFelix Held <felix-coreboot@felixheld.de>2024-09-06 13:36:57 +0000
commit216d8e19658881bce23014fc682185665c6e83e6 (patch)
treeb4d9b6025be2d91bb439f1587ba81c51d525af23
parent516a31551ef3b4da9840ffa6354aef17bff12535 (diff)
soc/intel/common/gpio: vm index changes as PTL vm entries are not continuous
Add specific virtual wire mapping structure for: - First pad group does not starts with bit position 0. - vw_index and position are not continuous in between groups within a community. BUG= TEST=boot to OS and use iotools to read the registers that use 16-bit port ID such as IOM AUX Bias Ctrl register to verify the 16-bit group ID field. Signed-off-by: Cliff Huang <cliff.huang@intel.com> Change-Id: I986d4f4fe59b110e5075cab8742dfe8b336d034b Reviewed-on: https://review.coreboot.org/c/coreboot/+/83997 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
-rw-r--r--src/soc/intel/common/block/gpio/gpio.c12
-rw-r--r--src/soc/intel/common/block/include/intelblocks/gpio.h7
2 files changed, 17 insertions, 2 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c
index d49742d1b5..625c3f4355 100644
--- a/src/soc/intel/common/block/gpio/gpio.c
+++ b/src/soc/intel/common/block/gpio/gpio.c
@@ -1068,8 +1068,16 @@ bool gpio_get_vw_info(gpio_t pad, unsigned int *vw_index, unsigned int *vw_bit)
if (i == comm->num_vw_entries)
return false;
- offset += pad - comm->vw_entries[i].first_pad;
- *vw_index = comm->vw_base + offset / 8;
+ /* Adjust offset and calculate vw_index based on the mapping type */
+ if (comm->vw_map) {
+ offset = pad - comm->vw_entries[i].first_pad;
+ offset += comm->vw_map[i].start_pos;
+ *vw_index = comm->vw_map[i].base + offset / 8;
+ } else {
+ offset += pad - comm->vw_entries[i].first_pad;
+ offset += comm->vw_base;
+ *vw_index = offset / 8;
+ }
*vw_bit = offset % 8;
return true;
diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h
index 39d17a199a..a501f7fd54 100644
--- a/src/soc/intel/common/block/include/intelblocks/gpio.h
+++ b/src/soc/intel/common/block/include/intelblocks/gpio.h
@@ -110,6 +110,12 @@ struct vw_entries {
gpio_t last_pad;
};
+/* virtual-wire mapping base and the starting bit position for a group */
+struct vw_map {
+ uint8_t base;
+ uint8_t start_pos;
+};
+
/* This structure will be used to describe a community or each group within a
* community when multiple groups exist inside a community
*/
@@ -152,6 +158,7 @@ struct pad_community {
* which they map to VW indexes (beginning with VW base)
*/
const struct vw_entries *vw_entries;
+ const struct vw_map *vw_map;
size_t num_vw_entries;
};