From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B46023DE451 for ; Mon, 13 Jul 2026 09:12:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783933953; cv=none; b=sHOsoizn9c9VxrJoF2qjJKohhLYcQ9NjgBqDeUQr47cilJDODkSTxpY2NAMzOPVJHz6oDSYWR1LXbl5RTWYSQ3OLsG7AInXoBBj5pQnwJPO5+b5f0t9Y9NxcyVkHWeT+97ufiFBC4QqDOCBF5rGaCcaQpbGXEa0hy/EgGT6j1ME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783933953; c=relaxed/simple; bh=RbkDyVGEpiHjztgi4iMzfvMIwsQl3uzt37d6+yuUskE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SGV/o4j/6vJ5imZV3d/7KoUJyqjdJakjqGqYEQ1bjbzGPZnWUiPkAO34xMTX5F8rSD+nho7soqOMGPFXltkMc0/COoQEcuPTjWsSylWFSkAfa5SLg4k3SzxI7CFViyGIQTsJgWHYX+JqSNb/HrVtcmYuQn38OqUCvjhbc2A4C6E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mWA6kga5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mWA6kga5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C5101F000E9; Mon, 13 Jul 2026 09:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783933952; bh=d4Ahol2EVxtqhUVcQmmh5ZgKPqb3XHarv+hB9DRVzAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mWA6kga50AYkrpO3CQGfTzPkyCtgV10DO0fmUji2NPYEmNHKngSQz2Xk2mzRgkLk0 CDtQ91TVts33JKzV8lmPSemzqlZjmvdb+rVBdL8lu4krIxZo+tcfMjAw8p89wJD2RP lmHOM83EPRTFOXb6h3hJxSce8kD7MpemF7GNVcoohuoWcWbv7HJaRX978XKXpNdoxb ii4tJwAENIvGmuFa6aJEMhcjHE9MAfeHCquDcPln5mvwy4LolODamgI04D0a33XGgr D+oO9wbMEl7Na47rXsu/x9CrBMAILEfCOKR+KGcgU4o0MocxeB/1E6VdDon+cTIIdd SKoSCUHms4xgQ== From: Michael Walle To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus Cc: linux-mtd@lists.infradead.org, Cheng Ming Lin , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] mtd: spi-nor: spansion: s25fs256t: move ARCFN check into .late_init Date: Mon, 13 Jul 2026 11:11:44 +0200 Message-ID: <20260713091206.2414400-7-mwalle@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260713091206.2414400-1-mwalle@kernel.org> References: <20260713091206.2414400-1-mwalle@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The SFPD parsing is optional. It not meant to fail if something is wrong with the chip (except for the SFDP itself). Thus it doesn't make any sense to return -ENODEV. Move that check to late_init(), which might fail and abort the flash probing. Signed-off-by: Michael Walle Tested-by: Takahiro Kuwano --- drivers/mtd/spi-nor/spansion.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index fc5da04aff07..40d3236c723b 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -545,7 +545,6 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt) { - struct spi_mem_op op; int ret; /* Assign 4-byte address mode method that is not determined in BFPT */ @@ -555,19 +554,6 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor, if (ret) return ret; - /* Read Architecture Configuration Register (ARCFN) */ - op = (struct spi_mem_op) - CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes, - SPINOR_REG_CYPRESS_ARCFN, 1, - nor->bouncebuf); - ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); - if (ret) - return ret; - - /* ARCFN value must be 0 if uniform sector is selected */ - if (nor->bouncebuf[0]) - return -ENODEV; - return 0; } @@ -598,6 +584,22 @@ static int s25fs256t_post_sfdp_fixup(struct spi_nor *nor) static int s25fs256t_late_init(struct spi_nor *nor) { + struct spi_mem_op op; + int ret; + + /* Read Architecture Configuration Register (ARCFN) */ + op = (struct spi_mem_op) + CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes, + SPINOR_REG_CYPRESS_ARCFN, 1, + nor->bouncebuf); + ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); + if (ret) + return ret; + + /* ARCFN value must be 0 if uniform sector is selected */ + if (nor->bouncebuf[0]) + return -ENODEV; + cypress_nor_ecc_init(nor); return 0; -- 2.47.3