From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC6E53B9608; Tue, 21 Jul 2026 23:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784678317; cv=none; b=hNBT8j28oziBpcUPrt/WHd5AdPDnK9qBGTiVOrk0twBHFs6X37a6todHoio1VLkc3WtuNnWkYz1o38Qzljr7JXabuNBQPKhkckJbSgnSr61yIYxEayk9MwRdjONWlsSrjDOTySIpOjBNe/nMqJ6+T77EQMvAWXfioDRChOxmNCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784678317; c=relaxed/simple; bh=nn7PkFixpTXzt6YkrCxlK03akCzBdzZSdQFi7Mv0BOQ=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Rpn6LHKMF7KLIzNWStkUcPbNOP5AvblMxN0GQvWDGd306rXv5nPyRHQhqZRYt2TxDUSkCNWDjOyO7eD8iDuoz3dXccisc/lshUizwY4GSYKBlkTqPxsKRIW8ycpPoEOfqtAYSfe4PEucngojPRLAU+L0zjSLrZHduj1znyRMyeg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wmKLu-000000008Dx-1U1X; Tue, 21 Jul 2026 23:58:22 +0000 Date: Wed, 22 Jul 2026 00:58:15 +0100 From: Daniel Golle To: Daniel Golle , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v4 0/4] net: dsa: mxl862xx: support firmware update Message-ID: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The firmware of MxL862xx managed Ethernet switches can be updated in-system via the same MDIO bus which is also used to manage the switch. Wire up the devlink flash_update operation for DSA drivers and implement firmware update and version reporting in the mxl862xx driver. Changes since v3: - only install the flash_update devlink op for switches whose driver implements it, so the devlink core rejects unsupported requests before fetching the firmware file from userspace - run the deferred reprobe from a kernel thread which ends in module_put_and_kthread_exit() instead of a work item that dropped its module reference while still executing module code - fail firmware API read commands with -ENODEV after the update has finished instead of faking success with an unfilled buffer, which could send port_fdb_dump() into an endless loop - keep the host block in place across the post-update version query by exempting SYS_MISC_FW_VERSION from block_host instead of briefly lifting the block, and write all blocking flags under the MDIO bus lock - check the return value of all SB PDI control writes; a failed address write during the half-bank switch could otherwise place the second half of the payload at the wrong flash offset - initialise the progress notification deadline from jiffies so notifications are not suppressed on 32-bit systems shortly after boot - log a distinct diagnostic when rescue mode detection fails on an SMDIO bus error instead of silently treating it as not being in rescue mode - flush the switchdev deferred queue after closing the ports so the bridge's deferred STP DISABLED transitions reach the firmware while it is still running instead of failing against the host block with "failed to set STP state" errors - treat -ENODEV as successful deletion in port_mdb_del() so the post-update teardown no longer leaves host MDB entries behind for the DSA core to report when the tree is torn down Changes since v2: - validate the firmware image, including both CRCs, before taking down any ports, so that a malformed file is rejected without disturbing the running switch and without the needless flash and reprobe cycle it previously triggered - reject images whose declared payload sizes overflow when summed (check_add_overflow) or sum up to zero; the latter previously erased the flash without writing anything back - allocate the reprobe work item and take the module and device references before starting the update, so scheduling the reprobe can no longer fail after the switch has been pushed into MCUboot - prevent the stats poll work from being re-armed and cancel the CRC error work before starting the transfer - check the host-blocking flags in mxl862xx_api_wrap() under the MDIO bus lock to close the race window where an API command which had already passed the check could reach the bus after the switch rebooted into MCUboot - check the return value of SB PDI data word writes so a failed MDIO transaction aborts the transfer instead of being noticed only through a corrupted image - report a per-model chip name (e.g. "MaxLinear MxL86252") as the devlink "asic.id" fixed version instead of the devicetree compatible string, whose comma is awkward for userspace consumers such as fwupd (see discussion on v2 patch 3) - report the canonical null version "0.0.0" instead of "mcuboot-rescue" as the running firmware version in rescue mode, so that version-comparing update tools like fwupd treat every available release as an upgrade and offer it for recovery Changes since RFC [1]: - detect a switch stuck in MCUboot rescue mode at probe, register the switch without any ports and report "mcuboot-rescue" as the running firmware version, so devlink flash can recover from a failed or interrupted update (Andrew Lunn) - clarify in the commit message of patch 2 that the per-transaction MDIO bus locking is about other, non-switch devices on the same MDIO bus (Andrew Lunn) - mention in the commit message of patch 3 that closing the ports also stops phylib from polling the switch-internal PHYs during the transfer (Andrew Lunn) - split up run-on sentence and explain the dynamically allocated reprobe work item instead of just pointing at iwlwifi in the commit message of patch 3 (Manuel Ebner) - use kzalloc_obj() (Manuel Ebner) - state the actual duration of a complete flash and reprobe cycle (just under a minute) in comments and the commit message, and clarify that the timeout values are generous upper bounds (Manuel Ebner) [1] https://lore.kernel.org/all/ak0J-HgzMRea53om@makrotopia.org/ Daniel Golle (4): net: dsa: wire flash_update devlink callback to drivers net: dsa: mxl862xx: add SMDIO clause-22 register access net: dsa: mxl862xx: add devlink flash_update and info_get net: dsa: mxl862xx: recover switch stuck in MCUboot rescue mode drivers/net/dsa/mxl862xx/Makefile | 2 +- drivers/net/dsa/mxl862xx/mxl862xx-cmd.h | 1 + drivers/net/dsa/mxl862xx/mxl862xx-fw.c | 535 ++++++++++++++++++++ drivers/net/dsa/mxl862xx/mxl862xx-fw.h | 18 + drivers/net/dsa/mxl862xx/mxl862xx-host.c | 52 ++ drivers/net/dsa/mxl862xx/mxl862xx-host.h | 2 + drivers/net/dsa/mxl862xx/mxl862xx-phylink.c | 2 + drivers/net/dsa/mxl862xx/mxl862xx.c | 50 +- drivers/net/dsa/mxl862xx/mxl862xx.h | 9 + include/net/dsa.h | 3 + net/dsa/devlink.c | 50 +- 11 files changed, 706 insertions(+), 18 deletions(-) create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-fw.c create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-fw.h base-commit: e0722efbcfeb142e02b0b8031136ce81610a8507 -- 2.55.0