[RFC 02/10] mtd: spi-nor: Use the highest supported READ protocol
Cyrille Pitchen
cyrille.pitchen at wedev4u.fr
Wed Dec 6 01:53:45 PST 2017
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.
Is the implementation of fls() correct on your platform ?
Best regards,
Cyrille
> const struct spi_nor_read_command *read;
>
> if (best_match < 0)
>
More information about the linux-mtd
mailing list