From nobody Wed Dec 17 10:53:29 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8B89EE49A3 for ; Tue, 22 Aug 2023 07:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233459AbjHVHMK (ORCPT ); Tue, 22 Aug 2023 03:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233417AbjHVHLt (ORCPT ); Tue, 22 Aug 2023 03:11:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1091CCF for ; Tue, 22 Aug 2023 00:11:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9BC8964D68 for ; Tue, 22 Aug 2023 07:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68FBFC433CB; Tue, 22 Aug 2023 07:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692688247; bh=uBLUgzG+Qr84SJ0zH/c3GfOsYhPI41nZW9Idjp3TdLA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XB2HxEK38oAsXHPG9LcXEus2ooxje6lgfIGI7RnHJLyXPEVTak4NxHNayJcnFLDBg eGUhXn/bb9FcFS2evYckhhllSF26aBK+C7KFLi1NGJdI2vFFp5MWXr1oRTuYPiTjXP rGkPB9K7MbVLwCAyCnXa42k5QpGQZN/hg3GRLX0KoPTrmdmY+99OiisOCaV/E5M5KF zFGXQEqkcYCsgVU1TQ6ODkd4DFSupu9lyhyWoX3KjnPOgfgoVIu1Pa5DyDRU65bHev +cOv0HwAeDc8T9H2xcDdzR5cgncxTxb2Un+8CD3Pbj575rs0UOeTuIpwBRalYGTYfr n33YpU6X/dm8g== From: Michael Walle Date: Tue, 22 Aug 2023 09:09:52 +0200 Subject: [PATCH v2 36/41] mtd: spi-nor: micron-st: sort flash_info database MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230807-mtd-flash-info-db-rework-v2-36-291a0f39f8d8@kernel.org> References: <20230807-mtd-flash-info-db-rework-v2-0-291a0f39f8d8@kernel.org> In-Reply-To: <20230807-mtd-flash-info-db-rework-v2-0-291a0f39f8d8@kernel.org> To: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Michael Walle X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The flash ID is the new primary key into our database. Sort the entry by it. Keep the most specific ones first, because there might be ID collisions between shorter and longer ones. Signed-off-by: Michael Walle --- drivers/mtd/spi-nor/micron-st.c | 336 ++++++++++++++++++++----------------= ---- 1 file changed, 168 insertions(+), 168 deletions(-) diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-s= t.c index 720fd2fbd0ad..4afcfc57c896 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -182,133 +182,35 @@ static const struct flash_info micron_nor_parts[] = =3D { =20 static const struct flash_info st_nor_parts[] =3D { { - .id =3D SNOR_ID(0x20, 0xbb, 0x15), - .name =3D "n25q016a", - .size =3D SZ_2M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0x20, 0xba, 0x16), - .name =3D "n25q032", - .size =3D SZ_4M, - .no_sfdp_flags =3D SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x16), - .name =3D "n25q032a", - .size =3D SZ_4M, - .no_sfdp_flags =3D SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0x20, 0xba, 0x17), - .name =3D "n25q064", - .size =3D SZ_8M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x17), - .name =3D "n25q064a", - .size =3D SZ_8M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x18), - .name =3D "n25q128a11", - .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | - SPI_NOR_BP3_SR_BIT6, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, - }, { - .id =3D SNOR_ID(0x20, 0xba, 0x18), - .name =3D "n25q128a13", - .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | - SPI_NOR_BP3_SR_BIT6, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, - }, { - .id =3D SNOR_ID(0x20, 0xba, 0x19, 0x10, 0x44, 0x00), - .name =3D "mt25ql256a", - .size =3D SZ_32M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .fixup_flags =3D SPI_NOR_4B_OPCODES, - .mfr_flags =3D USE_FSR, - }, { - .id =3D SNOR_ID(0x20, 0xba, 0x19), - .name =3D "n25q256a", - .size =3D SZ_32M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, - }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x19, 0x10, 0x44, 0x00), - .name =3D "mt25qu256a", - .size =3D SZ_32M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | - SPI_NOR_BP3_SR_BIT6, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .fixup_flags =3D SPI_NOR_4B_OPCODES, - .mfr_flags =3D USE_FSR, - }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x19), - .name =3D "n25q256ax1", - .size =3D SZ_32M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p05-nonjedec", + .sector_size =3D SZ_32K, + .size =3D SZ_64K, }, { - .id =3D SNOR_ID(0x20, 0xba, 0x20, 0x10, 0x44, 0x00), - .name =3D "mt25ql512a", - .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, - .mfr_flags =3D USE_FSR, + .name =3D "m25p10-nonjedec", + .sector_size =3D SZ_32K, + .size =3D SZ_128K, }, { - .id =3D SNOR_ID(0x20, 0xba, 0x20), - .name =3D "n25q512ax3", - .size =3D SZ_64M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | - SPI_NOR_BP3_SR_BIT6, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p20-nonjedec", + .size =3D SZ_256K, }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00), - .name =3D "mt25qu512a", - .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, - .mfr_flags =3D USE_FSR, + .name =3D "m25p40-nonjedec", + .size =3D SZ_512K, }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x20), - .name =3D "n25q512a", - .size =3D SZ_64M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | - SPI_NOR_BP3_SR_BIT6, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p80-nonjedec", + .size =3D SZ_1M, }, { - .id =3D SNOR_ID(0x20, 0xba, 0x21), - .name =3D "n25q00", - .size =3D SZ_128M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | - SPI_NOR_BP3_SR_BIT6 | NO_CHIP_ERASE, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p16-nonjedec", + .size =3D SZ_2M, }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x21), - .name =3D "n25q00a", - .size =3D SZ_128M, - .flags =3D NO_CHIP_ERASE, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p32-nonjedec", + .size =3D SZ_4M, }, { - .id =3D SNOR_ID(0x20, 0xba, 0x22), - .name =3D "mt25ql02g", - .size =3D SZ_256M, - .flags =3D NO_CHIP_ERASE, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p64-nonjedec", + .size =3D SZ_8M, }, { - .id =3D SNOR_ID(0x20, 0xbb, 0x22), - .name =3D "mt25qu02g", - .size =3D SZ_256M, - .flags =3D NO_CHIP_ERASE, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_FSR, + .name =3D "m25p128-nonjedec", + .sector_size =3D SZ_256K, + .size =3D SZ_16M, }, { .id =3D SNOR_ID(0x20, 0x20, 0x10), .name =3D "m25p05", @@ -348,36 +250,6 @@ static const struct flash_info st_nor_parts[] =3D { .name =3D "m25p128", .sector_size =3D SZ_256K, .size =3D SZ_16M, - }, { - .name =3D "m25p05-nonjedec", - .sector_size =3D SZ_32K, - .size =3D SZ_64K, - }, { - .name =3D "m25p10-nonjedec", - .sector_size =3D SZ_32K, - .size =3D SZ_128K, - }, { - .name =3D "m25p20-nonjedec", - .size =3D SZ_256K, - }, { - .name =3D "m25p40-nonjedec", - .size =3D SZ_512K, - }, { - .name =3D "m25p80-nonjedec", - .size =3D SZ_1M, - }, { - .name =3D "m25p16-nonjedec", - .size =3D SZ_2M, - }, { - .name =3D "m25p32-nonjedec", - .size =3D SZ_4M, - }, { - .name =3D "m25p64-nonjedec", - .size =3D SZ_8M, - }, { - .name =3D "m25p128-nonjedec", - .sector_size =3D SZ_256K, - .size =3D SZ_16M, }, { .id =3D SNOR_ID(0x20, 0x40, 0x11), .name =3D "m45pe10", @@ -391,18 +263,14 @@ static const struct flash_info st_nor_parts[] =3D { .name =3D "m45pe16", .size =3D SZ_2M, }, { - .id =3D SNOR_ID(0x20, 0x80, 0x12), - .name =3D "m25pe20", - .size =3D SZ_256K, + .id =3D SNOR_ID(0x20, 0x63, 0x16), + .name =3D "m25px32-s1", + .size =3D SZ_4M, + .no_sfdp_flags =3D SECT_4K, }, { - .id =3D SNOR_ID(0x20, 0x80, 0x14), - .name =3D "m25pe80", + .id =3D SNOR_ID(0x20, 0x71, 0x14), + .name =3D "m25px80", .size =3D SZ_1M, - }, { - .id =3D SNOR_ID(0x20, 0x80, 0x15), - .name =3D "m25pe16", - .size =3D SZ_2M, - .no_sfdp_flags =3D SECT_4K, }, { .id =3D SNOR_ID(0x20, 0x71, 0x15), .name =3D "m25px16", @@ -413,25 +281,157 @@ static const struct flash_info st_nor_parts[] =3D { .name =3D "m25px32", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K, + }, { + .id =3D SNOR_ID(0x20, 0x71, 0x17), + .name =3D "m25px64", + .size =3D SZ_8M, }, { .id =3D SNOR_ID(0x20, 0x73, 0x16), .name =3D "m25px32-s0", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K, }, { - .id =3D SNOR_ID(0x20, 0x63, 0x16), - .name =3D "m25px32-s1", - .size =3D SZ_4M, + .id =3D SNOR_ID(0x20, 0x80, 0x12), + .name =3D "m25pe20", + .size =3D SZ_256K, + }, { + .id =3D SNOR_ID(0x20, 0x80, 0x14), + .name =3D "m25pe80", + .size =3D SZ_1M, + }, { + .id =3D SNOR_ID(0x20, 0x80, 0x15), + .name =3D "m25pe16", + .size =3D SZ_2M, .no_sfdp_flags =3D SECT_4K, }, { - .id =3D SNOR_ID(0x20, 0x71, 0x17), - .name =3D "m25px64", + .id =3D SNOR_ID(0x20, 0xba, 0x16), + .name =3D "n25q032", + .size =3D SZ_4M, + .no_sfdp_flags =3D SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x17), + .name =3D "n25q064", .size =3D SZ_8M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, }, { - .id =3D SNOR_ID(0x20, 0x71, 0x14), - .name =3D "m25px80", - .size =3D SZ_1M, - }, + .id =3D SNOR_ID(0x20, 0xba, 0x18), + .name =3D "n25q128a13", + .size =3D SZ_16M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x19, 0x10, 0x44, 0x00), + .name =3D "mt25ql256a", + .size =3D SZ_32M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .fixup_flags =3D SPI_NOR_4B_OPCODES, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x19), + .name =3D "n25q256a", + .size =3D SZ_32M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x20, 0x10, 0x44, 0x00), + .name =3D "mt25ql512a", + .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, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x20), + .name =3D "n25q512ax3", + .size =3D SZ_64M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x21), + .name =3D "n25q00", + .size =3D SZ_128M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6 | NO_CHIP_ERASE, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xba, 0x22), + .name =3D "mt25ql02g", + .size =3D SZ_256M, + .flags =3D NO_CHIP_ERASE, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x15), + .name =3D "n25q016a", + .size =3D SZ_2M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x16), + .name =3D "n25q032a", + .size =3D SZ_4M, + .no_sfdp_flags =3D SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x17), + .name =3D "n25q064a", + .size =3D SZ_8M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x18), + .name =3D "n25q128a11", + .size =3D SZ_16M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x19, 0x10, 0x44, 0x00), + .name =3D "mt25qu256a", + .size =3D SZ_32M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .fixup_flags =3D SPI_NOR_4B_OPCODES, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x19), + .name =3D "n25q256ax1", + .size =3D SZ_32M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00), + .name =3D "mt25qu512a", + .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, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x20), + .name =3D "n25q512a", + .size =3D SZ_64M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x21), + .name =3D "n25q00a", + .size =3D SZ_128M, + .flags =3D NO_CHIP_ERASE, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + }, { + .id =3D SNOR_ID(0x20, 0xbb, 0x22), + .name =3D "mt25qu02g", + .size =3D SZ_256M, + .flags =3D NO_CHIP_ERASE, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_FSR, + } }; =20 /** --=20 2.39.2