Message ID | ef57dc6cc0b8b4dbd39cf1bdd2fd64203f08d15b.1650519576.git.Takahiro.Kuwano@infineon.com |
---|---|
State | Changes Requested |
Delegated to: | Pratyush Yadav |
Headers | show |
Series | mtd: spi-nor: Add support for Infineon s25hl-t/s25hs-t | expand |
On 4/21/22 09:40, tkuw584924@gmail.com wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Hi, Takahiro! > > The part specific quad_enable method for s25hl-t and s25hs-t relies on > address mode. Flash's address mode needs to be set before > spi_nor_quad_enable() call. Maybe I haven't understood something, but I thought you were going to use 3-byte addr for enabling quad mode. Can't you enable quad with 3-byte addr? If not, why? Cheers, ta > > Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> > --- > drivers/mtd/spi-nor/core.c | 30 +++++++++++++++--------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c > index 87603a99938f..748b77eb7841 100644 > --- a/drivers/mtd/spi-nor/core.c > +++ b/drivers/mtd/spi-nor/core.c > @@ -2665,6 +2665,21 @@ static int spi_nor_init(struct spi_nor *nor) > return err; > } > > + if (nor->addr_width == 4 && > + nor->read_proto != SNOR_PROTO_8_8_8_DTR && > + !(nor->flags & SNOR_F_4B_OPCODES)) { > + /* > + * If the RESET# pin isn't hooked up properly, or the system > + * otherwise doesn't perform a reset command in the boot > + * sequence, it's impossible to 100% protect against unexpected > + * reboots (e.g., crashes). Warn the user (or hopefully, system > + * designer) that this is bad. > + */ > + WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, > + "enabling reset hack; may not recover from unexpected reboots\n"); > + nor->params->set_4byte_addr_mode(nor, true); > + } > + > err = spi_nor_quad_enable(nor); > if (err) { > dev_dbg(nor->dev, "quad mode not supported\n"); > @@ -2686,21 +2701,6 @@ static int spi_nor_init(struct spi_nor *nor) > nor->flags & SNOR_F_SWP_IS_VOLATILE)) > spi_nor_try_unlock_all(nor); > > - if (nor->addr_width == 4 && > - nor->read_proto != SNOR_PROTO_8_8_8_DTR && > - !(nor->flags & SNOR_F_4B_OPCODES)) { > - /* > - * If the RESET# pin isn't hooked up properly, or the system > - * otherwise doesn't perform a reset command in the boot > - * sequence, it's impossible to 100% protect against unexpected > - * reboots (e.g., crashes). Warn the user (or hopefully, system > - * designer) that this is bad. > - */ > - WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, > - "enabling reset hack; may not recover from unexpected reboots\n"); > - nor->params->set_4byte_addr_mode(nor, true); > - } > - > return 0; > } > > -- > 2.25.1 >
On 4/21/2022 4:32 PM, Tudor.Ambarus@microchip.com wrote: > On 4/21/22 09:40, tkuw584924@gmail.com wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe >> >> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> > > Hi, Takahiro! >> >> The part specific quad_enable method for s25hl-t and s25hs-t relies on >> address mode. Flash's address mode needs to be set before >> spi_nor_quad_enable() call. > > Maybe I haven't understood something, but I thought you were going to use > 3-byte addr for enabling quad mode. Can't you enable quad with 3-byte addr? > If not, why? > You are correct. I can use value of 3 directly instead of nor->addr_width in quad enable method. Thanks, Takahiro
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 87603a99938f..748b77eb7841 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2665,6 +2665,21 @@ static int spi_nor_init(struct spi_nor *nor) return err; } + if (nor->addr_width == 4 && + nor->read_proto != SNOR_PROTO_8_8_8_DTR && + !(nor->flags & SNOR_F_4B_OPCODES)) { + /* + * If the RESET# pin isn't hooked up properly, or the system + * otherwise doesn't perform a reset command in the boot + * sequence, it's impossible to 100% protect against unexpected + * reboots (e.g., crashes). Warn the user (or hopefully, system + * designer) that this is bad. + */ + WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, + "enabling reset hack; may not recover from unexpected reboots\n"); + nor->params->set_4byte_addr_mode(nor, true); + } + err = spi_nor_quad_enable(nor); if (err) { dev_dbg(nor->dev, "quad mode not supported\n"); @@ -2686,21 +2701,6 @@ static int spi_nor_init(struct spi_nor *nor) nor->flags & SNOR_F_SWP_IS_VOLATILE)) spi_nor_try_unlock_all(nor); - if (nor->addr_width == 4 && - nor->read_proto != SNOR_PROTO_8_8_8_DTR && - !(nor->flags & SNOR_F_4B_OPCODES)) { - /* - * If the RESET# pin isn't hooked up properly, or the system - * otherwise doesn't perform a reset command in the boot - * sequence, it's impossible to 100% protect against unexpected - * reboots (e.g., crashes). Warn the user (or hopefully, system - * designer) that this is bad. - */ - WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, - "enabling reset hack; may not recover from unexpected reboots\n"); - nor->params->set_4byte_addr_mode(nor, true); - } - return 0; }