From nobody Sun Sep 7 12:36:17 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 11C0BC001B0 for ; Mon, 7 Aug 2023 13:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbjHGNZZ (ORCPT ); Mon, 7 Aug 2023 09:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234114AbjHGNYs (ORCPT ); Mon, 7 Aug 2023 09:24:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38DBE1BCE for ; Mon, 7 Aug 2023 06:23:35 -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 3E4F561ACC for ; Mon, 7 Aug 2023 13:23:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0125EC433C7; Mon, 7 Aug 2023 13:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691414586; bh=S2VGpvolKhnaojGSg3lKj4d7SDdm9iFqv4jQmZl9diQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=izRzvuAC1Kj2+PagOXQGgx1F6X2L7ZlMfSiXQPBpEMoX23BToljIbEdNJ7u4ANp+y dmaCz4xhXf/Cnvn/KPmD7Dhlq1bIdaKjzEy3a+NHIbiD712OSvx5Un1cl3TEN/nVEo A+2c8g3zMG0T2S0V6otbBEx8rNB6C7hmKcBs4HuSXJbmopJ3bVVaJjjDvTmVgw9vAR mIWM4F4IBm71JsJWkkKYErtjrHwTQ2ZbIci/Q0qWvOi+gTE3QjxinqxnIBJYmPFuIt VcGrHetWA/qo/ItoIlxJhBHizVVSVnrksYjAdoSDOMCDhlJSnTFO6CorXM7eCO1mZU S2dzbd6mJLf3w== From: Michael Walle Date: Mon, 07 Aug 2023 15:21:29 +0200 Subject: [PATCH 35/41] mtd: spi-nor: macronix: 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-v1-35-3d3d5bef4ba4@kernel.org> References: <20230807-mtd-flash-info-db-rework-v1-0-3d3d5bef4ba4@kernel.org> In-Reply-To: <20230807-mtd-flash-info-db-rework-v1-0-3d3d5bef4ba4@kernel.org> To: Tudor Ambarus , Pratyush Yadav , Michael Walle , 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/macronix.c | 130 ++++++++++++++++++++-----------------= ---- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 0508a207e9df..ea6be95e75a5 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -62,26 +62,44 @@ static const struct flash_info macronix_nor_parts[] =3D= { .name =3D "mx25l3205d", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K, - }, { - .id =3D SNOR_ID(0xc2, 0x9e, 0x16), - .name =3D "mx25l3255e", - .size =3D SZ_4M, - .no_sfdp_flags =3D SECT_4K, }, { .id =3D SNOR_ID(0xc2, 0x20, 0x17), .name =3D "mx25l6405d", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K, + }, { + .id =3D SNOR_ID(0xc2, 0x20, 0x18), + .name =3D "mx25l12805d", + .size =3D SZ_16M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP, + .no_sfdp_flags =3D SECT_4K, + }, { + .id =3D SNOR_ID(0xc2, 0x20, 0x19), + .name =3D "mx25l25635e", + .size =3D SZ_32M, + .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .fixups =3D &mx25l25635_fixups + }, { + .id =3D SNOR_ID(0xc2, 0x20, 0x1a), + .name =3D "mx66l51235f", + .size =3D SZ_64M, + .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .fixup_flags =3D SPI_NOR_4B_OPCODES, + }, { + .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, + }, { + .id =3D SNOR_ID(0xc2, 0x23, 0x14), + .name =3D "mx25v8035f", + .size =3D SZ_1M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x32), .name =3D "mx25u2033e", .size =3D SZ_256K, .no_sfdp_flags =3D SECT_4K, - }, { - .id =3D SNOR_ID(0xc2, 0x25, 0x36), - .name =3D "mx25u3235f", - .size =3D SZ_4M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x33), .name =3D "mx25u4035", @@ -92,74 +110,33 @@ static const struct flash_info macronix_nor_parts[] = =3D { .name =3D "mx25u8035", .size =3D SZ_1M, .no_sfdp_flags =3D SECT_4K, + }, { + .id =3D SNOR_ID(0xc2, 0x25, 0x36), + .name =3D "mx25u3235f", + .size =3D SZ_4M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x37), .name =3D "mx25u6435f", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K, - }, { - .id =3D SNOR_ID(0xc2, 0x20, 0x18), - .name =3D "mx25l12805d", - .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP, - .no_sfdp_flags =3D SECT_4K, - }, { - .id =3D SNOR_ID(0xc2, 0x26, 0x18), - .name =3D "mx25l12855e", - .size =3D SZ_16M, - }, { - .id =3D SNOR_ID(0xc2, 0x28, 0x15), - .name =3D "mx25r1635f", - .size =3D SZ_2M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0xc2, 0x28, 0x16), - .name =3D "mx25r3235f", - .size =3D SZ_4M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x38), .name =3D "mx25u12835f", .size =3D SZ_16M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0xc2, 0x20, 0x19), - .name =3D "mx25l25635e", - .size =3D SZ_32M, - .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .fixups =3D &mx25l25635_fixups }, { .id =3D SNOR_ID(0xc2, 0x25, 0x39), .name =3D "mx25u25635f", .size =3D SZ_32M, .no_sfdp_flags =3D SECT_4K, - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) + .fixup_flags =3D SPI_NOR_4B_OPCODES, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x3a), .name =3D "mx25u51245g", .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, - }, { - .id =3D SNOR_ID(0xc2, 0x81, 0x3a), - .name =3D "mx25uw51245g", - .n_banks =3D 4, - .flags =3D SPI_NOR_RWW, - }, { - .id =3D SNOR_ID(0xc2, 0x23, 0x14), - .name =3D "mx25v8035f", - .size =3D SZ_1M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - }, { - .id =3D SNOR_ID(0xc2, 0x26, 0x19), - .name =3D "mx25l25655e", - .size =3D SZ_32M, - }, { - .id =3D SNOR_ID(0xc2, 0x20, 0x1a), - .name =3D "mx66l51235f", - .size =3D SZ_64M, - .no_sfdp_flags =3D SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .fixup_flags =3D SPI_NOR_4B_OPCODES, }, { .id =3D SNOR_ID(0xc2, 0x25, 0x3a), .name =3D "mx66u51235f", @@ -167,22 +144,45 @@ 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, }, { - .id =3D SNOR_ID(0xc2, 0x20, 0x1b), - .name =3D "mx66l1g45g", - .size =3D SZ_128M, + .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, + }, { + .id =3D SNOR_ID(0xc2, 0x26, 0x18), + .name =3D "mx25l12855e", + .size =3D SZ_16M, + }, { + .id =3D SNOR_ID(0xc2, 0x26, 0x19), + .name =3D "mx25l25655e", + .size =3D SZ_32M, }, { .id =3D SNOR_ID(0xc2, 0x26, 0x1b), .name =3D "mx66l1g55g", .size =3D SZ_128M, .no_sfdp_flags =3D SPI_NOR_QUAD_READ, }, { - .id =3D SNOR_ID(0xc2, 0x25, 0x3c), - .name =3D "mx66u2g45g", - .size =3D SZ_256M, + .id =3D SNOR_ID(0xc2, 0x28, 0x15), + .name =3D "mx25r1635f", + .size =3D SZ_2M, .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(0xc2, 0x28, 0x16), + .name =3D "mx25r3235f", + .size =3D SZ_4M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0xc2, 0x81, 0x3a), + .name =3D "mx25uw51245g", + .n_banks =3D 4, + .flags =3D SPI_NOR_RWW, + }, { + .id =3D SNOR_ID(0xc2, 0x9e, 0x16), + .name =3D "mx25l3255e", + .size =3D SZ_4M, + .no_sfdp_flags =3D SECT_4K, + } }; =20 static void macronix_nor_default_init(struct spi_nor *nor) --=20 2.39.2