Re: [PATCH RFC v2 7/7] mfd: ls2kbmc: Capture the reset event of BMC through GPIO

From: Bartosz Golaszewski

Date: Wed Jul 08 2026 - 07:38:28 EST


On Tue, 7 Jul 2026 23:16:31 +0200, Miao Wang via B4 Relay
<devnull+shankerwangmiao.gmail.com@xxxxxxxxxx> said:
> From: Miao Wang <shankerwangmiao@xxxxxxxxx>
>
> The reset event of BMC is captured through GPIO. However, this driver
> bypasses the GPIO framework and directly accesses the GPIO controller
> through the fixed address. When the same GPIO controller is also
> exposed through ACPI and probed by the corresponding GPIO driver,
> there would be a conflict between the two drivers.
>
> This patch will try to find the GPIO through declared GPIO pin in the
> _CRS resources of the ACPI node. If no such delaration is found, the
> driver will fall back to search for the correct GPIO controller and pin
> according to the fixed address and pin number. A possible DSDT
> declaration for the GPIO pin might be as follows:
>
> Device (BMC0) {
> Name (_ADR, ...) // Match the PCI address of the BMC device
> // \_SB.GPO1 is the ACPI path of the GPIO controller
> Name (_CRS, ResourceTemplate () {
> GpioInt (Edge, ActiveLow, Exclusive, PullNone, 0,
> "\\_SB.GPO1", 0) {
> 14 // 14 is the GPIO pin number
> }
> }
>
> Signed-off-by: Miao Wang <shankerwangmiao@xxxxxxxxx>
> ---
> drivers/mfd/ls2k-bmc-core.c | 162 +++++++++++++++++++++++++++++++-------------
> 1 file changed, 115 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/mfd/ls2k-bmc-core.c b/drivers/mfd/ls2k-bmc-core.c
> index f87224105b3720cca97dcef089dad63fe57bc8c2..7187b2dfddc3acfb9fdf3cb3b4675299928dd03a 100644
> --- a/drivers/mfd/ls2k-bmc-core.c
> +++ b/drivers/mfd/ls2k-bmc-core.c
> @@ -26,6 +26,9 @@
> #include <linux/stop_machine.h>
> #include <linux/vt_kern.h>
> #include <linux/console.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/gpio/driver.h>
> +#include <linux/gpio.h>

I've stopped here because this is a legacy header that must not be included
and none of the interfaces in it must be used, as per the - very loud - comment
at the top of that file.

Bart