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=-18.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 F0660C4338F for ; Fri, 30 Jul 2021 07:32:08 +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 1F91860295 for ; Fri, 30 Jul 2021 07:32:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1F91860295 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.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 A07FF83219; Fri, 30 Jul 2021 09:32:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="h/qLkjxC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 00F0D83223; Fri, 30 Jul 2021 09:32:03 +0200 (CEST) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 58CDC83211 for ; Fri, 30 Jul 2021 09:31:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=p.yadav@ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 16U7VuZd125441; Fri, 30 Jul 2021 02:31:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1627630316; bh=Cidaa8jSZyafesq++jqVwLLJE2lWNTAhLplbZNRgdWQ=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=h/qLkjxC8F+goQxTQSDvqnnyF2hHbKRKCVC/ULbD4aLA6GxdiuJgxXlpr/yCFveo7 wplFuCLh9cSKqPFmrnwcRxg7HG+wBlDELQTiplOFrf/TfHXzhKuCz8pD7HdrPAw7hd 8ewBQSrxqlIk0yVIf9/734UXJyqFBKRbL/RNDUdY= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 16U7Vuvg081029 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 30 Jul 2021 02:31:56 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 30 Jul 2021 02:31:56 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Fri, 30 Jul 2021 02:31:56 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 16U7Vtb8001501; Fri, 30 Jul 2021 02:31:56 -0500 Date: Fri, 30 Jul 2021 13:01:55 +0530 From: Pratyush Yadav To: Bin Meng CC: Jagan Teki , Vignesh Raghavendra , Subject: Re: [PATCH v2 2/2] mtd: spi-nor: Mask out fast read if not requested in DT Message-ID: <20210730073152.4q67jzeq2pw53ar2@ti.com> References: <20210730072017.660331-1-bmeng.cn@gmail.com> <20210730072017.660331-2-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20210730072017.660331-2-bmeng.cn@gmail.com> User-Agent: NeoMutt/20171215 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 On 30/07/21 03:20PM, Bin Meng wrote: > 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) Hehe, I just commented about this on your v1, and I see the v2 in my inbox already ;-) So this will make sure that dev_ofnode() will be valid, right? > > 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), Let's avoid the #if here and do if (CONFIG_IS_ENABLED(DM_SPI) && !ofnode_read_bool()) > + "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; -- Regards, Pratyush Yadav Texas Instruments Inc.