All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/10] mfd: nct6694: Refactor transport layer and add HIF (eSPI) support
@ 2026-08-21  3:34 a0282524688
  2026-08-21  3:34 ` [PATCH v7 01/10] mfd: nct6694: Move module type macros to shared header a0282524688
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: a0282524688 @ 2026-08-21  3:34 UTC (permalink / raw)
  To: lee; +Cc: linux-kernel, Ming Yu

From: Ming Yu <a0282524688@gmail.com>

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.

The refactoring is split into small, self-contained steps: the USB
transport is first isolated behind a dedicated data structure and file
(nct6694-usb.c), the transport-agnostic device management is extracted
into a new core module (nct6694-core.c), and the firmware command
interface is then wrapped behind regmap so that sub-device drivers no
longer reference any transport detail. The HIF (eSPI) driver is finally
added cleanly on top of this abstraction, reusing the shared core.

Patches 6 to 8 fix pre-existing bugs in the USB transport that were
pointed out during the v6 review. They carry a Fixes tag and are placed
before the regmap rework so that they can be picked up independently.

Changes since version 6:
- Transfer command payloads through a buffer owned by the transport
  instead of the caller's, which may be embedded in a sub-device
  structure and is therefore not safe to map for DMA.
- Locate the interrupt IN endpoint with usb_find_int_in_endpoint()
  rather than reading endpoint[0] unchecked.
- Submit the interrupt URB after the core has created the IRQ domain,
  and kill it before the core is removed.
- HIF: zero the tail of the caller buffer on a short firmware response,
  request the interrupt before registering the core so that devres
  releases it last, skip unmapped hardware interrupts, return
  IRQ_HANDLED once the status has been cleared, reject an unconfigured
  shared memory base address, and program the SIRQ register with the
  hardware interrupt number instead of the Linux virq.

Changes since version 5:
- Replaced the custom read_msg/write_msg function-pointer indirection
  with a regmap-based transport abstraction. The firmware addressing
  (host control, module id and 16-bit offset) is packed into a single
  32-bit regmap register, so sub-device drivers use the standard regmap
  bulk accessors while each transport implements its own regmap_bus.
- Added nct6694_write_read_msg() for the few commands (e.g. the I2C
  "deliver") that send a request and read the reply back in a single
  transaction, and converted the I2C transfer path to use it.
- Dropped the per-transport access_lock; regmap already serialises bus
  accesses on its own.
- Reordered the series accordingly: rename the USB I/O functions and the
  driver file first, extract the transport-agnostic core, then introduce
  the regmap abstraction, and finally add the HIF driver.

Changes since version 4:
- Split the monolithic refactoring and HIF support patch into a series of
  smaller, logical commits to improve reviewability and adhere to the
  single logical change principle.
- Decoupled USB-specific data into a dedicated 'nct6694_usb_data'
  structure referenced through a void *priv pointer in the core.
- Renamed the existing driver to 'nct6694-usb.c' to strictly identify its
  transport boundary, alongside Kconfig/Makefile updates.
- Extracted transport-agnostic device management (IRQ domain setup, IDA
  initialization, and MFD cell registration) into a standalone
  'nct6694-core.c' module.
- Added the 'nct6694-hif' eSPI transport driver on top of the new core
  abstraction.

Changes since version 3:
- Remove redundant module type macro definitions from sub-device drivers
  that are now provided by the shared header <linux/mfd/nct6694.h>,
  fixing -Wmacro-redefined warnings.

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 (10):
  mfd: nct6694: Move module type macros to shared header
  mfd: nct6694: Refactor USB-specific data into nct6694_usb_data
  mfd: nct6694: Rename USB transport functions with _usb_ prefix
  mfd: nct6694: Rename driver to nct6694-usb and update Kconfig
  mfd: nct6694: Extract core device management into a separate module
  mfd: nct6694: Transfer command payloads via a dedicated DMA buffer
  mfd: nct6694: Validate the interrupt IN endpoint
  mfd: nct6694: Submit the interrupt URB after the core is registered
  mfd: nct6694: Introduce regmap-based transport abstraction
  mfd: nct6694: Add Host Interface (HIF) eSPI transport driver

 MAINTAINERS                         |   2 +-
 drivers/gpio/gpio-nct6694.c         |   7 -
 drivers/hwmon/nct6694-hwmon.c       |  21 -
 drivers/i2c/busses/i2c-nct6694.c    |   9 +-
 drivers/mfd/Kconfig                 |  48 ++-
 drivers/mfd/Makefile                |   4 +-
 drivers/mfd/nct6694-core.c          | 136 +++++++
 drivers/mfd/nct6694-hif.c           | 590 ++++++++++++++++++++++++++++
 drivers/mfd/nct6694-usb.c           | 388 ++++++++++++++++++
 drivers/mfd/nct6694.c               | 388 ------------------
 drivers/net/can/usb/nct6694_canfd.c |   6 -
 drivers/rtc/rtc-nct6694.c           |   7 -
 drivers/watchdog/nct6694_wdt.c      |   7 -
 include/linux/mfd/nct6694.h         | 104 ++++-
 14 files changed, 1242 insertions(+), 475 deletions(-)
 create mode 100644 drivers/mfd/nct6694-core.c
 create mode 100644 drivers/mfd/nct6694-hif.c
 create mode 100644 drivers/mfd/nct6694-usb.c
 delete mode 100644 drivers/mfd/nct6694.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-08-21  3:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  3:34 [PATCH v7 00/10] mfd: nct6694: Refactor transport layer and add HIF (eSPI) support a0282524688
2026-08-21  3:34 ` [PATCH v7 01/10] mfd: nct6694: Move module type macros to shared header a0282524688
2026-08-21  3:45   ` sashiko-bot
2026-08-21  3:34 ` [PATCH v7 02/10] mfd: nct6694: Refactor USB-specific data into nct6694_usb_data a0282524688
2026-08-21  3:34 ` [PATCH v7 03/10] mfd: nct6694: Rename USB transport functions with _usb_ prefix a0282524688
2026-08-21  3:34 ` [PATCH v7 04/10] mfd: nct6694: Rename driver to nct6694-usb and update Kconfig a0282524688
2026-08-21  3:35 ` [PATCH v7 05/10] mfd: nct6694: Extract core device management into a separate module a0282524688
2026-08-21  3:35 ` [PATCH v7 06/10] mfd: nct6694: Transfer command payloads via a dedicated DMA buffer a0282524688
2026-08-21  3:35 ` [PATCH v7 07/10] mfd: nct6694: Validate the interrupt IN endpoint a0282524688
2026-08-21  3:35 ` [PATCH v7 08/10] mfd: nct6694: Submit the interrupt URB after the core is registered a0282524688
2026-08-21  3:35 ` [PATCH v7 09/10] mfd: nct6694: Introduce regmap-based transport abstraction a0282524688
2026-08-21  3:35 ` [PATCH v7 10/10] mfd: nct6694: Add Host Interface (HIF) eSPI transport driver a0282524688

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.