From: chaochao2021666 <chaochao2021666@163.com>
To: "Jagan Teki" <jagan@amarulasolutions.com>
Cc: Tudor.Ambarus@microchip.com, chao.zeng@siemens.com,
u-boot@lists.denx.de, trini@konsulko.com,
jan.kiszka@siemens.com, vigneshr@ti.com,
baocheng.su@siemens.com, le.jin@siemens.com
Subject: Re:Re: [PATCH] sf: Querying write-protect status before operating the flash
Date: Tue, 9 Nov 2021 09:52:57 +0800 (CST) [thread overview]
Message-ID: <7bce9791.f95.17d0265f91e.Coremail.chaochao2021666@163.com> (raw)
In-Reply-To: <CAMty3ZCMToWri1=mPXWaUKsGoH_kC-boexfv620eEdg+0KdFzA@mail.gmail.com>
HI jagan and ta
I might have a different view, the caller can not get the correct response even though we can not
operate the device sucessfully.
I think it is necessary to return a valid value.
if return 0, the device cannot actually be operated but the correct results are not possible
BRs
Chao
At 2021-11-06 02:08:04, "Jagan Teki" <jagan@amarulasolutions.com> wrote:
>On Fri, Nov 5, 2021 at 10:47 PM <Tudor.Ambarus@microchip.com> wrote:
>>
>> Hi,
>>
>> On 6/22/21 8:21 AM, chao zeng wrote:
>> > From: Chao Zeng <chao.zeng@siemens.com>
>> >
>> > When operating the write-protection flash,spi_flash_std_write() and
>> > spi_flash_std_erase() would return wrong result.The flash is protected,
>> > but write or erase the flash would show "OK".
>> >
>> > Check the flash write protection state if the write-protection has enbale
>> > before operating the flash.
>> >
>> > Signed-off-by: Chao Zeng <chao.zeng@siemens.com>
>> > ---
>> >
>> > drivers/mtd/spi/sf_probe.c | 10 ++++++++++
>> > 1 file changed, 10 insertions(+)
>> >
>> > diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
>> > index 3befbe91ca..f06e6b88bd 100644
>> > --- a/drivers/mtd/spi/sf_probe.c
>> > +++ b/drivers/mtd/spi/sf_probe.c
>> > @@ -109,6 +109,11 @@ static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
>> > struct mtd_info *mtd = &flash->mtd;
>> > size_t retlen;
>> >
>> > + if (flash->flash_is_locked && flash->flash_is_locked(flash, offset, len)) {
>> > + debug("SF: Flash is locked\n");
>> > + return -ENOPROTOOPT;
>>
>> Keep a debug message, but return 0 please. Writes or erases on protected areas
>> are ignored by the flash, we should reflect that in the code.
>
>Agreed this point, Chao are you fine to do this change while applying it?
>
>Jagan.
next prev parent reply other threads:[~2021-11-09 1:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 5:21 [PATCH] sf: Querying write-protect status before operating the flash chao zeng
2021-06-29 13:50 ` Jagan Teki
2021-09-08 4:55 ` chaochao2021666
2021-09-13 7:48 ` Jan Kiszka
2021-10-04 13:36 ` Jan Kiszka
2021-11-03 12:18 ` Jan Kiszka
2021-11-04 16:06 ` Tom Rini
2021-11-05 17:17 ` Tudor.Ambarus
2021-11-05 18:08 ` Jagan Teki
2021-11-08 9:50 ` [PATCH] sf: Querying write-protect status before operating the Michael Walle
2021-11-08 11:01 ` Tudor.Ambarus
2021-11-09 1:52 ` chaochao2021666 [this message]
2021-11-09 8:14 ` [PATCH] sf: Querying write-protect status before operating the flash Tudor.Ambarus
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=7bce9791.f95.17d0265f91e.Coremail.chaochao2021666@163.com \
--to=chaochao2021666@163.com \
--cc=Tudor.Ambarus@microchip.com \
--cc=baocheng.su@siemens.com \
--cc=chao.zeng@siemens.com \
--cc=jagan@amarulasolutions.com \
--cc=jan.kiszka@siemens.com \
--cc=le.jin@siemens.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--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).