From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83D0C4338F for ; Fri, 30 Jul 2021 07:20:48 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3809460560 for ; Fri, 30 Jul 2021 07:20:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3809460560 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5EB4583224; Fri, 30 Jul 2021 09:20:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="swk6FWpT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA10183224; Fri, 30 Jul 2021 09:20:34 +0200 (CEST) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EA1FE8314F for ; Fri, 30 Jul 2021 09:20:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-ej1-x62f.google.com with SMTP id gs8so15015528ejc.13 for ; Fri, 30 Jul 2021 00:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fu12ofBCtjxltS4Pck+RceYug2q+LppZr5niWQOTKEI=; b=swk6FWpTwZfgP57fUAm+/D4gsZY+2rQOVZyGRtLurCNDoVeilUVuldk3hEcuVmGsfA AosLVXaATHQz4SZLUfyDSCLLVHP6TkFogvVoOaAjv1sFxds++88PuRZjRGbldw41JDM0 RmYmqQlgQHnTHwPFxB0ry/ZW82Se7aVOZvyfzcjDj/y6p3tn+5kAPrUmQVSKChswc1Cu dSBO1mdf60qjBF3d9rXcWofYMZ+bKYsoml/QDFgD8yENIuGJnDazpIoX2u+WqYYDdmB+ 2V1WcuGgthxPAZlcjqZP92F2pdH/780V3tXbRQXrh6M6pNbF/eIH92eTG4rTdHrOEx7/ 14sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fu12ofBCtjxltS4Pck+RceYug2q+LppZr5niWQOTKEI=; b=F+SvEH9hDrTUsdxZTpnBZC1M22Gb3k4tbrt+Bf2apySF6vz4YrOvjOQidBiapnzGF2 ORbhEOEnewJGmrBsiZjPDGc0JCe1b5LYmg5ahGUf9h2/nt+wOepfrdjWW18kTEKtSYFi CNU9Lv4XaIpIk/OtV46w8A6q81MIL3rC3LjF5oUK3RBM9Sk9iL5Om74GR8OGv/e2o8Ig p4O358t2G3TUSX7WVIo4zeNVj1SWGAzS4+IvzjkvfP8jwlhJ1wEA7xtVlfp7gsiNaltW jcMv6kLuC/JvMQrVsQCVeXdHtb1XyB+IUwTXf4SQtVdT/IhrRQWVJZYiZxxodl4VDPPx 9/qw== X-Gm-Message-State: AOAM530R9D84B//mFVgFFs7FkJL5HOzpyiZqLFj2sfRXWbSbSpE2EFb3 5CY4E8XCGkPgPbimaraLxNY= X-Google-Smtp-Source: ABdhPJyRnmvn/GomuxHz/GUB3yDdRxnUH0q9G3M3JVBBObmC0ISQQie2+dZzN9plmVNV5DQ1zcBuPg== X-Received: by 2002:a17:906:2c45:: with SMTP id f5mr1235130ejh.464.1627629631619; Fri, 30 Jul 2021 00:20:31 -0700 (PDT) Received: from pek-vx-bsp2.wrs.com (ec2-44-242-66-180.us-west-2.compute.amazonaws.com. [44.242.66.180]) by smtp.gmail.com with ESMTPSA id og35sm266250ejc.28.2021.07.30.00.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 00:20:31 -0700 (PDT) From: Bin Meng To: Jagan Teki , Vignesh Raghavendra , Pratyush Yadav , u-boot@lists.denx.de Subject: [PATCH v2 2/2] mtd: spi-nor: Mask out fast read if not requested in DT Date: Fri, 30 Jul 2021 15:20:17 +0800 Message-Id: <20210730072017.660331-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210730072017.660331-1-bmeng.cn@gmail.com> References: <20210730072017.660331-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean The DT bindings of "jedec,spi-nor" [1] defines "m25p,fast-read" property to indicate that "fast read" opcode can be used to read data from the chip instead of the usual "read" opcode. If this property is not present in DT, mask out fast read in spi_nor_init_params(). This change mirrors the same logic in spi_nor_info_init_params() in drivers/mtd/spi-nor/core.c in the Linux kernel v5.14-rc3. [1] Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml in the kernel tree Signed-off-by: Bin Meng --- Changes in v2: - Guard changes with CONFIG_IS_ENABLED(DM_SPI) drivers/mtd/spi/spi-nor-core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index c8c3bdd890..d5d905fa5a 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -2604,18 +2604,28 @@ static int spi_nor_init_params(struct spi_nor *nor, params->size = info->sector_size * info->n_sectors; params->page_size = info->page_size; + 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; + + /* Mask out Fast Read if not requested at DT instantiation. */ +#if CONFIG_IS_ENABLED(DM_SPI) + if (!ofnode_read_bool(dev_ofnode(nor->spi->dev), + "m25p,fast-read")) + params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; +#endif + } + /* (Fast) Read settings. */ params->hwcaps.mask |= SNOR_HWCAPS_READ; spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ], 0, 0, SPINOR_OP_READ, SNOR_PROTO_1_1_1); - if (!(info->flags & SPI_NOR_NO_FR)) { - params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; + if (params->hwcaps.mask & SNOR_HWCAPS_READ_FAST) spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_FAST], 0, 8, SPINOR_OP_READ_FAST, SNOR_PROTO_1_1_1); - } if (info->flags & SPI_NOR_DUAL_READ) { params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2; -- 2.25.1