Skip to contentSkip to conversation

soc: add NPCM LPC BPC driver support

PATCH In review Tomer Maimon 2 participants 6 messages Jun 10, 2019 – Jun 13, 2019

Subsystems (2)
lore
Share & tools
lore

Tomer Maimon

author maintainer
#0 lore raw

cover soc: add NPCM LPC BPC driver support

This patch set adds LPC BIOS Post code (BPC) support for the Nuvoton NPCM Baseboard Management Controller (BMC).

Nuvoton BMC NPCM LPC BIOS Post Code (BPC) monitoring two configurable I/O addresses written by the host on the Low Pin Count (LPC) bus, the capture data stored in 128-word FIFO.

NPCM BPC can support capture double words.

The NPCM7xx BPC driver tested on NPCM750 evaluation board.

NPCM BPC driver upstream process start few months ago on misc folder
http://lkml.iu.edu/hypermail/linux/kernel/1904.2/00412.html

The NPCM LPC BPC is similar to Aspeed LPC snoop, last kernel 5.0.2 Aspeed LPC snoop driver moved from misc folder to soc folder, so it seems NPCM BPC dirver should upstream to soc as well.
https://lkml.org/lkml/2019/4/22/377

I have created common lpc-snoop documentation for both Nuvoton and Aspeed drivers as Andrew suggested. Andrew Jeffery: https://patchwork.kernel.org/patch/10506269/

I add Andrew and Rob reviewed signature because they already reviewed and signed the lpc-snoop documentation in the misc folder
https://lkml.org/lkml/2019/4/29/998

Tomer Maimon (2):
dt-binding: soc: Add common LPC snoop documentation
soc: nuvoton: add NPCM LPC BPC driver

 .../devicetree/bindings/soc/lpc/lpc-snoop.txt |  27 ++
 drivers/soc/Kconfig                           |   1 +
 drivers/soc/Makefile                          |   1 +
 drivers/soc/nuvoton/Kconfig                   |  16 +
 drivers/soc/nuvoton/Makefile                  |   2 +
 drivers/soc/nuvoton/npcm-lpc-bpc-snoop.c      | 387 ++++++++++++++++++
 6 files changed, 434 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/lpc/lpc-snoop.txt
 create mode 100644 drivers/soc/nuvoton/Kconfig
 create mode 100644 drivers/soc/nuvoton/Makefile
 create mode 100644 drivers/soc/nuvoton/npcm-lpc-bpc-snoop.c
Signature · 1 line
2.18.0
author maintainer
#1 lore raw

PATCH 1/2 dt-binding: soc: Add common LPC snoop documentation

Added device tree binding documentation for Nuvoton BMC NPCM BIOS Post Code (BPC) and Aspeed AST2500 LPC snoop. The LPC snoop monitoring two configurable I/O addresses written by the host on Low Pin Count (LPC) bus.

---
 .../devicetree/bindings/soc/lpc/lpc-snoop.txt | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/lpc/lpc-snoop.txt
Documentation/devicetree/bindings/soc/lpc/lpc-snoop.txt new file +27 -0
new file mode 100644
index 000000000000..c21cb8df4ffb
@@ -0,0 +1,27 @@
+LPC snoop interface
+
+The LPC snoop (BIOS Post Code) interface can monitor
+two configurable I/O addresses written by the host on
+the Low Pin Count (LPC) bus.
+
+Nuvoton NPCM7xx LPC snoop supports capture double words,
+when using capture double word only I/O address 1 is monitored.
+
+Required properties for lpc-snoop node
+- compatible   : "nuvoton,npcm750-lpc-bpc-snoop" for Poleg NPCM7XX
+                 "aspeed,ast2500-lpc-snoop" for Aspeed AST2500.
+- reg          : specifies physical base address and size of the registers.
+- interrupts   : contain the LPC snoop interrupt with flags for falling edge.
+- snoop-ports  : contain monitor I/O addresses, at least one monitor I/O
+                 address required
+
+Optional property for NPCM7xx lpc-snoop node
+- nuvoton,lpc-en-dwcapture : enable capture double words support.
+
+Example:
+	lpc-snoop: lpc_snoop@f0007040 {
+		compatible = "nuvoton,npcm750-lpc-bpc-snoop";
+		reg = <0xf0007040 0x14>;
+		snoop-ports = <0x80>;
+		interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+	};
Signature · 1 line
2.18.0
author maintainer
#2 lore raw

PATCH 2/2 soc: nuvoton: add NPCM LPC BPC driver

In reply to Tomer Maimon

Add Nuvoton BMC NPCM BIOS post code (BPC) driver.

The NPCM BPC monitoring two I/O address written by the host on the Low Pin Count (LPC) bus, the capure data stored in 128-word FIFO.

---
 drivers/soc/Kconfig                      |   1 +
 drivers/soc/Makefile                     |   1 +
 drivers/soc/nuvoton/Kconfig              |  16 +
 drivers/soc/nuvoton/Makefile             |   2 +
 drivers/soc/nuvoton/npcm-lpc-bpc-snoop.c | 387 +++++++++++++++++++++++
 5 files changed, 407 insertions(+)
 create mode 100644 drivers/soc/nuvoton/Kconfig
 create mode 100644 drivers/soc/nuvoton/Makefile
 create mode 100644 drivers/soc/nuvoton/npcm-lpc-bpc-snoop.c
