Skip to contentSkip to conversation

mfd: nct6694: Refactor transport layer and add HIF (eSPI) support

PATCH Superseded [email protected] 2 participants 4 messages Apr 22 – Apr 26

Subsystems (2)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v3 cover mfd: nct6694: Refactor transport layer and add HIF (eSPI) support

From: Ming Yu <[email protected]>

The Nuvoton NCT6694 is a peripheral expander that provides GPIO, I2C, CAN-FD, Watchdog, HWMON, PWM, and RTC sub-devices. Currently, the driver only supports USB as the host transport interface.

This series refactors the NCT6694 MFD core to support multiple transport backends and adds a new Host Interface (HIF) transport driver that communicates over eSPI using Super-I/O shared memory.

Changes since version 2:
- Restore per-device IDA and mfd_add_hotplug_devices()/PLATFORM_DEVID_AUTO to avoid child device ID conflicts with multiple NCT6694 chips.
- Validate irq_find_mapping() return value before dispatching IRQs.
- Check superio_enter() return value in nct6694_irq_init().

Changes since version 1:
- Reworked the Super-I/O access helpers.

Ming Yu (1):
mfd: Add Host Interface (HIF) support for Nuvoton NCT6694

 MAINTAINERS                 |   1 +
 drivers/mfd/Kconfig         |  47 ++-
 drivers/mfd/Makefile        |   3 +-
 drivers/mfd/nct6694-hif.c   | 663 ++++++++++++++++++++++++++++++++++++
 drivers/mfd/nct6694.c       | 111 ++++--
 include/linux/mfd/nct6694.h |  54 +--
 6 files changed, 813 insertions(+), 66 deletions(-)
 create mode 100644 drivers/mfd/nct6694-hif.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/1 mfd: Add Host Interface (HIF) support for Nuvoton NCT6694

From: Ming Yu <[email protected]>

The Nuvoton NCT6694 also provides a Host Interface (HIF) via eSPI to the host to access its features.

Sub-devices can use the common functions nct6694_read_msg() and nct6694_write_msg() to issue a command. They can also request interrupts that will be called when the HIF device triggers a shared memory interrupt.

To support multiple transports, the driver configuration is updated to allow selecting between the USB and HIF interfaces.

---
Changes since version 2:
- Restore per-device IDA and mfd_add_hotplug_devices()/PLATFORM_DEVID_AUTO to avoid child device ID conflicts with multiple NCT6694 chips.
- Validate irq_find_mapping() return value before dispatching IRQs.
- Check superio_enter() return value in nct6694_irq_init().

Changes since version 1:
- Drop function pointers from Super-I/O access and use static inline helpers with proper types.

 MAINTAINERS                 |   1 +
 drivers/mfd/Kconfig         |  47 ++-
 drivers/mfd/Makefile        |   3 +-
 drivers/mfd/nct6694-hif.c   | 663 ++++++++++++++++++++++++++++++++++++
 drivers/mfd/nct6694.c       | 111 ++++--
 include/linux/mfd/nct6694.h |  54 +--
 6 files changed, 813 insertions(+), 66 deletions(-)
 create mode 100644 drivers/mfd/nct6694-hif.c
MAINTAINERS +1 -0
index d25342ca8aa1..fb2b126502a0 100644
@@ -19055,6 +19055,7 @@ S:	Supported
 F:	drivers/gpio/gpio-nct6694.c
 F:	drivers/hwmon/nct6694-hwmon.c
 F:	drivers/i2c/busses/i2c-nct6694.c
+F:	drivers/mfd/nct6694-hif.c
 F:	drivers/mfd/nct6694.c
 F:	drivers/net/can/usb/nct6694_canfd.c
 F:	drivers/rtc/rtc-nct6694.c
drivers/mfd/Kconfig +37 -10

56 lines not on this page · raw message

drivers/mfd/Makefile +2 -1
index e75e8045c28a..4cee9b74978c 100644
@@ -124,7 +124,8 @@ obj-$(CONFIG_MFD_MC13XXX_I2C)	+= mc13xxx-i2c.o
 
 obj-$(CONFIG_MFD_PF1550)	+= pf1550.o
 
-obj-$(CONFIG_MFD_NCT6694)	+= nct6694.o
+obj-$(CONFIG_MFD_NCT6694_HIF)	+= nct6694-hif.o
+obj-$(CONFIG_MFD_NCT6694_USB)	+= nct6694.o
 
 obj-$(CONFIG_MFD_CORE)		+= mfd-core.o
 
