From nobody Mon Sep 8 08:03:36 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 C7CFFEE57EF for ; Fri, 8 Sep 2023 10:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241524AbjIHK3c (ORCPT ); Fri, 8 Sep 2023 06:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239943AbjIHK3a (ORCPT ); Fri, 8 Sep 2023 06:29:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D73A01BF1 for ; Fri, 8 Sep 2023 03:29:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04673C43215; Fri, 8 Sep 2023 10:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694168267; bh=8w3XDg6OtHsIPMEmA3w/5H7T3yQdVD+fVZ/p/srxbKw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BmF1Q8Xw5RvCcYCipJeXpRSaDyA94pD/NTPVmB4OCXMprWMjv275emueSl0J11+7x q000AXd4tkAIfhlUGoKzYLkOXJwTwEE/pdXJt7sX7/g/4XlWOlCrZrutSazGCR2bYn IyiLjm2pNnN6dBlYdskAbfHmiN2xvQuYhickwvj62KFbwc7lVdCVqjD4xnW0dB/PmO YA3g8aD+yoalvaizrF2NEenNzjj1xLKeF5C74cCX7qOZE4Pfxl0J0PwxL8TSL1jEdX IDxguPc40od+94FcZi0C6/kjSupVunB14nzdLqgwIskAT7KrVegfnnFxtHCnuRQ06v 8ZbzaMbvz7HYg== From: Michael Walle Date: Fri, 08 Sep 2023 12:16:55 +0200 Subject: [PATCH v3 37/41] mtd: spi-nor: spansion: 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-v3-37-e60548861b10@kernel.org> References: <20230807-mtd-flash-info-db-rework-v3-0-e60548861b10@kernel.org> In-Reply-To: <20230807-mtd-flash-info-db-rework-v3-0-e60548861b10@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/spansion.c | 174 ++++++++++++++++++++-----------------= ---- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index 5953df6aff93..fd2652aa6c1e 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -757,28 +757,35 @@ static const struct spi_nor_fixups s25fs_s_nor_fixups= =3D { =20 static const struct flash_info spansion_nor_parts[] =3D { { + .id =3D SNOR_ID(0x01, 0x02, 0x12), + .name =3D "s25sl004a", + .size =3D SZ_512K, + }, { + .id =3D SNOR_ID(0x01, 0x02, 0x13), + .name =3D "s25sl008a", + .size =3D SZ_1M, + }, { + .id =3D SNOR_ID(0x01, 0x02, 0x14), + .name =3D "s25sl016a", + .size =3D SZ_2M, + }, { .id =3D SNOR_ID(0x01, 0x02, 0x15, 0x4d, 0x00), .name =3D "s25sl032p", .size =3D SZ_4M, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0x01, 0x02, 0x15), + .name =3D "s25sl032a", + .size =3D SZ_4M, }, { .id =3D SNOR_ID(0x01, 0x02, 0x16, 0x4d, 0x00), .name =3D "s25sl064p", .size =3D SZ_8M, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x00, 0x80), - .name =3D "s25fl128s0", - .size =3D SZ_16M, - .sector_size =3D SZ_256K, - .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_CLSR, - }, { - .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x80), - .name =3D "s25fl128s1", - .size =3D SZ_16M, - .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_CLSR, + .id =3D SNOR_ID(0x01, 0x02, 0x16), + .name =3D "s25sl064a", + .size =3D SZ_8M, }, { .id =3D SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x80), .name =3D "s25fl256s0", @@ -787,31 +794,16 @@ static const struct flash_info spansion_nor_parts[] = =3D { .no_sfdp_flags =3D SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_= READ, .mfr_flags =3D USE_CLSR, }, { - .id =3D SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x01, 0x80), - .name =3D "s25fl256s1", + .id =3D SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x81), + .name =3D "s25fs256s0", .size =3D SZ_32M, - .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_CLSR, - }, { - .id =3D SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x80), - .name =3D "s25fl512s", - .size =3D SZ_64M, .sector_size =3D SZ_256K, - .flags =3D SPI_NOR_HAS_LOCK, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .mfr_flags =3D USE_CLSR, }, { - .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x81), - .name =3D "s25fs128s1", - .size =3D SZ_16M, - .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .mfr_flags =3D USE_CLSR, - .fixups =3D &s25fs_s_nor_fixups, - }, { - .id =3D SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x81), - .name =3D "s25fs256s0", + .id =3D SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x01, 0x80), + .name =3D "s25fl256s1", .size =3D SZ_32M, - .sector_size =3D SZ_256K, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .mfr_flags =3D USE_CLSR, }, { @@ -820,6 +812,14 @@ static const struct flash_info spansion_nor_parts[] = =3D { .size =3D SZ_32M, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .mfr_flags =3D USE_CLSR, + }, { + .id =3D SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x80), + .name =3D "s25fl512s", + .size =3D SZ_64M, + .sector_size =3D SZ_256K, + .flags =3D SPI_NOR_HAS_LOCK, + .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_CLSR, }, { .id =3D SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x81), .name =3D "s25fs512s", @@ -837,6 +837,13 @@ static const struct flash_info spansion_nor_parts[] = =3D { .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x03, 0x01), .name =3D "s25sl12801", .size =3D SZ_16M, + }, { + .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x00, 0x80), + .name =3D "s25fl128s0", + .size =3D SZ_16M, + .sector_size =3D SZ_256K, + .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_CLSR, }, { .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x00), .name =3D "s25fl129p0", @@ -845,51 +852,34 @@ static const struct flash_info spansion_nor_parts[] = =3D { .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .mfr_flags =3D USE_CLSR, }, { - .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01), - .name =3D "s25fl129p1", + .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x80), + .name =3D "s25fl128s1", .size =3D SZ_16M, .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .mfr_flags =3D USE_CLSR, }, { - .id =3D SNOR_ID(0x01, 0x02, 0x12), - .name =3D "s25sl004a", - .size =3D SZ_512K, - }, { - .id =3D SNOR_ID(0x01, 0x02, 0x13), - .name =3D "s25sl008a", - .size =3D SZ_1M, - }, { - .id =3D SNOR_ID(0x01, 0x02, 0x14), - .name =3D "s25sl016a", - .size =3D SZ_2M, - }, { - .id =3D SNOR_ID(0x01, 0x02, 0x15), - .name =3D "s25sl032a", - .size =3D SZ_4M, + .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x81), + .name =3D "s25fs128s1", + .size =3D SZ_16M, + .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_CLSR, + .fixups =3D &s25fs_s_nor_fixups, }, { - .id =3D SNOR_ID(0x01, 0x02, 0x16), - .name =3D "s25sl064a", - .size =3D SZ_8M, + .id =3D SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01), + .name =3D "s25fl129p1", + .size =3D SZ_16M, + .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .mfr_flags =3D USE_CLSR, }, { - .id =3D SNOR_ID(0xef, 0x40, 0x13), - .name =3D "s25fl004k", + .id =3D SNOR_ID(0x01, 0x40, 0x13), + .name =3D "s25fl204k", .size =3D SZ_512K, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ, }, { - .id =3D SNOR_ID(0xef, 0x40, 0x14), - .name =3D "s25fl008k", + .id =3D SNOR_ID(0x01, 0x40, 0x14), + .name =3D "s25fl208k", .size =3D SZ_1M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0xef, 0x40, 0x15), - .name =3D "s25fl016k", - .size =3D SZ_2M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0xef, 0x40, 0x17), - .name =3D "s25fl064k", - .size =3D SZ_8M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ, }, { .id =3D SNOR_ID(0x01, 0x40, 0x15), .name =3D "s25fl116k", @@ -905,16 +895,6 @@ static const struct flash_info spansion_nor_parts[] = =3D { .name =3D "s25fl164k", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K, - }, { - .id =3D SNOR_ID(0x01, 0x40, 0x13), - .name =3D "s25fl204k", - .size =3D SZ_512K, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ, - }, { - .id =3D SNOR_ID(0x01, 0x40, 0x14), - .name =3D "s25fl208k", - .size =3D SZ_1M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ, }, { .id =3D SNOR_ID(0x01, 0x60, 0x17), .name =3D "s25fl064l", @@ -934,10 +914,11 @@ static const struct flash_info spansion_nor_parts[] = =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixup_flags =3D SPI_NOR_4B_OPCODES, }, { - .id =3D SNOR_ID(0x34, 0x2b, 0x19, 0x0f, 0x08, 0x90), - .name =3D "s25fs256t", - .mfr_flags =3D USE_CLPEF, - .fixups =3D &s25fs256t_fixups + .id =3D SNOR_ID(0x04, 0x2c, 0xc2, 0x7f, 0x7f, 0x7f), + .name =3D "cy15x104q", + .size =3D SZ_512K, + .sector_size =3D SZ_512K, + .flags =3D SPI_NOR_NO_ERASE, }, { .id =3D SNOR_ID(0x34, 0x2a, 0x1a, 0x0f, 0x03, 0x90), .name =3D "s25hl512t", @@ -954,6 +935,11 @@ static const struct flash_info spansion_nor_parts[] = =3D { .mfr_flags =3D USE_CLPEF, .flags =3D NO_CHIP_ERASE, .fixups =3D &s25hx_t_fixups + }, { + .id =3D SNOR_ID(0x34, 0x2b, 0x19, 0x0f, 0x08, 0x90), + .name =3D "s25fs256t", + .mfr_flags =3D USE_CLPEF, + .fixups =3D &s25fs256t_fixups }, { .id =3D SNOR_ID(0x34, 0x2b, 0x1a, 0x0f, 0x03, 0x90), .name =3D "s25hs512t", @@ -970,12 +956,6 @@ static const struct flash_info spansion_nor_parts[] = =3D { .mfr_flags =3D USE_CLPEF, .flags =3D NO_CHIP_ERASE, .fixups =3D &s25hx_t_fixups - }, { - .id =3D SNOR_ID(0x04, 0x2c, 0xc2, 0x7f, 0x7f, 0x7f), - .name =3D "cy15x104q", - .size =3D SZ_512K, - .sector_size =3D SZ_512K, - .flags =3D SPI_NOR_NO_ERASE, }, { .id =3D SNOR_ID(0x34, 0x5a, 0x1a), .name =3D "s28hl512t", @@ -1001,6 +981,26 @@ static const struct flash_info spansion_nor_parts[] = =3D { .name =3D "s28hs02gt", .mfr_flags =3D USE_CLPEF, .fixups =3D &s28hx_t_fixups, + }, { + .id =3D SNOR_ID(0xef, 0x40, 0x13), + .name =3D "s25fl004k", + .size =3D SZ_512K, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0xef, 0x40, 0x14), + .name =3D "s25fl008k", + .size =3D SZ_1M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0xef, 0x40, 0x15), + .name =3D "s25fl016k", + .size =3D SZ_2M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0xef, 0x40, 0x17), + .name =3D "s25fl064k", + .size =3D SZ_8M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, } }; =20 --=20 2.39.2