All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <p.yadav@ti.com>
To: <Tudor.Ambarus@microchip.com>
Cc: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
	<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<nsekhar@ti.com>, <boris.brezillon@collabora.com>
Subject: Re: [PATCH v16 00/15] mtd: spi-nor: add xSPI Octal DTR support
Date: Thu, 29 Oct 2020 01:32:22 +0530	[thread overview]
Message-ID: <20201028200220.eskcgrf2bqzzijz5@ti.com> (raw)
In-Reply-To: <d9d96eda-4cb6-fe68-7469-e73dc7ba2fda@microchip.com>

On 28/10/20 03:21PM, Tudor.Ambarus@microchip.com wrote:
> On 10/28/20 2:49 PM, Pratyush Yadav wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Tudor,
> > 
> > On 28/10/20 07:53AM, Tudor.Ambarus@microchip.com wrote:
> >> Hi, Pratyush,
> >>
> >> On 10/5/20 6:31 PM, Pratyush Yadav wrote:
> >>> Tested on Micron MT35X and S28HS flashes for Octal DTR.
> >>
> >> Do these flashes define the "Command Sequences to Change to
> >> Octal DDR (8D-8D-8D) mode" table? Can't we use that table
> >> instead of defining our own octal dtr enable functions?
> > 
> > The Micron flash does not have this table. The Cypress flash does. The
> > problem is that one of the samples of the Cypress flash I tested on had
> > incorrect data in that table which meant the sequence would fail. The
> > newer samples of the flash have the correct data.
> 
> Can we differentiate the Cypress flashes?

No way I know of.

> Do you remember what was the incorrect data?

The address width for the write register command was 4 bytes when the 
flash uses 3 bytes by default.
 
> > 
> > I don't know how many of those faulty flashes are out there in the wild.
> > IMO, to be on the safe side spi_nor_cypress_octal_dtr_enable() needs to
> > be implemented. So from the point of view of this series there is no
> > need to parse the Octal DDR enable table.
> 
> Meh, we cover manufacturer's mistakes. On the long run, our aim should be
> to follow the SFDP standard and if a flash implements it wrong, to either
> fix it via a fixup hook (if the fix is minimal), or to skip the faulty
> table.
> 
> Regarding "Command Sequences to Change to Octal DDR (8D-8D-8D) mode"
> table. Have you looked over
> https://patchwork.ozlabs.org/project/linux-mtd/patch/1590737775-4798-4-git-send-email-masonccyang@mxic.com.tw/
> ?
> Is there a standard way to determine the offsets of opcode, addr and
> data in the cmd seq?

To be honest the spec does not say much about how the data should be 
interpreted so I am not sure either. My understanding is that those are 
effectively data bytes to send out on the bus.

One way to implement such a function, would be to put the first byte as 
the command opcode and the rest as data [0], with no address and dummy 
cycles. So no matter the address length, the controller should send out 
the bytes in sequence and then the flash can interpret them according to 
the address width it expects.

The downside is that someone debugging this on the controller's end 
might get confused seeing an opcode that expects an address phase but 
SPI NOR not sending one.

The other way would be to use the first byte as opcode, the next 
nor->addr_width bytes as address and the remaining as data, with no 
dummy cycles. This would fail if the 8D enable command does not use 
nor->addr_width address bytes [1].

I don't know which of the two is better but I think both are better than 
the switch-case hackery in Mason's patch which has to assume either the 
address width or the data length and leaves no way to play around with 
them in fixup hooks. If you have any better ideas I'm all ears.

[0] AFAIK many controllers can't have 0 command bytes.
[1] I'm not sure how common that would be though.
 
> Cheers,
> ta
> > 
> >> I see that Mason used this table for a macronix flash:
> >> https://patchwork.ozlabs.org/project/linux-mtd/patch/1590737775-4798-4-git-send-email-masonccyang@mxic.com.tw/
> >> https://patchwork.ozlabs.org/project/linux-mtd/patch/1590737775-4798-8-git-send-email-masonccyang@mxic.com.tw/
> >>
> >> Cheers,
> >> ta
> > 
> > --
> > Regards,
> > Pratyush Yadav
> > Texas Instruments India
> > 
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments India

