Re: [PATCH ipmi/kcs_bmc v1] ipmi: add an NPCM7xx KCS BMC driver

2018-04-13 Thread Wang, Haiyue

Thanks, Corey.

BR,

Haiyue


On 2018-04-13 23:56, Corey Minyard wrote:

On 03/22/2018 07:50 AM, Haiyue Wang wrote:

This driver exposes the Keyboard Controller Style (KCS) interface on
Novoton NPCM7xx SoCs as a character device. Such SOCs are commonly used
as a BaseBoard Management Controller (BMC) on a server board, and KCS
interface is commonly used to perform the in-band IPMI communication
between the server and its BMC.


Sorry, I missed this.  It is queued for the next kernel release.

Thanks,

-corey 




Re: [PATCH ipmi/kcs_bmc v1] ipmi: add an NPCM7xx KCS BMC driver

2018-04-13 Thread Wang, Haiyue

Thanks, Corey.

BR,

Haiyue


On 2018-04-13 23:56, Corey Minyard wrote:

On 03/22/2018 07:50 AM, Haiyue Wang wrote:

This driver exposes the Keyboard Controller Style (KCS) interface on
Novoton NPCM7xx SoCs as a character device. Such SOCs are commonly used
as a BaseBoard Management Controller (BMC) on a server board, and KCS
interface is commonly used to perform the in-band IPMI communication
between the server and its BMC.


Sorry, I missed this.  It is queued for the next kernel release.

Thanks,

-corey 




Re: [PATCH ipmi/kcs_bmc v1] ipmi: add an NPCM7xx KCS BMC driver

2018-04-13 Thread Corey Minyard

On 03/22/2018 07:50 AM, Haiyue Wang wrote:

This driver exposes the Keyboard Controller Style (KCS) interface on
Novoton NPCM7xx SoCs as a character device. Such SOCs are commonly used
as a BaseBoard Management Controller (BMC) on a server board, and KCS
interface is commonly used to perform the in-band IPMI communication
between the server and its BMC.


Sorry, I missed this.  It is queued for the next kernel release.

Thanks,

-corey



Signed-off-by: Avi Fishman 
Signed-off-by: Haiyue Wang 
---
  .../devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt   |  39 
  drivers/char/ipmi/Kconfig  |  15 ++
  drivers/char/ipmi/Makefile |   1 +
  drivers/char/ipmi/kcs_bmc_npcm7xx.c| 204 +
  4 files changed, 259 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
  create mode 100644 drivers/char/ipmi/kcs_bmc_npcm7xx.c

diff --git a/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt 
b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
new file mode 100644
index 000..3538a21
--- /dev/null
+++ b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
@@ -0,0 +1,39 @@
+* Nuvoton NPCM7xx KCS (Keyboard Controller Style) IPMI interface
+
+The Nuvoton SOCs (NPCM7xx) are commonly used as BMCs
+(Baseboard Management Controllers) and the KCS interface can be
+used to perform in-band IPMI communication with their host.
+
+Required properties:
+- compatible : should be one of
+"nuvoton,npcm750-kcs-bmc"
+- interrupts : interrupt generated by the controller
+- kcs_chan : The KCS channel number in the controller
+
+Example:
+
+lpc_kcs: lpc_kcs@f0007000 {
+compatible = "nuvoton,npcm750-lpc-kcs", "simple-mfd", "syscon";
+reg = <0xf0007000 0x40>;
+reg-io-width = <1>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges = <0x0 0xf0007000 0x40>;
+
+kcs1: kcs1@0 {
+compatible = "nuvoton,npcm750-kcs-bmc";
+reg = <0x0 0x40>;
+interrupts = <0 9 4>;
+kcs_chan = <1>;
+status = "disabled";
+};
+
+kcs2: kcs2@0 {
+compatible = "nuvoton,npcm750-kcs-bmc";
+reg = <0x0 0x40>;
+interrupts = <0 9 4>;
+kcs_chan = <2>;
+status = "disabled";
+};
+};
\ No newline at end of file
diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig
index 3bda116..470f976 100644
--- a/drivers/char/ipmi/Kconfig
+++ b/drivers/char/ipmi/Kconfig
@@ -111,6 +111,21 @@ config ASPEED_KCS_IPMI_BMC
  The driver implements the BMC side of the KCS contorller, it
  provides the access of KCS IO space for BMC side.
  
+config NPCM7XX_KCS_IPMI_BMC

