[RFC 02/10] mtd: spi-nor: Use the highest supported READ protocol

Prabhakar Kushwaha prabhakar.kushwaha at nxp.com
Thu Dec 7 00:29:45 PST 2017



Regards,
Prabhakar

> -----Original Message-----
> From: Cyrille Pitchen [mailto:cyrille.pitchen at wedev4u.fr]
> Sent: Wednesday, December 06, 2017 3:24 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>; linux-
> mtd at lists.infradead.org
> Cc: boris.brezillon at free-electrons.com; computersforpeace at gmail.com;
> dedekind1 at gmail.com
> Subject: Re: [RFC 02/10] mtd: spi-nor: Use the highest supported READ protocol
> 
> Hi Prabhakar,
> 
> Le 06/12/2017 à 09:15, Prabhakar Kushwaha a écrit :
> > HWCAP read capabilities defines higher bit position as the higher
> > priority. i.e. use Octo SPI protocols first, then Quad SPI protocols
> > before Dual SPI protocols, Fast Read and lastly (Slow) Read.
> >
> > Currently implementation chose the last set bit i.e. slowest read.
> > This patch select the highest available read capability.
> >
> > Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>
> > ---
> >  drivers/mtd/spi-nor/spi-nor.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> > index 7d3b52f..01898e1 100644
> > --- a/drivers/mtd/spi-nor/spi-nor.c
> > +++ b/drivers/mtd/spi-nor/spi-nor.c
> > @@ -2521,7 +2521,7 @@ static int spi_nor_select_read(struct spi_nor *nor,
> >  			       const struct spi_nor_flash_parameter *params,
> >  			       u32 shared_hwcaps)
> >  {
> > -	int cmd, best_match = fls(shared_hwcaps &
> SNOR_HWCAPS_READ_MASK) - 1;
> > +	int cmd, best_match = ffs(shared_hwcaps &
> SNOR_HWCAPS_READ_MASK) - 1;
> 
> I'm pretty sure this patch is wrong and fls() - find last
> (most-significant) bit set - is actually what we want to select the best match.
> 

I misunderstood below line.   Thanks for correcting me. 

/*
 * fls() returns zero if the input is zero, otherwise returns the bit
 * position of the last set bit, where the LSB is 1 and MSB is 32.
 */

--pk




More information about the linux-mtd mailing list