cmd_sf: add handler for +len arg for all commands
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
This patch adds [+]len handler for the all the commands that will automatically round up the requested erase length to the flash's sector_size.
It was previously only available for the erase command.
---
common/cmd_sf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
common/cmd_sf.c +6 -6
@@ -245,8 +245,8 @@ static int do_spi_flash_read_write(int argc, char * const argv[]) offset =simple_strtoul (argv[2 ], &endp,16 );if (*argv[2 ] ==0 || *endp !=0 )return -1 ; - len =simple_strtoul (argv[3 ], &endp,16 ); -if (*argv[3 ] ==0 || *endp !=0 ) + len =sf_parse_len_arg (argv[3 ], &len); +if (ret !=1 )return -1 ;/* Consistency checking */
@@ -529,15 +529,15 @@ usage:U_BOOT_CMD ( sf,5 ,1 , do_spi_flash,"SPI flash sub-system" , +"Note: `+len' round up `len' to block size\n" "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n" " and chip select\n" -"sf read addr offset len - read `len' bytes starting at\n" +"sf read addr offset [+]len - read `len' bytes starting at\n" " `offset' to memory at `addr'\n" -"sf write addr offset len - write `len' bytes from memory\n" +"sf write addr offset [+]len - write `len' bytes from memory\n" " at `addr' to flash at `offset'\n" "sf erase offset [+]len - erase `len' bytes from `offset'\n" -" `+len' round up `len' to block size\n" -"sf update addr offset len - erase and write `len' bytes from memory\n" +"sf update addr offset [+]len - erase and write `len' bytes from memory\n" " at `addr' to flash at `offset'" SF_TEST_HELP );
Signature · 1 line
2.1.1
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.
Best regards,
Thomas
---
Sent from my phone.
Maxime Hadjinlian <[email protected]> hat geschrieben:
This patch adds [+]len handler for the all the commands that will automatically round up the requested erase length to the flash's sector_size.
It was previously only available for the erase command.
---
common/cmd_sf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
common/cmd_sf.c +6 -6
@@ -245,8 +245,8 @@ static int do_spi_flash_read_write(int argc, char * const argv[]) offset =simple_strtoul (argv[2 ], &endp,16 );if (*argv[2 ] ==0 || *endp !=0 )return -1 ; - len =simple_strtoul (argv[3 ], &endp,16 ); -if (*argv[3 ] ==0 || *endp !=0 ) + len =sf_parse_len_arg (argv[3 ], &len); +if (ret !=1 )return -1 ;/* Consistency checking */
@@ -529,15 +529,15 @@ usage:U_BOOT_CMD ( sf,5 ,1 , do_spi_flash,"SPI flash sub-system" , +"Note: `+len' round up `len' to block size\n" "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n" " and chip select\n" -"sf read addr offset len - read `len' bytes starting at\n" +"sf read addr offset [+]len - read `len' bytes starting at\n" " `offset' to memory at `addr'\n" -"sf write addr offset len - write `len' bytes from memory\n" +"sf write addr offset [+]len - write `len' bytes from memory\n" " at `addr' to flash at `offset'\n" "sf erase offset [+]len - erase `len' bytes from `offset'\n" -" `+len' round up `len' to block size\n" -"sf update addr offset len - erase and write `len' bytes from memory\n" +"sf update addr offset [+]len - erase and write `len' bytes from memory\n" " at `addr' to flash at `offset'" SF_TEST_HELP );
--
2.1.1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Hi Thomas, all,
Quoted 4 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.
Quoted 63 lines
Best regards,
Thomas---
Sent from my phone.Maxime Hadjinlian <[email protected]> hat geschrieben:
This patch adds [+]len handler for the all the commands that will automatically round up the requested erase length to the flash's
sector_size.
It was previously only available for the erase command.Signed-off-by Maxime Hadjinlian <[email protected]>---
common/cmd_sf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)common/cmd_sf.c +6
-7@@ -245,8 +245,8 @@ static int do_spi_flash_read_write(int argc, char * const argv[]) offset =simple_strtoul (argv[2 ], &endp,16 );if (*argv[2 ] ==0 || *endp !=0 )return -1 ; - len =simple_strtoul (argv[3 ], &endp,16 ); -if (*argv[3 ] ==0 || *endp !=0 ) + len =sf_parse_len_arg (argv[3 ], &len); +if (ret !=1 )return -1 ;/* Consistency checking */ @@ -529,15 +529,15 @@ usage:U_BOOT_CMD ( sf,5 ,1 , do_spi_flash,"SPI flash sub-system" , +"Note: `+len' round up `len' to block size\n" "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n" " and chip select\n" -"sf read addr offset len - read `len' bytes starting at\n" +"sf read addr offset [+]len - read `len' bytes starting at\n" " `offset' to memory at `addr'\n" -"sf write addr offset len - write `len' bytes from memory\n" +"sf write addr offset [+]len - write `len' bytes from memory\n" " at `addr' to flash at `offset'\n" "sf erase offset [+]len - erase `len' bytes from `offset'\n" -" `+len' round up `len' to block size\n" -"sf update addr offset len - erase and write `len' bytes from memory\n" +"sf update addr offset [+]len - erase and write `len' bytes from memory\n" " at `addr' to flash at `offset'" SF_TEST_HELP ); --2.1.1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 9 lines · Maxime Hadjinlian
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.
Quoted 6 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.
I wonder, do all SPI flashes need to do sector-aligned writes ?
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 10 lines · Maxime Hadjinlian
Quoted 9 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.
Quoted 8 lines
Quoted 6 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size.
Otherwise the current implementation of env_sf.c would also not work.
Quoted 3 lines
Best regards,
Marek Vasut
Best regards,
Thomas
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 17 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 17 lines · Maxime Hadjinlian
Quoted 15 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.
Quoted 5 lines
Quoted 1 line
I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size.
Otherwise the current implementation ofenv_sf.cwould also not work.
Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Quoted 7 lines
Quoted 4 lines
Best regards,
Marek VasutBest regards,
Thomas
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 18 lines · Maxime Hadjinlian
Quoted 17 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 17 lines · Maxime Hadjinlian
Quoted 15 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size.
Otherwise the current implementation ofenv_sf.cwould also not work.Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Aligned how exactly?
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 21 lines · Marek Vasut
Quoted 20 lines · Maxime Hadjinlian
Quoted 19 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 18 lines · Maxime Hadjinlian
Quoted 9 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.Quoted 6 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.I wonder, do all SPI flashes need to do sector-aligned writes ?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size.
Otherwise the current implementation ofenv_sf.cwould also not work.Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Aligned how exactly?
sector-aligned.
If I write anything that is not sector aligned, the 'sf' command will fail.
Quoted 3 lines
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 26 lines · Maxime Hadjinlian
Quoted 25 lines · Marek Vasut
Quoted 24 lines · Maxime Hadjinlian
Quoted 22 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 10 lines · Maxime Hadjinlian
Quoted 9 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.Quoted 8 lines
Quoted 6 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size. Otherwise the current implementation of
env_sf.cwould also not work.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Aligned how exactly?
sector-aligned.
If I write anything that is not sector aligned, the 'sf' command will fail.
Is that really a property of the SPI flash or the SPI controller ? And if the later, is it a property of a particular one or is that a common thing ?
Which SPI flash are you talking about and which controller ?
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 30 lines · Marek Vasut
Quoted 29 lines · Maxime Hadjinlian
Quoted 28 lines · Marek Vasut
Quoted 26 lines · Maxime Hadjinlian
Quoted 17 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 17 lines · Maxime Hadjinlian
Quoted 15 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.Quoted 5 lines
Quoted 1 line
I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size. Otherwise the current implementation of
env_sf.cwould also not work.Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Aligned how exactly?
sector-aligned.
If I write anything that is not sector aligned, the 'sf' command will fail.Is that really a property of the SPI flash or the SPI controller ? And if the later, is it a property of a particular one or is that a common thing ?
I'll have to check but if I remember correctly, it's the SPI flash. It's a Micron Serial NOR flash (N25Q512A83G1240x).
And the controller is the Cadence QSPI controller available on the SoC FPGA platform.
Maybe what caused my issues was the driver after all ?
Quoted 5 lines
Which SPI flash are you talking about and which controller ?
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 43 lines · Maxime Hadjinlian
Quoted 34 lines · Marek Vasut
Quoted 33 lines · Maxime Hadjinlian
Quoted 31 lines · Marek Vasut
Quoted 21 lines · Maxime Hadjinlian
Quoted 20 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 19 lines · Maxime Hadjinlian
Quoted 9 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.Quoted 7 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.I wonder, do all SPI flashes need to do sector-aligned writes ?
Quoted 7 lines
Quoted 4 lines
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size. Otherwise the current implementation of
env_sf.cwould also not work.Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Aligned how exactly?
Quoted 7 lines
Quoted 3 lines
sector-aligned.
If I write anything that is not sector aligned, the 'sf' command will fail.Is that really a property of the SPI flash or the SPI controller ? And if the later, is it a property of a particular one or is that a common thing ?
Quoted 5 lines
I'll have to check but if I remember correctly, it's the SPI flash. It's a Micron Serial NOR flash (N25Q512A83G1240x).
And the controller is the Cadence QSPI controller available on the SoC FPGA platform.
Maybe what caused my issues was the driver after all ?
+CC Altera guys, they might help too.
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 44 lines · marex at denx.de
Quoted 43 lines · Maxime Hadjinlian
Quoted 41 lines · Marek Vasut
Quoted 28 lines · Maxime Hadjinlian
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Maxime Hadjinlian
Quoted 24 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 18 lines · Maxime Hadjinlian
Quoted 9 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.Quoted 7 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.Quoted 1 line
I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size. Otherwise the current implementation of
env_sf.cwould also not work.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Aligned how exactly?
sector-aligned.
If I write anything that is not sector aligned, the 'sf' command will fail.Is that really a property of the SPI flash or the SPI controller ? And if the later, is it a property of a particular one or is that a common thing ?
Quoted 7 lines
Quoted 5 lines
I'll have to check but if I remember correctly, it's the SPI flash. It's a Micron Serial NOR flash (N25Q512A83G1240x).
And the controller is the Cadence QSPI controller available on the SoC FPGA platform.
Maybe what caused my issues was the driver after all ?+CC Altera guys, they might help too.
Hmmm.... quite strange to write for sector aligned. Wonder the write related to filesystem access?
Within Cadence QSPI controller, read and write access need to be done within a page. But that would be taken care by controller when the access beyond the next page. From software perspective, we just tell controller the numbers of bytes to be transfer (for indirect transfer setup).
Chin Liang
Quoted 3 lines
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Hi all,
Quoted 53 lines · Chin Liang See
Quoted 44 lines · marex at denx.de
Quoted 43 lines · Maxime Hadjinlian
Quoted 41 lines · Marek Vasut
Quoted 28 lines · Maxime Hadjinlian
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Maxime Hadjinlian
Quoted 24 lines · On Sun, Oct 5, 2014 at 9:19 PM, <[email protected]> wrote:
Quoted 18 lines · Maxime Hadjinlian
Quoted 9 lines
Hi Thomas, all,
Quoted 5 lines · On Sun, Oct 5, 2014 at 7:43 PM, <[email protected]> wrote:
Hello Maxime,
can you explain the usecase?
I think, only the erase is executed per sector, all other commands are working fine with a byte oriented length.Quoted 7 lines
I need to write a file that is downloaded through TFTP. So I can get the filesize through the variable of the same name, but if it's not rounded, the write command may fail.
I can save the filesize in another variable, but at next boot, when I need to read this file, I can't read the file, since I only know it's size in byte, I need to be able to round it again.Quoted 1 line
I wonder, do all SPI flashes need to do sector-aligned writes ?
All the serial flashes I have seen so far do support reading and writing with any length, independent from the erase size. Otherwise the current implementation of
env_sf.cwould also not work.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Well the QSPI, I used, does not. Every read and write has to be aligned. That's why I needed that in the first place.
Aligned how exactly?
sector-aligned.
If I write anything that is not sector aligned, the 'sf' command will fail.Is that really a property of the SPI flash or the SPI controller ? And if the later, is it a property of a particular one or is that a common thing ?
Quoted 7 lines
Quoted 5 lines
I'll have to check but if I remember correctly, it's the SPI flash. It's a Micron Serial NOR flash (N25Q512A83G1240x).
And the controller is the Cadence QSPI controller available on the SoC FPGA platform.
Maybe what caused my issues was the driver after all ?+CC Altera guys, they might help too.
Quoted 8 lines
Hmmm.... quite strange to write for sector aligned. Wonder the write related to filesystem access?
Within Cadence QSPI controller, read and write access need to be done within a page. But that would be taken care by controller when the access beyond the next page. From software perspective, we just tell controller the numbers of bytes to be transfer (for indirect transfer setup).
My needs have evolved a bit, and I no longer require this function. But I wasn't able to right a file tftp into RAM using 'sf update' without this patch.
I could try to reproduce the errors and maybe dig in a little more.
Quoted 8 lines
Chin Liang
Quoted 3 lines
Best regards,
Marek Vasut
PATCH 1/1 cmd_sf: add handler for +len arg for all commands
Quoted 1 line · Maxime Hadjinlian
Hi all,
Hi!
[...]
Quoted 11 lines
Quoted 10 lines
Quoted 1 line
+CC Altera guys, they might help too.
Hmmm.... quite strange to write for sector aligned. Wonder the write related to filesystem access?
Within Cadence QSPI controller, read and write access need to be done within a page. But that would be taken care by controller when the access beyond the next page. From software perspective, we just tell controller the numbers of bytes to be transfer (for indirect transfer setup).
Quoted 4 lines
My needs have evolved a bit, and I no longer require this function. But I wasn't able to right a file tftp into RAM using 'sf update' without this patch.
I could try to reproduce the errors and maybe dig in a little more.
This would be really helpful. Esp. since the Cadence QSPI driver is coming to mainline in next MW.
Thank you!
Best regards,
Marek Vasut