From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=68.232.154.123 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796024720; b=Yxvhr2pvkOAla1YLfZmpyGUh66lPgzLL459x/eRqK0WNDafkNXwtFrJ6tbNrspuAHvy3 /kAycU8/htuYdf6QkzF7OTSHXi7vkCtPsG2hIi1+yYTgDulNCPxDiYnnIg5r5rhxGRqMH iSifiCVNLMIW7a476i0x7tiioWVgydBybe6RO2+eekv56NCHS1/K+d4iGOgQv7rOgjPpa 3zWP+MyIGLLAkBRrSOiLT4ROtHPpybcBcVLTk3XOWHFc/8RWkCByiexpCaFgmXtoHtCHh BsRg4i7JPK5PxTGT9p6v62Z7klgAk2BxT2X/eHX2/+bpQmPZAUfBRRc4gv3Fn+fHWgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796024720; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-Amp-Result:Received:Received:Received:From:To:CC: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type; bh=R6dwt8QyhucUjLyYBUnyw0BPaHOaBqT7VDKDMwKaxeM=; b=17Hfx0F1cZ1R7OF0LQ6+AS64H0SixoEfSxKo0s/GFT8oZN6y3Zbnd5nJATU8bouqbckt wsw7YcILUK952WQPajvKXFl+O5ePgud43ZpZqJeRteY6opuo+imt2+KySNSEJ3y8t/Ljx v6PcVBUoFcB3jDQDB3e+irAmsbG1xrvLrQDUgjRPS1jtQy+5OCS7/XmS4AITm1DZ0SFWs uP8BcfINv70Up3QV7Pn3uOv8EyFSv6n8wH4oBTM2B1KrBsbHdla1BuIrMcYhh21C/5buw Ww57Gen23lLTacGxFqBh0/3mEah1LcSWAi3nb70jbQ1CK34ZCHglXu4MingrQGBdH8Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=LmtpQjkI; arc=none smtp.remote-ip=68.232.154.123 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9629F606A332 for ; Mon, 30 Nov 2026 07:45:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9629F606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=LmtpQjkI DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1796024719; x=1827560719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8bkSa60ESTzEKOlrh7+8fGhMdKTyxEcQ5oZsoQadPuo=; b=LmtpQjkIa/KI9a0WHfV4RBgdHGT5jPZtwtmAGi4vLDvXYWdtVqkRYZmo CqXhbSWWWk3ZKssB4uhN6x0xQYv8Ag2sJe2QQGcmtWuSGRHW+ct1EPCr/ zGl/Z7OFVo3HEFNsYV698lGhstNFYrHSOyemtk5wCnQ8haKMvGYauZhhv RBZx6nf1xrAC/UBFSMy9PzZ8yKXnY0ukEJK5piful///6XBCrSY0D0KNI vOH7Tly3+t90oM2P89kRW1l+4I5JP//b03INNKHXYKEiQw5tnUYXo3kIF q9R/pIHQmZQd47JyKV8Flg5CGczEixKi7ctDgB80i3VZCWjaQOAvttsLp Q==; X-CSE-ConnectionGUID: 7vnK01y4SMWuiVEtDmxVdQ== X-CSE-MsgGUID: tGTZpAmRQMq44BaFPH928Q== X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="234244655" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 00:45:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.57; Mon, 30 Nov 2026 00:45:18 -0700 Received: from che-ll-i67131.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Mon, 30 Nov 2026 00:45:15 -0700 From: Manikandan Muralidharan To: , , , , , , , , CC: Subject: [PATCH v2 1/2] mtd: spi-nor: drop fw_devlink suppliers below a flash that failed to probe Date: Mon, 30 Nov 2026 13:15:06 +0530 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain When a SPI NOR flash is not populated or not reachable, spi_nor_scan() fails and nothing described below the flash node (the SFDP NVMEM device, its nvmem-layout, partitions) is ever registered. fw_devlink still holds links from consumers of those nodes, so a consumer such as an Ethernet MAC whose "nvmem-cells" points at the SFDP EUI-48 cell waits for its supplier forever and is never probed: platform f8008000.ethernet: deferred probe pending: platform: wait for supplier /ahb/apb/spi@f0024000/flash@0/sfdp/nvmem-layout/mac-address On a permanent spi_nor_scan() failure, call fw_devlink_purge_absent_suppliers() on each child of the flash node to drop their consumer links, so the consumer is probed. Keep the links on -EPROBE_DEFER, as the flash may still probe once the reset GPIO or regulator is available. Signed-off-by: Manikandan Muralidharan --- drivers/mtd/spi-nor/core.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 99584ee0ecb3..c2661dc2395b 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -3624,6 +3625,25 @@ static int spi_nor_create_write_dirmap(struct spi_nor *nor) return PTR_ERR_OR_ZERO(nor->dirmap.wdesc); } +/** + * spi_nor_purge_absent_suppliers() - drop fw_devlink links below a missing + * flash + * @dev: pointer to the flash 'struct device' + * + * When the flash cannot be probed (e.g. it is not populated or not + * reachable), nothing described below its node, such as the SFDP NVMEM + * device or the partitions, is ever registered. Mark those nodes as never + * becoming devices and drop their consumer links, so that consumers such as + * an Ethernet MAC using an NVMEM cell are not deferred forever. + */ +static void spi_nor_purge_absent_suppliers(struct device *dev) +{ + struct fwnode_handle *child; + + device_for_each_child_node(dev, child) + fw_devlink_purge_absent_suppliers(child); +} + static int spi_nor_probe(struct spi_mem *spimem) { struct spi_device *spi = spimem->spi; @@ -3672,8 +3692,12 @@ static int spi_nor_probe(struct spi_mem *spimem) flash_name = spi->modalias; ret = spi_nor_scan(nor, flash_name, &hwcaps); - if (ret) + if (ret) { + /* A deferred probe (e.g. on the reset GPIO) may still succeed. */ + if (ret != -EPROBE_DEFER) + spi_nor_purge_absent_suppliers(dev); return ret; + } spi_nor_debugfs_register(nor); -- 2.43.0