mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: SHUKLA Mamta Ramendra <mamta.shukla@leica-geosystems.com>,
	"pratyush@kernel.org" <pratyush@kernel.org>,
	"michael@walle.cc" <michael@walle.cc>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	"richard@nod.at" <richard@nod.at>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: GEO-CHHER-bsp-development  <bsp-development.geo@leica-geosystems.com>
Subject: Re: [PATCH v2] mtd: micron-st: enable lock/unlock for mt25qu512a
Date: Thu, 5 Oct 2023 14:51:50 +0100	[thread overview]
Message-ID: <2d7271b3-dd60-44bb-9700-f6a5295ea873@linaro.org> (raw)
In-Reply-To: <a24d7b3b-4077-9dbe-49ae-96f595b42223@leica-geosystems.com>



On 10/5/23 10:21, SHUKLA Mamta Ramendra wrote:

cut

>>
>> and the second one will add just the BP support, something like:
>> diff --git a/drivers/mtd/spi-nor/micron-st.c
>> b/drivers/mtd/spi-nor/micron-st.c
>> index a8da1f18e335..fdafbfa0f936 100644
>> --- a/drivers/mtd/spi-nor/micron-st.c
>> +++ b/drivers/mtd/spi-nor/micron-st.c
>> @@ -405,6 +405,8 @@ static const struct flash_info st_nor_parts[] = {
>>          }, {
>>                  .id = SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00),
>>                  .name = "mt25qu512a",
>> +               .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB |
>> SPI_NOR_4BIT_BP |
>> +                        SPI_NOR_BP3_SR_BIT6,
>>                  .mfr_flags = USE_FSR,
>>          }, {
>>                  .id = SNOR_ID(0x20, 0xbb, 0x20),
>>
>> Of course, I expect you to run again the mtd_debug tests and also verify
>> the locking. Thanks!
> 
> I applied both changes as mentioned above i.e
> 1] Switch to SFDP and 2] Using BP Flags.
> 
> Case 1: Use BP Flags and Switch to SFDP
> With both these changes, the lock/unlock doesn't work.
> 
> ## x86-64-smarc-evk-uwd0j0007 # uname -r
> 6.6.0-rc2
> 
> # flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x4000000
> Lock status: unlocked
> Return code: 0
> # flash_lock -l /dev/mtd0
> flash_lock: error!: could not lock device: /dev/mtd0
> 
>              error 5 (Input/output error)
> 
> 
> I suspected this is because of miscalculation of BP bits, like the 
> possibility mentioned here: 
> https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?h=spi-nor/next&id=3ea3f0ac242c86c0275d347ab8c92bf1eb854b49 
> 
> 
> But further checked size, it is correct:
> 
>   # mtd_debug info /dev/mtd0
> mtd.type = MTD_NORFLASH
> mtd.flags = MTD_CAP_NORFLASH
> mtd.size = 67108864 (64M)
> mtd.erasesize = 4096 (4K)
> mtd.writesize = 1
> mtd.oobsize = 0
> regions = 0
> 
> And rest of read/write functions work as expected.
> 
> Any suggestions about this?
> 
> Case 2: Just added BP flags, rest of the size, mfr_flags, fixup flags 
> kept as it is.

would you please detail what exact definitions you used in case 2? Send
us the diff please.

Cheers,
ta

> Lock/unlock works.
> 
> ## x86-64-smarc-evk-uwd0j0007 # uname -r
> 6.6.0-rc2
> 
> # flash_lock -i /dev/mtd0
> Start: 0
> Len: 0x4000000
> Lock status: unlocked
> Return code: 0
> 
> # flash_lock -l /dev/mtd0
> # flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x4000000
> Lock status: locked
> Return code: 1
> 
> ## x86-64-smarc-evk-uwd0j0007 # mtd_debug erase /dev/mtd0 0 1048576
> [  413.472411] spi-nor spi-PRP0001:00: Erase operation failed.
> [  413.478084] spi-nor spi-PRP0001:00: Attempted to modify a protected 
> sector.
> MEMERASE: Input/output error
> 
> # flash_lock -u /dev/mtd0
> # flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x4000000
> Lock status: unlocked
> Return code: 0
> 
> ## x86-64-smarc-evk-uwd0j0007 #  mtd_debug erase /dev/mtd0 0 1048576
> Erased 1048576 bytes from address 0x00000000 in flash
> 
> 
> Further I tested on stable 6.5.5 Kernel with old way of Flash Info 
> Format and which has forced PARSE_SFDP Flag, no issues with lock/unlock.
> 
> 
> ---
> Mamta

  reply	other threads:[~2023-10-05 16:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 15:49 Mamta Shukla
2023-07-06  6:42 ` Michael Walle
2023-07-13  3:43 ` Tudor Ambarus
2023-07-14  8:15   ` SHUKLA Mamta Ramendra
2023-08-22 12:16     ` SHUKLA Mamta Ramendra
2023-09-21 14:31       ` Tudor Ambarus
2023-09-21 14:35         ` Tudor Ambarus
2023-10-05  9:21         ` SHUKLA Mamta Ramendra
2023-10-05 13:51           ` Tudor Ambarus [this message]
2023-10-05 14:21             ` SHUKLA Mamta Ramendra
2023-10-05 14:59               ` Tudor Ambarus
2023-10-06 10:30                 ` SHUKLA Mamta Ramendra
2023-10-06 13:33                   ` Tudor Ambarus
2023-10-06 13:46                     ` Tudor Ambarus
2023-10-06 16:09                       ` SHUKLA Mamta Ramendra
2023-10-09  6:13                         ` Tudor Ambarus
2023-10-16  9:39                           ` SHUKLA Mamta Ramendra
2023-10-17  7:53                             ` Tudor Ambarus
2023-10-17 13:53                               ` SHUKLA Mamta Ramendra

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=2d7271b3-dd60-44bb-9700-f6a5295ea873@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=bsp-development.geo@leica-geosystems.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mamta.shukla@leica-geosystems.com \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --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

all inboxes | Powered by JetHome®