From nobody Wed Dec 17 10:43:13 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 D8AFBEE49A3 for ; Tue, 22 Aug 2023 07:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233338AbjHVHMF (ORCPT ); Tue, 22 Aug 2023 03:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233389AbjHVHLm (ORCPT ); Tue, 22 Aug 2023 03:11:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3303E79 for ; Tue, 22 Aug 2023 00:11:13 -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 A586E63441 for ; Tue, 22 Aug 2023 07:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7748DC433CA; Tue, 22 Aug 2023 07:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692688246; bh=S2VGpvolKhnaojGSg3lKj4d7SDdm9iFqv4jQmZl9diQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=r3H31Kgixm/tob7MNx9kQ3x/nGVzVA2gLIIzIz8HURmeaoLo1eHjKF9Hmaq0tXhya FwSX6ve6usH4LH1GOSOd9ATD9XfetrUa3SlHUIJaw2TwPe81yeSgunrgHkraIjNNr1 0zbnP8F5eM+nLIePk/DZ4J49twZ40T9/d6LmxpLYPrH3zUaqRFIP+poZHLaQuIw32s hhyruXGNIhfRLN6NtTge4LRRM7O+Ptj0Sc5vtDAO2j8QpouAZbO9tD3dlJGMKWcTuE gn+Ft+EHiboL6xYdCc0rmGy4L8NdcYie7oQdxNf4dhLVuJe5HKJg1sERx+1N3jvPxu 5DN5S3wBJXltg== From: Michael Walle Date: Tue, 22 Aug 2023 09:09:51 +0200 Subject: [PATCH v2 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-v2-35-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/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