All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "dwmw2@infradead.org" <dwmw2@infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"richard@nod.at" <richard@nod.at>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Cc: "nsekhar@ti.com" <nsekhar@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"masonccyang@mxic.com.tw" <masonccyang@mxic.com.tw>,
	"tudor.ambarus@microchip.com" <tudor.ambarus@microchip.com>,
	"sergei.shtylyov@cogentembedded.com" 
	<sergei.shtylyov@cogentembedded.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"arnd@arndb.de" <arnd@arndb.de>
Subject: Re: [RFC PATCH v2 1/5] mtd: cfi_cmdset_0002: Add support for polling status register
Date: Mon, 25 Mar 2019 17:24:16 +0000	[thread overview]
Message-ID: <f0be796d3662f5b0016edfe73e8665b466b16d20.camel@infinera.com> (raw)
In-Reply-To: <08f5424f-3ce3-492a-d2b3-4798993d35b9@ti.com>

On Mon, 2019-03-25 at 22:36 +0530, Vignesh Raghavendra wrote:
> 
> On 25/03/19 7:21 PM, Joakim Tjernlund wrote:
> > On Mon, 2019-03-25 at 18:27 +0530, Vignesh Raghavendra wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > > 
> > > 
> > > Hi,
> > > 
> > > On 21/03/19 11:41 PM, Joakim Tjernlund wrote:
> > > > On Thu, 2019-03-21 at 23:15 +0530, Vignesh Raghavendra wrote:
> > > > > HyperFlash devices are compliant with CFI AMD/Fujitsu Extended Command
> > > > > Set(0x0002) for flash operations, therefore drivers/mtd/chips/cfi_cmdset_0002.c
> > > > > can be use as is. But these devices do not support DQ polling method of
> > > > > determining chip ready/good status. These flashes provide Status
> > > > > Register whose bits can be polled to know status of flash operation.
> > > > > 
> > > > > Cypress HyperFlash datasheet here[1], talks about CFI Amd/Fujitsu
> > > > > Extended Query version 1.5. Bit 0 of "Software Features supported" field
> > > > > of CFI Primary Vendor-Specific Extended Query table indicates
> > > > > presence/absence of status register and Bit 1 indicates whether or not
> > > > > DQ polling is supported. Using these bits, its possible to determine
> > > > > whether flash supports DQ polling or need to use Status Register.
> > > > > 
> > > > > Add support for polling status register to know device ready/status of
> > > > > erase/write operations when DQ polling is not supported.
> > > > 
> > > > Isn't this new Status scheme just a copy of Intels(cmdset_0001)?
> > > 
> > > Yes, but with one difference: At the end of program/erase operation,
> > > device directly enters status register mode and  starts reflecting
> > > status register content at any address.
> > > The device remains in the read status register state until another
> > > command is written to the device. Therefore there is notion of device is
> > > in "status register read mode" (FL_STATUS) state
> > 
> > That seems to vary and long time ago RMK added this:
> > 		/* If the flash has finished erasing, then 'erase suspend'
> > 		 * appears to make some (28F320) flash devices switch to
> > 		 * 'read' mode.  Make sure that we switch to 'read status'
> > 		 * mode so we get the right data. --rmk
> > 		 */
> > 		map_write(map, CMD(0x70), chip->in_progress_block_addr);
> > 
> 
> This behavior is expected with cmdset_0001. Because "The device remains
> in the read status register state until another command is written",
> therefore "erase suspend' command after erase completion will switch
> device to read mode. And therefore read status is safe thing to do for
> cmdset_0001.
> 
> But in case of cmdset_0002 erase completion will not put device to read
> status mode and therefore no special status tracking is required.
> 
> > > But in case of cfi_cmdset_0002, once program/erase operation is
> > > complete, device returns to previous address space overlay from which
> > > operation was started from (mostly read mode)
> > 
> > I hope you can do the same as Intel here, issue an explicit Status CMD or you will be in trouble.
> 
> Even if we issue Read Status command to enter read status mode, any
> single subsequent read will put device back to read mode. So, sending
> explicit Status CMD is of not much use.
> 
> As long as cmdset_0002 driver ensures sending Read Status cmd and next
> single read can be done in one go (ie. mutex held), I don't see any
> trouble here. This is already take care off.

