aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/gpio
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2022-01-04 20:29:27 +0000
committerSubrata Banik <subratabanik@google.com>2022-01-26 08:29:35 +0000
commit7e8a0e61e732c9cf17663d94a88d08be1bcbee9c (patch)
tree8e37fa909a3f9d8dc0c0f84cbf24b98bd2579701 /src/soc/intel/common/block/gpio
parentfe678cbd195d354e11b702e649ad6aba384f92ba (diff)
soc/intel/common/gpio: Rework PAD config macro to add lock support
This patch extends `struct pad_config` to add new variable for gpio lock action. Additionally, it creates new GPIO PAD configuration macros that perform GPIO pad configuration and pad lock configuration as well. List of new macros are: 1. PAD_CFG_NF_LOCK 2. PAD_CFG_GPO_LOCK 3. PAD_CFG_GPI_LOCK 4. PAD_CFG_GPI_TRIG_OWN_LOCK 5. PAD_CFG_GPI_GPIO_DRIVER_LOCK 6. PAD_CFG_GPI_INT_LOCK 7. PAD_CFG_GPI_APIC_LOCK 8. PAD_CFG_GPI_IRQ_WAKE_LOCK Mainboard users can use the above macros to lock the PAD after configuration. So far on IA chipset, the default GPIO pad lock configuration reset type is POWERGOOD hence, it's recommended as per GPIO BWG (doc: 630603) to configure the GPP PAD reset type the same as lock configuration reset type to avoid GPP reset value misconfiguration issue. BUG=b:211573253, b:211950520 Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: Ibf8b0a845005ad545266d995449d0aa711f45a61 Reviewed-on: https://review.coreboot.org/c/coreboot/+/60774 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com> Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'src/soc/intel/common/block/gpio')
-rw-r--r--src/soc/intel/common/block/gpio/gpio.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c
index 8d262fad18..dcec12a8f0 100644
--- a/src/soc/intel/common/block/gpio/gpio.c
+++ b/src/soc/intel/common/block/gpio/gpio.c
@@ -345,6 +345,8 @@ static void gpio_configure_pad(const struct pad_config *cfg)
gpio_configure_owner(cfg, comm);
gpi_enable_smi(cfg, comm);
gpi_enable_nmi(cfg, comm);
+ if (cfg->lock_action)
+ gpio_lock_pad(cfg->pad, cfg->lock_action);
}
void gpio_configure_pads(const struct pad_config *cfg, size_t num_pads)
@@ -468,13 +470,13 @@ gpio_pad_config_lock_using_sbi(const struct gpio_lock_config *pad_info,
.fid = 0,
};
- if (!(pad_info->action & GPIO_LOCK_FULL)) {
- printk(BIOS_ERR, "%s: Error: no action specified for pad %d!\n",
+ if (!(pad_info->lock_action & GPIO_LOCK_FULL)) {
+ printk(BIOS_ERR, "%s: Error: no lock_action specified for pad %d!\n",
__func__, pad_info->pad);
return;
}
- if ((pad_info->action & GPIO_LOCK_CONFIG) == GPIO_LOCK_CONFIG) {
+ if ((pad_info->lock_action & GPIO_LOCK_CONFIG) == GPIO_LOCK_CONFIG) {
if (CONFIG(DEBUG_GPIO))
printk(BIOS_INFO, "%s: Locking pad %d configuration\n",
__func__, pad_info->pad);
@@ -484,7 +486,7 @@ gpio_pad_config_lock_using_sbi(const struct gpio_lock_config *pad_info,
printk(BIOS_ERR, "Failed to lock GPIO PAD, response = %d\n", response);
}
- if ((pad_info->action & GPIO_LOCK_TX) == GPIO_LOCK_TX) {
+ if ((pad_info->lock_action & GPIO_LOCK_TX) == GPIO_LOCK_TX) {
if (CONFIG(DEBUG_GPIO))
printk(BIOS_INFO, "%s: Locking pad %d Tx state\n",
__func__, pad_info->pad);
@@ -552,14 +554,14 @@ static void
gpio_pad_config_lock_using_pcr(const struct gpio_lock_config *pad_info,
uint8_t pid, uint16_t offset, const uint32_t bit_mask)
{
- if ((pad_info->action & GPIO_LOCK_CONFIG) == GPIO_LOCK_CONFIG) {
+ if ((pad_info->lock_action & GPIO_LOCK_CONFIG) == GPIO_LOCK_CONFIG) {
if (CONFIG(DEBUG_GPIO))
printk(BIOS_INFO, "%s: Locking pad %d configuration\n",
__func__, pad_info->pad);
pcr_or32(pid, offset, bit_mask);
}
- if ((pad_info->action & GPIO_LOCK_TX) == GPIO_LOCK_TX) {
+ if ((pad_info->lock_action & GPIO_LOCK_TX) == GPIO_LOCK_TX) {
if (CONFIG(DEBUG_GPIO))
printk(BIOS_INFO, "%s: Locking pad %d TX state\n",
__func__, pad_info->pad);
@@ -612,7 +614,7 @@ static int gpio_non_smm_lock_pad(const struct gpio_lock_config *pad_info)
return 0;
}
-int gpio_lock_pad(const gpio_t pad, enum gpio_lock_action action)
+int gpio_lock_pad(const gpio_t pad, enum gpio_lock_action lock_action)
{
/* Skip locking GPIO PAD in early stages */
if (ENV_ROMSTAGE_OR_BEFORE)
@@ -620,7 +622,7 @@ int gpio_lock_pad(const gpio_t pad, enum gpio_lock_action action)
const struct gpio_lock_config pads = {
.pad = pad,
- .action = action
+ .lock_action = lock_action
};
if (!ENV_SMM && !CONFIG(SOC_INTEL_COMMON_BLOCK_SMM_LOCK_GPIO_PADS))