Shaunak Saha has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41057 )
Change subject: [WIP][DONOTMERGE]: Print GPIO DW's for every community ......................................................................
[WIP][DONOTMERGE]: Print GPIO DW's for every community
Function to print every gpio DW value. The values would be printed in order of community as defined in soc's gpio.c community array.
Signed-off-by: Shaunak Saha shaunak.saha@intel.com Change-Id: I0b7b6963cbe1af8264461b0149681fbcb37bf416
Change-Id: I5f7b9b3d62317dd153a63e684a6193a05d037c61 --- M src/soc/intel/common/block/gpio/gpio.c M src/soc/intel/common/block/include/intelblocks/gpio.h 2 files changed, 62 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/57/41057/1
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index e73c776..a5c554c 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -298,12 +298,47 @@ gpi_enable_smi(cfg, comm); }
+#if CONFIG(DEBUG_GPIO) +void gpio_print_pads(void) +{ + size_t gpio_communities; + const struct pad_community *comm; + uint32_t i, j, k, l; + const struct pad_group *group_curr; + uint32_t comm_size = 0; + uint16_t config_offset; + uint32_t pad_conf; + + comm = soc_gpio_get_community(&gpio_communities); + + for (i = 0; i < gpio_communities; i++) { + group_curr = comm->groups; + for (j = 0; j < comm->num_groups; j++) { + for (k = 0; k < group_curr->size; k++) { + i config_offset = pad_config_offset(comm, (comm_size + k)); + printk(BIOS_DEBUG, "gpio_padcfg GPP_%s_%d [0x%02x, %02zd] ", + group_curr->grp_name, k, comm->port, relative_pad_in_comm(comm, (comm_size+k))); + for (l = 0; l < GPIO_NUM_PAD_CFG_REGS; l++) { + pad_conf = pcr_read32(comm->port, PAD_CFG_OFFSET(config_offset, l)); + printk(BIOS_DEBUG, " DW%d [0x%08x]", l, pad_conf); + } + printk(BIOS_DEBUG, "\n"); + } + comm_size = comm_size + group_curr->size; + group_curr++; + } + comm++; + } +} +#endif + void gpio_configure_pads(const struct pad_config *cfg, size_t num_pads) { size_t i;
for (i = 0; i < num_pads; i++) gpio_configure_pad(cfg + i); + }
/* diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h index db0f503..1267cb2 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio.h @@ -39,6 +39,20 @@ #ifndef __ACPI__ #include <types.h>
+#if CONFIG(DEBUG_GPIO) +#define INTEL_GPP_BASE(first_of_community, start_of_group, end_of_group,\ + group_pad_base, name) \ + { \ + .first_pad = (start_of_group) - (first_of_community), \ + .size = (end_of_group) - (start_of_group) + 1, \ + .acpi_pad_base = (group_pad_base), \ + .grp_name = (name), \ + } +/* The common/default group numbering is contiguous */ +#define INTEL_GPP(first_of_community, start_of_group, end_of_group, name)\ + INTEL_GPP_BASE(first_of_community, start_of_group, end_of_group,\ + PAD_BASE_NONE, name) +#else /* * GPIO numbers may not be contiguous and instead will have a different * starting pin number for each pad group. @@ -50,18 +64,17 @@ .size = (end_of_group) - (start_of_group) + 1, \ .acpi_pad_base = (group_pad_base), \ } - +/* The common/default group numbering is contiguous */ +#define INTEL_GPP(first_of_community, start_of_group, end_of_group) \ + INTEL_GPP_BASE(first_of_community, start_of_group, end_of_group,\ + PAD_BASE_NONE) +#endif /* * A pad base of -1 indicates that this group uses contiguous numbering * and a pad base should not be used for this group. */ #define PAD_BASE_NONE -1
-/* The common/default group numbering is contiguous */ -#define INTEL_GPP(first_of_community, start_of_group, end_of_group) \ - INTEL_GPP_BASE(first_of_community, start_of_group, end_of_group,\ - PAD_BASE_NONE) - /* * Following should be defined in soc/gpio.h * GPIO_MISCCFG - offset to GPIO MISCCFG Register @@ -107,6 +120,9 @@ * PAD_BASE_NONE and use contiguous numbering for ACPI. */ int acpi_pad_base; +#if CONFIG(DEBUG_GPIO) + const char *grp_name; +#endif };
/* This structure will be used to describe a community or each group within a @@ -174,6 +190,11 @@ */ void gpio_configure_pads(const struct pad_config *cfg, size_t num_pads);
+#if CONFIG(DEBUG_GPIO) +/* Print gpio pads configured */ +void gpio_print_pads(void); +#endif + /* * gpio_configure_pads_with_override accepts as input two GPIO tables: * 1. Base config