Ouch, a non sticky Status sounds borken. Are you sure that nothing can change the
chip between you issue the Status CMD and read out of status bits?
Like if an erase/suspend/resume completes just after Status CMD but before Status readout?

 Jocke

> 
> > Also, I think you need to use the various map_word_xxx as in:
> > status = map_read(map, chip->in_progress_block_addr);
> > if (map_word_andequal(map, status, status_OK, status_OK))
> > 	break;
> 
> Yes, I will fixup this patch to use map_word_* wherever necessary in the
> next revision.
> 
> 
> > otherwise you will break interleaved setups(like two 8-bit flashes in parallel to
> > form one 16 bit bus). Maybe this is not supported for CMDSET 0002 ?
> > 
> 
> Interleaved is indeed supported by cmdset_0002. Thanks for pointing that
> out!
> 
> >  Jocke
> > 
> > > In order to enter status register overlay mode, Read Status command is
> > > to be written to addr_unlock1(0x555) address. The overlay is in effect
> > > for one read access, specifically the next read access that follows the
> > > Status Register Read command
> > > Therefore code around FL_STATUS state in cfi_cmdset_0001 is not
> > > applicable to cfi_cmdset_0002 as is.
> > > 
> > > 
> > > > If so I think the new status impl. in 0002 should borrow from 0001 as this is a
> > > > hardened and battle tested impl.
> > > > 
> > > 
> > > In case of cfi_cmdset_0001.c, program/erase is followed by
> > > inval_cache_and_wait_for_operation() to poll ready bit and based on
> > > status register value, success or the error handling is done.
> > > 
> > > Most of the code corresponding to inval_cache_and_wait_for_operation()
> > > is already in cfi_cmdset_0002.c. So, whats missing in this patch is
> > > handling and reporting of errors as reflected in status register after
> > > write/erase failures. I will add that in the next version.
> > > 
> > > But, I don't see much to borrow apart from error handling sequence.
> > > Please, let me know if I missed something.
> > > 
> > > > I know other modern 0002 chips supports both old and new impl. of Status and I world
> > > > guess that we will see more chips with new Status only.
> > > > 
> > > 
> > > Agreed. Newer devices would mostly be CFI 1.5.
> > > 
> > > --
> > > Regards
> > > Vignesh


WARNING: multiple messages have this Message-ID (diff)
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "dwmw2@infradead.org" <dwmw2@infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"richard@nod.at" <richard@nod.at>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"sergei.shtylyov@cogentembedded.com"
	<sergei.shtylyov@cogentembedded.com>,
	"tudor.ambarus@microchip.com" <tudor.ambarus@microchip.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"masonccyang@mxic.com.tw" <masonccyang@mxic.com.tw>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH v2 1/5] mtd: cfi_cmdset_0002: Add support for polling status register
Date: Mon, 25 Mar 2019 17:24:16 +0000	[thread overview]
Message-ID: <f0be796d3662f5b0016edfe73e8665b466b16d20.camel@infinera.com> (raw)
In-Reply-To: <08f5424f-3ce3-492a-d2b3-4798993d35b9@ti.com>

