Skip to content

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

[email protected] linux-can linux-gpio linux-hwmon linux-i2c linux-rt-devel linux-rtc linux-watchdog lkml mfd 10 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest13 patches 5 repliesIn review
  2. v912 patches 7 repliesSuperseded
  3. v813 patches 3 repliesApplied
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v710 patches9 repliesSuperseded
v67 patches5 repliesSuperseded
v50 of 7 patches0 repliesSuperseded
v41 patch2 repliesSuperseded
v31 patch0 repliesSuperseded
v22 patches2 repliesSuperseded
v12 patches2 repliesSuperseded

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13mfd: nct6694: Validate the USB endpointsdrivers/mfd/nct6694.c include/linux/mfd/nct6694.h+18 -130 replies
2/13mfd: nct6694: Check the length of received USB packetsdrivers/mfd/nct6694.c+15 -00 replies
3/13mfd: nct6694: Ignore interrupts without a mappingdrivers/mfd/nct6694.c+1 -10 replies
4/13mfd: nct6694: Transfer data packets via a dedicated bufferdrivers/mfd/nct6694.c include/linux/mfd/nct6694.h+31 -100 replies
5/13mfd: nct6694: Drop the unused IRQ enable maskdrivers/mfd/nct6694.c include/linux/mfd/nct6694.h+0 -272 replies
6/13mfd: nct6694: Move module type macros to shared headerdrivers/gpio/gpio-nct6694.c drivers/hwmon/nct6694-hwmon.c drivers/i2c/busses/i2c-nct6694.c +4 more+9 -551 reply
7/13mfd: nct6694: Refactor USB-specific data into nct6694_usb_datadrivers/mfd/nct6694.c include/linux/mfd/nct6694.h+136 -1190 replies
8/13mfd: nct6694: Rename USB transport functions with _usb_ prefixdrivers/mfd/nct6694.c include/linux/mfd/nct6694.h+42 -200 replies
9/13mfd: nct6694: Rename driver to nct6694-usbMAINTAINERS drivers/mfd/Makefile drivers/mfd/nct6694-usb.c+2 -20 replies
10/13mfd: nct6694: Extract core device management into a separate moduleMAINTAINERS drivers/mfd/Makefile drivers/mfd/nct6694-core.c +2 more+104 -600 replies
11/13mfd: nct6694: Introduce regmap-based transport abstractiondrivers/i2c/busses/i2c-nct6694.c drivers/mfd/Kconfig drivers/mfd/nct6694-usb.c +1 more+114 -500 replies
12/13mfd: nct6694: Add a Kconfig symbol for the USB transportdrivers/mfd/Kconfig drivers/mfd/Makefile+17 -50 replies
13/13mfd: nct6694: Add Host Interface (HIF) eSPI transport driverdrivers/mfd/Kconfig drivers/mfd/Makefile drivers/mfd/nct6694-hif.c +1 more+594 -12 replies

Reviews trailers per patch

3 of 13 patches have a Reviewed-by or Acked-by.

PatchAndi ShytiSebastian Andrzej SiewiorGuenter Roeck
1/13
2/13
3/13
4/13
5/13R-b
6/13R-b A-b
7/13
8/13
9/13
10/13
11/13A-b
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v10 thread

Cover letter [PATCH v10 00/13] 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 driver to support multiple transport backends and adds a Host Interface (HIF) transport driver that communicates over eSPI using Super-I/O shared memory.

Patches 1-5 fix pre-existing bugs in the current driver. They carry a Fixes tag and can be picked up independently of the rest of the series.

Patches 6-12 isolate the USB transport, extract the transport-agnostic core into nct6694-core.c and wrap the firmware command interface behind regmap, so that the sub-device drivers no longer depend on the transport. Patch 13 adds the HIF transport on top.

Changes since version 9:
- Added "mfd: nct6694: Drop the unused IRQ enable mask", which removes the .irq_enable/.irq_disable callbacks that took a spinlock_t under the raw desc->lock (reported by Sashiko on v9 06/12 and 09/12), and rebased "Refactor USB-specific data into nct6694_usb_data" and "Extract core device management into a separate module" on top of it.
- HIF: commented that a read of a SET register passes val_buf as the write-then-read request.
- Used devm_kzalloc_obj() for the new allocations.
- Rebased on 20eef29b7c84 (after v7.4-rc3), which converts the driver to devm_kzalloc_obj().

Changes since version 8:
- Dropped "gpio: nct6694: Mark the GPIO controller as sleeping", which has been applied by Bartosz to the GPIO tree:
https://git.kernel.org/brgl/c/fcbc48dc650d2f58bfe19c4486830de0e9cad62e
- Rejected transfers larger than NCT6694_MAX_DATA_LEN in the regmap bus callbacks of both transports.
- Reworded the commit message of "Rename USB transport functions with _usb_ prefix".
- Collected tags from Andi.
- Rebased on v7.3-rc7.

Changes since version 7:
- Marked the GPIO controller as sleeping.
- Validated the USB endpoints with usb_check_{bulk,int}_endpoints().
- Checked the length of received USB packets.
- Ignored interrupts without a mapping.
- Moved all fixes to the start of the series.
- Embedded struct nct6694 in the transport data and dropped the priv pointer.
- Renamed variables and buffers consistently.
- Retrieved struct nct6694 from the driver data in the core, and let the transports register their own MFD cells.
- Returned -ENOMEM when the IRQ domain cannot be created.
- Kept MFD_NCT6694 as the core symbol and added MFD_NCT6694_USB.
- Folded the interrupt URB submission fix into the core extraction.
- HIF: requested the interrupt after the core is set up, so that it is freed before the IRQ domain is removed.

Changes since version 6:
- Transfer command payloads through a buffer owned by the transport.
- Locate the interrupt IN endpoint with usb_find_int_in_endpoint().
- Submit the interrupt URB after the core has created the IRQ domain.
- HIF: several robustness fixes in the interrupt and shared memory setup.

Changes since version 5:
- Replaced the read_msg/write_msg function pointers with a regmap-based transport abstraction, and added nct6694_write_read_msg().

Changes since version 4:
- Split the monolithic patch into a series of logical commits.

Changes since version 3:
- Removed redundant module type macro definitions from the sub-device drivers.

Changes since version 2:
- Restored per-device IDA and PLATFORM_DEVID_AUTO.
- Validated the irq_find_mapping() return value.
- Checked the superio_enter() return value.

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

Ming Yu (13):
mfd: nct6694: Validate the USB endpoints
mfd: nct6694: Check the length of received USB packets
mfd: nct6694: Ignore interrupts without a mapping
mfd: nct6694: Transfer data packets via a dedicated buffer
mfd: nct6694: Drop the unused IRQ enable mask
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
mfd: nct6694: Extract core device management into a separate module
mfd: nct6694: Introduce regmap-based transport abstraction
mfd: nct6694: Add a Kconfig symbol for the USB transport
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                 |  34 +-
 drivers/mfd/Makefile                |   4 +-
 drivers/mfd/nct6694-core.c          |  85 ++++
 drivers/mfd/nct6694-hif.c           | 579 ++++++++++++++++++++++++++++
 drivers/mfd/nct6694-usb.c           | 420 ++++++++++++++++++++
 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         |  93 ++++-
 14 files changed, 1191 insertions(+), 471 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

base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca

Signature · 1 line
2.34.1