From nobody Wed Dec 17 10:42: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 CADB9EE49A3 for ; Tue, 22 Aug 2023 07:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233471AbjHVHMN (ORCPT ); Tue, 22 Aug 2023 03:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233419AbjHVHLu (ORCPT ); Tue, 22 Aug 2023 03:11:50 -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 86C96E65 for ; Tue, 22 Aug 2023 00:11:20 -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 9B17661500 for ; Tue, 22 Aug 2023 07:10:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CBBFC433C7; Tue, 22 Aug 2023 07:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692688249; bh=8w3XDg6OtHsIPMEmA3w/5H7T3yQdVD+fVZ/p/srxbKw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RdDnz6oEsGZBmCYG9ChhLr/8h7zSDm2+sCtAmhhRCehP5jUhVVQLLhYWzVXRjW7Yg xu+hAySF4pXszQNQFzuplSm0Z7l1zXEC/k97NDSMSmgtfOYKutdpn85JjuHiO9Kgop ov4ady6NYHhYJiZdkXK5p8arUhxcByU/XUWdGf7YLeMynw8ewMYlW7IPPsVKvl6UKF 8M6MqnOKori2t7vvKaxRhPNsm8WIb0LSFXJWIr2eDnrzF5mtpNF1T+H0TGZl55xG+i mhtFmjJyzWpOV3kRAM8QGJLu5x1ZQN+Is9bowlKPr0ExSqe3wITiTbTTDtk7b3Hnec ZszD+4ORGjMNw== From: Michael Walle Date: Tue, 22 Aug 2023 09:09:53 +0200 Subject: [PATCH v2 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-v2-37-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/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