Asmaa Mnebhi aad4183232 gpio: mlxbf3: Support shutdown() function
During Linux graceful reboot, the GPIO interrupts are not disabled.
Since the drivers are not removed during graceful reboot,
the logic to call mlxbf3_gpio_irq_disable() is not triggered.
Interrupts that remain enabled can cause issues on subsequent boots.

For example, the mlxbf-gige driver contains PHY logic to bring up the link.
If the gpio-mlxbf3 driver loads first, the mlxbf-gige driver
will use a GPIO interrupt to bring up the link.
Otherwise, it will use polling.
The next time Linux boots and loads the drivers in this order, we encounter the issue:
- mlxbf-gige loads first and uses polling while the GPIO10
  interrupt is still enabled from the previous boot. So if
  the interrupt triggers, there is nothing to clear it.
- gpio-mlxbf3 loads.
- i2c-mlxbf loads. The interrupt doesn't trigger for I2C
  because it is shared with the GPIO interrupt line which
  was not cleared.

The solution is to add a shutdown function to the GPIO driver to clear and disable
all interrupts. Also clear the interrupt after disabling it in mlxbf3_gpio_irq_disable().

Fixes: 38a700efc510 ("gpio: mlxbf3: Add gpio driver support")
Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Reviewed-by: David Thompson <davthompson@nvidia.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240611171509.22151-1-asmaa@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-10 21:35:16 +02:00
..
2021-04-14 10:19:22 +01:00
2024-02-12 10:12:41 +01:00
2023-10-13 08:39:30 +02:00
2021-05-05 16:07:41 +02:00
2022-10-26 14:52:01 +02:00
2024-07-15 17:53:24 -07:00
2022-10-08 09:46:29 -07:00
2023-10-04 11:37:25 +02:00
2024-07-15 17:53:24 -07:00
2023-08-21 10:39:58 +02:00
2022-06-21 18:01:11 +03:00
2023-03-06 12:33:02 +02:00
2023-10-31 17:21:54 -10:00
2023-08-29 10:21:56 -07:00
2019-12-09 10:40:18 +01:00
2024-07-15 17:53:24 -07:00
2024-07-15 17:53:24 -07:00
2024-07-25 10:42:22 -07:00
2024-07-15 17:53:24 -07:00