On Mon, 2019-03-25 at 22:36 +0530, Vignesh Raghavendra wrote:
> 
> On 25/03/19 7:21 PM, Joakim Tjernlund wrote:
> > On Mon, 2019-03-25 at 18:27 +0530, Vignesh Raghavendra wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > > 
> > > 
> > > Hi,
> > > 
> > > On 21/03/19 11:41 PM, Joakim Tjernlund wrote:
> > > > On Thu, 2019-03-21 at 23:15 +0530, Vignesh Raghavendra wrote:
> > > > > HyperFlash devices are compliant with CFI AMD/Fujitsu Extended Command
> > > > > Set(0x0002) for flash operations, therefore drivers/mtd/chips/cfi_cmdset_0002.c
> > > > > can be use as is. But these devices do not support DQ polling method of
> > > > > determining chip ready/good status. These flashes provide Status
> > > > > Register whose bits can be polled to know status of flash operation.
> > > > > 
> > > > > Cypress HyperFlash datasheet here[1], talks about CFI Amd/Fujitsu
> > > > > Extended Query version 1.5. Bit 0 of "Software Features supported" field
> > > > > of CFI Primary Vendor-Specific Extended Query table indicates
> > > > > presence/absence of status register and Bit 1 indicates whether or not
> > > > > DQ polling is supported. Using these bits, its possible to determine
> > > > > whether flash supports DQ polling or need to use Status Register.
> > > > > 
> > > > > Add support for polling status register to know device ready/status of
> > > > > erase/write operations when DQ polling is not supported.
> > > > 
> > > > Isn't this new Status scheme just a copy of Intels(cmdset_0001)?
> > > 
> > > Yes, but with one difference: At the end of program/erase operation,
> > > device directly enters status register mode and  starts reflecting
> > > status register content at any address.
> > > The device remains in the read status register state until another
> > > command is written to the device. Therefore there is notion of device is
> > > in "status register read mode" (FL_STATUS) state
> > 
> > That seems to vary and long time ago RMK added this:
> > 		/* If the flash has finished erasing, then 'erase suspend'
> > 		 * appears to make some (28F320) flash devices switch to
> > 		 * 'read' mode.  Make sure that we switch to 'read status'
> > 		 * mode so we get the right data. --rmk
> > 		 */
> > 		map_write(map, CMD(0x70), chip->in_progress_block_addr);
> > 
> 
> This behavior is expected with cmdset_0001. Because "The device remains
> in the read status register state until another command is written",
> therefore "erase suspend' command after erase completion will switch
> device to read mode. And therefore read status is safe thing to do for
> cmdset_0001.
> 
> But in case of cmdset_0002 erase completion will not put device to read
> status mode and therefore no special status tracking is required.
> 
> > > But in case of cfi_cmdset_0002, once program/erase operation is
> > > complete, device returns to previous address space overlay from which
> > > operation was started from (mostly read mode)
> > 
> > I hope you can do the same as Intel here, issue an explicit Status CMD or you will be in trouble.
> 
> Even if we issue Read Status command to enter read status mode, any
> single subsequent read will put device back to read mode. So, sending
> explicit Status CMD is of not much use.
> 
> As long as cmdset_0002 driver ensures sending Read Status cmd and next
> single read can be done in one go (ie. mutex held), I don't see any
> trouble here. This is already take care off.

Ouch, a non sticky Status sounds borken. Are you sure that nothing can change the
chip between you issue the Status CMD and read out of status bits?
Like if an erase/suspend/resume completes just after Status CMD but before Status readout?

 Jocke

> 
> > Also, I think you need to use the various map_word_xxx as in:
> > status = map_read(map, chip->in_progress_block_addr);
> > if (map_word_andequal(map, status, status_OK, status_OK))
> > 	break;
> 
> Yes, I will fixup this patch to use map_word_* wherever necessary in the
> next revision.
> 
> 
> > otherwise you will break interleaved setups(like two 8-bit flashes in parallel to
> > form one 16 bit bus). Maybe this is not supported for CMDSET 0002 ?
> > 
> 
> Interleaved is indeed supported by cmdset_0002. Thanks for pointing that
> out!
> 
> >  Jocke
> > 
> > > In order to enter status register overlay mode, Read Status command is
> > > to be written to addr_unlock1(0x555) address. The overlay is in effect
> > > for one read access, specifically the next read access that follows the
> > > Status Register Read command
> > > Therefore code around FL_STATUS state in cfi_cmdset_0001 is not
> > > applicable to cfi_cmdset_0002 as is.
> > > 
> > > 
> > > > If so I think the new status impl. in 0002 should borrow from 0001 as this is a
> > > > hardened and battle tested impl.
> > > > 
> > > 
> > > In case of cfi_cmdset_0001.c, program/erase is followed by
> > > inval_cache_and_wait_for_operation() to poll ready bit and based on
> > > status register value, success or the error handling is done.
> > > 
> > > Most of the code corresponding to inval_cache_and_wait_for_operation()
> > > is already in cfi_cmdset_0002.c. So, whats missing in this patch is
> > > handling and reporting of errors as reflected in status register after
> > > write/erase failures. I will add that in the next version.
> > > 
> > > But, I don't see much to borrow apart from error handling sequence.
> > > Please, let me know if I missed something.
> > > 
> > > > I know other modern 0002 chips supports both old and new impl. of Status and I world
> > > > guess that we will see more chips with new Status only.
> > > > 
> > > 
> > > Agreed. Newer devices would mostly be CFI 1.5.
> > > 
> > > --
> > > Regards
> > > Vignesh