drivers/mfd/nct6694-hif.c new file +663 -0

663 lines not on this page · raw message

drivers/mfd/nct6694.c +75 -36

240 lines not on this page · raw message

include/linux/mfd/nct6694.h +35 -19

84 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v3 1/1] mfd: Add Host Interface (HIF) support for Nuvoton NCT6694

kernel test robot noticed the following build warnings:

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-leds/for-leds-next linus/master lee-mfd/for-mfd-fixes v7.0 next-20260424] [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/a0282524688-gmail-com/mfd-Add-Host-Interface-HIF-support-for-Nuvoton-NCT6694/20260424-201531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
patch link:    https://lore.kernel.org/r/20260422035307.2065172-2-a0282524688%40gmail.com
patch subject: [PATCH v3 1/1] mfd: Add Host Interface (HIF) support for Nuvoton NCT6694
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20260426/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260426/[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]/

All warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-nct6694.c:21:9: warning: 'NCT6694_GPIO_MOD' redefined
      21 | #define NCT6694_GPIO_MOD        0xFF
         |         ^~~~~~~~~~~~~~~~
   In file included from drivers/gpio/gpio-nct6694.c:12:
   include/linux/mfd/nct6694.h:27:9: note: this is the location of the previous definition
      27 | #define NCT6694_GPIO_MOD        NCT6694_RPT_MOD
         |         ^~~~~~~~~~~~~~~~

vim +/NCT6694_GPIO_MOD +21 drivers/gpio/gpio-nct6694.c

611a995e8ae1a5 Ming Yu 2025-09-12  15  
611a995e8ae1a5 Ming Yu 2025-09-12  16  /*
611a995e8ae1a5 Ming Yu 2025-09-12  17   * USB command module type for NCT6694 GPIO controller.
611a995e8ae1a5 Ming Yu 2025-09-12  18   * This defines the module type used for communication with the NCT6694
611a995e8ae1a5 Ming Yu 2025-09-12  19   * GPIO controller over the USB interface.
611a995e8ae1a5 Ming Yu 2025-09-12  20   */

611a995e8ae1a5 Ming Yu 2025-09-12 @21 #define NCT6694_GPIO_MOD 0xFF
611a995e8ae1a5 Ming Yu 2025-09-12 22

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw

Re: [PATCH v3 1/1] mfd: Add Host Interface (HIF) support for Nuvoton NCT6694

In reply to [email protected]
kernel test robot noticed the following build warnings:

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-leds/for-leds-next linus/master lee-mfd/for-mfd-fixes v7.0 next-20260424] [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/a0282524688-gmail-com/mfd-Add-Host-Interface-HIF-support-for-Nuvoton-NCT6694/20260424-201531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
patch link:    https://lore.kernel.org/r/20260422035307.2065172-2-a0282524688%40gmail.com
patch subject: [PATCH v3 1/1] mfd: Add Host Interface (HIF) support for Nuvoton NCT6694
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260427/[email protected]/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260427/[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]/

All warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-nct6694.c:21:9: warning: 'NCT6694_GPIO_MOD' macro redefined [-Wmacro-redefined]
      21 | #define NCT6694_GPIO_MOD        0xFF
         |         ^
   include/linux/mfd/nct6694.h:27:9: note: previous definition is here
      27 | #define NCT6694_GPIO_MOD        NCT6694_RPT_MOD
         |         ^

1 warning generated.

vim +/NCT6694_GPIO_MOD +21 drivers/gpio/gpio-nct6694.c

611a995e8ae1a5 Ming Yu 2025-09-12  15  
611a995e8ae1a5 Ming Yu 2025-09-12  16  /*
611a995e8ae1a5 Ming Yu 2025-09-12  17   * USB command module type for NCT6694 GPIO controller.
611a995e8ae1a5 Ming Yu 2025-09-12  18   * This defines the module type used for communication with the NCT6694
611a995e8ae1a5 Ming Yu 2025-09-12  19   * GPIO controller over the USB interface.
611a995e8ae1a5 Ming Yu 2025-09-12  20   */

611a995e8ae1a5 Ming Yu 2025-09-12 @21 #define NCT6694_GPIO_MOD 0xFF
611a995e8ae1a5 Ming Yu 2025-09-12 22

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki