linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: "Csókás Bence" <csokas.bence@prolan.hu>
Cc: Pratyush Yadav <pratyush@kernel.org>,
	 <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	 "Tudor Ambarus" <tudor.ambarus@linaro.org>,
	 Michael Walle <mwalle@kernel.org>,
	 "Miquel Raynal" <miquel.raynal@bootlin.com>,
	 Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH] mtd: spi-nor: sst: Factor out common write operation to `sst_nor_write_data()`
Date: Wed, 10 Jul 2024 16:58:43 +0200	[thread overview]
Message-ID: <mafs034ohnvj0.fsf@kernel.org> (raw)
In-Reply-To: <5fe0e312-0844-4de7-8096-eae24361c0a4@prolan.hu> ("Csókás Bence"'s message of "Wed, 10 Jul 2024 15:35:38 +0200")

On Wed, Jul 10 2024, Csókás Bence wrote:

> Hi!
>
> On 7/10/24 15:04, Pratyush Yadav wrote:
>>> Notes:
>>>      RFC: I'm thinking of removing SPINOR_OP_BP in favor of
>>>      SPINOR_OP_PP (they have the same value). SPINOR_OP_PP
>>>      is the "standard" name for the elementary unit-sized
>>>      (1 byte, in the case of NOR) write operation. I find it
>>>      confusing to have two names for the same operation,
>>>      so in a followup I plan to remove the vendor-specific
>>>      name in favor of the standard one.
>> Even though the operations have the same opcode, I see them as different
>> operations. One is a byte program: it can only write one byte at a time.
>> The other is a page program: it can write up to one page (256 bytes
>> usually) at a time.
>> So I would actually find it more confusing if you use page program in a
>> situation where the operation is actually a byte program, and attempting
>> to program the whole page will fail.
>
> Yes, SST engineers took some _unconventional_ steps when designing this
> family... However, there are no 256 byte pages in these chips. You either
> program it one byte at a time, or as a sequence of two byte values. So, in my
> eyes, that makes it a Flash where the page size is 1 byte, and the
> vendor-specific write is something extra added on (and mind you, that's not a
> page program either, you just feed it an *arbitrary* even number of bytes, there
> really are no pages here at all, only erase sectors).

Exactly. Since there are no pages, calling the operation "Page Program"
would be a misnomer, no? Byte Program is a fitting name IMO.

Beyond cosmetic reasons, do you see any need for changing this?
Otherwise, I'd rather avoid the churn on something that is in the gray
zone anyway.

>
>> Not directly related to this patch, but when reviewing this patch I
>> noticed another small improvement you can make. [...]
>> Here, we do a write disable. Then if a one-byte write is needed, do a
>> write enable again, write the data and write disable.
>> Do we really need to toggle write enable between these? If not, it can
>> be simplified to only do the write disable after all bytes have been
>> written.
>
> Honestly, I'm not sure, I was too afraid to touch that part. However, from the
> datasheet of SST25VF040B I presume that if we did not toggle it, then the Flash
> chip would interpret the 0x02 opcode and its argument as another 2 bytes of data
> to write at the end. Byte Program takes exactly 1 argument, so it can be
> followed by another command, but AAI WP goes on until ~CS goes high.

I see. Then let's _not_ fix what isn't broken!

-- 
Regards,
Pratyush Yadav

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

  reply	other threads:[~2024-07-10 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  9:14 [PATCH] mtd: spi-nor: sst: Factor out common write operation to `sst_nor_write_data()` Csókás, Bence
2024-07-10 13:04 ` Pratyush Yadav
2024-07-10 13:35   ` Csókás Bence
2024-07-10 14:58     ` Pratyush Yadav [this message]
2024-07-29 14:55 ` Pratyush Yadav

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=mafs034ohnvj0.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --cc=csokas.bence@prolan.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).