WARNING: multiple messages have this Message-ID (diff)
From: Pratyush Yadav <p.yadav@ti.com>
To: <Tudor.Ambarus@microchip.com>
Cc: vigneshr@ti.com, richard@nod.at, nsekhar@ti.com,
	linux-kernel@vger.kernel.org, boris.brezillon@collabora.com,
	linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com
Subject: Re: [PATCH v16 00/15] mtd: spi-nor: add xSPI Octal DTR support
Date: Thu, 29 Oct 2020 01:32:22 +0530	[thread overview]
Message-ID: <20201028200220.eskcgrf2bqzzijz5@ti.com> (raw)
In-Reply-To: <d9d96eda-4cb6-fe68-7469-e73dc7ba2fda@microchip.com>

On 28/10/20 03:21PM, Tudor.Ambarus@microchip.com wrote:
> On 10/28/20 2:49 PM, Pratyush Yadav wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Tudor,
> > 
> > On 28/10/20 07:53AM, Tudor.Ambarus@microchip.com wrote:
> >> Hi, Pratyush,
> >>
> >> On 10/5/20 6:31 PM, Pratyush Yadav wrote:
> >>> Tested on Micron MT35X and S28HS flashes for Octal DTR.
> >>
> >> Do these flashes define the "Command Sequences to Change to
> >> Octal DDR (8D-8D-8D) mode" table? Can't we use that table
> >> instead of defining our own octal dtr enable functions?
> > 
> > The Micron flash does not have this table. The Cypress flash does. The
> > problem is that one of the samples of the Cypress flash I tested on had
> > incorrect data in that table which meant the sequence would fail. The
> > newer samples of the flash have the correct data.
> 
> Can we differentiate the Cypress flashes?

No way I know of.

> Do you remember what was the incorrect data?

The address width for the write register command was 4 bytes when the 
flash uses 3 bytes by default.
 
> > 
> > I don't know how many of those faulty flashes are out there in the wild.
> > IMO, to be on the safe side spi_nor_cypress_octal_dtr_enable() needs to
> > be implemented. So from the point of view of this series there is no
> > need to parse the Octal DDR enable table.
> 
> Meh, we cover manufacturer's mistakes. On the long run, our aim should be
> to follow the SFDP standard and if a flash implements it wrong, to either
> fix it via a fixup hook (if the fix is minimal), or to skip the faulty
> table.
> 
> Regarding "Command Sequences to Change to Octal DDR (8D-8D-8D) mode"
> table. Have you looked over
> https://patchwork.ozlabs.org/project/linux-mtd/patch/1590737775-4798-4-git-send-email-masonccyang@mxic.com.tw/
> ?
> Is there a standard way to determine the offsets of opcode, addr and
> data in the cmd seq?

To be honest the spec does not say much about how the data should be 
interpreted so I am not sure either. My understanding is that those are 
effectively data bytes to send out on the bus.

One way to implement such a function, would be to put the first byte as 
the command opcode and the rest as data [0], with no address and dummy 
cycles. So no matter the address length, the controller should send out 
the bytes in sequence and then the flash can interpret them according to 
the address width it expects.

The downside is that someone debugging this on the controller's end 
might get confused seeing an opcode that expects an address phase but 
SPI NOR not sending one.

The other way would be to use the first byte as opcode, the next 
nor->addr_width bytes as address and the remaining as data, with no 
dummy cycles. This would fail if the 8D enable command does not use 
nor->addr_width address bytes [1].

I don't know which of the two is better but I think both are better than 
the switch-case hackery in Mason's patch which has to assume either the 
address width or the data length and leaves no way to play around with 
them in fixup hooks. If you have any better ideas I'm all ears.

[0] AFAIK many controllers can't have 0 command bytes.
[1] I'm not sure how common that would be though.
 
