From nobody Sun Sep 7 12:25:51 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 B20E3C001B0 for ; Mon, 7 Aug 2023 13:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233815AbjHGNYr (ORCPT ); Mon, 7 Aug 2023 09:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234047AbjHGNYA (ORCPT ); Mon, 7 Aug 2023 09:24:00 -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 B8AC826A4 for ; Mon, 7 Aug 2023 06:23: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 989C061AE3 for ; Mon, 7 Aug 2023 13:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 539C5C433CB; Mon, 7 Aug 2023 13:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691414593; bh=/8n9R2/oWAVHgTCJaVeGwlOLzTsRsPPSO3b5ChZ4ZCs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FZylSiwJgs6mftUeStn078FokHyU8c7OBO8YMXYuwNEygKOSTHDnsD3Ju+HJfm8DI s7cikYPyUqEjYoa3NzA99UO1FfWBvG6GgG7blm+GLZraEs31CXr7DtNd2kaYA7FIPY 6h7NfYqgZwSn1foT3cVHmfgiqG0+NYmQ27ugF8fXAasQpVnG/Uzc4yi3G8Dbo5RSje rjuVuffh+614NDaejwshNjFQyO3xLzI+sHkH3kf5ArKa7oBZ4vYhQXW2BUJ2P/65+G 2C7kQgP5ysarN+kwILbrBpvtrqhmqLafB2zvEkpqRJVAc3jM2LAd9Krjk2bJgf9dSV Cb5Kr1PV3hmlQ== From: Michael Walle Date: Mon, 07 Aug 2023 15:21:32 +0200 Subject: [PATCH 38/41] mtd: spi-nor: sst: 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-38-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/sst.c | 90 +++++++++++++++++++++++--------------------= ---- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c index 8defff00c35f..0f09eaf43db9 100644 --- a/drivers/mtd/spi-nor/sst.c +++ b/drivers/mtd/spi-nor/sst.c @@ -62,38 +62,16 @@ static const struct spi_nor_fixups sst26vf_nor_fixups = =3D { =20 static const struct flash_info sst_nor_parts[] =3D { { - .id =3D SNOR_ID(0xbf, 0x25, 0x8d), - .name =3D "sst25vf040b", - .size =3D SZ_512K, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, - .no_sfdp_flags =3D SECT_4K, - .mfr_flags =3D SST_WRITE, - }, { - .id =3D SNOR_ID(0xbf, 0x25, 0x8e), - .name =3D "sst25vf080b", - .size =3D SZ_1M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, - .no_sfdp_flags =3D SECT_4K, - .mfr_flags =3D SST_WRITE, - }, { - .id =3D SNOR_ID(0xbf, 0x25, 0x41), - .name =3D "sst25vf016b", - .size =3D SZ_2M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, - .no_sfdp_flags =3D SECT_4K, - .mfr_flags =3D SST_WRITE, - }, { - .id =3D SNOR_ID(0xbf, 0x25, 0x4a), - .name =3D "sst25vf032b", - .size =3D SZ_4M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, + .id =3D SNOR_ID(0x62, 0x16, 0x12), + .name =3D "sst25wf020a", + .size =3D SZ_256K, + .flags =3D SPI_NOR_HAS_LOCK, .no_sfdp_flags =3D SECT_4K, - .mfr_flags =3D SST_WRITE, }, { - .id =3D SNOR_ID(0xbf, 0x25, 0x4b), - .name =3D "sst25vf064c", - .size =3D SZ_8M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP | SPI_NOR_SWP_IS_VOLATILE, + .id =3D SNOR_ID(0x62, 0x16, 0x13), + .name =3D "sst25wf040b", + .size =3D SZ_512K, + .flags =3D SPI_NOR_HAS_LOCK, .no_sfdp_flags =3D SECT_4K, }, { .id =3D SNOR_ID(0xbf, 0x25, 0x01), @@ -116,18 +94,6 @@ static const struct flash_info sst_nor_parts[] =3D { .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, .no_sfdp_flags =3D SECT_4K, .mfr_flags =3D SST_WRITE, - }, { - .id =3D SNOR_ID(0x62, 0x16, 0x12), - .name =3D "sst25wf020a", - .size =3D SZ_256K, - .flags =3D SPI_NOR_HAS_LOCK, - .no_sfdp_flags =3D SECT_4K, - }, { - .id =3D SNOR_ID(0x62, 0x16, 0x13), - .name =3D "sst25wf040b", - .size =3D SZ_512K, - .flags =3D SPI_NOR_HAS_LOCK, - .no_sfdp_flags =3D SECT_4K, }, { .id =3D SNOR_ID(0xbf, 0x25, 0x04), .name =3D "sst25wf040", @@ -143,10 +109,39 @@ static const struct flash_info sst_nor_parts[] =3D { .no_sfdp_flags =3D SECT_4K, .mfr_flags =3D SST_WRITE, }, { - .id =3D SNOR_ID(0xbf, 0x26, 0x51), - .name =3D "sst26wf016b", + .id =3D SNOR_ID(0xbf, 0x25, 0x41), + .name =3D "sst25vf016b", .size =3D SZ_2M, - .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, + .no_sfdp_flags =3D SECT_4K, + .mfr_flags =3D SST_WRITE, + }, { + .id =3D SNOR_ID(0xbf, 0x25, 0x4a), + .name =3D "sst25vf032b", + .size =3D SZ_4M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, + .no_sfdp_flags =3D SECT_4K, + .mfr_flags =3D SST_WRITE, + }, { + .id =3D SNOR_ID(0xbf, 0x25, 0x4b), + .name =3D "sst25vf064c", + .size =3D SZ_8M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP | SPI_NOR_SWP_IS_VOLATILE, + .no_sfdp_flags =3D SECT_4K, + }, { + .id =3D SNOR_ID(0xbf, 0x25, 0x8d), + .name =3D "sst25vf040b", + .size =3D SZ_512K, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, + .no_sfdp_flags =3D SECT_4K, + .mfr_flags =3D SST_WRITE, + }, { + .id =3D SNOR_ID(0xbf, 0x25, 0x8e), + .name =3D "sst25vf080b", + .size =3D SZ_1M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, + .no_sfdp_flags =3D SECT_4K, + .mfr_flags =3D SST_WRITE, }, { .id =3D SNOR_ID(0xbf, 0x26, 0x41), .name =3D "sst26vf016b", @@ -160,6 +155,11 @@ static const struct flash_info sst_nor_parts[] =3D { .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixups =3D &sst26vf_nor_fixups, + }, { + .id =3D SNOR_ID(0xbf, 0x26, 0x51), + .name =3D "sst26wf016b", + .size =3D SZ_2M, + .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, } }; =20 --=20 2.39.2