Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp671439lqt; Fri, 19 Apr 2024 07:15:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqxJj7IF1LUOwPPAo6pY8OPxtRjKf08x8b8koqD3dbN08LgYQQ0hK8CTtHIuZuvBARlq/nRxnhLKbu1/pud6Ip3XH4NPK8Qli/EuEYMw== X-Google-Smtp-Source: AGHT+IEZE5nWIzA1WSe/9JCkRSP/2OMiozRHkvaVzb/MJvRGODBe7CNyBw+y7+fyBYP1owOLmZpz X-Received: by 2002:ae9:ec09:0:b0:78d:5e66:e256 with SMTP id h9-20020ae9ec09000000b0078d5e66e256mr2483814qkg.18.1713536104851; Fri, 19 Apr 2024 07:15:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713536104; cv=pass; d=google.com; s=arc-20160816; b=qLf9qdLpegmqhhyTpUtygJPAZk1J7RBJ93DJYygdcA2g1qO+O1Z/nNpq//pxB/yFg5 lgJOQaijzxQvme/L+qeAefaHRGalkA5HQkN0Bpzw6DdWZJC1fHrG7bIq4zMgqZ4+DVCN 2QHo5Xpcanpf+cNWCJQgJFWyGK+BDO58ay9Kok6rMOic3jomDdMbZfhmPhA9QkqcbBDP XDPH92Vi/ru5MeD0gclKrjtdpQcHSvcMZy3DFETKd55RWmTJ9NH6OR+3DocYyObuljF7 QTNaoomw+kEtjQTaejddExjok+mxr7B8wjS81Kf/+C2h0VohjEy8ZGYasqvj+COm6HMk 6reA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DtsmF0fVVh1488LTO/YQlVS8yTLe26E59GukcV5R2Kg=; fh=hiyeRkAIXP8QwHYs1AmdSY1rKZOn+IclXHUsKmVu2mQ=; b=xm40VjPJ8BSU7UtCyZeNJC7qVAKPAGFnWWX8rOhVf3IT1vNQ0VLqZ/xYtfmuSGwBKW jf4zOeAuU/D2LBshNSQy4s0O/Yu+wkYQxazU/iZ6hngtXr2HVO4kojsO/2QifTGcaGFL /sBL2n6H3TulS36UpuXnujp0q8uJLOufvkqrnAwpjT6GN+ULHnkGh4TCgWoOo3qKgkMF 7EBz6jSBu0TGWSn79qoUU/sIY4aRUvnLuhnTB5Ju1eNUXWsCvqPoTJFFXmNsuWSY6B3j zk3zPiAKgYoxmUKdDZGlxYKxDPku+EP2urTyT9u3mZu9Z1mLh0Iu5KTkLMmWN9+wLNhw pFsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=deB2QTFG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-151563-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m19-20020a05620a24d300b0078d63d57329si4336244qkn.332.2024.04.19.07.15.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 07:15:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151563-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=deB2QTFG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-151563-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9379B1C20C33 for ; Fri, 19 Apr 2024 14:15:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DA6812D1F9; Fri, 19 Apr 2024 14:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="deB2QTFG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8621012F59A for ; Fri, 19 Apr 2024 14:14:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713536056; cv=none; b=SkCW4Lwq7wBKucYvG+CKIOvnTtiZ03m78Cz9udbHacX8L51Pp9X6pKZDGsJJmS4LfELAaeJT3/z1r6mOXf51+SqB5JzEZt99f2u2lfQjs+OLWFzXGFLyfPNTROBPnv2BmQ8N/3SvK5okdKjZLzw91Z9eaxAcbUV0+AEVk0GoXvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713536056; c=relaxed/simple; bh=ZiwsAW01Vo0W/LIsWonJMl/TomhMGShCbtNy1DqFzs4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YhN5zUlR93oZmGv1bwGIU1ZJSP8/2erdF0wzoPXANPo2rXYnuHZqbRZyia4ZSNcKtkiKEDPmrOMsl4pjqP1V+D1RnwkgeUjg9DZ76ytETMcAGUqoc+EbXxAd86yULazJ9mSsXWETfjZza3LhdrkS5W2Um6CjaDoIadpldnzOILw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=deB2QTFG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 306E4C072AA; Fri, 19 Apr 2024 14:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713536056; bh=ZiwsAW01Vo0W/LIsWonJMl/TomhMGShCbtNy1DqFzs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=deB2QTFGDKjdUBu0Q5WELIIiO5HhzOLZ7gcHlleifYuS24mXPFrzTu6lN28JmfA6P TUw+RBKKNKoZXDLgx1b3cO3niv8S5w5oRwdiYxnVutR1KsBiwB++p5lrAjCBoBVv5J f2NedEPAOjVHxT3sj6Mz4ZXq/e607XsamxO/tOyCfvXcdPdp865QfErNOOiK9FMJhs l62w8gCcMeGFWu5/ppd7DvoLdJ8Ad770WMuSibO58MrpVOQkKtc3Yb9xB4P3x0MrgF WysT3sAN6Mw77z8sBKpZg10JcwOwOHjJSgzVpZ4dOdvaJaej7zgSficI9SDPzeMtuP +CQrT5SiL+KyA== From: Michael Walle To: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Ricardo Ribalda , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Michael Walle Subject: [PATCH v2 4/6] mtd: spi-nor: get rid of SPI_NOR_NO_FR Date: Fri, 19 Apr 2024 16:12:47 +0200 Message-Id: <20240419141249.609534-5-mwalle@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240419141249.609534-1-mwalle@kernel.org> References: <20240419141249.609534-1-mwalle@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The evervision FRAM devices are the only user of the NO_FR flag. Drop the global flag and instead use a manufacturer fixup for the evervision flashes to drop the fast read support. Signed-off-by: Michael Walle --- Please note, that the fast read opcode will still be set in spi_nor_init_default_params(), but the selection of the read opcodes just depends on the mask. That is also something I want to fix soon: the opcodes can always be set and the drivers/SFDP will only set the mask. Opcodes then can be switched between 3b and 4b ones if necessary. --- drivers/mtd/spi-nor/core.c | 9 ++------- drivers/mtd/spi-nor/core.h | 2 -- drivers/mtd/spi-nor/everspin.c | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index f4c0b5185818..4e2ae6642d4c 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2923,15 +2923,10 @@ static void spi_nor_init_default_params(struct spi_nor *nor) params->page_size = info->page_size ?: SPI_NOR_DEFAULT_PAGE_SIZE; params->n_banks = info->n_banks ?: SPI_NOR_DEFAULT_N_BANKS; - if (!(info->flags & SPI_NOR_NO_FR)) { - /* Default to Fast Read for DT and non-DT platform devices. */ + /* Default to Fast Read for non-DT and enable it if requested by DT. */ + if (!np || of_property_read_bool(np, "m25p,fast-read")) params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; - /* Mask out Fast Read if not requested at DT instantiation. */ - if (np && !of_property_read_bool(np, "m25p,fast-read")) - params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; - } - /* (Fast) Read settings. */ params->hwcaps.mask |= SNOR_HWCAPS_READ; spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ], diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 497957b64906..1516b6d0dc37 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -470,7 +470,6 @@ struct spi_nor_id { * Usually these will power-up in a write-protected * state. * SPI_NOR_NO_ERASE: no erase command needed. - * SPI_NOR_NO_FR: can't do fastread. * SPI_NOR_QUAD_PP: flash supports Quad Input Page Program. * SPI_NOR_RWW: flash supports reads while write. * @@ -519,7 +518,6 @@ struct flash_info { #define SPI_NOR_BP3_SR_BIT6 BIT(4) #define SPI_NOR_SWP_IS_VOLATILE BIT(5) #define SPI_NOR_NO_ERASE BIT(6) -#define SPI_NOR_NO_FR BIT(7) #define SPI_NOR_QUAD_PP BIT(8) #define SPI_NOR_RWW BIT(9) diff --git a/drivers/mtd/spi-nor/everspin.c b/drivers/mtd/spi-nor/everspin.c index 5f321e24ae7d..0720a61947e7 100644 --- a/drivers/mtd/spi-nor/everspin.c +++ b/drivers/mtd/spi-nor/everspin.c @@ -14,28 +14,39 @@ static const struct flash_info everspin_nor_parts[] = { .size = SZ_16K, .sector_size = SZ_16K, .addr_nbytes = 2, - .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, + .flags = SPI_NOR_NO_ERASE, }, { .name = "mr25h256", .size = SZ_32K, .sector_size = SZ_32K, .addr_nbytes = 2, - .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, + .flags = SPI_NOR_NO_ERASE, }, { .name = "mr25h10", .size = SZ_128K, .sector_size = SZ_128K, - .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, + .flags = SPI_NOR_NO_ERASE, }, { .name = "mr25h40", .size = SZ_512K, .sector_size = SZ_512K, - .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, + .flags = SPI_NOR_NO_ERASE, } }; +static void evervision_nor_default_init(struct spi_nor *nor) +{ + /* Everspin FRAMs don't support the fast read opcode. */ + nor->params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; +} + +static const struct spi_nor_fixups evervision_nor_fixups = { + .default_init = evervision_nor_default_init, +}; + const struct spi_nor_manufacturer spi_nor_everspin = { .name = "everspin", .parts = everspin_nor_parts, .nparts = ARRAY_SIZE(everspin_nor_parts), + .fixups = &evervision_nor_fixups, }; -- 2.39.2