From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76A7E1E1E12 for ; Wed, 1 Jul 2026 03:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782877842; cv=none; b=MHILq1dmf75acpJ9a4z6/OKUykbgXLrGGZA32dIQfZD72ykllfwtW3eQOXrA9o+l/1alnxuv0ULdp0+2098PD6JcuuLCrnsmHQhbrnSMawTHlNOtFhBOxgexUBtH9rNHd9wuUzm+uZEoH7WSJCHYQb+LHR72nWk0mbRMQ8XHzMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782877842; c=relaxed/simple; bh=sEoFutNDNsMlsR4bWn/jOMqm9aJ9DZzQlVCEEIVdjM0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mHlr1QkGQVM6xMwNfie3VsoYFvqW2qmgmAqjjM4zgCQ6+Zboun/z2LnYb4pLGWhIsoBFsKc3S9XvpdG679mAlCltuBI6lU++M5lmNJIYmVtgGPHJ2lD8q8wftThq/ys72o1iK+22jxyggQfTB4fCXvDTuxHLXnMNRJeHCtBmMS8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=neDqz48H; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="neDqz48H" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c998fd549a8so37166a12.2 for ; Tue, 30 Jun 2026 20:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782877841; x=1783482641; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Quv9OyJNEO+Nv+Chz5oh3NgaVMWP06DIEoB4TON/LBA=; b=neDqz48HuxizDWf9+lcelkDcJBU9ginn4oAeFGiOSieLVOi8dyQNP1nL+M6rFTe0dS KqNQWr5tPSl2dpgjCrTaIsbESqH9la3ACzVDSGe1JcOcYK/NcmFmt5iV7K0CMuWMFBGr MpWZ6tuZZXxxaAEu3VgmluvESAMTKXf81zeahMhXZ/ys2qeO6gajfDN2eTLRDvXauNxL 2UVZGBXqoPD7HZ8ZdkgpIndM0R3iWjHMwGGJCyHoTTJfh43HunGJ9RL7oBrgjH8o7o1m FPUpaBG5z4JVCtcPEKAwgenIiSvTNv3BxUJOf7O8Gy//8Plg5nGpnrJrGz35f00cyyLE +MWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782877841; x=1783482641; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Quv9OyJNEO+Nv+Chz5oh3NgaVMWP06DIEoB4TON/LBA=; b=o7gOFzz6HAobZXDt8GnqnC200JS6kJVhDUjogpSpNH3x0tF2Sz2J+n3PxSH1xFutLo 3Idt6FfPuBSJP/WoYZaHK9dL6VtyspMOmSVL7dcSgOjWcbRV6Me714YkajLlRqA70PS8 GoxzqpUUmY/hKkCzR41e2SttjYAnOpEZQDeRAQOIYqUFL/hXbsjrghxdMJgBrcTQNdg8 a/dnvsYISZdHbykuFrAnUt+l3xgS0DAScQMI/yG3m8GJD9ous2GSghzcwtKVPgAIkQdp sBg6/1w5fbyLsApE5ZPTpCEEceBAG5iBOb+L5v7zDqf2utjx6cyCF0DnN+LClKdI58Wg BWuA== X-Gm-Message-State: AOJu0YydGGKAoFgTNEKGZYT3KqOPHcHfNKJOd7ttnVIJjPvID/3NvCrd 1fOGv6ZGiOwX/cTzKBL5D2Sr2atrmUGxebPEmPNuBJk1f/tRA7cRGP49 X-Gm-Gg: AfdE7cmopqChrmV/Pjhx0tb+7O1Y/jkERt1DeHwmZ5vQ5sGKS2nvjVDbgLyimUL/72n 6jwxjkoVtQAjLloyPq3jx26+uRPmEAyj3au4bvBa/yxZr9vJxmS4UEK96xmNcqLM/epDFu2bhWk vLsUu7ds2/ZPoPsdkHZo0uMR8OUg5QF1dvaFB0LU/FnxsizuD/V4VzrFyqDOpX0bbxaa5xbDEY7 oRFyKpoX/qkEQUhKb2KSfPCC2+yIs0gCg09IhccRrTYZyyLyd6yGpivmid2VQ21UXEb/ttxS/Jm FDBvYFNbu08pDrlSgK8FXayiyP5X6c9Yy9FFRrWs5ZSTTYYmxMgzSrbeKV/r4IFUMNhMKxY5ECd hiuj184riJode9YLsobOPpup+ItiF+t8xJ88YjUxV/DAfHGHj0vrkwO0D5VI+Dh6uYBjHbxhj2C 5A2lZt5lXOI7NZnwnn83/r21Er1n7xXc77wZoqOFT38P5VWi/To4QiUmY= X-Received: by 2002:a05:6a21:4d91:b0:3b2:a809:1000 with SMTP id adf61e73a8af0-3bfdc2da84cmr2806285637.3.1782877840509; Tue, 30 Jun 2026 20:50:40 -0700 (PDT) Received: from hcdev-d520mt2.. (60-250-196-139.hinet-ip.hinet.net. [60.250.196.139]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c9bbd27a924sm2429089a12.14.2026.06.30.20.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 20:50:40 -0700 (PDT) From: a0282524688@gmail.com To: lee@kernel.org Cc: linux-kernel@vger.kernel.org, Ming Yu Subject: [PATCH v6 0/7] mfd: nct6694: Refactor transport layer and add HIF (eSPI) support Date: Wed, 1 Jul 2026 11:50:18 +0800 Message-Id: <20260701035025.3082927-1-a0282524688@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ming Yu 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. 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 , 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 (7): 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: 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 | 565 +++++++++++++++++++++++ drivers/mfd/{nct6694.c => nct6694-usb.c} | 283 ++++++------ 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 | 102 +++- 13 files changed, 969 insertions(+), 228 deletions(-) create mode 100644 drivers/mfd/nct6694-core.c create mode 100644 drivers/mfd/nct6694-hif.c rename drivers/mfd/{nct6694.c => nct6694-usb.c} (54%) -- 2.34.1