Message ID | 20211018062428.4201-4-jaimeliao.tw@gmail.com |
---|---|
State | Superseded |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Series | Add octal DTR support for Macronix flash | expand |
On 18/10/21 02:24PM, JaimeLiao wrote: > Following linux kernel to check address width and 4byte flag to enable > 4byte opcode setting. > > Signed-off-by: JaimeLiao <jaimeliao.tw@gmail.com> > --- > drivers/mtd/spi/spi-nor-core.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c > index 87a7de7d60..7d6671ade2 100644 > --- a/drivers/mtd/spi/spi-nor-core.c > +++ b/drivers/mtd/spi/spi-nor-core.c > @@ -3902,6 +3902,10 @@ int spi_nor_scan(struct spi_nor *nor) > return -EINVAL; > } > > + /* Set 4byte opcodes when possible. */ > + if (nor->addr_width == 4 && info->flags & SPI_NOR_4B_OPCODES) > + spi_nor_set_4byte_opcodes(nor, info); > + I still don't think this is the right thing to do. You should rework the previous check for SPI_NOR_4B_OPCODES to fit whatever your flash needs instead of adding it again. > /* Send all the required SPI flash commands to initialize device */ > ret = spi_nor_init(nor); > if (ret) > -- > 2.17.1 >
> > On 18/10/21 02:24PM, JaimeLiao wrote: > > Following linux kernel to check address width and 4byte flag to enable > > 4byte opcode setting. > > > > Signed-off-by: JaimeLiao <jaimeliao.tw@gmail.com> > > --- > > drivers/mtd/spi/spi-nor-core.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c > > index 87a7de7d60..7d6671ade2 100644 > > --- a/drivers/mtd/spi/spi-nor-core.c > > +++ b/drivers/mtd/spi/spi-nor-core.c > > @@ -3902,6 +3902,10 @@ int spi_nor_scan(struct spi_nor *nor) > > return -EINVAL; > > } > > > > + /* Set 4byte opcodes when possible. */ > > + if (nor->addr_width == 4 && info->flags & SPI_NOR_4B_OPCODES) > > + spi_nor_set_4byte_opcodes(nor, info); > > + > > I still don't think this is the right thing to do. You should rework the > previous check for SPI_NOR_4B_OPCODES to fit whatever your flash needs > instead of adding it again. You are right, 3 byte command can be accepted after SPINOR_OP_EN4B. I will remove this part in patch next revision. > > > /* Send all the required SPI flash commands to initialize device */ > > ret = spi_nor_init(nor); > > if (ret) > > -- > > 2.17.1 > > > > -- > Regards, > Pratyush Yadav > Texas Instruments Inc.
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 87a7de7d60..7d6671ade2 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3902,6 +3902,10 @@ int spi_nor_scan(struct spi_nor *nor) return -EINVAL; } + /* Set 4byte opcodes when possible. */ + if (nor->addr_width == 4 && info->flags & SPI_NOR_4B_OPCODES) + spi_nor_set_4byte_opcodes(nor, info); + /* Send all the required SPI flash commands to initialize device */ ret = spi_nor_init(nor); if (ret)
Following linux kernel to check address width and 4byte flag to enable 4byte opcode setting. Signed-off-by: JaimeLiao <jaimeliao.tw@gmail.com> --- drivers/mtd/spi/spi-nor-core.c | 4 ++++ 1 file changed, 4 insertions(+)