Skip to contentSkip to conversation

soc: add NPCM BPC driver support

PATCH Superseded Tomer Maimon 4 participants 9 messages Dec 12, 2023 – Dec 13, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tomer Maimon

author maintainer
#0 lore raw

v2 cover soc: add NPCM BPC driver support

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

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

NPCM BPC can support capture double words.

The NPCM BPC driver tested on NPCM750 Olympus board.

Tomer Maimon (3):
dt-bindings: soc: nuvoton: Add NPCM BPC
soc: nuvoton: add configuration menu
soc: nuvoton: add NPCM BPC driver

 .../soc/nuvoton/nuvoton,npcm-bpc.yaml         |  63 +++
 drivers/soc/nuvoton/Kconfig                   |  16 +-
 drivers/soc/nuvoton/Makefile                  |   1 +
 drivers/soc/nuvoton/npcm-bpc.c                | 388 ++++++++++++++++++
 4 files changed, 467 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml
 create mode 100644 drivers/soc/nuvoton/npcm-bpc.c
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v2 1/3 dt-bindings: soc: nuvoton: Add NPCM BPC

Added device tree binding documentation for Nuvoton BMC NPCM BIOS Post Code (BPC).

The NPCM BPC monitoring two configurable I/O addresses written by the host on the bus.

---
 .../soc/nuvoton/nuvoton,npcm-bpc.yaml         | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +63 -0
new file mode 100644
index 000000000000..30033cdac8f5
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/nuvoton/nuvoton,npcm-bpc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton BMC NPCM BIOS Post Code (bpc) controller
+
+maintainers:
+  - Tomer Maimon <[email protected]>
+
+description:
+  Nuvoton BMC NPCM BIOS Post Code (BPC) monitoring two configurable I/O
+  addresses written by the host on the bus, the capture data stored in
+  128-word FIFO.
+
+  NPCM BPC supports capture double words, when using capture
+  double word only I/O address 1 is monitored.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-bpc
+      - nuvoton,npcm845-bpc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  nuvoton,monitor-ports:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    description:
+      Contain monitor I/O addresses on the bus, at least one monitor I/O
+      address required.
+
+  nuvoton,bpc-en-dwcapture:
+    description:
+      If present, Enable FIFO capture of the DWord address according to
+      one address setting.
+    type: boolean
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - nuvoton,monitor-ports
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    bpc: bpc@f0007040 {
+        compatible = "nuvoton,npcm750-bpc";
+        reg = <0xf0007040 0x20>;
+        interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+        nuvoton,monitor-ports = <0x80>;
+    };
+...
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: soc: nuvoton: Add NPCM BPC

Quoted 49 lines · Tomer Maimon

Added device tree binding documentation for Nuvoton BMC NPCM BIOS Post Code (BPC).

The NPCM BPC monitoring two configurable I/O addresses written by the host on the bus.

---
 .../soc/nuvoton/nuvoton,npcm-bpc.yaml         | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +31 -0
new file mode 100644
index 000000000000..30033cdac8f5
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/nuvoton/nuvoton,npcm-bpc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton BMC NPCM BIOS Post Code (bpc) controller
+
+maintainers:
+  - Tomer Maimon <[email protected]>
+
+description:
+  Nuvoton BMC NPCM BIOS Post Code (BPC) monitoring two configurable I/O
+  addresses written by the host on the bus, the capture data stored in
+  128-word FIFO.
+
+  NPCM BPC supports capture double words, when using capture
+  double word only I/O address 1 is monitored.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-bpc
+      - nuvoton,npcm845-bpc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+

Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml line 41

Quoted 10 lines
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +10 -0
+  nuvoton,monitor-ports:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    description:
+      Contain monitor I/O addresses on the bus, at least one monitor I/O
+      address required.
+
+  nuvoton,bpc-en-dwcapture:
+    description:
+      If present, Enable FIFO capture of the DWord address according to
+      one address setting.

This sounds like something you can either infer from the compatible or is determining software policy. A more detailed explanation/justification is required here.

Thanks,
Conor.

Quoted 26 lines
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +22 -0
+    type: boolean
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - nuvoton,monitor-ports
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    bpc: bpc@f0007040 {
+        compatible = "nuvoton,npcm750-bpc";
+        reg = <0xf0007040 0x20>;
+        interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+        nuvoton,monitor-ports = <0x80>;
+    };
+...
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: soc: nuvoton: Add NPCM BPC

In reply to Tomer Maimon
Quoted 8 lines · Tomer Maimon

Added device tree binding documentation for Nuvoton BMC NPCM BIOS Post Code (BPC).

The NPCM BPC monitoring two configurable I/O addresses written by the host on the bus.

---

It's v2, so changelog?

Quoted 10 lines
 .../soc/nuvoton/nuvoton,npcm-bpc.yaml         | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +0 -0
new file mode 100644
index 000000000000..30033cdac8f5

Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +7 -0
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/nuvoton/nuvoton,npcm-bpc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton BMC NPCM BIOS Post Code (bpc) controller

s/bpc/BPC/

Quoted 7 lines
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +7 -0
+
+maintainers:
+  - Tomer Maimon <[email protected]>
+
+description:
+  Nuvoton BMC NPCM BIOS Post Code (BPC) monitoring two configurable I/O
+  addresses written by the host on the bus, the capture data stored in

Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +10 -0
+  128-word FIFO.
+
+  NPCM BPC supports capture double words, when using capture
+  double word only I/O address 1 is monitored.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-bpc
+      - nuvoton,npcm845-bpc

