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

Prabhakar Kushwaha prabhakar.kushwaha at nxp.com
Wed Dec 6 00:15:33 PST 2017


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;
 	const struct spi_nor_read_command *read;
 
 	if (best_match < 0)
-- 
2.7.4




More information about the linux-mtd mailing list