mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-02 09:03:27 +08:00
mtd: spi-nor-core: Add the ->ready() hook
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> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
This commit is contained in:
parent
a4aa9b7522
commit
24b1e2c690
@ -713,7 +713,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;
|
||||
|
||||
@ -726,6 +726,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.
|
||||
|
@ -504,6 +504,7 @@ struct spi_flash {
|
||||
* completely locked
|
||||
* @quad_enable: [FLASH-SPECIFIC] enables SPI NOR quad mode
|
||||
* @octal_dtr_enable: [FLASH-SPECIFIC] enables SPI NOR octal DTR mode.
|
||||
* @ready: [FLASH-SPECIFIC] check if the flash is ready
|
||||
* @priv: the private data
|
||||
*/
|
||||
struct spi_nor {
|
||||
@ -552,6 +553,7 @@ struct spi_nor {
|
||||
int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
|
||||
int (*quad_enable)(struct spi_nor *nor);
|
||||
int (*octal_dtr_enable)(struct spi_nor *nor);
|
||||
int (*ready)(struct spi_nor *nor);
|
||||
|
||||
void *priv;
|
||||
/* Compatibility for spi_flash, remove once sf layer is merged with mtd */
|
||||
|
Loading…
Reference in New Issue
Block a user