From nobody Mon Feb 9 11:01:46 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.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 020B631A54E for ; Wed, 22 Oct 2025 10:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761127670; cv=none; b=mtaR+JNPiHUeE5/GWLb7wF9sYUsEMe6XV7ws0tkywfaOrAoGXn0yQ66DZc0xVSWXAiwijX6YbN9t/F2BkK+ICr+49cwyeGU+oB+LCzH4LzpRwWbVu7JVDLVPjDidYScqGqixyYNmVhEJVxujYe1e524d9IkAIUsx+21YHZDg68s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761127670; c=relaxed/simple; bh=EE+lQvhBcq8YWD8yg0KXpLqUBc6P3VmAPuUl2lPwJ4M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ej0rLfkh9FO9udCKGFu4C1KBLhyHug8kz+jTJwf3mhMde3ennJIYI5/f10OEyML9O9EluZfyfCyyw3uPyBxQnV5ll2uEQvs2o5yfWL+H0TJTeNN8e4C2k3SfGXxHk8ZD7TEGEyhIeXnOzzpeyD1TppfBAuy7PsHI5+mHLNkYA4Q= 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=IOHgV1Fk; arc=none smtp.client-ip=209.85.210.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="IOHgV1Fk" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-781251eec51so5259432b3a.3 for ; Wed, 22 Oct 2025 03:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761127668; x=1761732468; 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=tmV9fCMr++K8ts5w/0Bxy7I3jHnhgfz3UV/3J0ZHaWo=; b=IOHgV1FkS72yGC7e+e8w+EO9Gzck/RDccuYdqxV0EvgfPQf+3AZQzx5Eckfzo1kseV wSwxCwb1+CbHtEmWpTEubTc40Fnxy1ptWZom2u8qGHs/yimZn6zXaN/Lw8AA97psqfPM VcMNjl6mI2E8Y6AOCjYU4ptUSxGuX3l653qT8FL5Dvn37DJM51HunWr52m0TseB923al EajzhSqbxwNriXPncYgXaH9yCotzNvH9lbh7pBgT9TlmlPZ2Y49wHUrZ3G/vDziVqWQX +LnWhVo9EVFdtSF0sgG7Q1TiSrFqls+iJXdTKeYZbyRMdmmoyqAtb5TMzn3weqet62Qr 9/uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761127668; x=1761732468; 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=tmV9fCMr++K8ts5w/0Bxy7I3jHnhgfz3UV/3J0ZHaWo=; b=ifqZhmImjAR1rtjaIX00IUqdtCVpKYA9g5Bu1T0pl/tbG61X+uPblw+qW7EoeHU7A2 EPdIsJdwT/2xjNB6m1o//l4JjM2obRx/z7igRVgppWzfhrmoogU3jbGhoh81rKQRgdVE XiFmxmUjcLibNpUjIMWmGgpFfDkgfb2qftXBKC5uwC4uDQqWJIAacmPKsZd+L/VIcP3u RuM7/+sjPaOCrhiYxDoYkWGdSNBlyqL4XSGXVOMvJgKigKwFl0EMN/MpN5o48XeCu+H6 CII2XQaEQjhToYJQO+IFFyogMCeWFl6KejuOYlIAFlC0iM5iKsPlGES0faITixUT6L7H 5Oew== X-Forwarded-Encrypted: i=1; AJvYcCVIYkErfHkAPNp+NIREIJkKeviRRGCaZV6ydLJsRjUBfaWif501UTZ5/wJs5SC+57K6FxE2QtjD8c6Wngo=@vger.kernel.org X-Gm-Message-State: AOJu0YzggkckdFfKtBwtQWZrDz7DMBx+zmD52m3hvSHZUJOLvmgfVnbO jXuZGB9weymHgZy6oeVXv0KX86tfsQDKY2Y9g+ArP0VEG48g2PkKgYOR X-Gm-Gg: ASbGncuLQaaSfx9UgsdWMkts3EQQVPMIjujZLUDADNyYDX4ibtw4LfVZzOQ6mRJacFm D2suDwjz5RYlWU0SAHPgDXxOt0eZVJUnmK8UFmUPgqrbiRxIwGhBrslhcmirRjyXxB8KqXLc95K PMwDwdafhgiln+SWq6ZiUr4DvC3HvhA8V17XgQPa4hDuQWP4smQMEt2dikJWK9svik3LOT7Z8cK a4C5Lr6W7LoaXd92kDE0cD6QxmMF8z8Akt2IK7ua2G5kkfV1orpsIFouQGeP78bVBw9vpyJs7nV TH697IMZr1/MDIsZucbb7rtDRSxz0LDUaP+e501edpBeA3F/ReWaLGTofF+2PA3rg1XLqQ1Y65f n1DLL40N7VEMwsSaJqO+bhGbgA+e3/1H9885R57rojFa/zOawTsV6n8erVutfhZ+Plt01baZIxe xEMAoCjdc/iFDojLSOHtrYUC+pjHTeS24x9Lz2OuRSG/5WRFixpfkO/YL1myhjjMiQ0CysWcs38 0awEtQ= X-Google-Smtp-Source: AGHT+IGmAyoOf1blTsx9zbXEb1T36PS8OzuPvHqvqIWm+8GwFN3zHx9eDgBeC1jDzo6A+Oib9IpRiQ== X-Received: by 2002:a17:902:ce8c:b0:267:e3af:ae67 with SMTP id d9443c01a7336-290c9ca6b29mr317088695ad.14.1761127668205; Wed, 22 Oct 2025 03:07:48 -0700 (PDT) Received: from ISCN5CG2520RPD.infineon.com (KD106168128197.ppp-bb.dion.ne.jp. [106.168.128.197]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471fdd10sm133774585ad.83.2025.10.22.03.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 03:07:47 -0700 (PDT) From: Takahiro Kuwano X-Google-Original-From: Takahiro Kuwano Date: Wed, 22 Oct 2025 19:07:20 +0900 Subject: [PATCH 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: <20251022-s25fs-s-smpt-fixup-v1-1-ce26d4084b2d@infineon.com> References: <20251022-s25fs-s-smpt-fixup-v1-0-ce26d4084b2d@infineon.com> In-Reply-To: <20251022-s25fs-s-smpt-fixup-v1-0-ce26d4084b2d@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=1761127659; l=3092; i=Takahiro.Kuwano@infineon.com; s=20250227; h=from:subject:message-id; bh=EE+lQvhBcq8YWD8yg0KXpLqUBc6P3VmAPuUl2lPwJ4M=; b=fnudW1b5lbsiOhhodsmvx5JidPX2ZaZ/gj2RhsLV8gMTZhFjyYB5rlHvGy23RPN0gf3apC4r6 8FuCpNV5RReAmciNr5pQDwPHfAGPIcbRnWBumBlSth29mu1NJPz9OZd X-Developer-Key: i=Takahiro.Kuwano@infineon.com; a=ed25519; pk=aS8V9WLuMUkl0vmgD0xJU19ZajdJmuyFBnBfVj0dfDs= SMPT contains config detection info that descibes opcode, address, and dummy cycles to read sector map config. The dummy cycles parameter can be 'variable' and should be determined in device specific fixup hook. Inroduce smpt_read_dummy() in struct spi_nor_fixups. It is called when the dummy cycle field in SMPT config detection is 'varialble'. Signed-off-by: Takahiro Kuwano Reviewed-by: Tudor Ambarus Tested-by: Marek Vasut # S25FS512S --- 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 11:01:46 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 5C67631AF21 for ; Wed, 22 Oct 2025 10:07:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761127674; cv=none; b=NfnhxlAFN8sXyDOi21e9lBUFPOIUsSIEYzCoxD7rE7Z3RQC6bUQYueXakdYHgC9EWhVo1sDjUXbh/OZjudPDOcYDYwylFGJgyGYV+B5FECjLo6D3HCTnAc7t8a9SmLEji8FtReBEn0eSqN9DFXF4qoMPw6CaadwHNzopf53jxOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761127674; c=relaxed/simple; bh=BOiQy4dkt6OnjJhuvrMGCPaSRKLELL+BS8cMn1Du9Sg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R4ikWjA3GXDE1aayNQVZWxjbxhqpsdYSfCBYLR1POiHnG/A22pupDyUQdwguG22tjbsYLu570vvag4BaYi5ey+wBxoPZ5bwmBzZo12xadDz1KfckyjierNq9DRVP7TzpfJiwXiSu4nUeS8HNPVO7ECeUiFQeVeMAWO2vJFIe5Yg= 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=Ud24wTdG; arc=none smtp.client-ip=209.85.214.169 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="Ud24wTdG" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2909448641eso9109505ad.1 for ; Wed, 22 Oct 2025 03:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761127673; x=1761732473; 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=+Rin+olPBDSpDNBx3ZCCvnc8fn5rgxCNRJAfPjBnGKs=; b=Ud24wTdGO04JHq6JYscQAEsXcJ/pXN8jJtsbrIr37ZtMlloSs/LA6gTLdG6Wg9+eD0 U5xdT3MotQ+PScuOe0MyA4nfebE5kRqSF05OzQ8rupO68bpZqsKDOV6dGIRg9m5HTfGx 3UoVv6bYT33KPJeWBEAfIwKfCM1k/8Ie96V9YTV8wJWff9JvYY8gSBtP+jyXn+h0uxo4 HtywXnh0i/T2f/HUbDbtDi46L4MmR09vyiNara7I8ZTHrh4SoPkwQoHkbsc9KyLwk+fb ubxjfTjT5k1HJpDBCubZSvEZB26f9JXh28b9dMfoqu1MLgTBFre7HeFbjuDlA1Lr416H JGfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761127673; x=1761732473; 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=+Rin+olPBDSpDNBx3ZCCvnc8fn5rgxCNRJAfPjBnGKs=; b=acQsxZLDgSN7v2fPOZGdDPtYCw5fYhrzhz9d1VnANpglbiWzo/yK0+IjyI+K2ZkMhX sWOhYqKmolCfX4H4ZmxegxjGAiFTWtvINaJoAm5ZLiEIg42n56Cczrhb7JUcdgtc/lj0 6H2pTyItQmQsDSPQ7YmNjcHM2dwcxb9UGew/91ili+IP1DwVUJrlA7qjw30tRBbf9KRH 5cKyo6o/lMyXE3F7um7AbFc0MPtY9NeX8jqpO+Ph+wJ577xxlsxiYXuI7LNGrlZMbmo+ 27VDiMRyF8jFKMh4bVeOngNFM/XYoeGh5BLtBHMn2SjyVXGH8gkxL6GlcqIN8CjhGYcB xp+w== X-Forwarded-Encrypted: i=1; AJvYcCWP6Y01n4lfdLUFZ2GOfa/GGebNmKGe5/VMbHig64qYB7iPxlc/lsZtczwNybPx2H+0I5kMA6NSyxwVNd4=@vger.kernel.org X-Gm-Message-State: AOJu0Yza4DmmR1fVzQJO3D45Nm+wMKiOZhrBPMBoLZrsV5QedYmOf7eS FYQX6FyCkWkGINWBeeYD0agYn1UMWfhfsa/8Ej4zfPN5uSnDIid/JBAW X-Gm-Gg: ASbGncvAdG8G8RcnQm89kiKOeOzToiIsGlUYmDWjAkF29fAWREQHdytmQCcPyPK29md Fd3Z8OAeoesO02J+2sPtzi7AChWOlN1nbH5ClyRL4yFEGRBxlYN8kJJM2dbLyUdj+sFaTdMZ27j HcjX2R7iJoZTm7TGzl42O8iaDLAl1n4hvkSRC9SlIUF2HCWMRmXGO9JDqsOGMQGO6Q9qg5bkCQq LUEariA3WJcd2EKOz9OISjAbdWYSL4xuOWq/J4ErlE8IrhMLOTxovgeyHdFPCM3dqbPHaAYEaXu zIgA2FhNkVOg+yT2c/owMTL6xY9+Z3Uim4vc5POullIuz84M8I1DxsqERCrZdPRphSLkqmIdwon 6DhM6zSM7YNlUTQxpX8qcRfBte3JLBuOOHT90P5g2gfx9oRT2/O4y024lPe5n3ad/G/VluhdVWq GpFnISS0QvwFwtn7Y+6g/FSnTXzbP/FOcQDYdNied36aSh6X6WFoSoGhs/GahZA8MEjo4xA+kOm 2XtcyA= X-Google-Smtp-Source: AGHT+IEUiygtgTqcwUWRzcMEa52HUa99Ij9lNtSOVruV1mseZ8SjR/ReWp+fLosN/bNvr0EnD8Nfhw== X-Received: by 2002:a17:902:e5c3:b0:271:9b0e:54c7 with SMTP id d9443c01a7336-2935e03624bmr12703345ad.11.1761127672529; Wed, 22 Oct 2025 03:07:52 -0700 (PDT) Received: from ISCN5CG2520RPD.infineon.com (KD106168128197.ppp-bb.dion.ne.jp. [106.168.128.197]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471fdd10sm133774585ad.83.2025.10.22.03.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 03:07:52 -0700 (PDT) From: Takahiro Kuwano X-Google-Original-From: Takahiro Kuwano Date: Wed, 22 Oct 2025 19:07:21 +0900 Subject: [PATCH 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: <20251022-s25fs-s-smpt-fixup-v1-2-ce26d4084b2d@infineon.com> References: <20251022-s25fs-s-smpt-fixup-v1-0-ce26d4084b2d@infineon.com> In-Reply-To: <20251022-s25fs-s-smpt-fixup-v1-0-ce26d4084b2d@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=1761127659; l=3033; i=Takahiro.Kuwano@infineon.com; s=20250227; h=from:subject:message-id; bh=BOiQy4dkt6OnjJhuvrMGCPaSRKLELL+BS8cMn1Du9Sg=; b=Xv6/MqkpU/YGPwnfT1w6kk7uH7YbY+SaOmwrijqqxPSaYsfx0aw+bu55VD2QXPyeW5K9SbIvL 7L78EonnLmFD0zAWJeTxbcH9Sg8Qdb6d30Uj46pghfMDe4gR79e0+gr X-Developer-Key: i=Takahiro.Kuwano@infineon.com; a=ed25519; pk=aS8V9WLuMUkl0vmgD0xJU19ZajdJmuyFBnBfVj0dfDs= Some chips have inconsistency in SMPT that derives wrong map ID and fails to detect correct sector map. Introduce smpt_map_id() into struct spi_nor_fixups. That is called after map ID detection by SMPT and chip specific implementation can correct map ID. Co-developed-by: Marek Vasut Signed-off-by: Marek Vasut Signed-off-by: Takahiro Kuwano Reviewed-by: Tudor Ambarus >=20 Tested-by: Marek Vasut # S25FS512S --- 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 11:01:46 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 82CF231D742 for ; Wed, 22 Oct 2025 10:07:57 +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=1761127679; cv=none; b=e59gAovdycCXhqOB59KfyAG5PzPnn7QaNy/Wrx6co3ubdMxEwpqSCc/bBHVQHTTgJgSRxH8F4qBzLahyrk8jkIYx7yvluRsaeQBXjvNi4HDU2mz3XR+W05tUn12WgAyith00P0OPrpIC+7CnBzrQqrKp6nnK67qAp83pxY2CrqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761127679; c=relaxed/simple; bh=fLuO8IxKB26gg7ELkbxj90c+H+nFUPtNyWO7nnhkCfo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mx5mxH7rIBhRCJAPMZRtNfoGOHVteq530SpVDexVYc/4ZlUy/B4w7bhMEtUGWrGUzlbGQG4Trs7bd9bnqFiffZMKbZuzcy+bLrW4lPipLdgBxFSWj/QwXOSMut5pcoebk64hwVp37BbDsVquu3bFUDNHNnP9K41jmLfTfx/4Ksc= 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=Nh3qP5IN; 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="Nh3qP5IN" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-290aaff555eso65523585ad.2 for ; Wed, 22 Oct 2025 03:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761127677; x=1761732477; 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=BhhPNj408J9IsKyB0ngF4mWpHs2Tqp+ApiMYzTxgWxQ=; b=Nh3qP5IN1xAK1nvWF0BMMyXYfBZwHl/LEQOkivZrmKXYkzKlq4TxyUDej15aP+V93m C7xpRTpTcYAL8F1QYIbKFPJWi56LwM8xw1fl7iJSdIhMeFQhcosLQFJabDH/tuTRyscY FuplSrP8WZtjbwyHb77tdtg3cGqA89RAZsPWR4nVV8F/uIoJg+jVbvTkmaxMgoKZ03kU tUXnZD5rCROdGOoKgX/xTZi2yXmhZAjaSw9qw/XpGXN6DvkRte4ao3LQclStmhRkopZY I19MpjXf2BUV0UzhYj+Pr0pTmIhje5KPwmLvl+2uurZBCeLauzzDsDTeAnxmZKt9hR2M D1Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761127677; x=1761732477; 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=BhhPNj408J9IsKyB0ngF4mWpHs2Tqp+ApiMYzTxgWxQ=; b=fWeTa2CBs74DCqYhoK3m0iYFPRE3Mx25rHp3sW+U8PJzVDt8qwCtmpm1v+SzmjP4R8 lM8jkPLNwwfKFDBOcF1Y4IdZCwCCOGXKukWTmw8lP3MCMOnK7okHY2hdJi3zd984kqkE 9B0zEP+Z9q5EGGKJCHFU2Phybm3rOJJ5HOs6nw7vdey6zZUkF5jMZ+AWpkNB+z2wChqm HIob7G2dD2qxjHcWjNBqdkGEciAxHhTh8plsUz0HM4ScZePyyetCLGOSRVlqp1UAjAFd de15tRn3nW7XntDzX05TWG2OaypW9jZgANiV9Vd4YEKBuqijHHGgnJnYbb5NQ7epzuJF YKWQ== X-Forwarded-Encrypted: i=1; AJvYcCWLIoPLDjYUN5bzFvc8s6SFAPT97cWqIJ/cOHI9V0P0oIE9hHixxRv8rpgmWALpKqIKD8Wcv/wpLdSsaF0=@vger.kernel.org X-Gm-Message-State: AOJu0YxrMOmjZuVnEvkvetX94AOzUX4uvpXghyAG0xDx4TNCDy3IefRP wb8LZXcl4tqAqS4IqAhHy367Gw1rKAQGPSkMul5uYhshrmQNzOpwLana X-Gm-Gg: ASbGncvA+X8T3Z5RZoHsbUcJFovjsi6K/SxBpV1hY4SSsjMZRqGQj38cNr5ZrSFl8yk dUk+h6ASNkE232eN+9QT0yZCCB4rcsUD8+O635nHzqwbtby+vpmdTAECVLM2bugTF68//m5yVrs FaZ42slPkDuFUc7ZOSyasCHNgpCwu/4yJ1EN+/3Wjy5x9BkSokbYF1CAUL+77nrnA4Ntu3ghr6i 9XwhrP+y/2JG4CE3yEx/ovX8Z8ZNQocLMKjWxG3rtCp7dtNkpv/5uLMrUp9FwU4ri+fmq+hqygq fy/9lQftXkGq/o76BYzxUwLD7SC+JVe/0X35HFyPQYsKZLCehuBh+3uQheXbxKeLzRBoQejab3E 61VI8dVPSTPSNtgZn2wb2wQlokKuCi3OfLw0GI0st9Ui/bGLVHCAwwT/LpgOEUaQA5pa6eRbpSQ VSADBefr6Sjk56pWZUQrpx9uFEpujBF1koJupGN+q2kGN045WbWl7+WH5FAQn4gpy7Gx7YJCZD8 54tdBw= X-Google-Smtp-Source: AGHT+IF0dKQMctLSkd4qXSEnXRqPwvQ5TWac1/EzJdBKxCT0QRGMk7vNb6lFW2DDOrk55+uovWre8Q== X-Received: by 2002:a17:902:f70b:b0:283:c950:a76f with SMTP id d9443c01a7336-290cc2f91d2mr263984515ad.43.1761127676820; Wed, 22 Oct 2025 03:07:56 -0700 (PDT) Received: from ISCN5CG2520RPD.infineon.com (KD106168128197.ppp-bb.dion.ne.jp. [106.168.128.197]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471fdd10sm133774585ad.83.2025.10.22.03.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 03:07:56 -0700 (PDT) From: Takahiro Kuwano X-Google-Original-From: Takahiro Kuwano Date: Wed, 22 Oct 2025 19:07:22 +0900 Subject: [PATCH 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: <20251022-s25fs-s-smpt-fixup-v1-3-ce26d4084b2d@infineon.com> References: <20251022-s25fs-s-smpt-fixup-v1-0-ce26d4084b2d@infineon.com> In-Reply-To: <20251022-s25fs-s-smpt-fixup-v1-0-ce26d4084b2d@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=1761127659; l=3010; i=Takahiro.Kuwano@infineon.com; s=20250227; h=from:subject:message-id; bh=fLuO8IxKB26gg7ELkbxj90c+H+nFUPtNyWO7nnhkCfo=; b=bltMHTs5AspF5ecMV3QBvbvqMd8jNFEudmeFnUVLAxuuGrO/QAtbtyiK/3a7pP7nayGZtn3hr LMils1Ud7PUCyjP7O8WjupIXPM6w+lk8FcqePY079/f5M5jDtDdf6Fc 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 Signed-off-by: Takahiro Kuwano Reviewed-by: Tudor Ambarus Tested-by: Marek Vasut # S25FS512S --- drivers/mtd/spi-nor/spansion.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index a0296c871634678be509cb30d26e18debff3066d..89e85eba2c31a4d74dcbfeffdef= f7139b6e0f6b1 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -785,8 +785,42 @@ 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 datasheet rev.O Table 71 on page 153 + * JEDEC Sector Map Parameter Dword-6 Config. Detect-3 does + * use CR3NV bit 1 to discern 64kiB/256kiB uniform sectors + * device configuration, however according to section 7.5.5.1 + * Configuration Register 3 Non-volatile (CR3NV) page 61, the + * CR3NV bit 1 is RFU Reserved for Future Use, and is set to + * 0 on newly manufactured devices, which means 64kiB sectors. + * Since the device does not support 64kiB uniform sectors in + * any configuration, parsing SMPT table cannot find a valid + * sector map entry and fails. Fix this up by setting SMPT + * configuration index bit 0, which is populated exactly by + * the CR3NV bit 1 being 1. + */ + 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