From nobody Fri Dec 19 06:37:35 2025 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 851321E990E for ; Tue, 11 Feb 2025 06:34:43 +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=1739255686; cv=none; b=SWVwrUTMXeFNz3zePRvfPzPTNTextbYbzK2PrK2KcDEGd7ZCwfVt71DYWJbL/DuvWyaXXHu+P5pjhQ647nJRE/wAbgt/+xT4RYpz4Jnaujrtyc2jDwOhTKdE3xw9ywwJhK3GJNBzgPjiYvG8OpOlxJxdMynDIkZR3YwQrO9uIw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739255686; c=relaxed/simple; bh=KumiqswpPUXztvd1inmn4Q+k3gYM0J3dcN0w5O5msf0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=K3oCFP6HsA/+B99NYEji13fd2QXeV+qo7jHhDjOoYky9wL8vhuDt9VpvpIM9e0kxK+T12PNj/uQqcx5HKMXB2yJS2bwusdsSTupel/6Kaapwd8z8Z8Fxb5HLcDht5wAPDi/wARuYX+5JwXrg92vJmkkEBHS3pnlw4aGU1Zl7+Tw= 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=lFiIoV5E; 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="lFiIoV5E" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-21f7f1e1194so58504215ad.2 for ; Mon, 10 Feb 2025 22:34:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739255683; x=1739860483; 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=BFE+aICRwMBPop7u3D8WpfY+pXRY8kSUQS+SbynUSDE=; b=lFiIoV5EqlhvnTTYoyhRRHwXIBID0jxxb+GgftsUW1CZlNGoM+vgUpEd7vjav15sii XiTamr7UTU74ESzLL0hcLA+7yKfmRs9jZ+GxHlouXb0HSjl4afL7972a2B8N326XhMAl H/Yh5sH1gjBgc/X20UA1kg3SpWVEqbt/tbMwsU4CUGXqwR8CPZ1P9uXq2HEhCfT/qgAn 7eDgOPOMffemqWrXC8+0CWk4bdJBNk27sVO5oKB+BgSGF8dhdo8fe443p/ZZCFfx9iHo Ztl1mwqLHbJYsjpsUc7cA5hxr8rNqW501DqjMP8dTJKwhJf3VwwLOvhJuhE6QRLeapcW yk4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739255683; x=1739860483; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BFE+aICRwMBPop7u3D8WpfY+pXRY8kSUQS+SbynUSDE=; b=VjtzI2+5aXvBXjDPIdhWyqoSIJ02IRwSLdRWBV+h9CjgDxSUcd1JGMk9WnLIy9sWTx JzO+LWwtb6iIyWKYisb8w9Z79TVHiiJEijqmZkTWar7StXZ8oidOACekhXBbcJB1xckq 1QsF1se4eWYTAa73rd95UmNUpr4FED/3dD71dSA2rHMHOKzbDp4TpOwHgzxvOVz6Ec8Z ppTi9I3TRUqk+hr/o9DsVsPZL66h5F9JpVF3RrqY6jQyQCtbU+J07fGhbRf9j66dnAsI vaImF5Qsqxxw/KXfcDq/qGC1kYpGvkpMTT3Kf6PWmau9DFJhb9bLee3Giq+PN3kcWB9L C4eQ== X-Forwarded-Encrypted: i=1; AJvYcCWu0RdyuqIjUnOQuwwywHi3Q6FUKekxEpTE9z3aA1vOjAx1VJP+EhsdPqKHGdI3MtnQcLV3ZIGnijGtnTs=@vger.kernel.org X-Gm-Message-State: AOJu0YxW65CwlciOv08dT4Z+S1LjPaVNQStZHoHf2g3J0PcKikg76W2t v/kKUAZyWB2jFpSxhczgFTMe++VAqXyCUhnvkwnlQnzL7KH0ekPZ4GIg3w== X-Gm-Gg: ASbGnctFsOO6MyPQhbwQE3F4JM/3LgrincH+RSqifOjc6HsQ7bvpjpzsvFUzyDIl25g ASDHuWiv+LYy8Ygdf1oSmU/xst8mFWeQg9YWw7ORa+tnaeAy0BAv2qmMJgbRPqCoxPbTli3o+C/ l9a2CUw5KwnVApsOMqL5NZAWOQC/RFnQvJpnu/kmjY1QxDIK5KhXbkrS7O1CQHBgBPDz1xGjnmG FHU3ERFc4Y3S/GxQD8qwVpGiO7KzlGj1n8Zxpc2JENTL5OsMIL0abARFe905XnfeW+jGAmXSsvg plnwwdbRWV6IEq5Rq/G/lSgOFHGPvDayYNSXio0= X-Google-Smtp-Source: AGHT+IFwX8mAZFCGvzmUtYLKDj8TTGkGRUOXxdC7VEPJsHw48BLzdh9jISBNeeKA18f9NU5Jg5Nchw== X-Received: by 2002:a05:6a21:350d:b0:1dc:2a02:913b with SMTP id adf61e73a8af0-1ee03a475c3mr29594797637.15.1739255682777; Mon, 10 Feb 2025 22:34:42 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ad51af7a22dsm8750683a12.69.2025.02.10.22.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2025 22:34:42 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 1294580844; Tue, 11 Feb 2025 14:45:12 +0800 (CST) From: Cheng Ming Lin To: tudor.ambarus@linaro.org, pratyush@kernel.org, mwalle@kernel.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: alvinzhou@mxic.com.tw, leoyu@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program Date: Tue, 11 Feb 2025 14:30:27 +0800 Message-Id: <20250211063028.382169-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250211063028.382169-1-linchengming884@gmail.com> References: <20250211063028.382169-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 Although certain Macronix NOR flash support the Quad Input Page Program feature, the corresponding information in the 4-byte Address Instruction Table of these flash is not properly filled. As a result, this feature cannot be enabled as expected. To address this issue, a post_sfdp fixups implementation is required to correct the missing information. Signed-off-by: Cheng Ming Lin Reviewed-by: Tudor Ambarus --- zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c22019 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 0f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff d6 59 dd 00 82 9f 03 db 44 03 67 38 |.....Y......D.= g8| 00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d......= ..| 00000120 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2201a zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 1f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff d6 49 c5 00 81 df 04 e3 44 03 67 38 |.....I......D.= g8| 00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f ef ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d......= ..| 00000120 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2201b zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 3f 44 eb 08 6b 08 3b 04 bb |. .....?D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff d6 49 c5 00 85 df 04 e3 44 03 67 38 |.....I......D.= g8| 00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f ef ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d......= ..| 00000120 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2253a zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 1f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff 87 49 b5 00 82 df 04 e2 44 03 67 38 |.....I......D.= g8| 00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 20 50 16 9d f9 c0 64 85 cb ff ff ff ff ff ff |. P....d......= ..| 00000120 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2253c zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 7f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff 89 49 bd 00 8d 12 00 e2 44 03 67 44 |.....I......D.= gD| 00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 20 00 17 9d f9 c0 64 85 cb ff ff ff ff ff ff |. .....d......= ..| 00000120 drivers/mtd/spi-nor/macronix.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 830da21eea08..ada17999ccbb 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -45,8 +45,26 @@ mx25l25635_post_bfpt_fixups(struct spi_nor *nor, return 0; } =20 +static int +macronix_qpp4b_post_sfdp_fixups(struct spi_nor *nor) +{ + /* PP_1_1_4_4B is supported but missing in 4BAIT. */ + struct spi_nor_flash_parameter *params =3D nor->params; + + params->hwcaps.mask |=3D SNOR_HWCAPS_PP_1_1_4; + spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP_1_1_4], + SPINOR_OP_PP_1_1_4_4B, SNOR_PROTO_1_1_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, +}; + +static const struct spi_nor_fixups macronix_qpp4b_fixups =3D { + .post_sfdp =3D macronix_qpp4b_post_sfdp_fixups, }; =20 static const struct flash_info macronix_nor_parts[] =3D { @@ -102,11 +120,13 @@ static const struct flash_info macronix_nor_parts[] = =3D { .size =3D SZ_64M, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixup_flags =3D SPI_NOR_4B_OPCODES, + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x20, 0x1b), .name =3D "mx66l1g45g", .size =3D SZ_128M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x23, 0x14), .name =3D "mx25v8035f", @@ -154,18 +174,21 @@ static const struct flash_info macronix_nor_parts[] = =3D { .size =3D SZ_64M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixup_flags =3D SPI_NOR_4B_OPCODES, + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x3a), .name =3D "mx66u51235f", .size =3D SZ_64M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixup_flags =3D SPI_NOR_4B_OPCODES, + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x3c), .name =3D "mx66u2g45g", .size =3D SZ_256M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixup_flags =3D SPI_NOR_4B_OPCODES, + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x26, 0x18), .name =3D "mx25l12855e", --=20 2.25.1 From nobody Fri Dec 19 06:37:35 2025 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 213491E9B1D for ; Tue, 11 Feb 2025 06:34:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739255687; cv=none; b=RlaA+iCUtiJWBILazQk8qGOPYJTrvc6va3PZdS5UrTuTToAiSeH+0WBdTogMaQ+IvkYNBZE8+NlFRiVGiZ0c8w5+9t5EU2sD4HrBq4w3Sx/BQydondK3Iw7bqx5Bb1PSWDPe57jddt3NOmg+tdKrPgX6wJC1nBsPNDg4trZKBj0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739255687; c=relaxed/simple; bh=yEh+wfvXyMKxy4q415KWaZQ+XT+nGCyOCMrUo6c1dqY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g1HJ0WXe+TRaKLvZcg0gPwPlyG6YOSpkOeLc2T16JTl1Bbi7AyEhWy7nMacjkiBhwO/38pqGZmZ7yTWK8lW34IghQDXKvJk8IoNsTLQM8Nn2+5mEuzhv3veUK5msKJuTUqBhoVNqhcWaqiJjdpLEHUGGaERBZ8u8kXab0U0gxtw= 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=InXBplIY; arc=none smtp.client-ip=209.85.214.170 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="InXBplIY" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21f818a980cso35662855ad.3 for ; Mon, 10 Feb 2025 22:34:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739255683; x=1739860483; 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=vKRSXduA6DFDHyuX/Ea2ObIMjg6KIzYqpO3UD99KkoE=; b=InXBplIYCZ4K9mz+C8n9TcrjJTxUHkutckvv/fU+peFYwx1Cgcb6ps0tfdnE637tN5 hYDY1ozMGs36j4IicE4Pfxt6k3wGH6WIbqfc647M/gg9Aa3qVPrMbPStOSJLZeoqlHGq OTdjtisvg47vU/9KnWfYVeY29uooJwg/0qUWDDo8KEKPsnZmRjb9uR+Yimk2PKHa7O3X vYc5gz+kHTuLoqefj5MbZid5Hg5ffJcMXBpYIYMO4N5JkZmOh0vjsFsargx781ie/a1a J2L7V3UZddJ/a6M+qlv7PVPgTDtt5pKbZ3ygQrJ8kDglW1k/HzNTnuMkxiF9+H3A6Pn5 oeZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739255683; x=1739860483; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vKRSXduA6DFDHyuX/Ea2ObIMjg6KIzYqpO3UD99KkoE=; b=IANzCAgcyboUk7StQKOgMPRNwn7VsA+LaSoDI0evccRMW4swqiiCT086aue0cs9h2J V0h9PnrqUeg2v+BpBUmk1T1uU5Yv9L+767KBVMD4nDxjssXr/SnnavgB3oYeN8kBrcuj yjLPQPVQFrW15oIpYPjM60eACWanLDtkAD20NbuqfQ/6J36fmN7H7aRz9uMhqwrO/vCR j3dLrKHadkihNMpiEBqQCSxFsHfb98jMz5hLCPZQm1TlvKhfn/AWrLi+Z0/KwORkOptE 6Zd+yScKqM/iCdTAQXPKXLGxeuNZc3e603Z20QKIGx5wv4pliwVmGEfNgz9uUOVMCfdA GfXg== X-Forwarded-Encrypted: i=1; AJvYcCX0MaBevtcd017O240mchwPvm8hyF72JbnFqAEdyewYQinQ7wjZjKEvod5ZQ70j296WFTcABwZ30q1uqdY=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6yHlywuzHx+6c34OGbYQaerVTTq1suhZQwI6pYhj/Dw3VlGWm 14F8UB51svbym3lTtza0d6zRaVC1fFpL7gtI0SGiQ/5HGXz71pUv X-Gm-Gg: ASbGncsXZR8TvgCynW3Sheeii485u8Af0mboh+PtjI+uIA65hzRYjTq2m2KBDz7Pa+P 2OFZsbwtCOVSor/kF4144XHWIAjtjpAnCx/Ly9T8OM23ipEW8lKMirwJRWhZaIs7sarTa925Yru faudk3E2MvLb9yDQ+fOVs9Z25LHo+i9b8Pk+509IJ+d23LxMgoBQhqRVDI853ZAwHs6NnkQI1SA l+2qsjl94HHTCWQCTlZiP1yQMoOzekMkVlTXMfBmZpmO19EDzeaF3T8AJuq2NFsBKr/VKPWV3t2 Vvdos1J8cyLdaC/SeX82+b/pBUDYHcy82emfs9g= X-Google-Smtp-Source: AGHT+IHrklW+WYbJjVKmrqHKY87kx0859k3rLUinVvuIp2riMk8pcr/rqcEpuwnu0N3fZqwHz4Qfjg== X-Received: by 2002:a17:903:2311:b0:215:acb3:3786 with SMTP id d9443c01a7336-21f4e6e649dmr286416455ad.19.1739255683313; Mon, 10 Feb 2025 22:34:43 -0800 (PST) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21f3653baa8sm89405455ad.73.2025.02.10.22.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2025 22:34:42 -0800 (PST) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 1922380845; Tue, 11 Feb 2025 14:45:12 +0800 (CST) From: Cheng Ming Lin To: tudor.ambarus@linaro.org, pratyush@kernel.org, mwalle@kernel.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: alvinzhou@mxic.com.tw, leoyu@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v2 2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash Date: Tue, 11 Feb 2025 14:30:28 +0800 Message-Id: <20250211063028.382169-3-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250211063028.382169-1-linchengming884@gmail.com> References: <20250211063028.382169-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 Due to incorrect values in the 4-BAIT table for these two flash IDs, it is necessary to add these two flash IDs with fixups. Signed-off-by: Cheng Ming Lin Reviewed-by: Tudor Ambarus --- zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2201c zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 7f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff 87 49 bd 00 84 d2 04 e2 44 03 67 38 |.....I......D.= g8| 00000060 30 b0 30 b0 f7 bd ff 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d......= ..| 00000120 zynq> sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 9af233495e5cffd2f38e9e2b8334a0d51c01fa93e9a17a991f674c8d6a350358 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp zynq> cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 0 dummy cycles 4 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 1S-4S-4S opcode 0x3e zynq> cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id c2 20 1c c2 20 1c size 256 MiB write size 1 page size 256 address nbytes 4 flags 4B_OPCODES | HAS_4BAIT | SOFT_RESET opcodes read 0xec dummy cycles 6 erase 0xdc program 0x3e 8D extension none protocols read 1S-4S-4S write 1S-4S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (256 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+---------- 00000000-0fffffff | [ 3] | no zynq> dd if=3D/dev/urandom of=3D/tmp/spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out 2097152 bytes (2.0MB) copied, 0.082418 seconds, 24.3MB/s zynq> mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read zynq> hexdump /tmp/spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 zynq> sha256sum /tmp/spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_= read zynq> mtd_debug write /dev/mtd0 0 2097152 /tmp/spi_test Copied 2097152 bytes from /tmp/spi_test to address 0x00000000 in flash zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read zynq> sha256sum /tmp/spi* affd6358abe2a75a7edd4d28a9c62bbb25d485c8958993d6e4fbc3de579b8dc0 /tmp/spi_= read affd6358abe2a75a7edd4d28a9c62bbb25d485c8958993d6e4fbc3de579b8dc0 /tmp/spi_= test zynq> mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read zynq> sha256sum /tmp/spi* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_= read affd6358abe2a75a7edd4d28a9c62bbb25d485c8958993d6e4fbc3de579b8dc0 /tmp/spi_= test zynq> mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 268435456 (256M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2253b zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0.= ..| 00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |..............= ..| 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000030 e5 20 fb ff ff ff ff 3f 44 eb 08 6b 08 3b 04 bb |. .....?D..k.;= ..| 00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. = .R| 00000050 10 d8 00 ff 89 49 bd 00 8d 12 00 e2 44 03 67 44 |.....I......D.= gD| 00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P= ..| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\........= ..| (wrong bit here, 7f should be ff) 000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |..............= ..| 00000110 00 20 00 17 9d f9 c0 64 85 cb ff ff ff ff ff ff |. .....d......= ..| 00000120 zynq> sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp ef47525560aa30ca7eb4634eb2eb15a0aa618d3b61f774933f9935d05fb475f6 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp zynq> cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 0 dummy cycles 4 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 1S-4S-4S opcode 0x3e zynq> cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id c2 25 3b c2 25 3b size 128 MiB write size 1 page size 256 address nbytes 4 flags 4B_OPCODES | HAS_4BAIT | SOFT_RESET opcodes read 0xec dummy cycles 6 erase 0xdc program 0x3e 8D extension none protocols read 1S-4S-4S write 1S-4S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (128 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+---------- 00000000-07ffffff | [ 3] | no zynq> dd if=3D/dev/urandom of=3D/tmp/spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out 2097152 bytes (2.0MB) copied, 0.082397 seconds, 24.3MB/s zynq> mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read zynq> hexdump /tmp/spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 zynq> sha256sum /tmp/spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_= read zynq> mtd_debug write /dev/mtd0 0 2097152 /tmp/spi_test Copied 2097152 bytes from /tmp/spi_test to address 0x00000000 in flash zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read zynq> sha256sum /tmp/spi* 8b57e38d293cf08cca7ef239ee70d20d70356ae798c2065576463414e490a759 /tmp/spi_= read 8b57e38d293cf08cca7ef239ee70d20d70356ae798c2065576463414e490a759 /tmp/spi_= test zynq> mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read zynq> sha256sum /tmp/spi* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_= read 8b57e38d293cf08cca7ef239ee70d20d70356ae798c2065576463414e490a759 /tmp/spi_= test zynq> mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 134217728 (128M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 drivers/mtd/spi-nor/macronix.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index ada17999ccbb..39a2a88ad54b 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -127,6 +127,10 @@ static const struct flash_info macronix_nor_parts[] = =3D { .size =3D SZ_128M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixups =3D ¯onix_qpp4b_fixups, + }, { + /* MX66L2G45G */ + .id =3D SNOR_ID(0xc2, 0x20, 0x1c), + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x23, 0x14), .name =3D "mx25v8035f", @@ -182,6 +186,10 @@ static const struct flash_info macronix_nor_parts[] = =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixup_flags =3D SPI_NOR_4B_OPCODES, .fixups =3D ¯onix_qpp4b_fixups, + }, { + /* MX66U1G45G */ + .id =3D SNOR_ID(0xc2, 0x25, 0x3b), + .fixups =3D ¯onix_qpp4b_fixups, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x3c), .name =3D "mx66u2g45g", --=20 2.25.1