WARNING: multiple messages have this Message-ID (diff)
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "dwmw2@infradead.org" <dwmw2@infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"richard@nod.at" <richard@nod.at>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"sergei.shtylyov@cogentembedded.com"
	<sergei.shtylyov@cogentembedded.com>,
	"tudor.ambarus@microchip.com" <tudor.ambarus@microchip.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"masonccyang@mxic.com.tw" <masonccyang@mxic.com.tw>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH v2 1/5] mtd: cfi_cmdset_0002: Add support for polling status register
Date: Mon, 25 Mar 2019 17:24:16 +0000	[thread overview]
Message-ID: <f0be796d3662f5b0016edfe73e8665b466b16d20.camel@infinera.com> (raw)
In-Reply-To: <08f5424f-3ce3-492a-d2b3-4798993d35b9@ti.com>

On Mon, 2019-03-25 at 22:36 +0530, Vignesh Raghavendra wrote:
> 
> On 25/03/19 7:21 PM, Joakim Tjernlund wrote:
> > On Mon, 2019-03-25 at 18:27 +0530, Vignesh Raghavendra wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > > 
> > > 
> > > Hi,
> > > 
> > > On 21/03/19 11:41 PM, Joakim Tjernlund wrote:
> > > > On Thu, 2019-03-21 at 23:15 +0530, Vignesh Raghavendra wrote:
> > > > > HyperFlash devices are compliant with CFI AMD/Fujitsu Extended Command
> > > > > Set(0x0002) for flash operations, therefore drivers/mtd/chips/cfi_cmdset_0002.c
> > > > > can be use as is. But these devices do not support DQ polling method of
> > > > > determining chip ready/good status. These flashes provide Status
> > > > > Register whose bits can be polled to know status of flash operation.
> > > > > 
> > > > > Cypress HyperFlash datasheet here[1], talks about CFI Amd/Fujitsu
> > > > > Extended Query version 1.5. Bit 0 of "Software Features supported" field
> > > > > of CFI Primary Vendor-Specific Extended Query table indicates
> > > > > presence/absence of status register and Bit 1 indicates whether or not
> > > > > DQ polling is supported. Using these bits, its possible to determine
> > > > > whether flash supports DQ polling or need to use Status Register.
> > > > > 
> > > > > Add support for polling status register to know device ready/status of
> > > > > erase/write operations when DQ polling is not supported.
> > > > 
> > > > Isn't this new Status scheme just a copy of Intels(cmdset_0001)?
> > > 
> > > Yes, but with one difference: At the end of program/erase operation,
> > > device directly enters status register mode and  starts reflecting
> > > status register content at any address.
> > > The device remains in the read status register state until another
> > > command is written to the device. Therefore there is notion of device is
> > > in "status register read mode" (FL_STATUS) state
> > 
> > That seems to vary and long time ago RMK added this:
> > 		/* If the flash has finished erasing, then 'erase suspend'
> > 		 * appears to make some (28F320) flash devices switch to
> > 		 * 'read' mode.  Make sure that we switch to 'read status'
> > 		 * mode so we get the right data. --rmk
> > 		 */
> > 		map_write(map, CMD(0x70), chip->in_progress_block_addr);
> > 
> 
> This behavior is expected with cmdset_0001. Because "The device remains
> in the read status register state until another command is written",
> therefore "erase suspend' command after erase completion will switch
> device to read mode. And therefore read status is safe thing to do for
> cmdset_0001.
> 
> But in case of cmdset_0002 erase completion will not put device to read
> status mode and therefore no special status tracking is required.
> 
> > > But in case of cfi_cmdset_0002, once program/erase operation is
> > > complete, device returns to previous address space overlay from which
> > > operation was started from (mostly read mode)
> > 
> > I hope you can do the same as Intel here, issue an explicit Status CMD or you will be in trouble.
> 
> Even if we issue Read Status command to enter read status mode, any
> single subsequent read will put device back to read mode. So, sending
> explicit Status CMD is of not much use.
> 
> As long as cmdset_0002 driver ensures sending Read Status cmd and next
> single read can be done in one go (ie. mutex held), I don't see any
> trouble here. This is already take care off.

