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>
This commit is contained in:
parent
516a31551e
commit
216d8e1965
2 changed files with 17 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue