From 3f672323b5f5cd6eaf955a31ebd0f73685f1d257 Mon Sep 17 00:00:00 2001 From: Bora Guvendik Date: Wed, 22 Nov 2017 13:48:12 -0800 Subject: soc/intel/common/block/gpio: Change group offset calculation Add group information for each gpio community and use it to calculate offset of a pad within its group. Original implementation assumed that the number of gpios in each group is same but that lead to a bug for cnl since numbers differ for each group. BUG=b:69616750 TEST=Need to test again on SKL,CNL,APL,GLK Change-Id: I02ab1d878bc83d32222be074bd2db5e23adaf580 Signed-off-by: Bora Guvendik Reviewed-on: https://review.coreboot.org/22571 Reviewed-by: Lijian Zhao Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/soc/intel/common/block/include/intelblocks/gpio.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/soc/intel/common/block/include') diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h index 879d30b469..625ebef881 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio.h @@ -23,6 +23,12 @@ #ifndef __ACPI__ #include +#define INTEL_GPP(first_of_community, start_of_group, end_of_group) \ + { \ + .first_pad = (start_of_group) - (first_of_community), \ + .size = (end_of_group) - (start_of_group) + 1, \ + } + /* * Following should be defined in soc/gpio.h * GPIO_MISCCFG - offset to GPIO MISCCFG Register @@ -55,6 +61,14 @@ struct reset_mapping { uint32_t chipset; }; + +/* Structure describes the groups within each community */ +struct pad_group { + int first_pad; /* offset of first pad of the group relative + to the community */ + unsigned int size; /* Size of the group */ +}; + /* This structure will be used to describe a community or each group within a * community when multiple groups exist inside a community */ @@ -76,6 +90,8 @@ struct pad_community { const struct reset_mapping *reset_map; /* PADRSTCFG logical to chipset mapping */ size_t num_reset_vals; + const struct pad_group *groups; + size_t num_groups; }; /* -- cgit v1.2.3