* [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts @ 2015-06-18 14:58 Anurag Kumar Vulisha 2015-06-19 19:11 ` Graham Moore 2015-06-20 19:13 ` Rafał Miłecki 0 siblings, 2 replies; 4+ messages in thread From: Anurag Kumar Vulisha @ 2015-06-18 14:58 UTC (permalink / raw) To: dwmw2, computersforpeace, marex, shijie.huang, zajec5, ben, mika.westerberg, beanhuo, grmoore Cc: harinik, Anurag Kumar Vulisha, svemula, linux-kernel, broonie, linux-mtd, anirudh, punnaia micron flash parts by default operates in extended spi protocol,which accepts command on single line and can accept address & data on one,two and four lines depending on the command sent.In set_quad_enable() we are enabling the quad io protocol for micron flash parts by updating the EVCR register,in this method the flash expects the command,address and data to be transmitted on all four data lines which may not be supported on all qspi controllers.So READ_1_1_4 command does not necessarily go out using those bus widths. So i have added SPI_QUAD_IO_PROTOCOL flag,which should be checked before enabling the quad io protocol. Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com> --- drivers/mtd/spi-nor/spi-nor.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 14a5d23..a6fa8dc 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -55,6 +55,7 @@ struct flash_info { #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ #define USE_FSR 0x80 /* use flag status register */ +#define SPI_QUAD_IO_PROTOCOL 0x100 /* use quad io protocol */ }; #define JEDEC_MFR(info) ((info)->id[0]) @@ -962,6 +963,8 @@ static int set_quad_mode(struct spi_nor *nor, struct flash_info *info) } return status; case CFI_MFR_ST: + if (!(info->flags & SPI_QUAD_IO_PROTOCOL)) + return 0; status = micron_quad_enable(nor); if (status) { dev_err(nor->dev, "Micron quad-read not enabled\n"); -- 1.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts 2015-06-18 14:58 [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts Anurag Kumar Vulisha @ 2015-06-19 19:11 ` Graham Moore 2015-06-20 2:30 ` Punnaiah Choudary Kalluri 2015-06-20 19:13 ` Rafał Miłecki 1 sibling, 1 reply; 4+ messages in thread From: Graham Moore @ 2015-06-19 19:11 UTC (permalink / raw) To: Anurag Kumar Vulisha Cc: marex, harinik, mika.westerberg, ben, broonie, zajec5, Anurag Kumar Vulisha, linux-kernel, svemula, linux-mtd, anirudh, shijie.huang, punnaia, computersforpeace, dwmw2, "Bean Huo 霍斌斌 (beanhuo)" Hi Anurag, We're struggling with the same issue, our Cadence QSPI controller *does* handle four-line command, address, and data, but has to be configured for it. The setting of quad-io-protocol mode in micron_quad_enable is really jacking up our code. We have to snoop the command stream and configure the controller as soon as we see the quad-io-protocol command go to the Micron chip. Ugly. I'd like to point out that this flag is also dependent upon the particular controller in use, not just the Micron chip. In fact, it may be more of a controller thing than a chip thing. Maybe this flag should actually be an enum read_mode value, and passed into spi_nor_scan by the controller? Thanks, Graham On 06/18/2015 09:58 AM, Anurag Kumar Vulisha wrote: > micron flash parts by default operates in extended spi protocol,which accepts > command on single line and can accept address & data on one,two and four lines > depending on the command sent.In set_quad_enable() we are enabling the quad io > protocol for micron flash parts by updating the EVCR register,in this method the > flash expects the command,address and data to be transmitted on all four data > lines which may not be supported on all qspi controllers.So READ_1_1_4 command > does not necessarily go out using those bus widths. > > So i have added SPI_QUAD_IO_PROTOCOL flag,which should be checked before enabling > the quad io protocol. > > Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com> > --- > drivers/mtd/spi-nor/spi-nor.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c > index 14a5d23..a6fa8dc 100644 > --- a/drivers/mtd/spi-nor/spi-nor.c > +++ b/drivers/mtd/spi-nor/spi-nor.c > @@ -55,6 +55,7 @@ struct flash_info { > #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ > #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ > #define USE_FSR 0x80 /* use flag status register */ > +#define SPI_QUAD_IO_PROTOCOL 0x100 /* use quad io protocol */ > }; > > #define JEDEC_MFR(info) ((info)->id[0]) > @@ -962,6 +963,8 @@ static int set_quad_mode(struct spi_nor *nor, struct flash_info *info) > } > return status; > case CFI_MFR_ST: > + if (!(info->flags & SPI_QUAD_IO_PROTOCOL)) > + return 0; > status = micron_quad_enable(nor); > if (status) { > dev_err(nor->dev, "Micron quad-read not enabled\n"); > ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts 2015-06-19 19:11 ` Graham Moore @ 2015-06-20 2:30 ` Punnaiah Choudary Kalluri 0 siblings, 0 replies; 4+ messages in thread From: Punnaiah Choudary Kalluri @ 2015-06-20 2:30 UTC (permalink / raw) To: Graham Moore, Anurag Kumar Vulisha Cc: marex@denx.de, Harini Katakam, mika.westerberg@linux.intel.com, ben@decadent.org.uk, Mark Brown (broonie@kernel.org), zajec5@gmail.com, Anurag Kumar Vulisha, linux-kernel@vger.kernel.org, Srikanth Vemula, linux-mtd@lists.infradead.org, Anirudha Sarangi, shijie.huang@intel.com, Michal Simek, computersforpeace@gmail.com, dwmw2@infradead.org, "Bean Huo 霍斌斌 (beanhuo)" Hi Graham, > -----Original Message----- > From: Graham Moore [mailto:grmoore@opensource.altera.com] > Sent: Saturday, June 20, 2015 12:41 AM > To: Anurag Kumar Vulisha > Cc: dwmw2@infradead.org; computersforpeace@gmail.com; > marex@denx.de; shijie.huang@intel.com; zajec5@gmail.com; > ben@decadent.org.uk; mika.westerberg@linux.intel.com; "Bean Huo 霍斌 > 斌 (beanhuo)"; Harini Katakam; Anurag Kumar Vulisha; Srikanth Vemula; > linux-kernel@vger.kernel.org; broonie@kernel.org; linux- > mtd@lists.infradead.org; Anirudha Sarangi; Punnaiah Choudary Kalluri > Subject: Re: [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol > for micron flash parts > > Hi Anurag, > > We're struggling with the same issue, our Cadence QSPI controller *does* > handle four-line command, address, and data, but has to be configured > for it. The setting of quad-io-protocol mode in micron_quad_enable is > really jacking up our code. We have to snoop the command stream and > configure the controller as soon as we see the quad-io-protocol command > go to the Micron chip. Ugly. > > I'd like to point out that this flag is also dependent upon the > particular controller in use, not just the Micron chip. In fact, it may > be more of a controller thing than a chip thing. Agree, QUAD IO protocol is different to supporting QUAD IO read command. In QUAD IO Protocol mode, all the commands including register read, erase, read, Program... will be using the four lines. Enabling the QUAD IO Protocol in flash should ensure that both the controller and flash have this support otherwise the result is unpredictable. So, now m25p80 driver should check the number bits to use depending on the Protocol it uses. Literally we need another mode i.e protocol mode. The possible values for this modes are Dual Io protocol - all the commands will be sent using 2 lines Quad Io protocol - all the commands will be send using 4 lines. Extended spi protocol - number of data lines to use will depends on the data command. If the protocol is extended spi protocol, m25p80 should select the rx and tx bits to use for data operations depends on the "mode" i.e. quad/dual If the protocol is Quad IO/dual Io, m2p80 should select the rx and tx bits either 4/2 for All the commands. Data operations in the above context means read, page program operation. Suggest if we have any other acceptable solutions for implementing the quad/dual io Protocol support. Regards, Punnaiah > > Maybe this flag should actually be an enum read_mode value, and passed > into spi_nor_scan by the controller? > > Thanks, > Graham > > > On 06/18/2015 09:58 AM, Anurag Kumar Vulisha wrote: > > micron flash parts by default operates in extended spi protocol,which > accepts > > command on single line and can accept address & data on one,two and four > lines > > depending on the command sent.In set_quad_enable() we are enabling > the quad io > > protocol for micron flash parts by updating the EVCR register,in this method > the > > flash expects the command,address and data to be transmitted on all four > data > > lines which may not be supported on all qspi controllers.So READ_1_1_4 > command > > does not necessarily go out using those bus widths. > > > > So i have added SPI_QUAD_IO_PROTOCOL flag,which should be checked > before enabling > > the quad io protocol. > > > > Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com> > > --- > > drivers/mtd/spi-nor/spi-nor.c | 3 +++ > > 1 files changed, 3 insertions(+), 0 deletions(-) > > > > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c > > index 14a5d23..a6fa8dc 100644 > > --- a/drivers/mtd/spi-nor/spi-nor.c > > +++ b/drivers/mtd/spi-nor/spi-nor.c > > @@ -55,6 +55,7 @@ struct flash_info { > > #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ > > #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read > */ > > #define USE_FSR 0x80 /* use flag status > register */ > > +#define SPI_QUAD_IO_PROTOCOL 0x100 /* use quad io protocol */ > > }; > > > > #define JEDEC_MFR(info) ((info)->id[0]) > > @@ -962,6 +963,8 @@ static int set_quad_mode(struct spi_nor *nor, > struct flash_info *info) > > } > > return status; > > case CFI_MFR_ST: > > + if (!(info->flags & SPI_QUAD_IO_PROTOCOL)) > > + return 0; > > status = micron_quad_enable(nor); > > if (status) { > > dev_err(nor->dev, "Micron quad-read not > enabled\n"); > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts 2015-06-18 14:58 [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts Anurag Kumar Vulisha 2015-06-19 19:11 ` Graham Moore @ 2015-06-20 19:13 ` Rafał Miłecki 1 sibling, 0 replies; 4+ messages in thread From: Rafał Miłecki @ 2015-06-20 19:13 UTC (permalink / raw) To: Anurag Kumar Vulisha Cc: Marek Vašut, harinik, Anurag Kumar Vulisha, Ben Hutchings, David Woodhouse, svemula, Linux Kernel Mailing List, Mark Brown, linux-mtd@lists.infradead.org, anirudh, grmoore@altera.com, Huang Shijie, punnaia, Brian Norris, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo) Hi, I don't really have enough knowledge to comment QUAD IO, I'll just include some general comments. On 18 June 2015 at 16:58, Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com> wrote: > micron flash parts by default operates in extended spi protocol,which accepts > command on single line and can accept address & data on one,two and four lines > depending on the command sent.In set_quad_enable() we are enabling the quad io > protocol for micron flash parts by updating the EVCR register,in this method the > flash expects the command,address and data to be transmitted on all four data > lines which may not be supported on all qspi controllers.So READ_1_1_4 command > does not necessarily go out using those bus widths. > > So i have added SPI_QUAD_IO_PROTOCOL flag,which should be checked before enabling > the quad io protocol. Above description is a bit of pain to read & understand. Long sentences, lacking spaces after interpunction signs, small letters in "micron", "spi" etc., lines over 72 chars. You really could do better :) > @@ -55,6 +55,7 @@ struct flash_info { > #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ > #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ > #define USE_FSR 0x80 /* use flag status register */ > +#define SPI_QUAD_IO_PROTOCOL 0x100 /* use quad io protocol */ All defines use tab so follow this way (don't use space instead). ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-20 19:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-06-18 14:58 [RFC PATCH] mtd: spi-nor: Added flag check for quad io protocol for micron flash parts Anurag Kumar Vulisha 2015-06-19 19:11 ` Graham Moore 2015-06-20 2:30 ` Punnaiah Choudary Kalluri 2015-06-20 19:13 ` Rafał Miłecki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox