* [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
@ 2021-02-13 15:10 David Bauer
2021-03-08 5:50 ` Tudor.Ambarus
0 siblings, 1 reply; 7+ messages in thread
From: David Bauer @ 2021-02-13 15:10 UTC (permalink / raw)
To: linux-mtd; +Cc: richard, miquel.raynal, vigneshr, tudor.ambarus
The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
sectors as well as block protection and Dual-/Quad-read.
Tested on: Ubiquiti UniFi 6 LR
Signed-off-by: David Bauer <mail@david-bauer.net>
---
drivers/mtd/spi-nor/winbond.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index e5dfa786f190..49d0d7993368 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -95,6 +95,10 @@ static const struct flash_info winbond_parts[] = {
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+ { "w25q512jv", INFO(0xef4020, 0, 64 * 1024, 1024,
+ SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ |
+ SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
+ SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) },
{ "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) },
};
--
2.30.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
2021-02-13 15:10 [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV David Bauer
@ 2021-03-08 5:50 ` Tudor.Ambarus
2021-03-08 18:03 ` David Bauer
0 siblings, 1 reply; 7+ messages in thread
From: Tudor.Ambarus @ 2021-03-08 5:50 UTC (permalink / raw)
To: mail, linux-mtd, shuhao.mai.1990; +Cc: miquel.raynal, richard, vigneshr
On 2/13/21 5:10 PM, David Bauer wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
> sectors as well as block protection and Dual-/Quad-read.
>
> Tested on: Ubiquiti UniFi 6 LR
>
> Signed-off-by: David Bauer <mail@david-bauer.net>
David, I'll take Shuhao's patch because he sent it first:
https://patchwork.ozlabs.org/project/linux-mtd/patch/20210208075303.4200-1-shuhao.mai.1990@gmail.com/
Would you make an incremental patch on top op Shuhao's, to add the
locking support?
Shuhao, can you please test the locking ops with mtd-utils?
> ---
> drivers/mtd/spi-nor/winbond.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
> index e5dfa786f190..49d0d7993368 100644
> --- a/drivers/mtd/spi-nor/winbond.c
> +++ b/drivers/mtd/spi-nor/winbond.c
> @@ -95,6 +95,10 @@ static const struct flash_info winbond_parts[] = {
> SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
> { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512,
> SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
> + { "w25q512jv", INFO(0xef4020, 0, 64 * 1024, 1024,
> + SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ |
> + SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
> + SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) },
Looks good. Let's put these flags in some king of order:
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP
Cheers,
ta
> { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
> SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) },
> };
> --
> 2.30.1
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
2021-03-08 5:50 ` Tudor.Ambarus
@ 2021-03-08 18:03 ` David Bauer
2021-03-09 7:53 ` Tudor.Ambarus
0 siblings, 1 reply; 7+ messages in thread
From: David Bauer @ 2021-03-08 18:03 UTC (permalink / raw)
To: Tudor.Ambarus, linux-mtd, shuhao.mai.1990
Cc: miquel.raynal, richard, vigneshr
Hi Tudor,
On 3/8/21 6:50 AM, Tudor.Ambarus@microchip.com wrote:
> On 2/13/21 5:10 PM, David Bauer wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
>> sectors as well as block protection and Dual-/Quad-read.
>>
>> Tested on: Ubiquiti UniFi 6 LR
>>
>> Signed-off-by: David Bauer <mail@david-bauer.net>
>
> David, I'll take Shuhao's patch because he sent it first:
> https://patchwork.ozlabs.org/project/linux-mtd/patch/20210208075303.4200-1-shuhao.mai.1990@gmail.com/
Fine with me, I have not found this patch :)
>
> Would you make an incremental patch on top op Shuhao's, to add the
> locking support?
Sure, It's necessary for the board (UniFi 6 LR), as the bootloader locks the flash on boot.
I'll send a new patch for the lock support.
Best
David
>
> Shuhao, can you please test the locking ops with mtd-utils?
>
>
>> ---
>> drivers/mtd/spi-nor/winbond.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
>> index e5dfa786f190..49d0d7993368 100644
>> --- a/drivers/mtd/spi-nor/winbond.c
>> +++ b/drivers/mtd/spi-nor/winbond.c
>> @@ -95,6 +95,10 @@ static const struct flash_info winbond_parts[] = {
>> SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
>> { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512,
>> SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
>> + { "w25q512jv", INFO(0xef4020, 0, 64 * 1024, 1024,
>> + SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ |
>> + SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
>> + SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) },
>
> Looks good. Let's put these flags in some king of order:
>
> SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
> SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
> SPI_NOR_4BIT_BP
>
> Cheers,
> ta
>
>
>> { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
>> SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) },
>> };
>> --
>> 2.30.1
>>
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
2021-03-08 18:03 ` David Bauer
@ 2021-03-09 7:53 ` Tudor.Ambarus
2021-03-10 7:41 ` Shuhao Mai
0 siblings, 1 reply; 7+ messages in thread
From: Tudor.Ambarus @ 2021-03-09 7:53 UTC (permalink / raw)
To: mail, linux-mtd, shuhao.mai.1990; +Cc: miquel.raynal, richard, vigneshr
On 3/8/21 8:03 PM, David Bauer wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi Tudor,
>
> On 3/8/21 6:50 AM, Tudor.Ambarus@microchip.com wrote:
>> On 2/13/21 5:10 PM, David Bauer wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
>>> sectors as well as block protection and Dual-/Quad-read.
>>>
>>> Tested on: Ubiquiti UniFi 6 LR
>>>
>>> Signed-off-by: David Bauer <mail@david-bauer.net>
>>
>> David, I'll take Shuhao's patch because he sent it first:
>> https://patchwork.ozlabs.org/project/linux-mtd/patch/20210208075303.4200-1-shuhao.mai.1990@gmail.com/
>
> Fine with me, I have not found this patch :)
>
>>
>> Would you make an incremental patch on top op Shuhao's, to add the
>> locking support?
>
> Sure, It's necessary for the board (UniFi 6 LR), as the bootloader locks the flash on boot.
Is it necessary to unlock the flash at boot time?
You can unlock the flash from user-space, using mtd-utils.
Have you tried to lock/unlock portions of the flash using mtd-utils,
and check if what was locked corresponds to what the datasheet indicates?
>
> I'll send a new patch for the lock support.
>
Great, thanks!
ta
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
2021-03-09 7:53 ` Tudor.Ambarus
@ 2021-03-10 7:41 ` Shuhao Mai
2021-04-16 19:24 ` David Bauer
0 siblings, 1 reply; 7+ messages in thread
From: Shuhao Mai @ 2021-03-10 7:41 UTC (permalink / raw)
To: Tudor.Ambarus; +Cc: mail, linux-mtd, miquel.raynal, richard, vigneshr
On Tue, Mar 09, 2021 at 07:53:59AM +0000, Tudor.Ambarus@microchip.com wrote:
> On 3/8/21 8:03 PM, David Bauer wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > Hi Tudor,
> >
> > On 3/8/21 6:50 AM, Tudor.Ambarus@microchip.com wrote:
> >> On 2/13/21 5:10 PM, David Bauer wrote:
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
> >>> sectors as well as block protection and Dual-/Quad-read.
> >>>
> >>> Tested on: Ubiquiti UniFi 6 LR
> >>>
> >>> Signed-off-by: David Bauer <mail@david-bauer.net>
> >>
> >> David, I'll take Shuhao's patch because he sent it first:
> >> https://patchwork.ozlabs.org/project/linux-mtd/patch/20210208075303.4200-1-shuhao.mai.1990@gmail.com/
> >
> > Fine with me, I have not found this patch :)
> >
> >>
> >> Would you make an incremental patch on top op Shuhao's, to add the
> >> locking support?
> >
> > Sure, It's necessary for the board (UniFi 6 LR), as the bootloader locks the flash on boot.
>
> Is it necessary to unlock the flash at boot time?
> You can unlock the flash from user-space, using mtd-utils.
>
> Have you tried to lock/unlock portions of the flash using mtd-utils,
> and check if what was locked corresponds to what the datasheet indicates?
>
> >
> > I'll send a new patch for the lock support.
> >
> Great, thanks!
> ta
Hi Tudor and David,
I made a quick test on flash_lock with kernel 5.8.18 and mtd-utils
v2.1.2. It returns "could not lock device: /dev/mtd0" and "error 22
(Invalid argument)".
Could be the error caused by my test environment, if it's functional on
UniFi 6 LR.
Sincerely
Shuhao
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
2021-03-10 7:41 ` Shuhao Mai
@ 2021-04-16 19:24 ` David Bauer
2021-05-05 2:25 ` Shuhao Mai
0 siblings, 1 reply; 7+ messages in thread
From: David Bauer @ 2021-04-16 19:24 UTC (permalink / raw)
To: Shuhao Mai, Tudor.Ambarus; +Cc: linux-mtd, miquel.raynal, richard, vigneshr
Hi Shuhao,
Sorry for coming back late to this.
On 3/10/21 8:41 AM, Shuhao Mai wrote:
> On Tue, Mar 09, 2021 at 07:53:59AM +0000, Tudor.Ambarus@microchip.com wrote:
>> On 3/8/21 8:03 PM, David Bauer wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Tudor,
>>>
>>> On 3/8/21 6:50 AM, Tudor.Ambarus@microchip.com wrote:
>>>> On 2/13/21 5:10 PM, David Bauer wrote:
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
>>>>> sectors as well as block protection and Dual-/Quad-read.
>>>>>
>>>>> Tested on: Ubiquiti UniFi 6 LR
>>>>>
>>>>> Signed-off-by: David Bauer <mail@david-bauer.net>
>>>>
>>>> David, I'll take Shuhao's patch because he sent it first:
>>>> https://patchwork.ozlabs.org/project/linux-mtd/patch/20210208075303.4200-1-shuhao.mai.1990@gmail.com/
>>>
>>> Fine with me, I have not found this patch :)
>>>
>>>>
>>>> Would you make an incremental patch on top op Shuhao's, to add the
>>>> locking support?
>>>
>>> Sure, It's necessary for the board (UniFi 6 LR), as the bootloader locks the flash on boot.
>>
>> Is it necessary to unlock the flash at boot time?
>> You can unlock the flash from user-space, using mtd-utils.
>>
>> Have you tried to lock/unlock portions of the flash using mtd-utils,
>> and check if what was locked corresponds to what the datasheet indicates?
>>
>>>
>>> I'll send a new patch for the lock support.
>>>
>> Great, thanks!
>> ta
>
> Hi Tudor and David,
>
>
> I made a quick test on flash_lock with kernel 5.8.18 and mtd-utils
> v2.1.2. It returns "could not lock device: /dev/mtd0" and "error 22
> (Invalid argument)".
>
> Could be the error caused by my test environment, if it's functional on
> UniFi 6 LR.
Were these partitions starting with the first / ending with the last block on the flash chip?
Locking / unlocking mtd partitions not aligned at the beginning / end of the chip sound will
return invalid argument.
For the UniFi 6 LR, these flags are required, as otherwise the lower half of the flash
remains write protected (the bootloader actively enables this protection for whatever reason).
I'll send a rebased patch adding the required flags shortly.
Best wishes
David
>
>
> Sincerely
> Shuhao
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
2021-04-16 19:24 ` David Bauer
@ 2021-05-05 2:25 ` Shuhao Mai
0 siblings, 0 replies; 7+ messages in thread
From: Shuhao Mai @ 2021-05-05 2:25 UTC (permalink / raw)
To: David Bauer; +Cc: Tudor.Ambarus, linux-mtd, miquel.raynal, richard, vigneshr
On Fri, Apr 16, 2021 at 09:24:39PM +0200, David Bauer wrote:
> Hi Shuhao,
>
> Sorry for coming back late to this.
>
> On 3/10/21 8:41 AM, Shuhao Mai wrote:
> > On Tue, Mar 09, 2021 at 07:53:59AM +0000, Tudor.Ambarus@microchip.com wrote:
> >> On 3/8/21 8:03 PM, David Bauer wrote:
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> Hi Tudor,
> >>>
> >>> On 3/8/21 6:50 AM, Tudor.Ambarus@microchip.com wrote:
> >>>> On 2/13/21 5:10 PM, David Bauer wrote:
> >>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>>>
> >>>>> The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
> >>>>> sectors as well as block protection and Dual-/Quad-read.
> >>>>>
> >>>>> Tested on: Ubiquiti UniFi 6 LR
> >>>>>
> >>>>> Signed-off-by: David Bauer <mail@david-bauer.net>
> >>>>
> >>>> David, I'll take Shuhao's patch because he sent it first:
> >>>> https://patchwork.ozlabs.org/project/linux-mtd/patch/20210208075303.4200-1-shuhao.mai.1990@gmail.com/
> >>>
> >>> Fine with me, I have not found this patch :)
> >>>
> >>>>
> >>>> Would you make an incremental patch on top op Shuhao's, to add the
> >>>> locking support?
> >>>
> >>> Sure, It's necessary for the board (UniFi 6 LR), as the bootloader locks the flash on boot.
> >>
> >> Is it necessary to unlock the flash at boot time?
> >> You can unlock the flash from user-space, using mtd-utils.
> >>
> >> Have you tried to lock/unlock portions of the flash using mtd-utils,
> >> and check if what was locked corresponds to what the datasheet indicates?
> >>
> >>>
> >>> I'll send a new patch for the lock support.
> >>>
> >> Great, thanks!
> >> ta
> >
> > Hi Tudor and David,
> >
> >
> > I made a quick test on flash_lock with kernel 5.8.18 and mtd-utils
> > v2.1.2. It returns "could not lock device: /dev/mtd0" and "error 22
> > (Invalid argument)".
> >
> > Could be the error caused by my test environment, if it's functional on
> > UniFi 6 LR.
> Were these partitions starting with the first / ending with the last block on the flash chip?
> Locking / unlocking mtd partitions not aligned at the beginning / end of the chip sound will
> return invalid argument.
>
> For the UniFi 6 LR, these flags are required, as otherwise the lower half of the flash
> remains write protected (the bootloader actively enables this protection for whatever reason).
>
> I'll send a rebased patch adding the required flags shortly.
>
> Best wishes
> David
>
Hi David,
Thanks for advise, but the invalid argument is not caused by partition
alignment. I traced the flow of flash_lock, and it does relate to my
choice of platform.
In the function 'spi_nor_write_16bit_sr_and_check()', it will try to
read SR2 before writing to SR1. However, there's no handler for reading
SR2 in 'spi-nor/controllers/intel-spi.c'. It will return Invalid argument
if we try to do any operation to SR2 on Intel's platform currently.
Best Regards,
Shuhao
> >
> >
> > Sincerely
> > Shuhao
> >
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-05 2:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-13 15:10 [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV David Bauer
2021-03-08 5:50 ` Tudor.Ambarus
2021-03-08 18:03 ` David Bauer
2021-03-09 7:53 ` Tudor.Ambarus
2021-03-10 7:41 ` Shuhao Mai
2021-04-16 19:24 ` David Bauer
2021-05-05 2:25 ` Shuhao Mai
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).