aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2021-07-30 15:20:16 +0800
committerJagan Teki <jagan@amarulasolutions.com>2021-08-03 11:53:16 +0530
commit87e7219f9c6a30709ddf97b602983386f1b4cccf (patch)
tree59dee3a07f5a988e9c64e104b11e202fefcffbe7
parentcb42425aa1086f2a732dd2e0614acc0c993c869d (diff)
downloadu-boot-87e7219f9c6a30709ddf97b602983386f1b4cccf.zip
u-boot-87e7219f9c6a30709ddf97b602983386f1b4cccf.tar.gz
u-boot-87e7219f9c6a30709ddf97b602983386f1b4cccf.tar.bz2
mtd: spi-nor: Respect flash's hwcaps in spi_nor_adjust_hwcaps()
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> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
-rw-r--r--drivers/mtd/spi/spi-nor-core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 99e2f16..c8c3bdd 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -2858,10 +2858,11 @@ spi_nor_adjust_hwcaps(struct spi_nor *nor,
unsigned int cap;
/*
- * Enable all caps by default. We will mask them after checking what's
- * really supported using spi_mem_supports_op().
+ * Start by assuming the controller supports every capability.
+ * We will mask them after checking what's really supported
+ * using spi_mem_supports_op().
*/
- *hwcaps = SNOR_HWCAPS_ALL;
+ *hwcaps = SNOR_HWCAPS_ALL & params->hwcaps.mask;
/* X-X-X modes are not supported yet, mask them all. */
*hwcaps &= ~SNOR_HWCAPS_X_X_X;