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=-12.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,URIBL_BLOCKED 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 2E5EFC432BE for ; Thu, 29 Jul 2021 12:28:49 +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 9E4D460F0F for ; Thu, 29 Jul 2021 12:28:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9E4D460F0F 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 73B7E82E68; Thu, 29 Jul 2021 14:28:46 +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="Mgwh6aXO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1D94D82E7A; Thu, 29 Jul 2021 14:28:44 +0200 (CEST) Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) (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 24E8B82E1A for ; Thu, 29 Jul 2021 14:28:41 +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-yb1-xb29.google.com with SMTP id a201so9866035ybg.12 for ; Thu, 29 Jul 2021 05:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mBzDU/SERix9WAKQFDG9VBZ/zASzV7yLhTQt/7lmHhI=; b=Mgwh6aXOMSJZWobZ/Okk0+DoYGS2Z8IYvnkghDjeA/FA1yGZZPJh3kpv+nzlcCAI+E +mN5CHXjKgtYOTn4mC8Iyl9BTwIDSB1mpdQcEyGaCqDobe9KugMOOrHAAhU0NJTkksiW zHOeXiGUgXicUQr+45qyYor91lNNPe6AZqq+9K5KhaJpqjReKhF0Oh6AGtq0YHEPMvKH 2CLyUhwnKyTRyPDDas7cr+T0x+25NUqZV9kmxaL1AT02nn76HPdswWRpd+Q1Lb1iZerw XxkxzoE5GBU54afkKfXd/SDg8/0ft2TkQRClMYa1u56PgG0c4LvFMSDku6pfgEZonLCD KEeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mBzDU/SERix9WAKQFDG9VBZ/zASzV7yLhTQt/7lmHhI=; b=OckPccKmO4gq49DjFEyOr02HyKK5dF3v3nas/fu0xo3T5z9njIEDM3rMQp8DZB7qZu 08G/6MZFKc4lmUVx/W2YgwRGeKlXKt+/q3ZgrTXlVGixiflTDT+AdP+zHRAjYXyhWXqN g6oBfveuN6BFSJnovAemNBrrxsn/GYsGe950W0RDTgxt334SKZUdlF2hUbw9WkoKumaN JbAlo7CLlzL1zQstlBSVPBevBKyrqRorSBf2Zuo4+jABYRZONzq9Cps+HRb6Rm2mI79R RXcJq/Ir+lHv6VbOukuLxAQeUm2Yh5gaePFs8DP/64r0GUEEa52Y0j2/nFMZZwKLK0SX IGLQ== X-Gm-Message-State: AOAM530btGcCDouiAPue9SzRm/p219H3wc1RgE5xs3ekOFH5cj5NSh3V K8zcz29gltomvomEHY/ou/deSelzUqYk3heO+nI= X-Google-Smtp-Source: ABdhPJzTNJxsxY6kK+7bT8q56AV6shwy29EfP2xuWozV2DriixczYhaQBLbDZNNzy4Eqn9ugkXQhfnzSOVG646SGY1E= X-Received: by 2002:a5b:504:: with SMTP id o4mr6310471ybp.332.1627561720054; Thu, 29 Jul 2021 05:28:40 -0700 (PDT) MIME-Version: 1.0 References: <20210729115827.603282-1-bmeng.cn@gmail.com> <20210729120840.47a7amypamimh7yu@ti.com> In-Reply-To: <20210729120840.47a7amypamimh7yu@ti.com> From: Bin Meng Date: Thu, 29 Jul 2021 20:28:28 +0800 Message-ID: Subject: Re: [PATCH 1/2] mtd: spi-nor: Respect flash's hwcaps in spi_nor_adjust_hwcaps() To: Pratyush Yadav Cc: Jagan Teki , Vignesh Raghavendra , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" 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 Pratyush, On Thu, Jul 29, 2021 at 8:08 PM Pratyush Yadav wrote: > > 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 for the review! Will update comments in v2. Regards, Bin