Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp155966lql; Fri, 12 Apr 2024 06:44:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWY0Tb8wJZK8hFomoRdACaoCvEPOqARpRn8J0jX0nJZnh+uabODW8e0e3xA6WuoveioEAd/O8IPghVG0LhB4qc7cnBwN81+YJ6t7B+f3Q== X-Google-Smtp-Source: AGHT+IFdrXhXU0uxB06uDi1fc95H5jN36/ES6c6MP3IwMdtUsDM7Ua8MhpheamxabRRtpTt9NLJk X-Received: by 2002:a05:6102:41ac:b0:47a:4105:9371 with SMTP id cd44-20020a05610241ac00b0047a41059371mr3498824vsb.25.1712929492272; Fri, 12 Apr 2024 06:44:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712929492; cv=pass; d=google.com; s=arc-20160816; b=zIW8ThMqor/fHL97lAgRIy6vZtxtzJmGXdmGOzotdEKTZSz5d4C+ijqfaU5zmXM5xN lhFW7wWVdMgSootXh8u0CTtgEhXGZrZZhT9E8MX1CWzoZq0LdNg3X9c6BlWm1xcILpLf oevizrnkZtO31KykdM2+4EsnRwNVpoCSxrqwXwnHH2hnPB9tqBLDskPoElNAaMd0Yj2b DcORcelNSRSPKRgqF7iv3ynPSiFKTcOpTbznc58Ogt+YRJOWO2Px3rdJfkIxY9dQf+Wz 7E6jsELdJaG4xmYoqE2XCIzrlIQ8ZTIPppZdoSdQhw8jG+MI2T1KnhCZjmJHF2S/njV3 plKA== 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=pXpB+x0vl1zDkNKItB29NizLNe+FEvXFEz9p2pGU1Rw=; fh=LuNSX3JVG+htsysoJ/xF51pAKitwHo02H/zRZAOLqDw=; b=01wPFSOc4Q0St+0vDee8RxgISAE3SKXWqPJnOvXnOHxq5Wjq31oh4eqjtbDbXOP9kr ZtPh1hJN/bhoxYgj6Ay0CrAvcB4aEscDCHFG+teOn4ye/9cM7P05T7nCBI1j9/qzaUiB +bhYve2kBHANJdmzL3XMnywC+YGyQ0QOp14oukZfyGDSojtkUjZawrUQLnl+CVEGA3xa YwOIJb7xQ714lG0P2r2SvQUsBUWJdSTU3SVythlgztgP3oZEbvp7+qIxNaxZS/T0ZEzW aDGnlAuNpZUfZjDeMnVqGFOvP/3YJN2uc7/Y1P4GlKmpsIRlyI90gAluGY3oeZvN8cjR OyBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y5bW4N7Y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142751-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 i15-20020ad4410f000000b0069b4502ea0asi3583645qvp.20.2024.04.12.06.44.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 06:44:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142751-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=Y5bW4N7Y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142751-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 049411C23C03 for ; Fri, 12 Apr 2024 13:44:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D080584A48; Fri, 12 Apr 2024 13:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y5bW4N7Y" 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 030F684E1C for ; Fri, 12 Apr 2024 13:44:20 +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=1712929461; cv=none; b=CzWEZk5f1tOv7hQ8q65wC6Nnz3ZL4kGxhlVK5bHzRUv1gVYtNX5ZjlGOC7wwcED9N0nHxYZy0ULFkaebtw5FRRsSqYhSu1j1u6vTwKDDhU60pbcc1e2AjhtezQH0WkE0aZeAXTjlIG1wdyye9qgUWBV9ynwVOpnjR2aP4g4YXT8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712929461; c=relaxed/simple; bh=AWw8QbtlrB4/ifJTs50t8o18KiRdvOyj1VqAGw4riZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rPp331ox/HpH2u3vuAHNC9BC24zbdGAcn5FHSpBNwOR4nGvcTftMoID0UBXiHQLSe+1eg7BnYe2XkdFktY4nos3zcgxhR3BZDaEYsQA2qIzByVKDtKVtFM0ZsLboLSciIfrvmZJ/PvaMqCTHWA5p8q/GNFiNZM757sCtSsRi2Yc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y5bW4N7Y; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2D29C113CC; Fri, 12 Apr 2024 13:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712929460; bh=AWw8QbtlrB4/ifJTs50t8o18KiRdvOyj1VqAGw4riZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5bW4N7YtsBTPZQWSl+W7pqUwakqlNtumlkAg3tNKkn33l87kakt6DdsnqGeyuBDA IrHE+Csk5ZZ2gM8lNWKZQzuL6LB/ttsAtxdBLEdBF2Mt7rHGHuEWyjwivTspBisfFh XEUXOq0vPnOTHYrK+WKNRKCPtGPWFJ4W7wlEZxK3xSNsCPKUOLRdAPoHNBkXivy/tw X7Cy1uEJsQSHgpFNM2OSjXW2BTJaQZ8mmnBf8fSQtME0rY4eBJq56ImlqUaRaoApWD xCqwVXBclDHmA9aMU94FzT6n61R1GBQT4x1uCBKl8iLOiT1qFM2W+VnEYsdldxxyyu t/lzEfqalFtwQ== From: Michael Walle To: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Michael Walle Subject: [PATCH v1 3/6] mtd: spi-nor: get rid of SPI_NOR_NO_FR Date: Fri, 12 Apr 2024 15:44:02 +0200 Message-Id: <20240412134405.381832-4-mwalle@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412134405.381832-1-mwalle@kernel.org> References: <20240412134405.381832-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 | 12 +++++------- drivers/mtd/spi-nor/core.h | 2 -- drivers/mtd/spi-nor/everspin.c | 19 +++++++++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index fb76e0522665..65e6531ada0a 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2952,14 +2952,12 @@ 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. */ - params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; + /* Default to Fast Read for DT and non-DT platform devices. */ + 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; - } + /* 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; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 072c69b0d06c..9aa7d6399c8a 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -479,7 +479,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. * @@ -528,7 +527,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