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, URIBL_BLOCKED,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 A6C4DC4338F for ; Thu, 29 Jul 2021 12:08:56 +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 DF6EF60C40 for ; Thu, 29 Jul 2021 12:08:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DF6EF60C40 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 64C8482F26; Thu, 29 Jul 2021 14:08:53 +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="jEXa/CSA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3471582F2D; Thu, 29 Jul 2021 14:08:51 +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 D7AF482F1A for ; Thu, 29 Jul 2021 14:08:46 +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 lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 16TC8iaP037326; Thu, 29 Jul 2021 07:08:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1627560524; bh=fksZujNTauVhw/XBCq9JmuOZjCYV9YISIJC5fFievyI=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=jEXa/CSAZF3kcgu+hW6zZZftfFvKocJ19aKrYMMAULnwGXyRJfR8ljIL6dQpdmDQp Zu/LBb7fhLUQh+i6Jn+BwPd93myGI+vTxQf8FA4VE0KEUIXhlukWcctjDQ0VLEoU03 GtdDoEIo2w1FVLiyb/OyXOmUhqOrZPThO2X1eOCo= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 16TC8iE7060640 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 29 Jul 2021 07:08:44 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 29 Jul 2021 07:08:43 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) 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; Thu, 29 Jul 2021 07:08:43 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 16TC8hmj101857; Thu, 29 Jul 2021 07:08:43 -0500 Date: Thu, 29 Jul 2021 17:38:42 +0530 From: Pratyush Yadav To: Bin Meng CC: Jagan Teki , Vignesh Raghavendra , Subject: Re: [PATCH 1/2] mtd: spi-nor: Respect flash's hwcaps in spi_nor_adjust_hwcaps() Message-ID: <20210729120840.47a7amypamimh7yu@ti.com> References: <20210729115827.603282-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20210729115827.603282-1-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 smart spi_nor_adjust_hwcaps() does not respect the SPI flash's > hwcaps, and only looks to the controller on what can be supported. > > The flash's hwcaps needs to be AND'ed before checking. > > Fixes: 71025f013ccb ("mtd: spi-nor-core: Rework hwcaps selection") > Signed-off-by: Bin Meng > --- > > drivers/mtd/spi/spi-nor-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c > index 99e2f16349..2883d092fc 100644 > --- a/drivers/mtd/spi/spi-nor-core.c > +++ b/drivers/mtd/spi/spi-nor-core.c > @@ -2861,7 +2861,7 @@ spi_nor_adjust_hwcaps(struct spi_nor *nor, > * Enable all caps by default. We will mask them after checking what's > * really supported using spi_mem_supports_op(). > */ Please update the comment above. Maybe: Start by assuming the controller supports every cap. We will mask them... > - *hwcaps = SNOR_HWCAPS_ALL; > + *hwcaps = SNOR_HWCAPS_ALL & params->hwcaps.mask; This is practically equivalent to *hwcaps = params->hwcaps.mask but I think having SNOR_HWCAPS_ALL here to signify that we are assuming controller supports everything is not a bad idea IMO. With the above comment updated, Reviewed-by: Pratyush Yadav Thanks. > > /* X-X-X modes are not supported yet, mask them all. */ > *hwcaps &= ~SNOR_HWCAPS_X_X_X; > -- > 2.25.1 > -- Regards, Pratyush Yadav Texas Instruments Inc.