From nobody Mon Jun 8 07:24:28 2026 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (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 7DEDF301486 for ; Fri, 5 Jun 2026 00:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780621217; cv=none; b=Jv4+rSrOqGIahPyo1dehxihxJIHRAQTuXKQ4dnWyAnXfK7iDz0VXHBqloMROj5cz3HSoP0s9wgdd8jOURvi1aafAUOKLA3yeYdutPhUPpG/12yGPqji2TZ23IpRiPvOGY5C6PX6viXXf4ijG3xttZQNzdqjFExceTIARswaWVbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780621217; c=relaxed/simple; bh=+6iapMLF5LFq4Ew0zzmvV8Q/ztg8fcHwMPpnfeSSo/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CgVYDVhz3fkesGSC9M1gDLH//G9md25oVgiyi+eXNR31ywXvO4hcgt8z1jnE2l0h8ior2fBQxUocOnpen7KyAL+pCCuXJw++9Uv4WfZauTBPV55FP385EAmCX7u6wh206VtwBoDDOJ5fnBRywIBNGU01RcbJsXACU0i884g7xBY= 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=XlqXcJT/; arc=none smtp.client-ip=209.85.215.178 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="XlqXcJT/" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c85893bce34so541283a12.1 for ; Thu, 04 Jun 2026 17:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780621198; x=1781225998; 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=dTPPV6JZiYYlwbArmH1Q/4ShfP+Wrc5dPQHhlSVN1ec=; b=XlqXcJT/OzSioVPFqeACrGsL/g+1w4t9NuuIMq6Puin52/FvbQRjh/UFdi5wn3tnAR Onnbc/3Q0KdMeO25WPdQ5yxydwz4ts9PhXyCKtdlIttJaXUXxhOqDgiAp6I2V3lkQi6d DyYDvPFU2em4lJf+8nxRLbVLqwImIz18ljJ5DJSGQlybsdDSKZ0ERBG8eGyA7G3O1aKJ EVDlOfvYVEOhfsvX8stuAOPU+rBKMnHagSUxogOqEiTKxyf9VU67xGtpypD4mzrAAd3/ DPIJYg8PU2sqUghkaYihujSJZ8eTbopG+9d+uuvicrTZVeciyIiW6pSYom7zR7g0YFvt FxiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780621198; x=1781225998; 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=dTPPV6JZiYYlwbArmH1Q/4ShfP+Wrc5dPQHhlSVN1ec=; b=UfvWJoCTcqz8Po0JWbjzd8/kud2ugqykB9pggHMrESfKiMuG7g4r05nuqyyNM7ck5u y9N7D3TMc5gNIrX1YQ+VjSpbQNAlUSOBgY+eEhVetoeaoq+PNPc8Q78Wm/J35V/q48zJ V23VbjboCSCZPXYZ5kiMWSpaMHx/yAWEWbPxWrxJX6RkgCeyYcir2bVda4eA4aL48Uxb D8BKjS491mbOTzdo1kgHr/8wRKJhii/TJlbkBMIF3ogtdqeZxqXXnEXr5HvlEfvZ4H/s lxW69jyzMHsnv2doONMnJovvucZZppgVpEw1nXtKcVqQxqe9z1H2wre9GOjCP2TUWU2E QE3Q== X-Forwarded-Encrypted: i=1; AFNElJ+VOMmrtaXVNDgqmbUC3pJOQVFusCtcmeGDbdBDSbU7/aXGYHSVUHKCBvzpXvhVxT6ZSsae5EAObqpXIyM=@vger.kernel.org X-Gm-Message-State: AOJu0YwHBJFaVS9bS5ET2v3EB8G614EK9yWVCPHxfMObpwwt185oLwyv lsDiu1JpMSLD9TVvRn79rSqWfYOmu5jIBGkov54FHKoQd/ScsfYGnqLu2sgBwA== X-Gm-Gg: Acq92OEuoliTr8xLV+r8sIs42JcRXKoHomwRl3l23gZcNSVqsGLLdZPnejKzSp1t2qj AU6IpBDNo8SGYnEtEz2iY6bN7ST1s4Z7d1n2dYryY5okgLJTH2FdkxjDFLy4o6SQR8AwrxU9Kqe ETdhRDbvlVz3KqZUS8dNaSi5XCS3Fw7obC627KYXfueQMevlrcwUMNv0tPN+0lWR85xoS2kTdyK APDVPmnABWqiU8uramJJDUCyqvuwSorv4qh0FKs0pzJ3BGs6DiacNEW64NXvr+f8ZR26I6P/UV2 H5bUlnU7a/MnVWsf+y/vZGgnFAgqS+AX2zpeU2eshUT96TSQ4719dHmwgr5NGKzS02Rj3fP8iKz mVbPmWJa2W7066vFdR0E3UMIGW9oirL2INAqAw8/cD+f8Odvj5o2XCKnyyQbl6L48FqM4mn3Xej RbqzP9AxOpb617yvzxyMHvznbGD5pT9FRvdkKPTFuL0EwUueH22aarp76c X-Received: by 2002:a05:6a20:be86:b0:3b3:fc6:6226 with SMTP id adf61e73a8af0-3b4ccf7f128mr1382064637.24.1780621198351; Thu, 04 Jun 2026 17:59:58 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85df0bdbe4sm6528618a12.32.2026.06.04.17.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 17:59:57 -0700 (PDT) Received: from hqs-appsw-a2o.mp600.macronix.com (unknown [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 7333E4163B71; Fri, 5 Jun 2026 08:59:55 +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 v2 1/2] mtd: spi-nor: Add support for MX25L12833F and MX25L12845G Date: Fri, 5 Jun 2026 08:57:19 +0800 Message-Id: <20260605005720.1857413-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260605005720.1857413-1-linchengming884@gmail.com> References: <20260605005720.1857413-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_bfpt fixup. Since the legacy MX25L12805D does not support SFDP, it falls back to static parameters and will never execute the post_bfpt hook. The newer flashes will successfully parse the BFPT, trigger the hook, and safely append the SNOR_HWCAPS_PP_1_4_4 capability. Signed-off-by: Cheng Ming Lin Reviewed-by: Miquel Raynal --- 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..febcef6a1 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_bfpt_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_bfpt =3D mx25l12805d_4pp3b_post_bfpt_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 07:24:28 2026 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.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 171D9273D76 for ; Fri, 5 Jun 2026 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780621218; cv=none; b=utHZl2aMkfmYPQtTDhVAIk+iOsJ0xzvTBviGm78MCAFqd+SzrjbJvRlRIl+QeQDSGFuYddZgMx3ZHtu8zRK0+tefXUv1YpBCkm6fIf54VRTWV72X6p658p3loA5j5OmHUAeJ3cX0T0s7Ot7pkCGYVZK/yyBrFQDI6atdAfvRCB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780621218; c=relaxed/simple; bh=u0/w00vlK6fi8yvn+h86TeNOxWHIji6kmAtn8Yr+LtY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jrjZ6WB3D1hbMh6j5Bm1u41JhJ0jxTlm6TMhzKwdARMCSYC3r/QXL9aCQsdUFaL6KcsRKIxjoIJ0/TUwqkxnR8dKJjR8jHBs6h9El9NN21jrxsjmj9U1D8ZPdmbrjdAMre/mtapuS9zzv638ga61/paX9V/2g7anTf/KlquKgOo= 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=gOI0GMNJ; arc=none smtp.client-ip=209.85.210.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="gOI0GMNJ" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-842338c18e0so979498b3a.1 for ; Thu, 04 Jun 2026 17:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780621198; x=1781225998; 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=Q2yNPrajpmUjXUxkDV8KTQdIiGB5qpjbVC2V+xxbVWk=; b=gOI0GMNJIveWfc4p5kpW6qQu87tDfxWijmyP1iIe3U6z+FvKifDOKWhTkcxsJL8cRR VV/r0iDy5qUBCCBiS44/0NgaKKEA05kDdJPEke8ZZXUIOj5VAKk0L73MRgLatvMoL03e mahDxre9j/fRw91JPo55JnlQxl1kZP+D0oizZonj1+FMp36bFEMcb27JJofg6g+lFMn0 GcMfQ30KYCORC/EriKIUm+NGeZtgwsZLcZVZ4SLC9nCx4ymF7rYoyI52gb2CDK476/Pi kTqTakXjglIRn+JxXozM57Q4eRoqrtB74LJp0bh78B9WEHTh0YddmHv5R16Tfgzdk26j YjYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780621198; x=1781225998; 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=Q2yNPrajpmUjXUxkDV8KTQdIiGB5qpjbVC2V+xxbVWk=; b=XcGuMK6bem6hy4r7kSgEmy8b8YPslQxWUg/iUyvFUthK2cbXhF2Ybnrvh3dfbxiyNa ksEO7pEGkJcbtcnUushNFDlSnRGDmP/hA/ODHBWxJ3xSkL2Xe4c5gsmix9maRHxRzQVR fznC1qONSmuG4TySAkTPm0KsIjrkFqJ9qCCj18A4ey/hzH6AvoI1s5VDS4o7D1pJm6hj ihUZuLz2Bih8ujMoxFHT2Kni5S4nLLq5P/NhUj9cLHWVV0vBQPQ0fxfKSFFZvcrbqdkf 2DILNE9Ik/lzFM9mvRyISsgaPkaymRztaQ9rrDc7U3KFXKtQE7dwi1GE8v7vO6ScOyge VSuQ== X-Forwarded-Encrypted: i=1; AFNElJ9Bv+RII27WEy8vFpETif9Mm2tXMHCWUWS2Awp1d6UkWtSrL2Q4AI2Q1owB1dcV/hs/K10mLoteh+N7Sn4=@vger.kernel.org X-Gm-Message-State: AOJu0YyBnuCBxQfOTKfmZ745oLHDi7YFdUgS/vSniKRJ07svWOF9wX5Z hYzzIF30FB4Yk6wo9wiBBbhr4xZVFJcVAcyDZT2dwCPM3lHFfZWsJCP8 X-Gm-Gg: Acq92OEHroewy9FwVTJVQLXkoFQvZPOATEnH2jqO3q8in5AcFGalsPBsRURA8OweH0U qbtGCAo6Sfh1Dm8GhMNw036OPvYsq6jTsbqjC4fEgSDtCv1d73UYAsuPhpH1O6l7EGe5nMVI9hJ W4angVlPdvedlmrQXRDJJ03pfYxVsO8pOWYi+6DCh1WZ/858y3plupwiTLoJi36dkag5tKZUsUU 5RhkLhtOz6zMTXST0fO/Mp5jebxGZ3/r9R9SpwuBAiZAgIbdy57zGvI4Lsq3aw1nC4588LTtUsC yLcU4EqwZp2foRUhqI/5ZsF6teYRRrK1o8qBmFPhAwO4xHjvBVgn0BdmdaHA8r0Wv7WRvfd7iIE kLHYZmGNrmTVcYg6YVNeS9Kfeb/dfW29pIt+Mot/7G0GHLJK5jsFFZZSv+cHcJktIpUOM9qlV/U wGDyyzo7/2cRQvN3IUtisTwgwjwvC/C/zQitiOn1HiKxVpeWib5PbNgWfH X-Received: by 2002:a05:6a00:908e:b0:842:459b:d61b with SMTP id d2e1a72fcca58-842b0f90d88mr1002312b3a.32.1780621198003; Thu, 04 Jun 2026 17:59:58 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8428235006dsm7730884b3a.13.2026.06.04.17.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 17:59:57 -0700 (PDT) Received: from hqs-appsw-a2o.mp600.macronix.com (unknown [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 7F6284163B72; Fri, 5 Jun 2026 08:59:55 +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 v2 2/2] mtd: spi-nor: macronix: Restore fallback parameters for MX25L12805D Date: Fri, 5 Jun 2026 08:57:20 +0800 Message-Id: <20260605005720.1857413-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260605005720.1857413-1-linchengming884@gmail.com> References: <20260605005720.1857413-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 Reviewed-by: Miquel Raynal --- 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 febcef6a1..4cb7c1e98 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