Your device driver suggests these are compatible, so express it in the bindings and modify driver respectively.

Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml line 28

Quoted 4 lines
Documentation/devicetree/bindings/soc/nuvoton/nuvoton,npcm-bpc.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+

Best regards,
Krzysztof

author maintainer
#4 lore raw

PATCH v2 2/3 soc: nuvoton: add configuration menu

In reply to Tomer Maimon

Add menu configuration to Nuvoton SoC drivers.

---
 drivers/soc/nuvoton/Kconfig | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/soc/nuvoton/Kconfig +6 -1
index df46182088ec..d5102f5f0c28 100644
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
-menuconfig WPCM450_SOC
+
+menu "NUVOTON SoC drivers"
+
+config WPCM450_SOC
 	tristate "Nuvoton WPCM450 SoC driver"
 	default y if ARCH_WPCM450
 	select SOC_BUS
@@ -9,3 +12,5 @@ menuconfig WPCM450_SOC
 
 	  This driver provides information such as the SoC model and
 	  revision.
+
+endmenu
Signature · 1 line
2.34.1
author maintainer
#5 lore raw

PATCH v2 3/3 soc: nuvoton: add NPCM BPC driver

In reply to Tomer Maimon

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

The NPCM BPC monitoring two configurable I/O address written by the host on the bus.

---
 drivers/soc/nuvoton/Kconfig    |   9 +
 drivers/soc/nuvoton/Makefile   |   1 +
 drivers/soc/nuvoton/npcm-bpc.c | 388 +++++++++++++++++++++++++++++++++
 3 files changed, 398 insertions(+)
 create mode 100644 drivers/soc/nuvoton/npcm-bpc.c
drivers/soc/nuvoton/Kconfig +9 -0
index d5102f5f0c28..ebd162633942 100644
@@ -2,6 +2,15 @@
 
 menu "NUVOTON SoC drivers"
 
+config NPCM_BPC
+	tristate "NPCM BIOS Post Code support"
+	depends on (ARCH_NPCM || COMPILE_TEST)
+	help
+	  Provides NPCM driver to control the BIOS Post Code
+	  interface which allows the BMC to monitor and save
+	  the data written by the host to an arbitrary I/O port,
+	  the BPC is connected to the host thourgh LPC or eSPI bus.
+
 config WPCM450_SOC
 	tristate "Nuvoton WPCM450 SoC driver"
 	default y if ARCH_WPCM450
drivers/soc/nuvoton/Makefile +1 -0
index e30317b4e829..c6c96079c6e9 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_NPCM_BPC)		+= npcm-bpc.o
 obj-$(CONFIG_WPCM450_SOC)	+= wpcm450-soc.o
drivers/soc/nuvoton/npcm-bpc.c new file +388 -0

388 lines not on this page · raw message

Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v2 3/3] soc: nuvoton: add NPCM BPC driver

kernel test robot noticed the following build warnings:

Hi Tomer,

kernel test robot noticed the following build warnings:

[auto build test WARNING on soc/for-next]
[also build test WARNING on robh/for-next linus/master v6.7-rc5 next-20231212] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tomer-Maimon/dt-bindings-soc-nuvoton-Add-NPCM-BPC/20231212-181115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link:    https://lore.kernel.org/r/20231212100703.3374555-4-tmaimon77%40gmail.com
patch subject: [PATCH v2 3/3] soc: nuvoton: add NPCM BPC driver
config: arm64-randconfig-r112-20231213 (https://download.01.org/0day-ci/archive/20231213/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20231213/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> drivers/soc/nuvoton/npcm-bpc.c:105:22: sparse: sparse: invalid assignment: |=
>> drivers/soc/nuvoton/npcm-bpc.c:105:22: sparse:    left side has type restricted __poll_t
>> drivers/soc/nuvoton/npcm-bpc.c:105:22: sparse:    right side has type int

drivers/soc/nuvoton/npcm-bpc.c:108:22: sparse: sparse: invalid assignment: |=
drivers/soc/nuvoton/npcm-bpc.c:108:22: sparse: left side has type restricted __poll_t
drivers/soc/nuvoton/npcm-bpc.c:108:22: sparse: right side has type int

vim +105 drivers/soc/nuvoton/npcm-bpc.c

    97	
    98	static __poll_t npcm_bpc_poll(struct file *file, struct poll_table_struct *pt)
    99	{
   100		struct npcm_bpc_channel *chan = npcm_file_to_ch(file);
   101		__poll_t mask = 0;
   102	
   103		poll_wait(file, &chan->wq, pt);
   104		if (!kfifo_is_empty(&chan->fifo))
 > 105			mask |= POLLIN;

106
107 if (chan->host_reset) {
108 mask |= POLLHUP;
109 chan->host_reset = false;
110 }
111
112 return mask;
113 }
114

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#7 lore raw
In reply to Tomer Maimon
Quoted 10 lines · Tomer Maimon

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

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

NPCM BPC can support capture double words.

The NPCM BPC driver tested on NPCM750 Olympus board.

Where is the changelog?

Best regards,
Krzysztof

author maintainer
#8 lore raw

Hi Krzysztof,

Thanks for your comment

Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Tomer Maimon

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

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

Quoted 5 lines
Quoted 3 lines

NPCM BPC can support capture double words.

The NPCM BPC driver tested on NPCM750 Olympus board.

Where is the changelog?

Sorry i forgot to add the change log, I will do it in version 3

Quoted 4 lines

Best regards,
Krzysztof

Best regards,

Tomer