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 C354EC4338F for ; Fri, 30 Jul 2021 07:24:36 +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 E28236103B for ; Fri, 30 Jul 2021 07:24:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E28236103B 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 6696E83230; Fri, 30 Jul 2021 09:24:33 +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="XjfMqA9E"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA38C83230; Fri, 30 Jul 2021 09:24:31 +0200 (CEST) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 ED11783227 for ; Fri, 30 Jul 2021 09:24:27 +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 fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 16U7OPP4084530; Fri, 30 Jul 2021 02:24:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1627629865; bh=ici2KfsdgLbRJJln7xBlAlcZLCpFZvHh4Gr0vshrsxo=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=XjfMqA9ENEHB/5YOpt2z2HMOG6ue31cntHzLOsB7jzd9oCihlStWo3E74klUPeSPN 0OxbfzLdhIpluXtRSh2UW/pnVRnE6iM9IYcTk6GfkYW8LL64+M6WXIfzuC3u4f37pz geqcjqrhkE55dcNbFyj+xuDb0KbyRrMl3KH/DIgE= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 16U7OP9V072066 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 30 Jul 2021 02:24:25 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE108.ent.ti.com (10.64.6.29) 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:24:24 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE115.ent.ti.com (10.64.6.36) 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:24:24 -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 16U7OOjx120009; Fri, 30 Jul 2021 02:24:24 -0500 Date: Fri, 30 Jul 2021 12:54:23 +0530 From: Pratyush Yadav To: Bin Meng CC: Jagan Teki , Vignesh Raghavendra , Subject: Re: [PATCH 2/2] mtd: spi-nor: Mask out fast read if not requested in DT Message-ID: <20210730072421.f3essit2v3bg4fvn@ti.com> References: <20210729115827.603282-1-bmeng.cn@gmail.com> <20210729115827.603282-2-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20210729115827.603282-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 Hi Bin, On 29/07/21 07:58PM, 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 > --- > > drivers/mtd/spi/spi-nor-core.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c > index 2883d092fc..d6a0ed39c5 100644 > --- a/drivers/mtd/spi/spi-nor-core.c > +++ b/drivers/mtd/spi/spi-nor-core.c > @@ -2597,6 +2597,8 @@ static int spi_nor_init_params(struct spi_nor *nor, > const struct flash_info *info, > struct spi_nor_flash_parameter *params) > { > + struct spi_slave *spi = nor->spi; > + > /* Set legacy flash parameters as default. */ > memset(params, 0, sizeof(*params)); > > @@ -2604,18 +2606,25 @@ 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 (!ofnode_read_bool(dev_ofnode(spi->dev), "m25p,fast-read")) Do you need to check if dev_ofnode() is valid? Can spi-nor be instantiated from a non-DT platform (like platdata maybe)? I am not very familiar with DT/platdata stuff, other than the basics. > + 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], > 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); > - } The patch looks good to me other than the point above. > > if (info->flags & SPI_NOR_DUAL_READ) { > params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2; > -- > 2.25.1 > -- Regards, Pratyush Yadav Texas Instruments Inc.