From: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
To: Michael Walle <michael@walle.cc>
Cc: <clg@kaod.org>, <linux-kernel@vger.kernel.org>,
<linux-mtd@lists.infradead.org>, <p.yadav@ti.com>,
<quic_ggregory@quicinc.com>, <quic_jiles@quicinc.com>,
<tudor.ambarus@microchip.com>
Subject: Re: [PATCH] mtd: spi-nor: winbond: add support for W25Q512NW-IQ/IN
Date: Fri, 15 Jul 2022 15:35:19 -0700 [thread overview]
Message-ID: <c628e868-5c73-ca4b-1f99-60cc149806bf@quicinc.com> (raw)
In-Reply-To: <b42cb229-f241-6e29-a138-29023ce316d9@quicinc.com>
Hi Michael,
On 7/15/2022 1:15 PM, Jae Hyun Yoo wrote:
> Hi Michael,
>
> On 7/14/2022 7:30 AM, Jae Hyun Yoo wrote:
>> On 7/14/2022 7:21 AM, Michael Walle wrote:
>>> Am 2022-07-14 16:16, schrieb Michael Walle:
>>>> Am 2022-07-14 15:47, schrieb Jae Hyun Yoo:
>>>>> On 7/14/2022 12:41 AM, Michael Walle wrote:
>>>>>> What does "doesn't boot at all" mean? Are there any kernel startup
>>>>>> messages?
>>>>>
>>>>> I'm sharing the error messages below.
>>>>
>>>> Thanks.
>>>>
>>>>> [ 0.748594] spi-nor spi0.0: w25q512nwq (65536 Kbytes)
>>>>> [ 0.865216] spi-aspeed-smc 1e620000.spi: CE0 read buswidth:4
>>>>> [0x406c0741]
>>>>> [ 0.872833] ------------[ cut here ]------------
>>>>> [ 0.877984] WARNING: CPU: 1 PID: 1 at drivers/mtd/mtdcore.c:583
>>>>> add_mtd_device+0x28c/0x53c
>>>>> [ 0.887237] CPU: 1 PID: 1 Comm: swapper/0 Not tainted
>>>>> 5.15.43-AUTOINC-dirty-23801a6 #1
>>>>
>>>> Could you please try it on the latest (vanilla) linux-next?
>>>
>>> or spi-nor/next [1] as there are quite a lot of changes. The
>>> patches shall be based on that.
>>
>> Okay. Let me try that. I tested it using 5.15.43 with back-ported
>> spi-nor patches from the latest. I'll back-port more changes from
>> the spi-nor/next and will test the INFO(0xef6020, 0, 0, 0) setting
>> again.
>
> I tested the setting again after cherry picking all SPI relating changes
> from the 'for-next' branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi repository.
>
> No luck! It's still making the same warning dump at 'add_mtd_device'
> since 'mtd->erasesize' is checked as 0.
>
> I traced it further to check if the erasesize is properly parsed from
> the sfdp and checked that erase map seems parsed and initialized
> correctly in 'spi_nor_parse_bfpt' but problem is, a target
> mtd->erasesize is not properly selected in 'spi_nor_select_erase' since
> the 'wanted_size' variable is initialized as sector size of info table
> so a selected target mtd->erasesize is also 0 so looks like it's the
> reason why it can't initialize mtd device if we use
> INFO(0xef6020, 0, 0, 0).
>
> Also, checked that the mtd->erasesize is set to 4096 if I enable
> CONFIG_MTD_SPI_NOR_USE_4K_SECTORS so the SPI flash can be initialized
> with the INFO(0xef6020, 0, 0, 0) setting but, it should cover even when
> the configuration is not enabled. I think, this patch should go as it
> is. The erasesize selecting issue could be fixed using a separate
> patch.
>
> Are you still sure that the INFO(0xef6020, 0, 0, 0) works in the
> latest spi-next?
I also tried to fix the issue and made a fix like below.
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 502967c76c5f..f8a020f80a56 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2117,7 +2117,7 @@ spi_nor_select_uniform_erase(struct
spi_nor_erase_map *map,
* If the current erase size is the one, stop here:
* we have found the right uniform Sector Erase command.
*/
- if (tested_erase->size == wanted_size) {
+ if (wanted_size && tested_erase->size == wanted_size) {
erase = tested_erase;
break;
}
Tested that it makes the INFO(0xef6020, 0, 0, 0) setting work and a
selected mtd->erasesize is 65536 which is what I expected for this
device.
Not sure if it's a right fix or not. Please review and let me know if
it's good to submit or not.
Thanks,
Jae
> Thanks,
>
> Jae
>
>> -Jae
>>
>>> -michael
>>>
>>> [1]
>>> git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git#spi-nor/next
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2022-07-15 23:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-10 14:57 [PATCH] mtd: spi-nor: winbond: add support for W25Q512NW-IQ/IN Jae Hyun Yoo
2022-07-11 6:24 ` Cédric Le Goater
2022-07-11 9:50 ` Michael Walle
2022-07-13 14:26 ` Jae Hyun Yoo
2022-07-13 14:32 ` Michael Walle
2022-07-13 21:01 ` Jae Hyun Yoo
2022-07-14 7:41 ` Michael Walle
2022-07-14 13:47 ` Jae Hyun Yoo
2022-07-14 14:16 ` Michael Walle
2022-07-14 14:21 ` Michael Walle
2022-07-14 14:30 ` Jae Hyun Yoo
2022-07-15 20:15 ` Jae Hyun Yoo
2022-07-15 22:35 ` Jae Hyun Yoo [this message]
2022-07-15 23:03 ` Michael Walle
2022-07-15 23:15 ` Jae Hyun Yoo
2022-07-15 23:20 ` Michael Walle
2022-07-15 23:26 ` Jae Hyun Yoo
2022-07-15 22:52 ` Michael Walle
2022-07-15 23:04 ` Jae Hyun Yoo
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=c628e868-5c73-ca4b-1f99-60cc149806bf@quicinc.com \
--to=quic_jaehyoo@quicinc.com \
--cc=clg@kaod.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=p.yadav@ti.com \
--cc=quic_ggregory@quicinc.com \
--cc=quic_jiles@quicinc.com \
--cc=tudor.ambarus@microchip.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