> Cheers,
> ta
> > 
> >> I see that Mason used this table for a macronix flash:
> >> https://patchwork.ozlabs.org/project/linux-mtd/patch/1590737775-4798-4-git-send-email-masonccyang@mxic.com.tw/
> >> https://patchwork.ozlabs.org/project/linux-mtd/patch/1590737775-4798-8-git-send-email-masonccyang@mxic.com.tw/
> >>
> >> Cheers,
> >> ta
> > 
> > --
> > Regards,
> > Pratyush Yadav
> > Texas Instruments India
> > 
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments India

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

  reply	other threads:[~2020-10-29  0:23 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 15:31 [PATCH v16 00/15] mtd: spi-nor: add xSPI Octal DTR support Pratyush Yadav
2020-10-05 15:31 ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 01/15] mtd: spi-nor: core: use EOPNOTSUPP instead of ENOTSUPP Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 02/15] mtd: spi-nor: add spi_nor_controller_ops_{read_reg,write_reg,erase}() Pratyush Yadav
2020-10-05 15:31   ` [PATCH v16 02/15] mtd: spi-nor: add spi_nor_controller_ops_{read_reg, write_reg, erase}() Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 03/15] mtd: spi-nor: add support for DTR protocol Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 04/15] mtd: spi-nor: sfdp: get command opcode extension type from BFPT Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 05/15] mtd: spi-nor: sfdp: parse xSPI Profile 1.0 table Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-27  9:58   ` Tudor.Ambarus
2020-10-27  9:58     ` Tudor.Ambarus
2020-10-05 15:31 ` [PATCH v16 06/15] mtd: spi-nor: core: use dummy cycle and address width info from SFDP Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 07/15] mtd: spi-nor: core: do 2 byte reads for SR and FSR in DTR mode Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 08/15] mtd: spi-nor: Introduce SNOR_F_IO_MODE_EN_VOLATILE Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 09/15] mtd: spi-nor: Parse SFDP SCCR Map Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 10/15] mtd: spi-nor: core: enable octal DTR mode when possible Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 11/15] mtd: spi-nor: sfdp: detect Soft Reset sequence support from BFPT Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 12/15] mtd: spi-nor: core: perform a Soft Reset on shutdown Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 13/15] mtd: spi-nor: core: disable Octal DTR mode on suspend Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-05 15:31 ` [PATCH v16 14/15] mtd: spi-nor: spansion: add support for Cypress Semper flash Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-11-07  7:58   ` Vignesh Raghavendra
2020-11-07  7:58     ` Vignesh Raghavendra
2020-11-09 11:45     ` Pratyush Yadav
2020-11-09 11:45       ` Pratyush Yadav
2020-11-09 13:28     ` Tudor.Ambarus
2020-11-09 13:28       ` Tudor.Ambarus
2020-10-05 15:31 ` [PATCH v16 15/15] mtd: spi-nor: micron-st: allow using MT35XU512ABA in Octal DTR mode Pratyush Yadav
2020-10-05 15:31   ` Pratyush Yadav
2020-10-06  8:11   ` Tudor.Ambarus
2020-10-06  8:11     ` Tudor.Ambarus
2020-10-28  7:53 ` [PATCH v16 00/15] mtd: spi-nor: add xSPI Octal DTR support Tudor.Ambarus
2020-10-28  7:53   ` Tudor.Ambarus
2020-10-28 12:49   ` Pratyush Yadav
2020-10-28 12:49     ` Pratyush Yadav
2020-10-28 15:21     ` Tudor.Ambarus
2020-10-28 15:21       ` Tudor.Ambarus
2020-10-28 20:02       ` Pratyush Yadav [this message]
2020-10-28 20:02         ` Pratyush Yadav
2020-10-29  6:26       ` Vignesh Raghavendra
2020-10-29  6:26         ` Vignesh Raghavendra
2020-11-09 17:25 ` Vignesh Raghavendra
2020-11-09 17:25   ` Vignesh Raghavendra

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=20201028200220.eskcgrf2bqzzijz5@ti.com \
    --to=p.yadav@ti.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=boris.brezillon@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=nsekhar@ti.com \
    --cc=richard@nod.at \
    --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.