Ouch, a non sticky Status sounds borken. Are you sure that nothing can change the
chip between you issue the Status CMD and read out of status bits?
Like if an erase/suspend/resume completes just after Status CMD but before Status readout?

 Jocke

> 
> > Also, I think you need to use the various map_word_xxx as in:
> > status = map_read(map, chip->in_progress_block_addr);
> > if (map_word_andequal(map, status, status_OK, status_OK))
> > 	break;
> 
> Yes, I will fixup this patch to use map_word_* wherever necessary in the
> next revision.
> 
> 
> > otherwise you will break interleaved setups(like two 8-bit flashes in parallel to
> > form one 16 bit bus). Maybe this is not supported for CMDSET 0002 ?
> > 
> 
> Interleaved is indeed supported by cmdset_0002. Thanks for pointing that
> out!
> 
> >  Jocke
> > 
> > > In order to enter status register overlay mode, Read Status command is
> > > to be written to addr_unlock1(0x555) address. The overlay is in effect
> > > for one read access, specifically the next read access that follows the
> > > Status Register Read command
> > > Therefore code around FL_STATUS state in cfi_cmdset_0001 is not
> > > applicable to cfi_cmdset_0002 as is.
> > > 
> > > 
> > > > If so I think the new status impl. in 0002 should borrow from 0001 as this is a
> > > > hardened and battle tested impl.
> > > > 
> > > 
> > > In case of cfi_cmdset_0001.c, program/erase is followed by
> > > inval_cache_and_wait_for_operation() to poll ready bit and based on
> > > status register value, success or the error handling is done.
> > > 
> > > Most of the code corresponding to inval_cache_and_wait_for_operation()
> > > is already in cfi_cmdset_0002.c. So, whats missing in this patch is
> > > handling and reporting of errors as reflected in status register after
> > > write/erase failures. I will add that in the next version.
> > > 
> > > But, I don't see much to borrow apart from error handling sequence.
> > > Please, let me know if I missed something.
> > > 
> > > > I know other modern 0002 chips supports both old and new impl. of Status and I world
> > > > guess that we will see more chips with new Status only.
> > > > 
> > > 
> > > Agreed. Newer devices would mostly be CFI 1.5.
> > > 
> > > --
> > > Regards
> > > Vignesh

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "dwmw2@infradead.org" <dwmw2@infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"richard@nod.at" <richard@nod.at>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"sergei.shtylyov@cogentembedded.com"
	<sergei.shtylyov@cogentembedded.com>,
	"tudor.ambarus@microchip.com" <tudor.ambarus@microchip.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"masonccyang@mxic.com.tw" <masonccyang@mxic.com.tw>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH v2 1/5] mtd: cfi_cmdset_0002: Add support for polling status register
Date: Mon, 25 Mar 2019 17:24:16 +0000	[thread overview]
Message-ID: <f0be796d3662f5b0016edfe73e8665b466b16d20.camel@infinera.com> (raw)
In-Reply-To: <08f5424f-3ce3-492a-d2b3-4798993d35b9@ti.com>

