Skip to content

Commit e12963c

Browse files
committed
pinctrl: intel: Fix a glitch when updating IRQ flags on a preconfigured line
The commit af7e3ee ("pinctrl: intel: Disable input and output buffer when switching to GPIO") hadn't taken into account an update of the IRQ flags scenario. When updating the IRQ flags on the preconfigured line the ->irq_set_type() is called again. In such case the sequential Rx buffer configuration changes may trigger a falling or rising edge interrupt that may lead, on some platforms, to an undesired event. This may happen because each of intel_gpio_set_gpio_mode() and __intel_gpio_set_direction() updates the pad configuration with a different value of the GPIORXDIS bit. Notable, that the intel_gpio_set_gpio_mode() is called only for the pads that are configured as an input. Due to this fact, integrate the logic of __intel_gpio_set_direction() call into the intel_gpio_set_gpio_mode() so that the Rx buffer won't be disabled and immediately re-enabled. Fixes: af7e3ee ("pinctrl: intel: Disable input and output buffer when switching to GPIO") Reported-by: Kane Chen <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Tested-by: Grace Kao <[email protected]>
1 parent e986f0e commit e12963c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)
451451
value &= ~PADCFG0_PMODE_MASK;
452452
value |= PADCFG0_PMODE_GPIO;
453453

454-
/* Disable input and output buffers */
455-
value |= PADCFG0_GPIORXDIS;
454+
/* Disable TX buffer and enable RX (this will be input) */
455+
value &= ~PADCFG0_GPIORXDIS;
456456
value |= PADCFG0_GPIOTXDIS;
457457

458458
/* Disable SCI/SMI/NMI generation */
@@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev,
497497

498498
intel_gpio_set_gpio_mode(padcfg0);
499499

500-
/* Disable TX buffer and enable RX (this will be input) */
501-
__intel_gpio_set_direction(padcfg0, true);
502-
503500
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
504501

505502
return 0;
@@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type)
11151112

11161113
intel_gpio_set_gpio_mode(reg);
11171114

1118-
/* Disable TX buffer and enable RX (this will be input) */
1119-
__intel_gpio_set_direction(reg, true);
1120-
11211115
value = readl(reg);
11221116

11231117
value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);

0 commit comments

Comments
 (0)