Message ID | 1589282819-42358-3-git-send-email-yangyicong@hisilicon.com |
---|---|
State | Changes Requested |
Delegated to: | Ambarus Tudor |
Headers | show |
Series | Add support to Disable the flash quad mode | expand |
Hi Yicong, On 12/05/20 07:26PM, 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@hisilicon.com> > --- > drivers/mtd/spi-nor/core.c | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Small nitpick below. > diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c > index 72e8d8b..564de02 100644 > --- a/drivers/mtd/spi-nor/core.c > +++ b/drivers/mtd/spi-nor/core.c > @@ -3004,6 +3004,9 @@ 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 */ I don't think this comment is needed. IMO the line below makes it pretty clear that we want to disable quad mode. > + spi_nor_quad_enable(nor, false); > } > EXPORT_SYMBOL_GPL(spi_nor_restore);
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 72e8d8b..564de02 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3004,6 +3004,9 @@ 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 */ + spi_nor_quad_enable(nor, false); } EXPORT_SYMBOL_GPL(spi_nor_restore);
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@hisilicon.com> --- drivers/mtd/spi-nor/core.c | 3 +++ 1 file changed, 3 insertions(+)