On Mon, 2019-03-25 at 22:36 +0530, Vignesh Raghavendra wrote:
> 
> On 25/03/19 7:21 PM, Joakim Tjernlund wrote:
> > On Mon, 2019-03-25 at 18:27 +0530, Vignesh Raghavendra wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > > 
> > > 
> > > Hi,
> > > 
> > > On 21/03/19 11:41 PM, Joakim Tjernlund wrote:
> > > > On Thu, 2019-03-21 at 23:15 +0530, Vignesh Raghavendra wrote:
> > > > > HyperFlash devices are compliant with CFI AMD/Fujitsu Extended Command
> > > > > Set(0x0002) for flash operations, therefore drivers/mtd/chips/cfi_cmdset_0002.c
> > > > > can be use as is. But these devices do not support DQ polling method of
> > > > > determining chip ready/good status. These flashes provide Status
> > > > > Register whose bits can be polled to know status of flash operation.
> > > > > 
> > > > > Cypress HyperFlash datasheet here[1], talks about CFI Amd/Fujitsu
> > > > > Extended Query version 1.5. Bit 0 of "Software Features supported" field
> > > > > of CFI Primary Vendor-Specific Extended Query table indicates
> > > > > presence/absence of status register and Bit 1 indicates whether or not
> > > > > DQ polling is supported. Using these bits, its possible to determine
> > > > > whether flash supports DQ polling or need to use Status Register.
> > > > > 
> > > > > Add support for polling status register to know device ready/status of
> > > > > erase/write operations when DQ polling is not supported.
> > > > 
> > > > Isn't this new Status scheme just a copy of Intels(cmdset_0001)?
> > > 
> > > Yes, but with one difference: At the end of program/erase operation,
> > > device directly enters status register mode and  starts reflecting
> > > status register content at any address.
> > > The device remains in the read status register state until another
> > > command is written to the device. Therefore there is notion of device is
> > > in "status register read mode" (FL_STATUS) state
> > 
> > That seems to vary and long time ago RMK added this:
> > 		/* If the flash has finished erasing, then 'erase suspend'
> > 		 * appears to make some (28F320) flash devices switch to
> > 		 * 'read' mode.  Make sure that we switch to 'read status'
> > 		 * mode so we get the right data. --rmk
> > 		 */
> > 		map_write(map, CMD(0x70), chip->in_progress_block_addr);
> > 
> 
> This behavior is expected with cmdset_0001. Because "The device remains
> in the read status register state until another command is written",
> therefore "erase suspend' command after erase completion will switch
> device to read mode. And therefore read status is safe thing to do for
> cmdset_0001.
> 
> But in case of cmdset_0002 erase completion will not put device to read
> status mode and therefore no special status tracking is required.
> 
> > > But in case of cfi_cmdset_0002, once program/erase operation is
> > > complete, device returns to previous address space overlay from which
> > > operation was started from (mostly read mode)
> > 
> > I hope you can do the same as Intel here, issue an explicit Status CMD or you will be in trouble.
> 
> Even if we issue Read Status command to enter read status mode, any
> single subsequent read will put device back to read mode. So, sending
> explicit Status CMD is of not much use.
> 
> As long as cmdset_0002 driver ensures sending Read Status cmd and next
> single read can be done in one go (ie. mutex held), I don't see any
> trouble here. This is already take care off.

Ouch, a non sticky Status sounds borken. Are you sure that nothing can change the
chip between you issue the Status CMD and read out of status bits?
Like if an erase/suspend/resume completes just after Status CMD but before Status readout?

 Jocke