+   depends on ARCH_NPCM7XX || COMPILE_TEST
+   select IPMI_KCS_BMC
+   select REGMAP_MMIO
+   tristate "NPCM7xx KCS IPMI BMC driver"
+   help
+ Provides a driver for the KCS (Keyboard Controller Style) IPMI
+ interface found on Nuvoton NPCM7xx SOCs.
+
+ The driver implements the BMC side of the KCS contorller, it
+ provides the access of KCS IO space for BMC side.
+
+ This support is also available as a module.  If so, the module
+ will be called kcs_bmc_npcm7xx.
+
  config ASPEED_BT_IPMI_BMC
depends on ARCH_ASPEED || COMPILE_TEST
 depends on REGMAP && REGMAP_MMIO && MFD_SYSCON
diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
index 21e9e87..7a3baf3 100644
--- a/drivers/char/ipmi/Makefile
+++ b/drivers/char/ipmi/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
  obj-$(CONFIG_IPMI_KCS_BMC) += kcs_bmc.o
  obj-$(CONFIG_ASPEED_BT_IPMI_BMC) += bt-bmc.o
  obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o
+obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o
diff --git a/drivers/char/ipmi/kcs_bmc_npcm7xx.c 
b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
new file mode 100644
index 000..7bc898c
--- /dev/null
+++ b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
@@ -0,0 +1,204 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, Nuvoton Corporation.
+ * Copyright (c) 2018, Intel Corporation.
+ */
+
+#define pr_fmt(fmt) "nuvoton-kcs-bmc: " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "kcs_bmc.h"
+
+#define DEVICE_NAME"npcm-kcs-bmc"
+#define KCS_CHANNEL_MAX3
+
+#define KCS1ST 0x0C
+#define KCS2ST 0x1E
+#define KCS3ST 0x30
+
+#define KCS1DO 0x0E
+#define KCS2DO 0x20
+#define KCS3DO 0x32
+
+#define KCS1DI 0x10
+#define KCS2DI 0x22
+#define KCS3DI 0x34
+
+#define KCS1CTL0x18
+#define KCS2CTL0x2A
+#define KCS3CTL0x3C
+#defineKCS_CTL_IBFIE   BIT(0)
+
+/*
+ * 7.2.4 Core KCS 

Re: [PATCH ipmi/kcs_bmc v1] ipmi: add an NPCM7xx KCS BMC driver

2018-04-13 Thread Corey Minyard

On 03/22/2018 07:50 AM, Haiyue Wang wrote:

This driver exposes the Keyboard Controller Style (KCS) interface on
Novoton NPCM7xx SoCs as a character device. Such SOCs are commonly used
as a BaseBoard Management Controller (BMC) on a server board, and KCS
interface is commonly used to perform the in-band IPMI communication
between the server and its BMC.


Sorry, I missed this.  It is queued for the next kernel release.

Thanks,

-corey



Signed-off-by: Avi Fishman 
Signed-off-by: Haiyue Wang 
---
  .../devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt   |  39 
  drivers/char/ipmi/Kconfig  |  15 ++
  drivers/char/ipmi/Makefile |   1 +
  drivers/char/ipmi/kcs_bmc_npcm7xx.c| 204 +
  4 files changed, 259 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
  create mode 100644 drivers/char/ipmi/kcs_bmc_npcm7xx.c

diff --git a/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt 
b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
new file mode 100644
index 000..3538a21
--- /dev/null
+++ b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
@@ -0,0 +1,39 @@
+* Nuvoton NPCM7xx KCS (Keyboard Controller Style) IPMI interface
+
+The Nuvoton SOCs (NPCM7xx) are commonly used as BMCs
+(Baseboard Management Controllers) and the KCS interface can be
+used to perform in-band IPMI communication with their host.
+
+Required properties:
+- compatible : should be one of
+"nuvoton,npcm750-kcs-bmc"
+- interrupts : interrupt generated by the controller
+- kcs_chan : The KCS channel number in the controller
+
+Example:
+
+lpc_kcs: lpc_kcs@f0007000 {
+compatible = "nuvoton,npcm750-lpc-kcs", "simple-mfd", "syscon";
+reg = <0xf0007000 0x40>;
+reg-io-width = <1>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges = <0x0 0xf0007000 0x40>;
+
+kcs1: kcs1@0 {
+compatible = "nuvoton,npcm750-kcs-bmc";
+reg = <0x0 0x40>;
+interrupts = <0 9 4>;
+kcs_chan = <1>;
+status = "disabled";
+};
+
+kcs2: kcs2@0 {
+compatible = "nuvoton,npcm750-kcs-bmc";
+reg = <0x0 0x40>;
+interrupts = <0 9 4>;
+kcs_chan = <2>;
+status = "disabled";
+};
+};
\ No newline at end of file
diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig
index 3bda116..470f976 100644
--- a/drivers/char/ipmi/Kconfig
+++ b/drivers/char/ipmi/Kconfig
@@ -111,6 +111,21 @@ config ASPEED_KCS_IPMI_BMC
  The driver implements the BMC side of the KCS contorller, it
  provides the access of KCS IO space for BMC side.
  
+config NPCM7XX_KCS_IPMI_BMC

+   depends on ARCH_NPCM7XX || COMPILE_TEST
+   select IPMI_KCS_BMC
+   select REGMAP_MMIO
+   tristate "NPCM7xx KCS IPMI BMC driver"
+   help
+ Provides a driver for the KCS (Keyboard Controller Style) IPMI
+ interface found on Nuvoton NPCM7xx SOCs.
+
+ The driver implements the BMC side of the KCS contorller, it
+ provides the access of KCS IO space for BMC side.
+
+ This support is also available as a module.  If so, the module
+ will be called kcs_bmc_npcm7xx.
+
  config ASPEED_BT_IPMI_BMC
depends on ARCH_ASPEED || COMPILE_TEST
 depends on REGMAP && REGMAP_MMIO && MFD_SYSCON
diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
index 21e9e87..7a3baf3 100644
--- a/drivers/char/ipmi/Makefile
+++ b/drivers/char/ipmi/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
  obj-$(CONFIG_IPMI_KCS_BMC) += kcs_bmc.o
  obj-$(CONFIG_ASPEED_BT_IPMI_BMC) += bt-bmc.o
  obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o
+obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o
diff --git a/drivers/char/ipmi/kcs_bmc_npcm7xx.c 
b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
new file mode 100644
index 000..7bc898c
--- /dev/null
+++ b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
@@ -0,0 +1,204 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, Nuvoton Corporation.
+ * Copyright (c) 2018, Intel Corporation.
+ */
+
+#define pr_fmt(fmt) "nuvoton-kcs-bmc: " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "kcs_bmc.h"
+
+#define DEVICE_NAME"npcm-kcs-bmc"
+#define KCS_CHANNEL_MAX3
+
+#define KCS1ST 0x0C
+#define KCS2ST 0x1E
+#define KCS3ST 0x30
+
+#define KCS1DO 0x0E
+#define KCS2DO 0x20
+#define KCS3DO 0x32
+
+#define KCS1DI 0x10
+#define KCS2DI 0x22
+#define KCS3DI 0x34
+
+#define KCS1CTL0x18
+#define KCS2CTL0x2A
+#define KCS3CTL0x3C
+#defineKCS_CTL_IBFIE   BIT(0)
+
+/*
+ * 7.2.4 Core KCS Registers
+ * Registers in this module are 8 bits. An 

Re: [PATCH ipmi/kcs_bmc v1] ipmi: add an NPCM7xx KCS BMC driver

2018-03-27 Thread Avi Fishman
Thanks Haiyue,

this works for us, I am adding Tested-by: Avi Fishman 

On Thu, Mar 22, 2018 at 3:50 PM, Haiyue Wang
 wrote:
> This driver exposes the Keyboard Controller Style (KCS) interface on
> Novoton NPCM7xx SoCs as a character device. Such SOCs are commonly used
> as a BaseBoard Management Controller (BMC) on a server board, and KCS
> interface is commonly used to perform the in-band IPMI communication
> between the server and its BMC.
>
> Signed-off-by: Avi Fishman 

Tested-by: Avi Fishman 

> Signed-off-by: Haiyue Wang 
> ---
>  .../devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt   |  39 
>  drivers/char/ipmi/Kconfig  |  15 ++
>  drivers/char/ipmi/Makefile |   1 +
>  drivers/char/ipmi/kcs_bmc_npcm7xx.c| 204 
> +
>  4 files changed, 259 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
>  create mode 100644 drivers/char/ipmi/kcs_bmc_npcm7xx.c
>
> diff --git a/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt 
> b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
> new file mode 100644
> index 000..3538a21
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
> @@ -0,0 +1,39 @@
> +* Nuvoton NPCM7xx KCS (Keyboard Controller Style) IPMI interface
> +
> +The Nuvoton SOCs (NPCM7xx) are commonly used as BMCs
> +(Baseboard Management Controllers) and the KCS interface can be
> +used to perform in-band IPMI communication with their host.
> +
> +Required properties:
> +- compatible : should be one of
> +"nuvoton,npcm750-kcs-bmc"
> +- interrupts : interrupt generated by the controller
> +- kcs_chan : The KCS channel number in the controller
> +
> +Example:
> +
> +lpc_kcs: lpc_kcs@f0007000 {
> +compatible = "nuvoton,npcm750-lpc-kcs", "simple-mfd", "syscon";
> +reg = <0xf0007000 0x40>;
> +reg-io-width = <1>;
> +
> +#address-cells = <1>;
> +#size-cells = <1>;
> +ranges = <0x0 0xf0007000 0x40>;
> +
> +kcs1: kcs1@0 {
> +compatible = "nuvoton,npcm750-kcs-bmc";
> +reg = <0x0 0x40>;
> +interrupts = <0 9 4>;
> +kcs_chan = <1>;
> +status = "disabled";
> +};
> +
> +kcs2: kcs2@0 {
> +compatible = "nuvoton,npcm750-kcs-bmc";
> +reg = <0x0 0x40>;
> +interrupts = <0 9 4>;
> +kcs_chan = <2>;
> +status = "disabled";
> +};
> +};
> \ No newline at end of file
> diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig
> index 3bda116..470f976 100644
> --- a/drivers/char/ipmi/Kconfig
> +++ b/drivers/char/ipmi/Kconfig
> @@ -111,6 +111,21 @@ config ASPEED_KCS_IPMI_BMC
>   The driver implements the BMC side of the KCS contorller, it
>   provides the access of KCS IO space for BMC side.
>
> +config NPCM7XX_KCS_IPMI_BMC
> +   depends on ARCH_NPCM7XX || COMPILE_TEST
> +   select IPMI_KCS_BMC
> +   select REGMAP_MMIO
> +   tristate "NPCM7xx KCS IPMI BMC driver"
> +   help
> + Provides a driver for the KCS (Keyboard Controller Style) IPMI
> + interface found on Nuvoton NPCM7xx SOCs.
> +
> + The driver implements the BMC side of the KCS contorller, it
> + provides the access of KCS IO space for BMC side.
> +
> + This support is also available as a module.  If so, the module
> + will be called kcs_bmc_npcm7xx.
> +
>  config ASPEED_BT_IPMI_BMC
> depends on ARCH_ASPEED || COMPILE_TEST
> depends on REGMAP && REGMAP_MMIO && MFD_SYSCON
> diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
> index 21e9e87..7a3baf3 100644
> --- a/drivers/char/ipmi/Makefile
> +++ b/drivers/char/ipmi/Makefile
> @@ -24,3 +24,4 @@ obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
>  obj-$(CONFIG_IPMI_KCS_BMC) += kcs_bmc.o
>  obj-$(CONFIG_ASPEED_BT_IPMI_BMC) += bt-bmc.o
>  obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o
> +obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o
> diff --git a/drivers/char/ipmi/kcs_bmc_npcm7xx.c 
> b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
> new file mode 100644
> index 000..7bc898c
> --- /dev/null
> +++ b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
> @@ -0,0 +1,204 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2018, Nuvoton Corporation.
> + * Copyright (c) 2018, Intel Corporation.
> + */
> +
> +#define pr_fmt(fmt) "nuvoton-kcs-bmc: " fmt
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "kcs_bmc.h"
> +
> +#define DEVICE_NAME"npcm-kcs-bmc"
> +#define KCS_CHANNEL_MAX3
> +
> +#define KCS1ST 0x0C
> +#define KCS2ST 0x1E
> +#define KCS3ST 0x30
> +
> 

