All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <p.yadav@ti.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Vignesh Raghavendra <vigneshr@ti.com>, <u-boot@lists.denx.de>
Subject: Re: [PATCH 1/2] mtd: spi-nor: Respect flash's hwcaps in spi_nor_adjust_hwcaps()
Date: Thu, 29 Jul 2021 17:38:42 +0530	[thread overview]
Message-ID: <20210729120840.47a7amypamimh7yu@ti.com> (raw)
In-Reply-To: <20210729115827.603282-1-bmeng.cn@gmail.com>

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 <bmeng.cn@gmail.com>
> ---
> 
>  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 <p.yadav@ti.com>

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.

  parent reply	other threads:[~2021-07-29 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 11:58 [PATCH 1/2] mtd: spi-nor: Respect flash's hwcaps in spi_nor_adjust_hwcaps() Bin Meng
2021-07-29 11:58 ` [PATCH 2/2] mtd: spi-nor: Mask out fast read if not requested in DT Bin Meng
2021-07-30  7:24   ` Pratyush Yadav
2021-07-29 12:08 ` Pratyush Yadav [this message]
2021-07-29 12:28   ` [PATCH 1/2] mtd: spi-nor: Respect flash's hwcaps in spi_nor_adjust_hwcaps() Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210729120840.47a7amypamimh7yu@ti.com \
    --to=p.yadav@ti.com \
    --cc=bmeng.cn@gmail.com \
    --cc=jagan@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.