From nobody Mon Jun 8 06:36:56 2026 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 026AB4A33F3 for ; Fri, 5 Jun 2026 08:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780649454; cv=none; b=KJ6esZXGHl4L0AbHUYKv/sKV8/vhG2rY56fQnHtNq/6jTyKzfJG2Cj+PEZpJNZhhg4xPNdkJs83NZGQTrEb/TQeGg3bpAO4i3kuoDnQE9H6QudDFZCnHlC1Mo0NUUBoRefJSKqErnNkyGg22mUFvxz4of5nabZWyKdzMHEUec6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780649454; c=relaxed/simple; bh=JtkGcj4NMQJRfNtBcYS95QpsASlY0SFfjTD5jy9OdS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I7DM5LUDDD7ql7GgF6e5RLN5OaUmByHIvQlpUR9NDfLyCU34lqu7EC/C2kcY1g8sPxPUSkgR5EsopMy0/2ENbZ7ac4LDNYeSClKAzAJXjkKliWuXiBDrDOcoHz2UKCATPJMjEklInZmvJfO6yxEtPXYu++H7iBfU02sCMM3zmqk= 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=M1Z7kX9X; arc=none smtp.client-ip=209.85.214.177 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="M1Z7kX9X" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2bf2247e38eso17304825ad.3 for ; Fri, 05 Jun 2026 01:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780649452; x=1781254252; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YD6JlpZB8VRwRhsmwmWgbgCmQfw1VyOwfiwGdy0zUc4=; b=M1Z7kX9XNmKgwGHnVXLc2OV2nrp7pg0lZ4cDjqD3RMHW/G6HvbwxQ9YUt/C+1kpPiQ HbMMsAMSE70/LB44vf8i2CxLarZRLPhASsBNYevUPcMmQ6hen6ttYBcKpdiJPUw1oYOU bwMrpmR5KvZhHQwzesakJIJj5Ks/tIQPZlmqQ9Gn6nNVyIs455ffDwRizyXx0XOixwnj ASWa8Za26lcWjH30bvNQgQmnHKNDAjwRsJKF9qo3vhrMdQLM356fcGKCu/j823iVBR8p tkILO0CjaQFvyhAhoTde5ycgO2uUcZtiURbCcEl01cKxVTmNdzwtjHMpc05POm27wInv LETg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780649452; x=1781254252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YD6JlpZB8VRwRhsmwmWgbgCmQfw1VyOwfiwGdy0zUc4=; b=XCc+t8vcKBvcHCRXZiGp0dIYohp5OzUdq21OIkPla83RV9YSinoMykhcwXsBDL0r0D UYXcxn+4d465Drl/aJbJGVV1pZwdmH3emCJf7DRGjlSUDY6GoFN1uP6nkAPqSAGaPhrK +4cc/q0PUHka6MtJtfBgKUW/DifKSHdgdhSA42weyuS2vYWOyxckikw+eCV1oh4vtTXQ LZvEP3I7cMeQunTceu2fatUf4WKT6sOyWVBfPerBFz5EJ7OT2dRE4+XDk2Ao7LhPVMiN 6g96i09yI0UB7l16Uw9fJ32svSua0wRFPtw7xWlBItb/seC5lOHZ+X9hWW4ie0UHGDRi TPGw== X-Forwarded-Encrypted: i=1; AFNElJ8MDfvnAfOdS4BqrDO0tGrhRzI7mkpaxZPIeMkozrhrE34UbHN/b++j5PIyOmz2uIJZliqFXs+EhPnNgU0=@vger.kernel.org X-Gm-Message-State: AOJu0YzMCY1pmdg6tulnYQLAUmccXUF0DxPS55pflDTYdc2t/ZJat+Gw HK5hoHIB/JuEw+MRoqpoRnNopxO8bcrOo9Tow8R1ZdPpne1X6MrW2ODD X-Gm-Gg: Acq92OEczTYiVDDyhvpy1iAdf/U+ll/850KR0pQsfToCQVn+lltB4gfeCjhveth+Iuv Sw7IsgU6RXRD3daJRMpz3cl//LmB7ifj8fLfnbtNp5BLhl9IOpR6LpKLDdxG/OhdqB1N+ZYGyI5 A6VI18KPuicbDKfR5Tmx6nvjIaAmbBTHqNv3kDbZZYutQymRJ3RIpPloeqzmFUFF7o+D10C5at3 K0Ugq2nivA8kwCOMRVZk1cbbV6Mj14ED0ezYC9sZsAAogBBGIVJ44JXMedQfNn/oRhkyeiZy3sd aDHHOT4HhKA7XGlgnpz4Wb7mHTH0Fu/3QDneSLehJXkHmyIL5O8uX5hdODtxndzfNi6P1Z/xlvB KrkFDq8S4gDbogjnva+MjwXauc7nBfhj2kC6v+DXbvSTFCHWHVePW5IssTtvmv7+s+3dX+UehGB nd0EIQBiPkaEQbwantqnFxtDWDAA3yG4c0UGIXqmxaNU2OHvx8nenByQTTVnjSdB3Tz6c= X-Received: by 2002:a17:903:3b8b:b0:2bf:114b:924 with SMTP id d9443c01a7336-2c1e85ca6b6mr28695655ad.34.1780649452121; Fri, 05 Jun 2026 01:50:52 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c164fa0236sm86673185ad.33.2026.06.05.01.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 01:50:51 -0700 (PDT) Received: from hqs-appsw-a2o.mp600.macronix.com (unknown [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id AD5854163B72; Fri, 5 Jun 2026 16:50:49 +0800 (CST) From: Cheng Ming Lin To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, alvinzhou@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v3 1/2] mtd: spi-nor: Add support for MX25L12833F and MX25L12845G Date: Fri, 5 Jun 2026 16:48:36 +0800 Message-Id: <20260605084837.1875896-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260605084837.1875896-1-linchengming884@gmail.com> References: <20260605084837.1875896-1-linchengming884@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cheng Ming Lin Add support for Macronix MX25L12833F and MX25L12845G SPI NOR flashes. These parts share the same JEDEC ID (0xc2, 0x20, 0x18) as the legacy MX25L12805D. The newer flashes support SFDP and 1-4-4 Page Program in 3-byte address mode, but this 4PP capability is not defined in their SFDP tables. Conversely, the legacy MX25L12805D lacks SFDP support entirely and does not support 4PP. To safely enable 4PP for the newer flashes without breaking the legacy part, introduce a post_sfdp fixup. Since the legacy MX25L12805D does not support SFDP, it falls back to static parameters and will never execute the post_sfdp hook. The newer flashes will successfully parse the SFDP, trigger the hook, and safely append the SNOR_HWCAPS_PP_1_4_4 capability. Signed-off-by: Cheng Ming Lin --- drivers/mtd/spi-nor/macronix.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index e97f5cbd9..1adb79832 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -83,6 +83,25 @@ mx25l3255e_late_init_fixups(struct spi_nor *nor) return 0; } =20 +static int +mx25l12805d_4pp3b_post_sfdp_fixups(struct spi_nor *nor) +{ + struct spi_nor_flash_parameter *params =3D nor->params; + + /* + * JEDEC ID 0xc22018 is shared by MX25L12805D (no SFDP, no 4PP) and + * MX25L12833F/MX25L12845G (support SFDP and 4PP in 3-byte mode). + * The legacy 05D lacks SFDP and will not execute this hook. For + * the newer flashes, 3-byte 1-4-4 PP is not defined in SFDP, so + * we safely enable it here. + */ + params->hwcaps.mask |=3D SNOR_HWCAPS_PP_1_4_4; + spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP_1_4_4], + SPINOR_OP_PP_1_4_4, SNOR_PROTO_1_4_4); + + return 0; +} + static const struct spi_nor_fixups mx25l25635_fixups =3D { .post_bfpt =3D mx25l25635_post_bfpt_fixups, .post_sfdp =3D macronix_qpp4b_post_sfdp_fixups, @@ -96,6 +115,10 @@ static const struct spi_nor_fixups mx25l3255e_fixups = =3D { .late_init =3D mx25l3255e_late_init_fixups, }; =20 +static const struct spi_nor_fixups mx25l12805d_4pp3b_fixups =3D { + .post_sfdp =3D mx25l12805d_4pp3b_post_sfdp_fixups, +}; + static const struct flash_info macronix_nor_parts[] =3D { { .id =3D SNOR_ID(0xc2, 0x20, 0x10), @@ -130,9 +153,10 @@ static const struct flash_info macronix_nor_parts[] = =3D { .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K, }, { - /* MX25L12805D */ + /* MX25L12805D, MX25L12833F, MX25L12845G */ .id =3D SNOR_ID(0xc2, 0x20, 0x18), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP, + .fixups =3D &mx25l12805d_4pp3b_fixups, }, { /* MX25L25635E, MX25L25645G */ .id =3D SNOR_ID(0xc2, 0x20, 0x19), --=20 2.25.1 From nobody Mon Jun 8 06:36:56 2026 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 92A0D37F74A for ; Fri, 5 Jun 2026 08:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780649455; cv=none; b=fxPTL3HmlLaT93gOUg9OuOINfHk+ktNI/DtzztGqoZPTCd0/2vYLOx9fDXxbP4qlxKQ9+E1srsp8lcBy7vrtDnxZW44PZ1VeG0RcVuOaIeXSu1T399M/rt4kztOcXaXFli0Xy0axLow4T2NIyECWi2GZtpv1M8h/YSLPOCTAtz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780649455; c=relaxed/simple; bh=rwpz8oRKT2EHd6rvYnp/8VrSAUtSAqZ55UfOX89Ibts=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Gg4rSHEQv4JrGS1yJ6+tPowGPps30py6tEscRYBf9EkH+GqA+2iinkPdO3EdfDAqZavxCO0RZnHNd6/PdGN1M9k7o6W892yFSilUTk4+A7b1eJ1yviJbGGtSSINWwHjZkbYkozrTZZra2ox8NR2AAmwssUjkryDdPCY2rDUz6YE= 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=I7bmhe+5; arc=none smtp.client-ip=209.85.214.176 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="I7bmhe+5" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2c0bd02d97eso19405665ad.2 for ; Fri, 05 Jun 2026 01:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780649453; x=1781254253; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k3OkoXbhs5kLS7ezOvy8weCw2fewKlEBiuSMFva/mlQ=; b=I7bmhe+5tjMagUOc7mwfY1+9qFbJArFILkpZ5O5SCH+dUB6jwxxokJxnAbZAZS5Q8l lPWp52p7200jDaaVfLStjWRaxhPfWDvYPuaTLUfzq20rTPUYKpnAOIbcWR4bd3tQ/Ewb SKHUe/yPdirO7zx1C+O0qIw2qwmE8GphknLXMgrHAVmTtdPF0e813aIEyZplt6Tj2Zo2 VHCxp4y/7nx8Y3whF8W0ZJSkKSQ7/pCsao7ORU4FQqMxXzVBhH9fT1ih84pt50zCZD9N bHfi7N8n9G+A9OuSP7GdTEe49+qxWtYIXv6JX/3JE71Wb5I3/5pFkXmofGAvljg7CsS8 hs/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780649453; x=1781254253; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k3OkoXbhs5kLS7ezOvy8weCw2fewKlEBiuSMFva/mlQ=; b=MFAvEqz7SechsaJUTs9giOgPOcYKWsl7zPU/pkZUzcK6NRjp5a6sMC+vN9585o8Fv8 YHe/Bplf+AXdR9mDMLWPWPlzTptbOqMXL+X2jnRIYxESQYl/yGEwDKEWpNFmhqIOFRgc ROTY5eA8vUwhNZWycGu/87y3nSNk8vzWAYZchvFw6htYaSrLAXsaBn1JdCClyyikxeXc kMHai9Zb2VtfcvUfY4icHACv3PWp67n9YddHbme6eJ7IZ9hLi0q+ZhVhYmSs290cxckQ XfXFaxNwb2haybKZ6BOM5WYKvQLSMWos1k0C2JbUcVILH9DTwpQjs9E2yIpt8uI1vrHb LuYg== X-Forwarded-Encrypted: i=1; AFNElJ//7Rd1c8fsRAPGo8YdRjCREF1n0aY9CXBKZOkXxp+QlsOQAssf6abeIg7g8y8qF85IYOzR5Xcc0zZeE/A=@vger.kernel.org X-Gm-Message-State: AOJu0YwRqukvxo6FdB7h1n4dUJ7K5pp7JLDunZ8y8TJ4Y1/nOp7sK0hn 83YUGdsv5Ec0Rbnq2V3JcESqv8gVt/yznnmte93R5FkPCaYUAkkYeROI X-Gm-Gg: Acq92OFnQXD0tLZHxQIsHYLukwbofjny3C7hurokixogJp7l/iQsFE4rM5KLMuWp8j8 RK9B3SkGwCategKQBCkrZpTVF/2MHfeTo7X8W0wO9j3HDJ/Q5Uy+GSZSayYp80Be/BtKUpALZRP YFuG8ky2+efKX0WCx19zi3EJR68QkMWaTVY8ViQV4TeFrsTJntgt+Ve6DzaNdJNWq7WPGuaO7bg v+vbIUg5Eqimz3WOS1gajXeJYMmXHaNj0tATt7629TCyKivgblwiIhEfXFMZm9Yn7l3fFSorG03 7Bs9smrWUtKL7JsWz2RicWwpA/M8S2f/aQKJnE4Wo1Sc250h0pyl9QyXoRFpvZeyFJeiFPam4f0 hZXG/hkQ9CVTWBT3l0sNxNCYsLI3UV00iui7xuX83EGhq3h0CdmwmwoPdUl36QnvVCWqKSTMZww bQ4pi7Liq4TM0tUDxygapKRS+lJw1au0ZDIrAl9nXLfEi4qfh16CVS3jUE0h+wBi5WRv8= X-Received: by 2002:a17:903:41c7:b0:2c1:77cd:fb0b with SMTP id d9443c01a7336-2c1e85e04bbmr27080835ad.37.1780649452732; Fri, 05 Jun 2026 01:50:52 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c16649fcdfsm108703915ad.78.2026.06.05.01.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 01:50:51 -0700 (PDT) Received: from hqs-appsw-a2o.mp600.macronix.com (unknown [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id B99234163B74; Fri, 5 Jun 2026 16:50:49 +0800 (CST) From: Cheng Ming Lin To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, alvinzhou@mxic.com.tw, Cheng Ming Lin , stable@vger.kernel.org Subject: [PATCH v3 2/2] mtd: spi-nor: macronix: Restore fallback parameters for MX25L12805D Date: Fri, 5 Jun 2026 16:48:37 +0800 Message-Id: <20260605084837.1875896-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260605084837.1875896-1-linchengming884@gmail.com> References: <20260605084837.1875896-1-linchengming884@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cheng Ming Lin In a previous effort to drop flash_info fields and rely on SFDP, the static size and no_sfdp_flags were removed from the MX25L12805D entry (JEDEC ID 0xc22018). At that time, the legacy MX25L12805D was already EOL and unavailable for physical testing. Verification was inadvertently performed using the newer MX25L12833F, which shares the same JEDEC ID but supports SFDP. As a result, the probe succeeded during testing, leading to the mistaken removal of the fallback parameters. Since the actual MX25L12805D lacks SFDP support entirely, it strictly requires these static parameters. Restore .size =3D SZ_16M and .no_sfdp_flags =3D SECT_4K to this entry to fix the probe failure for the legacy part. Fixes: 947c86e481a0 ("mtd: spi-nor: macronix: Drop the redundant flash info= fields") Cc: stable@vger.kernel.org Signed-off-by: Cheng Ming Lin --- drivers/mtd/spi-nor/macronix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 1adb79832..d13ea93b0 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -155,7 +155,9 @@ static const struct flash_info macronix_nor_parts[] =3D= { }, { /* MX25L12805D, MX25L12833F, MX25L12845G */ .id =3D SNOR_ID(0xc2, 0x20, 0x18), + .size =3D SZ_16M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP, + .no_sfdp_flags =3D SECT_4K, .fixups =3D &mx25l12805d_4pp3b_fixups, }, { /* MX25L25635E, MX25L25645G */ --=20 2.25.1