mfd: ls2kbmc: Add Loongson-2K BMC reset function support
authorBinbin Zhou <zhoubinbin@loongson.cn>
Thu, 4 Sep 2025 12:35:06 +0000 (20:35 +0800)
committerLee Jones <lee@kernel.org>
Wed, 1 Oct 2025 09:28:52 +0000 (10:28 +0100)
commitd952bba3fbb5d8a3c961e32bae3f7ff19a18762f
tree3d84cda523bea15195898ae594b556f77f783dca
parent0d64f6d1ffe96f59145481f7413344b1fa3ad1ce
mfd: ls2kbmc: Add Loongson-2K BMC reset function support

Since the display is a sub-function of the Loongson-2K BMC, when the
BMC reset, the entire BMC PCIe is disconnected, including the display
which is interrupted.

Quick overview of the entire LS2K BMC reset process:

There are two types of reset methods: soft reset (BMC-initiated reboot
of IPMI reset command) and BMC watchdog reset (watchdog timeout).

First, regardless of the method, an interrupt is generated (PCIe interrupt
for soft reset/GPIO interrupt for watchdog reset);

Second, during the interrupt process, the system enters bmc_reset_work,
clears the bus/IO/mem resources of the LS7A PCI-E bridge, waits for the BMC
reset to begin, then restores the parent device's PCI configuration space,
waits for the BMC reset to complete, and finally restores the BMC PCI
configuration space.

Display restoration occurs last.

Co-developed-by: Chong Qiao <qiaochong@loongson.cn>
Signed-off-by: Chong Qiao <qiaochong@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Acked-by: Corey Minyard <corey@minyard.net>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/de4e04b42ff9ee282f86f9bb9efbf959a9848205.1756987761.git.zhoubinbin@loongson.cn
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/ls2k-bmc-core.c