diff options
author | Dhruva Gole <d-gole@ti.com> | 2022-11-17 17:40:59 +0530 |
---|---|---|
committer | Anand Gadiyar <gadiyar@ti.com> | 2022-11-21 09:33:36 -0600 |
commit | 663e96dce3b4aa8e499f59d9e80adfe3aad2438b (patch) | |
tree | c9a737182104264f376e593ac60d531ad193410a /drivers | |
parent | a9df6cd890da6984504c00d466069b960366395e (diff) |
mtd: spi-nor-core: Add the ->ready() hook
Commit 24b1e2c690fb953a3a981a282e37de5a0f1a98b1 upstream.
For dual/quad die package devices from Spansion/Cypress, the device's
status needs to be checked by reading status registers in all dies, by
using Read Any Register command. To support this, a Flash specific hook
that can overwrite the legacy status check is needed.
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/spi/spi-nor-core.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 7cd42e326f..1f2f593ba0 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -724,7 +724,7 @@ static int spi_nor_fsr_ready(struct spi_nor *nor) return fsr & FSR_READY; } -static int spi_nor_ready(struct spi_nor *nor) +static int spi_nor_default_ready(struct spi_nor *nor) { int sr, fsr; @@ -737,6 +737,14 @@ static int spi_nor_ready(struct spi_nor *nor) return sr && fsr; } +static int spi_nor_ready(struct spi_nor *nor) +{ + if (nor->ready) + return nor->ready(nor); + + return spi_nor_default_ready(nor); +} + /* * Service routine to read status register until ready, or timeout occurs. * Returns non-zero if error. |