Re: [PATCH ipmi/kcs_bmc v1] ipmi: add an NPCM7xx KCS BMC driver

2018-03-27 Thread Avi Fishman
Thanks Haiyue,

this works for us, I am adding Tested-by: Avi Fishman 

On Thu, Mar 22, 2018 at 3:50 PM, Haiyue Wang
 wrote:
> This driver exposes the Keyboard Controller Style (KCS) interface on
> Novoton NPCM7xx SoCs as a character device. Such SOCs are commonly used
> as a BaseBoard Management Controller (BMC) on a server board, and KCS
> interface is commonly used to perform the in-band IPMI communication
> between the server and its BMC.
>
> Signed-off-by: Avi Fishman 

Tested-by: Avi Fishman 

> Signed-off-by: Haiyue Wang 
> ---
>  .../devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt   |  39 
>  drivers/char/ipmi/Kconfig  |  15 ++
>  drivers/char/ipmi/Makefile |   1 +
>  drivers/char/ipmi/kcs_bmc_npcm7xx.c| 204 
> +
>  4 files changed, 259 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
>  create mode 100644 drivers/char/ipmi/kcs_bmc_npcm7xx.c
>
> diff --git a/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt 
> b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
> new file mode 100644
> index 000..3538a21
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt
> @@ -0,0 +1,39 @@
> +* Nuvoton NPCM7xx KCS (Keyboard Controller Style) IPMI interface
> +
> +The Nuvoton SOCs (NPCM7xx) are commonly used as BMCs
> +(Baseboard Management Controllers) and the KCS interface can be
> +used to perform in-band IPMI communication with their host.
> +
> +Required properties:
> +- compatible : should be one of
> +"nuvoton,npcm750-kcs-bmc"
> +- interrupts : interrupt generated by the controller
> +- kcs_chan : The KCS channel number in the controller
> +
> +Example:
> +
> +lpc_kcs: lpc_kcs@f0007000 {
> +compatible = "nuvoton,npcm750-lpc-kcs", "simple-mfd", "syscon";
> +reg = <0xf0007000 0x40>;
> +reg-io-width = <1>;
> +
> +#address-cells = <1>;
> +#size-cells = <1>;
> +ranges = <0x0 0xf0007000 0x40>;
> +
> +kcs1: kcs1@0 {
> +compatible = "nuvoton,npcm750-kcs-bmc";
> +reg = <0x0 0x40>;
> +interrupts = <0 9 4>;
> +kcs_chan = <1>;
> +status = "disabled";
> +};
> +
> +kcs2: kcs2@0 {
> +compatible = "nuvoton,npcm750-kcs-bmc";
> +reg = <0x0 0x40>;
> +interrupts = <0 9 4>;
> +kcs_chan = <2>;
> +status = "disabled";
> +};
> +};
> \ No newline at end of file
> diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig
> index 3bda116..470f976 100644
> --- a/drivers/char/ipmi/Kconfig
> +++ b/drivers/char/ipmi/Kconfig
> @@ -111,6 +111,21 @@ config ASPEED_KCS_IPMI_BMC
>   The driver implements the BMC side of the KCS contorller, it
>   provides the access of KCS IO space for BMC side.
>
> +config NPCM7XX_KCS_IPMI_BMC
> +   depends on ARCH_NPCM7XX || COMPILE_TEST
> +   select IPMI_KCS_BMC
> +   select REGMAP_MMIO
> +   tristate "NPCM7xx KCS IPMI BMC driver"
> +   help
> + Provides a driver for the KCS (Keyboard Controller Style) IPMI
> + interface found on Nuvoton NPCM7xx SOCs.
> +
> + The driver implements the BMC side of the KCS contorller, it
> + provides the access of KCS IO space for BMC side.
> +
> + This support is also available as a module.  If so, the module
> + will be called kcs_bmc_npcm7xx.
> +
>  config ASPEED_BT_IPMI_BMC
> depends on ARCH_ASPEED || COMPILE_TEST
> depends on REGMAP && REGMAP_MMIO && MFD_SYSCON
> diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
> index 21e9e87..7a3baf3 100644
> --- a/drivers/char/ipmi/Makefile
> +++ b/drivers/char/ipmi/Makefile
> @@ -24,3 +24,4 @@ obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
>  obj-$(CONFIG_IPMI_KCS_BMC) += kcs_bmc.o
>  obj-$(CONFIG_ASPEED_BT_IPMI_BMC) += bt-bmc.o
>  obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o
> +obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o
> diff --git a/drivers/char/ipmi/kcs_bmc_npcm7xx.c 
> b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
> new file mode 100644
> index 000..7bc898c
> --- /dev/null
> +++ b/drivers/char/ipmi/kcs_bmc_npcm7xx.c
> @@ -0,0 +1,204 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2018, Nuvoton Corporation.
> + * Copyright (c) 2018, Intel Corporation.
> + */
> +
> +#define pr_fmt(fmt) "nuvoton-kcs-bmc: " fmt
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "kcs_bmc.h"
> +
> +#define DEVICE_NAME"npcm-kcs-bmc"
> +#define KCS_CHANNEL_MAX3
> +
> +#define KCS1ST 0x0C
> +#define KCS2ST 0x1E
> +#define KCS3ST 0x30
> +
> +#define KCS1DO 0x0E
> +#define KCS2DO 0x20
> +#define KCS3DO 0x32
> +
> +#define KCS1DI 0x10
>