> 
> > Also, I think you need to use the various map_word_xxx as in:
> > status = map_read(map, chip->in_progress_block_addr);
> > if (map_word_andequal(map, status, status_OK, status_OK))
> > 	break;
> 
> Yes, I will fixup this patch to use map_word_* wherever necessary in the
> next revision.
> 
> 
> > otherwise you will break interleaved setups(like two 8-bit flashes in parallel to
> > form one 16 bit bus). Maybe this is not supported for CMDSET 0002 ?
> > 
> 
> Interleaved is indeed supported by cmdset_0002. Thanks for pointing that
> out!
> 
> >  Jocke
> > 
> > > In order to enter status register overlay mode, Read Status command is
> > > to be written to addr_unlock1(0x555) address. The overlay is in effect
> > > for one read access, specifically the next read access that follows the
> > > Status Register Read command
> > > Therefore code around FL_STATUS state in cfi_cmdset_0001 is not
> > > applicable to cfi_cmdset_0002 as is.
> > > 
> > > 
> > > > If so I think the new status impl. in 0002 should borrow from 0001 as this is a
> > > > hardened and battle tested impl.
> > > > 
> > > 
> > > In case of cfi_cmdset_0001.c, program/erase is followed by
> > > inval_cache_and_wait_for_operation() to poll ready bit and based on
> > > status register value, success or the error handling is done.
> > > 
> > > Most of the code corresponding to inval_cache_and_wait_for_operation()
> > > is already in cfi_cmdset_0002.c. So, whats missing in this patch is
> > > handling and reporting of errors as reflected in status register after
> > > write/erase failures. I will add that in the next version.
> > > 
> > > But, I don't see much to borrow apart from error handling sequence.
> > > Please, let me know if I missed something.
> > > 
> > > > I know other modern 0002 chips supports both old and new impl. of Status and I world
> > > > guess that we will see more chips with new Status only.
> > > > 
> > > 
> > > Agreed. Newer devices would mostly be CFI 1.5.
> > > 
> > > --
> > > Regards
> > > Vignesh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-03-25 17:26 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 17:45 [RFC PATCH v2 0/5] MTD: Add Initial Hyperbus support Vignesh Raghavendra
2019-03-21 17:45 ` Vignesh Raghavendra
2019-03-21 17:45 ` Vignesh Raghavendra
2019-03-21 17:45 ` Vignesh Raghavendra
2019-03-21 17:45 ` [RFC PATCH v2 1/5] mtd: cfi_cmdset_0002: Add support for polling status register Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 18:11   ` Joakim Tjernlund
2019-03-21 18:11     ` Joakim Tjernlund
2019-03-21 18:11     ` Joakim Tjernlund
2019-03-21 18:11     ` Joakim Tjernlund
2019-03-25 12:57     ` Vignesh Raghavendra
2019-03-25 12:57       ` Vignesh Raghavendra
2019-03-25 12:57       ` Vignesh Raghavendra
2019-03-25 12:57       ` Vignesh Raghavendra
2019-03-25 13:51       ` Joakim Tjernlund
2019-03-25 13:51         ` Joakim Tjernlund
2019-03-25 13:51         ` Joakim Tjernlund
2019-03-25 13:51         ` Joakim Tjernlund
2019-03-25 17:06         ` Vignesh Raghavendra
2019-03-25 17:06           ` Vignesh Raghavendra
2019-03-25 17:06           ` Vignesh Raghavendra
2019-03-25 17:06           ` Vignesh Raghavendra
2019-03-25 17:24           ` Joakim Tjernlund [this message]
2019-03-25 17:24             ` Joakim Tjernlund
2019-03-25 17:24             ` Joakim Tjernlund
2019-03-25 17:24             ` Joakim Tjernlund
2019-04-02  9:03             ` Vignesh Raghavendra
2019-04-02  9:03               ` Vignesh Raghavendra
2019-04-02  9:03               ` Vignesh Raghavendra
2019-04-02  9:03               ` Vignesh Raghavendra
2019-03-24 16:23   ` Sergei Shtylyov
2019-03-24 16:23     ` Sergei Shtylyov
2019-03-24 16:23     ` Sergei Shtylyov
2019-03-21 17:45 ` [RFC PATCH v2 2/5] dt-bindings: mtd: Add binding documentation for Hyperbus memory devices Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-24 16:18   ` Sergei Shtylyov
2019-03-24 16:18     ` Sergei Shtylyov
2019-03-24 16:18     ` Sergei Shtylyov
2019-03-25 13:10     ` Vignesh Raghavendra
2019-03-25 13:10       ` Vignesh Raghavendra
2019-03-25 13:10       ` Vignesh Raghavendra
2019-03-25 13:10       ` Vignesh Raghavendra
2019-03-21 17:45 ` [RFC PATCH v2 3/5] mtd: Add support " Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-25 20:13   ` Sergei Shtylyov
2019-03-25 20:13     ` Sergei Shtylyov
2019-03-25 20:13     ` Sergei Shtylyov
2019-03-26  7:51     ` Sergei Shtylyov
2019-03-26  7:51       ` Sergei Shtylyov
2019-03-26  7:51       ` Sergei Shtylyov
2019-03-21 17:45 ` [RFC PATCH v2 4/5] dt-bindings: mtd: Add bindings for TI's AM654 Hyperbus memory controller Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45 ` [RFC PATCH v2 5/5] mtd: hyperbus: Add driver for TI's " Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-21 17:45   ` Vignesh Raghavendra
2019-03-26 10:40   ` Sergei Shtylyov
2019-03-26 10:40     ` Sergei Shtylyov
2019-03-26 10:40     ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0be796d3662f5b0016edfe73e8665b466b16d20.camel@infinera.com \
    --to=joakim.tjernlund@infinera.com \
    --cc=arnd@arndb.de \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=masonccyang@mxic.com.tw \
    --cc=nsekhar@ti.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.