From: Michael Walle <michael@walle.cc>
To: Tudor.Ambarus@microchip.com
Cc: vigneshr@ti.com, richard@nod.at, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com
Subject: Re: [PATCH v3 1/2] mtd: spi-nor: add OTP support
Date: Mon, 01 Mar 2021 22:31:22 +0100 [thread overview]
Message-ID: <a6ee55184d91fa1c1802bd82290407bd@walle.cc> (raw)
In-Reply-To: <7d1f770ae750d6ed5fb942b16979cdcb@walle.cc>
Am 2021-03-01 18:32, schrieb Michael Walle:
> Am 2021-02-28 13:00, schrieb Tudor.Ambarus@microchip.com:
>> On 2/16/21 6:28 PM, Michael Walle wrote:
>> Does the otp memory organization matter for the end user?
>> Can't we lock/read/write past region size, for example 2 or 3 regions
>> in a row,
>> depending on length?
>
> Mhh tough one. I guess the question really is: Do we want
> to remap the 0x1000, 0x2000, 0x3000 offsets?
> - 0x1000 -> 0
> - 0x2000 -> 1 * region_size
> - 0x3000 -> 2 * region_size
>
> This is just an example, some devices may us other offsets.
>
> I'd see this as a prerequsite for handling multiple regions
> in one write, because otherwise you'll have to handle the
> holes which makes it impossible I guess. For example what
> would happen with (given an otp size of 0x100):
> (1) lock(0, 0x100)
> (2) lock(0x100, 0xf00)
> (3) lock(0, 0x1000)
>
> (1) will work, (2) should return -EINVAL; but what will (3)
> return. -EINVAL too, I guess. But then, ops spanning multiple
> regions doesn't make sense at all, because they will always
> return -EINVAL.
>
> Unfortunately, I don't know how userspace might access it.
>
> This is how it looks like at the moment:
>
> # flash_otp_info -u /dev/mtd1
> Number of OTP user blocks on /dev/mtd1: 3
> block 0: offset = 0x1000 size = 256 bytes [unlocked]
> block 1: offset = 0x2000 size = 256 bytes [unlocked]
> block 2: offset = 0x3000 size = 256 bytes [unlocked]
Hm, I just found the following in the mtd-utils [1]:
"offset and size must match on OTP region boundaries".
[1]
http://git.infradead.org/mtd-utils.git/blob/HEAD:/misc-utils/flash_otp_lock.c#l25
-michael
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-03-01 21:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-16 16:28 [PATCH v3 0/2] mtd: spi-nor: OTP support Michael Walle
2021-02-16 16:28 ` [PATCH v3 1/2] mtd: spi-nor: add " Michael Walle
2021-02-28 12:00 ` Tudor.Ambarus
2021-03-01 17:32 ` Michael Walle
2021-03-01 21:31 ` Michael Walle [this message]
2021-02-16 16:28 ` [PATCH v3 2/2] mtd: spi-nor: implement OTP support for Winbond and similar flashes Michael Walle
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=a6ee55184d91fa1c1802bd82290407bd@walle.cc \
--to=michael@walle.cc \
--cc=Tudor.Ambarus@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox