Hi Pratyush, On 2020/4/24 21:35, Pratyush Yadav wrote: > Hi Yicong, > > On 24/04/20 05:20PM, Yicong Yang wrote: >> If the flash's quad mode is enabled, it'll remain in the quad mode when >> it's removed. If we drive the flash next time in SPI/Dual mode, then >> problem occurs as the flash's quad enable bit is not cleared. >> >> Disable the quad mode in spi_nor_restore(), the flash will leave >> quad mode when remove. This will make sure the flash always enter the >> correct mode when loaded. >> >> Signed-off-by: Yicong Yang <yangyicong@xxxxxxxxxxxxx> >> --- >> drivers/mtd/spi-nor/core.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c >> index d0516e8..611c0b7 100644 >> --- a/drivers/mtd/spi-nor/core.c >> +++ b/drivers/mtd/spi-nor/core.c >> @@ -3001,6 +3001,11 @@ void spi_nor_restore(struct spi_nor *nor) >> if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES) && >> nor->flags & SNOR_F_BROKEN_RESET) >> nor->params->set_4byte_addr_mode(nor, false); >> + >> + /* disable quad mode */ >> + if (spi_nor_get_protocol_width(nor->read_proto) == 4 || >> + spi_nor_get_protocol_width(nor->write_proto) == 4) >> + nor->params->quad_enable(nor, false); > If a flash doesn't have a quad enable function, this will lead to a NULL > pointer access. Please use spi_nor_quad_enable() instead. Okay. My careless. Thanks for pointing it out. Thanks, Yicong > >> } >> EXPORT_SYMBOL_GPL(spi_nor_restore); ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/