[PATCH] cmd: sf: align erase and write on erase block boundary
    Marek Vasut 
    marek.vasut at mailbox.org
       
    Sun Oct 12 17:36:10 CEST 2025
    
    
  
On 9/22/25 8:48 AM, Ye Li wrote:
Hello again,
I'm sorry for the horribly late reply.
>>> 在 2025/9/19 20:20, Marek Vasut 写道:
>>>> On 9/19/25 9:01 AM, Ye Li wrote:
>>>>> From: Viorel Suman <viorel.suman at nxp.com>
>>>>>
>>>>> Align erase and write on erase block boundary in line
>>>>> with how read was aligned in commit 622b5d35613.
>>>> What is the issue that is being fixed here ?
>>>>
>>> Previous commit 622b5d35613 tried to fix issue that offset is not 
>>> sector size aligned. But it only use the aligned offset read_offset 
>>> for flash read, not use it for erase and write. So still unaligned 
>>> offset send to spi_flash_erase and spi_flash_write.> What is the 
>>> reproducer ?
>>>>
>>> If the address is neither page or sector aligned, we meet issue with 
>>> flash update
>> What exact command do I run to trigger the problem, what is the 
>> failing result without this patch, what is the passing result with 
>> this patch ?
> You can use "sf update" command to reproduce the issue.
> Without the patch:
> u-boot=> sf update 0x94000000 0x10 0x20
> device 0 offset 0x10, size 0x20
> SPI flash failed in erase step
> 
> With the patch:
> u-boot=> sf update 0x94000000 0x10 0x20
> device 0 offset 0x10, size 0x20
> 32 bytes written, 0 bytes skipped in 0.20s, speed 1424 B/s
Thank you for the test case, this helped a lot.
If you want to do a V2, please include the test case in the commit message.
In either case:
Reviewed-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
Tested-by: Marek Vasut <marek.vasut+renesas at mailbox.org> # R-Car V4H 
Sparrow Hawk
Thank you !
    
    
More information about the U-Boot
mailing list