From nobody Mon Feb 9 16:52:58 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 2B62F25C6F1 for ; Wed, 5 Nov 2025 07:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328933; cv=none; b=lxTgvAWKu8B6hh0hTvZYu/3tYQMzoV/Cn7u7ZorQcnfn5/El1HSSU7vHnjtxVXoIg6WGqJHrHV3nwDTg61rT4mWL9RUuFX50xZDMajPv2votskc12jwAnna9cZd6XBLXVHsBYO8lTc1q3W6OrNaCTytkJKFW1ZuN1YgovfOV3kw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328933; c=relaxed/simple; bh=Y6gCu8pPNvoaaRlxS0r2zcF5cZ7AtnTriNRfIAsny+8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lqG0x3YdbpbB+UjpGDpZUtWsjwLaGv6H35PintbtUCTtamPRTEuzJPDHeZPUZblVrmVeo4Mls8IS2BXGgzu6/KwABpMIwjeKjJ5PXQtoygXymAFmUAw2rLcQJyum8+4z41Rfd7hdpwf/pEBeM3j449TFgDWaox5vOa83D8s3p3s= 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=X3FhMSDi; arc=none smtp.client-ip=209.85.214.182 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="X3FhMSDi" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2951a817541so72721255ad.2 for ; Tue, 04 Nov 2025 23:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762328931; x=1762933731; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n2dXDMbS4ZadtFN+PyoUE4mGeEjAPz+823eSljV2/WM=; b=X3FhMSDi2d1CP2vIZBOtdFqWaL/q68LHol9uLdgUYgRGysU8AubzrXB9clU/Imdtne RxOEIjCQTPIusxdgYwKLR+YIU/7g5Wk02lB9JbzCo0g8wAn4/espCf1rqHMW6BYN0b/q xjJv90i1vhSeR68dGIkNtyVGRmklHSa5xGS00hbjldlqhJ3iJyUEYOLW6VkfRm7KNMUx /SyzTMq6nV4ovRCe8mRLdR0e8gZe0tXAv8HENrv+voONvg2ikGL4J7NoRPcHo1fN/LtJ NOT7Ho5T55JezjkaUAkY6x8T8V9p0080dxKCrIimdgZ6WMOAyLK6/9TIxoz0fBFiKCfZ Xelg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762328931; x=1762933731; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n2dXDMbS4ZadtFN+PyoUE4mGeEjAPz+823eSljV2/WM=; b=q9P0uzeIdX96m38ZCxbgI3M8qr8GbLCoucBP6ztP/dcyhPJm58XMRztQmov2O4Zvyh +smeI5scaOevEZ82POiCNKtLLurvn4e3SEnTFe2pmNnqyB0TeNxdm13E3KTN1K050u95 bPrHMHT1bb8otvLglaeUu32szpe6LX4eokz5Uyt3wAfq7IkzSkJTpVxJW/4ZZQ+sKt2K Qfc6oTBkViPwZ1KHokuOTs+skWChNxUVaqGtPGwaupfcD0Dv6NGYEymZ9xbtbsvb+flC RfA26t7KoN5YfeUG5EGv1G7R9uDIJvzbgc/YqXgc0Kp49R2asjD6S78OA7F31b/PjtUo ASsQ== X-Forwarded-Encrypted: i=1; AJvYcCUNNfagcaostVIrGZaw+ZdCldkBRMxLf6BfPUGCMW0XmkJs+TQIBAJuHIIMzTmZRMB7El45FE742eAuv68=@vger.kernel.org X-Gm-Message-State: AOJu0YxmavZzOVBQdOn6Qqwo9Y/1xcH2rml9qu2an3XhQ0kbEQPNaJlC e5O9ivB2HxtRgi7sxZ5XlRT7jzLGIKMLH7T0c6LXO28/U8j6fqSf+GJ6 X-Gm-Gg: ASbGnctdqeS5WHr5PdzoX1OnEb0djtmjjty06xznPXxxVDZYbYoWdN9N4o1SYJJikCV igajxDRsIyBPatZBVkWYCUDaQaIqWrQ/aWUaKqALEOA/lKPWF7nOmyrpHxEGuyXK5IGgLfufETZ 6Ce728MhviHaHSifIicNh4p4c6rluByflquPFXsHkYdnUxhXP+uZ7dxLrKmmOJC3UIxSt+Tate8 FM9/Q0a+bkkC6HFEk6WapMD4OxG1q31QLpYKzy+kIzfp3qZCQKTEbEZ+s2M9uUV+DkYrzLcLNT/ 7ZRgto8+NMyXb5ZN14OViU6Bko2fvMRC89IxzAzQhw/PW74fhqMIF5/cyxZ2OQqvYmAGJF8cKpD 5qDxTvXcGgRReQTFhbxM9mXPc16PsK8wRZRExXXFbrkNTG5pVAEOwp0gfebSbzchBpCYyjzEFIt B4dIFOkzTcpHamtOI4KSZXkjzAOfxTcZs4F3ChSlVoVq1M/yUINEXTBMaQsF0YV5Lvngu+ X-Google-Smtp-Source: AGHT+IGwjhbHCrSIYYxs5ggXUedTi5MyxYZDYcPG0zxnBQaAx/ghpOMWz8w4ztpv3bw1eLJhcf344w== X-Received: by 2002:a17:902:d505:b0:290:c0ed:de42 with SMTP id d9443c01a7336-2962ada2117mr36675415ad.36.1762328931245; Tue, 04 Nov 2025 23:48:51 -0800 (PST) Received: from ISCN5CG2520RPD.infineon.com (KD106168128197.ppp-bb.dion.ne.jp. [106.168.128.197]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29601a5d74csm52174625ad.76.2025.11.04.23.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 23:48:50 -0800 (PST) From: Takahiro Kuwano X-Google-Original-From: Takahiro Kuwano Date: Wed, 05 Nov 2025 16:47:58 +0900 Subject: [PATCH v2 1/3] mtd: spi-nor: sfdp: introduce smpt_read_dummy fixup hook Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-s25fs-s-smpt-fixup-v2-1-c0fbd0f05ce7@infineon.com> References: <20251105-s25fs-s-smpt-fixup-v2-0-c0fbd0f05ce7@infineon.com> In-Reply-To: <20251105-s25fs-s-smpt-fixup-v2-0-c0fbd0f05ce7@infineon.com> To: Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Marek Vasut Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Takahiro Kuwano , tkuw584924@gmail.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1762328922; l=3552; i=Takahiro.Kuwano@infineon.com; s=20250227; h=from:subject:message-id; bh=Y6gCu8pPNvoaaRlxS0r2zcF5cZ7AtnTriNRfIAsny+8=; b=qm9kpfsjYgh2IDEtyLHT7wJAwnQk/1ZlXlG16ZoG+XF99c3jgO1rzmonmxivaARRWCziFjouU 25dlgimw7u9CumWOY3/nTkb308qOvavwoP3UoGiHKGl95jBKq3iYUZG X-Developer-Key: i=Takahiro.Kuwano@infineon.com; a=ed25519; pk=aS8V9WLuMUkl0vmgD0xJU19ZajdJmuyFBnBfVj0dfDs= SMPT contains config detection info that describes opcode, address, and dummy cycles to read sector map config. The dummy cycles parameter can be SMPT_CMD_READ_DUMMY_IS_VARIABLE and in that case nor->read_dummy (initialized as 0) is used. In Infineon flash chips, Read Any Register command with variable dummy cycle is defined in SMPT. S25Hx/S28Hx flash has 0 dummy cycle by default to read volatile regiters and nor->read_dummy can work. S25FS-S flash has 8 dummy cycles so we need a hook that can fix dummy cycles with actually used value. Inroduce smpt_read_dummy() in struct spi_nor_fixups. It is called when the dummy cycle field in SMPT config detection is 'varialble'. Reviewed-by: Tudor Ambarus Tested-by: Marek Vasut # S25FS512S Signed-off-by: Takahiro Kuwano --- drivers/mtd/spi-nor/core.h | 3 +++ drivers/mtd/spi-nor/sfdp.c | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index ceff412f7d65ab7b856795ca5c092cddbf598cd6..5ad46d95d09cc9d527f71579a71= eed210e726f68 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -409,6 +409,8 @@ struct spi_nor_flash_parameter { * flash parameters when information provided by the flash_= info * table is incomplete or wrong. * @post_bfpt: called after the BFPT table has been parsed + * @smpt_read_dummy: called during SMPT table is being parsed. Used to fix= the + * number of dummy cycles in read register ops. * @post_sfdp: called after SFDP has been parsed (is also called for SPI N= ORs * that do not support RDSFDP). Typically used to tweak various * parameters that could not be extracted by other means (i.e. @@ -426,6 +428,7 @@ struct spi_nor_fixups { int (*post_bfpt)(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt); + void (*smpt_read_dummy)(const struct spi_nor *nor, u8 *read_dummy); int (*post_sfdp)(struct spi_nor *nor); int (*late_init)(struct spi_nor *nor); }; diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index 21727f9a4ac6926080a116e30830c9533122fdad..9a47dcaca06ae2ad85ac8503658= 083b1d56d8b96 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -699,6 +699,17 @@ static u8 spi_nor_smpt_addr_nbytes(const struct spi_no= r *nor, const u32 settings } } =20 +static void spi_nor_smpt_read_dummy_fixups(const struct spi_nor *nor, + u8 *read_dummy) +{ + if (nor->manufacturer && nor->manufacturer->fixups && + nor->manufacturer->fixups->smpt_read_dummy) + nor->manufacturer->fixups->smpt_read_dummy(nor, read_dummy); + + if (nor->info->fixups && nor->info->fixups->smpt_read_dummy) + nor->info->fixups->smpt_read_dummy(nor, read_dummy); +} + /** * spi_nor_smpt_read_dummy() - return the configuration detection command = read * latency, in clock cycles. @@ -711,8 +722,11 @@ static u8 spi_nor_smpt_read_dummy(const struct spi_nor= *nor, const u32 settings) { u8 read_dummy =3D SMPT_CMD_READ_DUMMY(settings); =20 - if (read_dummy =3D=3D SMPT_CMD_READ_DUMMY_IS_VARIABLE) - return nor->read_dummy; + if (read_dummy =3D=3D SMPT_CMD_READ_DUMMY_IS_VARIABLE) { + read_dummy =3D nor->read_dummy; + spi_nor_smpt_read_dummy_fixups(nor, &read_dummy); + } + return read_dummy; } =20 --=20 2.34.1 From nobody Mon Feb 9 16:52:58 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 45A0D2D6E61 for ; Wed, 5 Nov 2025 07:48:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328937; cv=none; b=Y/Jp4jRnrsThGHkHqZi9KVAYS7SVMrHQEwJMYXY0qhVW0xaColF6kjlQ2ZMkIfqwwR4/eXZISIFGuv0lqVTjqs0vr1MN3ebLXaJBgrbMGfA1QeLTgck3MJWMJA1XuR3lId0QotfRy+4QnhFlYSLYxW56HzycmeoALPBpRnEeE4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328937; c=relaxed/simple; bh=nVurDGisbQbassAJC1QWOPaOxEMZSWrlBausbDp0Gps=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NMuD/PYTwBoWc/0kUIsB8koGZCiEE4LACR1rg/DqRYgudGPX7Xmcl8ju4z2nahaIt0evOWuLv+a18OzobYk47Ubpio6+QRgJWrErVzbahOkQk6EGaHBvfzxdx2vC7HLyI9LgltZUAWEtkZqIeEjsEHanCeCurCF5WZcd7yKEPxs= 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=fP9fGYxi; arc=none smtp.client-ip=209.85.214.179 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="fP9fGYxi" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2953ad5517dso50119765ad.0 for ; Tue, 04 Nov 2025 23:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762328935; x=1762933735; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SHv4nBRWTZt8vdLPnNPAb7DtW2NOOoy9mz9SlCozYmE=; b=fP9fGYxiSP2UG0o6W/Pd5PdkVKgOIIQ9mHbclT3r7JunG2Ph49IlNnm6KJWzZvE5fV ePw5i/SdTLj5rmnE5lYME4mndULBMmG4vHM2CJ9tZ8xh/0wAaT1Cgf0a7NUn5hQaOs27 Fjd4oytY7UDeW80T/8V+vShKXZdBZUmEb7GYL1BwTtENy8RWOc0vnJQM98WWvdFcoqtl qx1gZqp1KqPcFsDvodPWCq03G6RSy9RFGQSqlkKZj9yX5a35AtrRi742DY4oW2hM+nfr Byt5S4v1zSFIE1t/FOkkqhWU915SugaUZMz8N0GECjrXDB6F6XjnO46vOLPA169sCDA7 S8JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762328935; x=1762933735; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SHv4nBRWTZt8vdLPnNPAb7DtW2NOOoy9mz9SlCozYmE=; b=lvOrrYItLNrFEQ4NFZ4Lu/255LPGD/j8eyviWKRvepuF8XnTNl0Lp2PD5EAkvWr87m OtRHlcJx6q+bDqEurvcJyDOKTDtBpProSe8Bot7AKFZW/9XDpqULxhbUfxk5cPgAdqIi uUV4BHv7qu6QjMfRy6R0ES4O4ouaFvbz7J54LHJm8cd16AQVuoM7tDh/1a/naCIv4Peu m2qxcQO2G/UKbpTKqOA8JUUgVTdLeb8620gXNS/hfDXBqExIZYQIrDpxIzDEV5GoXA4A zUiFiVKNmoAYdJ3LpPvNJqo0+Ip2wEPaj1JHaCgwl0UIOuhAPgQF4LFgFQH0LX2qL4VJ k4Zw== X-Forwarded-Encrypted: i=1; AJvYcCVtvdqTjlevPnDbOlOpGVOuQPbcyfAtQl+n7sk0sjayVXKl/PvZjzqlWr2lE/La3D1KjAz3kr2xOU/IDJk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx049Zf4KUf54qIDFC6IXmyx7d/LHgrbCMnA/EIcBIil42+BIBO axYM+L2GCnU7c0K7zoc53TnBR0QFKVDfOB0CT9zJbZJYbpogluE6TMCk X-Gm-Gg: ASbGncvp/OdBcJsMePl93vohTby3rIzRsapFDvwqWmC4OLLTr68rtoX8zCoOuiFOdD7 i+DoHfnzVIzRBK38cF9OY5uDQw1XJpWmg4z4a1FDZOXVAz2Rdn5m4nnOI/nYqSMLXM9xZZd5VRD 0TLswZVrfBPpfTAXLvEAbbGDtscbgog5/jhkzLrLH5E8Y2v7v5V9DPe/aDk0dg+/ipO7h9LyWgU LVBN1fHa3/uvTfy+mKRYQITgjxzgcD/oBAKf6w8zGan/iRmEQzEytT5F6NGwuOWDH+r1PmeWkoj t43jpGEOal53hNW4gm7SVMsXkxq0g9pjaLXAEIaDy/qNGu+D1Y62fzguDB5n/QjKJUNwKzGkzfE 9p2C3B2VhjyVEdnbH9nEs2R2Dv49GZ9k21LOCUqhtdMkqkezkdFCBPXV3Zg4I+T2yQ2Aup/3K7b s+uKCfp1y5gPnELNyersMY4XuwZaAG/EP4QroSb41AyGwar4xIediREeFFnoA29rSK6RND X-Google-Smtp-Source: AGHT+IElVyESUBfM59SFNCufOWVW00WwLiAjs5x1QKfHQ/x0q29nn57QGeqQMEk8D/eNZfrpYehqaQ== X-Received: by 2002:a17:902:f550:b0:295:b7a3:323c with SMTP id d9443c01a7336-2962ae4c35bmr40142525ad.28.1762328935617; Tue, 04 Nov 2025 23:48:55 -0800 (PST) Received: from ISCN5CG2520RPD.infineon.com (KD106168128197.ppp-bb.dion.ne.jp. [106.168.128.197]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29601a5d74csm52174625ad.76.2025.11.04.23.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 23:48:55 -0800 (PST) From: Takahiro Kuwano X-Google-Original-From: Takahiro Kuwano Date: Wed, 05 Nov 2025 16:47:59 +0900 Subject: [PATCH v2 2/3] mtd: spi-nor: sfdp: introduce smpt_map_id fixup hook Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-s25fs-s-smpt-fixup-v2-2-c0fbd0f05ce7@infineon.com> References: <20251105-s25fs-s-smpt-fixup-v2-0-c0fbd0f05ce7@infineon.com> In-Reply-To: <20251105-s25fs-s-smpt-fixup-v2-0-c0fbd0f05ce7@infineon.com> To: Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Marek Vasut Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Takahiro Kuwano , tkuw584924@gmail.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1762328922; l=3412; i=Takahiro.Kuwano@infineon.com; s=20250227; h=from:subject:message-id; bh=nVurDGisbQbassAJC1QWOPaOxEMZSWrlBausbDp0Gps=; b=U/A5PCXLDj1/YLoagxPCbAHte+oH8HOQeW3C0Momim8VXyrbo2zUdVGd+/RdqiiuwT3BlTbr7 g9pgun+A6Q/D/DDJ2xjxAUfiOjfvHmCvpLX9ou/6JrDO9tMABhcQEjB X-Developer-Key: i=Takahiro.Kuwano@infineon.com; a=ed25519; pk=aS8V9WLuMUkl0vmgD0xJU19ZajdJmuyFBnBfVj0dfDs= Certain chips have inconsistent Sector Map Parameter Table (SMPT) data, which leads to the wrong map ID being identified, causing failures to detect the correct sector map. To fix this, introduce smpt_map_id() into the struct spi_nor_fixups. This function will be called after the initial SMPT-based detection, allowing chip-specific logic to correct the map ID. Infineon S25FS512S needs this fixup as it has inconsistency between map ID definition and configuration register value actually obtained. Co-developed-by: Marek Vasut Signed-off-by: Marek Vasut Reviewed-by: Tudor Ambarus Tested-by: Marek Vasut # S25FS512S Signed-off-by: Takahiro Kuwano --- drivers/mtd/spi-nor/core.h | 3 +++ drivers/mtd/spi-nor/sfdp.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 5ad46d95d09cc9d527f71579a71eed210e726f68..16b382d4f04f207aa26190ed8bd= f2d19885f7315 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -411,6 +411,8 @@ struct spi_nor_flash_parameter { * @post_bfpt: called after the BFPT table has been parsed * @smpt_read_dummy: called during SMPT table is being parsed. Used to fix= the * number of dummy cycles in read register ops. + * @smpt_map_id: called after map ID in SMPT table has been determined for= the + * case the map ID is wrong and needs to be fixed. * @post_sfdp: called after SFDP has been parsed (is also called for SPI N= ORs * that do not support RDSFDP). Typically used to tweak various * parameters that could not be extracted by other means (i.e. @@ -429,6 +431,7 @@ struct spi_nor_fixups { const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt); void (*smpt_read_dummy)(const struct spi_nor *nor, u8 *read_dummy); + void (*smpt_map_id)(const struct spi_nor *nor, u8 *map_id); int (*post_sfdp)(struct spi_nor *nor); int (*late_init)(struct spi_nor *nor); }; diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index 9a47dcaca06ae2ad85ac8503658083b1d56d8b96..a8324c2da0acf2953a4a62e2a9f= 7ed31fcd8b4f2 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -730,6 +730,16 @@ static u8 spi_nor_smpt_read_dummy(const struct spi_nor= *nor, const u32 settings) return read_dummy; } =20 +static void spi_nor_smpt_map_id_fixups(const struct spi_nor *nor, u8 *map_= id) +{ + if (nor->manufacturer && nor->manufacturer->fixups && + nor->manufacturer->fixups->smpt_map_id) + nor->manufacturer->fixups->smpt_map_id(nor, map_id); + + if (nor->info->fixups && nor->info->fixups->smpt_map_id) + nor->info->fixups->smpt_map_id(nor, map_id); +} + /** * spi_nor_get_map_in_use() - get the configuration map in use * @nor: pointer to a 'struct spi_nor' @@ -783,6 +793,8 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor= *nor, const u32 *smpt, map_id =3D map_id << 1 | !!(*buf & read_data_mask); } =20 + spi_nor_smpt_map_id_fixups(nor, &map_id); + /* * If command descriptors are provided, they always precede map * descriptors in the table. There is no need to start the iteration --=20 2.34.1 From nobody Mon Feb 9 16:52:58 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 CF1D22D77E3 for ; Wed, 5 Nov 2025 07:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328942; cv=none; b=A3pYfyV4WnrOGxuUmW1rZI4MExRAEBQ6zlJkvOPxpbyB4tiFtP/10KkxGCJQlFOAqXlXSAX+yPoSePMyJb9/ASlA5v5x1MogHohlyeKLaoZ5bCNUauMNVnGHGpfr65zGCnijhHTXcgTnWloGhPnZP8cqU2UxB9tE+SpSWDbYaNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328942; c=relaxed/simple; bh=BmyA0IWr4hyGD3vWpVmVZJSRjcmviFzh7aQHkcg3mN0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e/8k6Hdma97KaIiuBlmD0c84EbpObq4YjNHRlkUwQrHcUYeOW3APgFc3aRig+LpyFldpahy1wfaa8DDeV1IOAXd3oeWq+jJM1NlIQOnavRHPJ+T/sdNV2QWDghmXS6AC/eD29G/Y5+/ltEAjJnx3IGalyUjXOXGnnlFySy73CMA= 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=b/3YWFrE; arc=none smtp.client-ip=209.85.214.181 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="b/3YWFrE" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-294fd2ca6acso4956295ad.0 for ; Tue, 04 Nov 2025 23:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762328940; x=1762933740; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=67ZeKLSOELkdf7hZ3ElB6t0tmcMRx6X+ahqbBDAQsHI=; b=b/3YWFrEZ1aUTMz3CcBG1QvQV4ODeoj6tl01WN1t/iwZOrzs/R0qABc7UDU3X1nJoV wf0y8LWNDYNoDCgPBydW0siV8xR1VPa42Of/pu32ldZRjnVtFmYS0i5la4TG5uDzfQ9U au96DJP5RjxDfbz0gYY4QckKR/AqcSYl2nBBgpS2U2Hx8hcRO8mUGG2WhMjL9/Q8djUZ FMA6C45CKW/23qguyMEt8yzzuNEnAoQLtsSHbf/tdSeelrPY09+9T8d+izXJpJH40vBX ptVV47YQWodOSKpudEgDWzj1nhG5qFdxjaI4gAcjCKjMC/ER4OW0cABbmTj9ObXMRwPd Kmmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762328940; x=1762933740; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=67ZeKLSOELkdf7hZ3ElB6t0tmcMRx6X+ahqbBDAQsHI=; b=tEVeGx485dkQZbDI43Ot5OaJIncMpPETLWjRT4I/1qLDwEnKeSnR4ikUc6KckBTEW4 58wJMuAvJNSec8bljeTcZGAzIJxmNelumpWlnxP77vzWeXeYjJBPHqZyUWdyYW9s4jVD a0vLW9a8XZ9mdZ6szj+ZLAxrToVhdnuPZPEv/f5yOgvGlV9y87o8ie95yfk5TaP9l6Hr sMnwnvFeRaWlrWNtHn38M2/ebeWLNFOE4FMuWgukcGoiXKOQRvVotXJ8EyBjQgidToFx 5mxhlB5oQhym6pFlJOSq+WoIW7Gyyw9M9MTWVwfFxzr31sJNH9ZFsEEMdmxCl2Kosjbd 6JUA== X-Forwarded-Encrypted: i=1; AJvYcCWetaI3omCvOyJmMkQ4AYlSEvu6tbvNNFUk3ntDRCrQkr6WgrK/6VUPJfbe3Ws3CpWBPcZmb+H+Pjfp7NE=@vger.kernel.org X-Gm-Message-State: AOJu0YwnvUY0sgGh5EJFfevy0AcvC0UNmfsV4yzgQG+fg6XKfSVw9F5g 1O1shAQslc3yEiB6I4CSSBs5o7SkW3qSClBTvAMnXoXUlrg8ayeNBMo5 X-Gm-Gg: ASbGnctNrPpOP5ZoRxFB5IePy3YrQJuKdvsmEgjpdgQxu0bV0X8F42e3WODnflP8a63 fdMKBiYYT/vTE30uRj3LKCjfDzDW1WJRMCJSCNZ8wTeSTQ6MFuTQ2aR8Pf6vS/Jsc4Ej9AC21hl 6ZQwl4PO1N6ajlnDzDqr64a2AjkiWAJiYlx3uTHnxFztps6ma4lZ2Y4F31eiWXR6BU6oWmhOWu+ 9vjCA1O4i65BjGQy7ZN401XEkQSSbmb8ZmKHEmg6bwIUDzprMTBRgaiPieFlz7R12ElNYoQ3XeE lg+L882SUSZxHAqDL5Q55ao3EMLB1IEToKDY3+OlZtEhTl0hBKy4bwneie6zmVkC24wCTDiJMxt o2xlncxCKOfhuRaOoQcy3GpbYiJ+QiHC1bBlqY7gh6yRYyUXzf7C4ktV3iFgBFksyvZDZBQYfKY Ne5tehwQ7vwk6Mk2eHJ5setZwoJJjaUnPkcbsftaMk1+b+2jewVH+OMbjAPTx8yAEGBObw X-Google-Smtp-Source: AGHT+IGiAjmimpFxip7tKyRV/j/iBgiRLLtxcZ9CmJII710Vk29R8WF2Yb7ekv3p05OB8NoLOiQPmA== X-Received: by 2002:a17:902:d48c:b0:24b:270e:56d4 with SMTP id d9443c01a7336-2962ad0fba0mr31189105ad.4.1762328939942; Tue, 04 Nov 2025 23:48:59 -0800 (PST) Received: from ISCN5CG2520RPD.infineon.com (KD106168128197.ppp-bb.dion.ne.jp. [106.168.128.197]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29601a5d74csm52174625ad.76.2025.11.04.23.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 23:48:59 -0800 (PST) From: Takahiro Kuwano X-Google-Original-From: Takahiro Kuwano Date: Wed, 05 Nov 2025 16:48:00 +0900 Subject: [PATCH v2 3/3] mtd: spi-nor: spansion: SMPT fixups for S25FS-S Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-s25fs-s-smpt-fixup-v2-3-c0fbd0f05ce7@infineon.com> References: <20251105-s25fs-s-smpt-fixup-v2-0-c0fbd0f05ce7@infineon.com> In-Reply-To: <20251105-s25fs-s-smpt-fixup-v2-0-c0fbd0f05ce7@infineon.com> To: Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Marek Vasut Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Takahiro Kuwano , tkuw584924@gmail.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1762328922; l=3384; i=Takahiro.Kuwano@infineon.com; s=20250227; h=from:subject:message-id; bh=BmyA0IWr4hyGD3vWpVmVZJSRjcmviFzh7aQHkcg3mN0=; b=cCCLczuqHGsz4VITljQmiPangRInHsMQ5kOIX+SUpSeApzYq1bXAEQFpcUMLeg3Y2GHhDg3mI 32T/H45ZKvtAZevI1d8HFsm2H+S9LZ21HzIr6+ufxoiVXPJDusRY3zD X-Developer-Key: i=Takahiro.Kuwano@infineon.com; a=ed25519; pk=aS8V9WLuMUkl0vmgD0xJU19ZajdJmuyFBnBfVj0dfDs= S25FS-S family supports SMPT that helps to detect sector layout settings in configuration registers, but some of parameters in the table are wrong or undetermined so the fixups below are required. Read Any Register op is used to read configuration registers that related to sector map. The op requires 8 cycles latency by default. Implement smpt_read_dummy() to set correct dummy cycles. Map ID is structured by combination of CR3NV[3], CR1NV[2], and CR3NV[1]. However, in S25FS512S, CR3NV[1] is RFU and always 0, while map IDs defined in the table assume it is always 1. Implement smpt_map_id() to fix map ID for S25FS512S. Other densities in S25FS-S family (256Mb and 128Mb) don't need this fix as CR3NV[1] in those chips is configurable and map IDs are correctly defined in SMPT. Co-developed-by: Marek Vasut Signed-off-by: Marek Vasut Reviewed-by: Tudor Ambarus Tested-by: Marek Vasut # S25FS512S Signed-off-by: Takahiro Kuwano --- drivers/mtd/spi-nor/spansion.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index a0296c871634678be509cb30d26e18debff3066d..8498c7003d888bf96bd402694f7= 774bb2558706c 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -785,8 +785,46 @@ s25fs_s_nor_post_bfpt_fixups(struct spi_nor *nor, return 0; } =20 +static void s25fs_s_nor_smpt_read_dummy(const struct spi_nor *nor, + u8 *read_dummy) +{ + /* + * The configuration detection dwords in S25FS-S SMPT has 65h as + * command instruction and 'variable' as configuration detection command + * latency. Set 8 dummy cycles as it is factory default for 65h (read + * any register) op. + */ + *read_dummy =3D 8; +} + +static void s25fs_s_nor_smpt_map_id_dummy(const struct spi_nor *nor, u8 *m= ap_id) +{ + /* + * The S25FS512S chip supports: + * - Hybrid sector option which has physical set of eight 4-KB sectors + * and one 224-KB sector at the top or bottom of address space with + * all remaining sectors of 256-KB + * - Uniform sector option which has uniform 256-KB sectors + * + * On the other hand, the datasheet rev.O Table 71 on page 153 JEDEC + * Sector Map Parameter Dword-6 Config. Detect-3 does use CR3NV[1] to + * discern 64-KB(CR3NV[1]=3D0) and 256-KB(CR3NV[1]=3D1) uniform sectors + * device configuration. And in section 7.5.5.1 Configuration Register 3 + * Non-volatile (CR3NV) page 61, the CR3NV[1] is RFU Reserved for Future + * Use and set to 0, which means 64-KB uniform. Since the device does + * not support 64-KB uniform sectors in any configuration, parsing SMPT + * table cannot find a valid sector map entry and fails. Fix this up by + * setting SMPT by overwriting the CR3NV[1] value to 1, as the table + * expects. + */ + if (nor->params->size =3D=3D SZ_64M) + *map_id |=3D BIT(0); +} + static const struct spi_nor_fixups s25fs_s_nor_fixups =3D { .post_bfpt =3D s25fs_s_nor_post_bfpt_fixups, + .smpt_read_dummy =3D s25fs_s_nor_smpt_read_dummy, + .smpt_map_id =3D s25fs_s_nor_smpt_map_id_dummy, }; =20 static const struct flash_info spansion_nor_parts[] =3D { --=20 2.34.1