drivers/soc/Kconfig +1 -0
index 833e04a7835c..9a04c7208f8f 100644
@@ -10,6 +10,7 @@ source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
+source "drivers/soc/nuvoton/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/renesas/Kconfig"
 source "drivers/soc/rockchip/Kconfig"
drivers/soc/Makefile +1 -0
index 524ecdc2a9bb..75018b656412 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_MXC)		+= imx/
 obj-$(CONFIG_ARCH_IXP4XX)	+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
 obj-y				+= mediatek/
+obj-$(CONFIG_SOC_NUVOTON)	+= nuvoton/
 obj-y				+= amlogic/
 obj-y				+= qcom/
 obj-y				+= renesas/
drivers/soc/nuvoton/Kconfig new file +16 -0
new file mode 100644
index 000000000000..5490e2e5dade
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menu "Nuvoton NPCM BMC SoC drivers"
+
+config SOC_NUVOTON
+	def_bool y
+	depends on ARCH_NPCM || COMPILE_TEST
+
+config NPCM_LPC_BPC_SNOOP
+	tristate "NPCM LPC BIOS Post Code snoop support"
+	depends on (SOC_NUVOTON || COMPILE_TEST)
+	help
+	  Provides a NPCM BMC driver to control the LPC BIOS Post Code
+	  interface which allows the BMC to monitoring and save
+	  the data written by the host to an arbitrary LPC I/O port.
+
+endmenu
drivers/soc/nuvoton/Makefile new file +2 -0
new file mode 100644
index 000000000000..ffd0fb05d021
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_NPCM_LPC_BPC_SNOOP) += npcm-lpc-bpc-snoop.o
drivers/soc/nuvoton/npcm-lpc-bpc-snoop.c new file +387 -0

387 lines not on this page · raw message

Signature · 1 line
2.18.0
#3 lore raw

Re: [PATCH v1 2/2] soc: nuvoton: add NPCM LPC BPC driver

Quoted 8 lines · Tomer Maimon

Add Nuvoton BMC NPCM BIOS post code (BPC) driver.

The NPCM BPC monitoring two I/O address written by the host on the Low Pin Count (LPC) bus, the capure data stored in 128-word FIFO.

We've run into this situation before, but don't have a good solution yet:

The driver seems useful and well implemented, but I keep having a bad feeling about adding a chardev driver into drivers/soc for something that is clearly specific to a particular implementation on the hardware side but generic on the user interface. The same user interface might be used on an Aspeed BMC or any other one, so please coordinate at least between Novoton and Aspeed developers on creating a common user interface, and review each other's patches.

Maybe we can introduce a drivers/bmc/ (or even drivers/openbmc) that collects all those user interfaces with a thin abstraction layer and one or two hardware specific back-ends?

Arnd

author maintainer
#4 lore raw

PATCH 2/2 soc: nuvoton: add NPCM LPC BPC driver

Adding Patrick and Joel to this discussion,

Thanks for your prompt reply!

Quoted 12 lines · Arnd Bergmann
Quoted 8 lines · Tomer Maimon

Add Nuvoton BMC NPCM BIOS post code (BPC) driver.

The NPCM BPC monitoring two I/O address written by the host on the Low Pin Count (LPC) bus, the capure data stored in 128-word FIFO.

We've run into this situation before, but don't have a good solution yet:

Quoted 8 lines

The driver seems useful and well implemented, but I keep having a bad feeling about adding a chardev driver into drivers/soc for something that is clearly specific to a particular implementation on the hardware side but generic on the user interface. The same user interface might be used on an Aspeed BMC or any other one, so please coordinate at least between Novoton and Aspeed developers on creating a common user interface, and review each other's patches.

Probably the only vendors that will use the snoop will be Nuvoton and Aspeed.
is it worth to create new snoop common user interface for it, if we will develop a new snoop user interface who will be the maintainer?

Quoted 2 lines

Maybe we can introduce a drivers/bmc/ (or even drivers/openbmc)

that collects all those user interfaces with a thin abstraction layer

Quoted 2 lines

and one or two hardware specific back-ends?

Sounds good, Maybe we can move the KCS BMC from driver/char/ipmi to the drivers/bmc/?

Quoted 2 lines

Arnd

appreciate your opinions, Joel, Andrew and Patrick?

Thanks,

Tomer

#5 lore raw

Re: [PATCH v1 2/2] soc: nuvoton: add NPCM LPC BPC driver

Quoted 5 lines · Tomer Maimon

Probably the only vendors that will use the snoop will be Nuvoton and Aspeed. is it worth to create new snoop common user interface for it,
if we will develop a new snoop user interface who will be the maintainer?

One or more of you will have to volunteer to maintain the new subsystem.

There are lots of ways this can be structured, and once you have a maintainer (team), they can decide how to do it, but I'm available to come up with ideas here.

Generally speaking, you don't need a ton of abstraction. The drivers/watchdog subsystem could serve as a template there. This has both models, the old way in which each HW specific driver uses its own chardev, and the new model in which the common code sits in a library module, and individual drivers register to it.

I think the amount of code for two drivers is roughly the same in either model, but the shared user interface implementation makes it easier to ensure that the interfaces are in fact compatible.

The other thing your own framework can do is to provide some consistency between BMC specific drivers for different functionality.

Quoted 6 lines
Quoted 4 lines

Maybe we can introduce a drivers/bmc/ (or even drivers/openbmc)

that collects all those user interfaces with a thin abstraction layer and one or two hardware specific back-ends?

Sounds good, Maybe we can move the KCS BMC from driver/char/ipmi to the drivers/bmc/?

Good idea. Yes, please.

Arnd