* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands @ 2014-10-05 16:39 Maxime Hadjinlian 2014-10-05 17:43 ` thomas.langer at lantiq.com 0 siblings, 1 reply; 14+ messages in thread From: Maxime Hadjinlian @ 2014-10-05 16:39 UTC (permalink / raw) To: u-boot 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 <maxime.hadjinlian@gmail.com> --- common/cmd_sf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/cmd_sf.c b/common/cmd_sf.c index c60e8d1..d5af3fe 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 16:39 [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands Maxime Hadjinlian @ 2014-10-05 17:43 ` thomas.langer at lantiq.com 2014-10-05 18:40 ` Maxime Hadjinlian 0 siblings, 1 reply; 14+ messages in thread From: thomas.langer at lantiq.com @ 2014-10-05 17:43 UTC (permalink / raw) To: u-boot 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 <maxime.hadjinlian@gmail.com> 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 <maxime.hadjinlian@gmail.com> --- common/cmd_sf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/cmd_sf.c b/common/cmd_sf.c index c60e8d1..d5af3fe 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 17:43 ` thomas.langer at lantiq.com @ 2014-10-05 18:40 ` Maxime Hadjinlian 2014-10-05 19:12 ` Marek Vasut 0 siblings, 1 reply; 14+ messages in thread From: Maxime Hadjinlian @ 2014-10-05 18:40 UTC (permalink / raw) To: u-boot Hi Thomas, all, On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. > > Best regards, > Thomas > > --- > Sent from my phone. > > Maxime Hadjinlian <maxime.hadjinlian@gmail.com> 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 <maxime.hadjinlian@gmail.com> > --- > > common/cmd_sf.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/common/cmd_sf.c b/common/cmd_sf.c > index c60e8d1..d5af3fe 100644 > --- a/common/cmd_sf.c > +++ b/common/cmd_sf.c > @@ -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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 18:40 ` Maxime Hadjinlian @ 2014-10-05 19:12 ` Marek Vasut 2014-10-05 19:19 ` thomas.langer at lantiq.com 0 siblings, 1 reply; 14+ messages in thread From: Marek Vasut @ 2014-10-05 19:12 UTC (permalink / raw) To: u-boot On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: > Hi Thomas, all, > > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. I wonder, do all SPI flashes need to do sector-aligned writes ? Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 19:12 ` Marek Vasut @ 2014-10-05 19:19 ` thomas.langer at lantiq.com 2014-10-05 19:27 ` Maxime Hadjinlian 0 siblings, 1 reply; 14+ messages in thread From: thomas.langer at lantiq.com @ 2014-10-05 19:19 UTC (permalink / raw) To: u-boot > On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: > > Hi Thomas, all, > > > > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. > > 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. > > Best regards, > Marek Vasut Best regards, Thomas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 19:19 ` thomas.langer at lantiq.com @ 2014-10-05 19:27 ` Maxime Hadjinlian 2014-10-05 19:45 ` Marek Vasut 0 siblings, 1 reply; 14+ messages in thread From: Maxime Hadjinlian @ 2014-10-05 19:27 UTC (permalink / raw) To: u-boot On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: >> > Hi Thomas, all, >> > >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. >> >> 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. 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. > >> >> Best regards, >> Marek Vasut > > Best regards, > Thomas ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 19:27 ` Maxime Hadjinlian @ 2014-10-05 19:45 ` Marek Vasut 2014-10-05 19:51 ` Maxime Hadjinlian 0 siblings, 1 reply; 14+ messages in thread From: Marek Vasut @ 2014-10-05 19:45 UTC (permalink / raw) To: u-boot On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: > On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: > >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: > >> > Hi Thomas, all, > >> > > >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. > >> > >> 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. > > 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 19:45 ` Marek Vasut @ 2014-10-05 19:51 ` Maxime Hadjinlian 2014-10-05 20:28 ` Marek Vasut 0 siblings, 1 reply; 14+ messages in thread From: Maxime Hadjinlian @ 2014-10-05 19:51 UTC (permalink / raw) To: u-boot On Sun, Oct 5, 2014 at 9:45 PM, Marek Vasut <marex@denx.de> wrote: > On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: >> On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: >> >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: >> >> > Hi Thomas, all, >> >> > >> >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. >> >> >> >> 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. >> >> 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. > > Best regards, > Marek Vasut ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 19:51 ` Maxime Hadjinlian @ 2014-10-05 20:28 ` Marek Vasut 2014-10-05 20:35 ` Maxime Hadjinlian 0 siblings, 1 reply; 14+ messages in thread From: Marek Vasut @ 2014-10-05 20:28 UTC (permalink / raw) To: u-boot On Sunday, October 05, 2014 at 09:51:27 PM, Maxime Hadjinlian wrote: > On Sun, Oct 5, 2014 at 9:45 PM, Marek Vasut <marex@denx.de> wrote: > > On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: > >> On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: > >> >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: > >> >> > Hi Thomas, all, > >> >> > > >> >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. > >> >> > >> >> 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. > >> > >> 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 20:28 ` Marek Vasut @ 2014-10-05 20:35 ` Maxime Hadjinlian 2014-10-05 20:55 ` Marek Vasut 0 siblings, 1 reply; 14+ messages in thread From: Maxime Hadjinlian @ 2014-10-05 20:35 UTC (permalink / raw) To: u-boot On Sun, Oct 5, 2014 at 10:28 PM, Marek Vasut <marex@denx.de> wrote: > On Sunday, October 05, 2014 at 09:51:27 PM, Maxime Hadjinlian wrote: >> On Sun, Oct 5, 2014 at 9:45 PM, Marek Vasut <marex@denx.de> wrote: >> > On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: >> >> On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: >> >> >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: >> >> >> > Hi Thomas, all, >> >> >> > >> >> >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. >> >> >> >> >> >> 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. >> >> >> >> 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 ? 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 ? > > Which SPI flash are you talking about and which controller ? > > Best regards, > Marek Vasut ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 20:35 ` Maxime Hadjinlian @ 2014-10-05 20:55 ` Marek Vasut 2014-10-08 8:35 ` Chin Liang See 0 siblings, 1 reply; 14+ messages in thread From: Marek Vasut @ 2014-10-05 20:55 UTC (permalink / raw) To: u-boot On Sunday, October 05, 2014 at 10:35:06 PM, Maxime Hadjinlian wrote: > On Sun, Oct 5, 2014 at 10:28 PM, Marek Vasut <marex@denx.de> wrote: > > On Sunday, October 05, 2014 at 09:51:27 PM, Maxime Hadjinlian wrote: > >> On Sun, Oct 5, 2014 at 9:45 PM, Marek Vasut <marex@denx.de> wrote: > >> > On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: > >> >> On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: > >> >> >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: > >> >> >> > Hi Thomas, all, > >> >> >> > > >> >> >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. > >> >> >> > >> >> >> 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. > >> >> > >> >> 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 ? > > 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-05 20:55 ` Marek Vasut @ 2014-10-08 8:35 ` Chin Liang See 2014-10-10 21:16 ` Maxime Hadjinlian 0 siblings, 1 reply; 14+ messages in thread From: Chin Liang See @ 2014-10-08 8:35 UTC (permalink / raw) To: u-boot On Sun, 2014-10-05 at 22:55 +0200, marex at denx.de wrote: > On Sunday, October 05, 2014 at 10:35:06 PM, Maxime Hadjinlian wrote: > > On Sun, Oct 5, 2014 at 10:28 PM, Marek Vasut <marex@denx.de> wrote: > > > On Sunday, October 05, 2014 at 09:51:27 PM, Maxime Hadjinlian wrote: > > >> On Sun, Oct 5, 2014 at 9:45 PM, Marek Vasut <marex@denx.de> wrote: > > >> > On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: > > >> >> On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: > > >> >> >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: > > >> >> >> > Hi Thomas, all, > > >> >> >> > > > >> >> >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. > > >> >> >> > > >> >> >> 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. > > >> >> > > >> >> 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 ? > > > > 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 > > Best regards, > Marek Vasut ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-08 8:35 ` Chin Liang See @ 2014-10-10 21:16 ` Maxime Hadjinlian 2014-10-11 16:22 ` Marek Vasut 0 siblings, 1 reply; 14+ messages in thread From: Maxime Hadjinlian @ 2014-10-10 21:16 UTC (permalink / raw) To: u-boot Hi all, On Wed, Oct 8, 2014 at 10:35 AM, Chin Liang See <clsee@altera.com> wrote: > On Sun, 2014-10-05 at 22:55 +0200, marex at denx.de wrote: >> On Sunday, October 05, 2014 at 10:35:06 PM, Maxime Hadjinlian wrote: >> > On Sun, Oct 5, 2014 at 10:28 PM, Marek Vasut <marex@denx.de> wrote: >> > > On Sunday, October 05, 2014 at 09:51:27 PM, Maxime Hadjinlian wrote: >> > >> On Sun, Oct 5, 2014 at 9:45 PM, Marek Vasut <marex@denx.de> wrote: >> > >> > On Sunday, October 05, 2014 at 09:27:00 PM, Maxime Hadjinlian wrote: >> > >> >> On Sun, Oct 5, 2014 at 9:19 PM, <thomas.langer@lantiq.com> wrote: >> > >> >> >> On Sunday, October 05, 2014 at 08:40:26 PM, Maxime Hadjinlian wrote: >> > >> >> >> > Hi Thomas, all, >> > >> >> >> > >> > >> >> >> > On Sun, Oct 5, 2014 at 7:43 PM, <thomas.langer@lantiq.com> 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. >> > >> >> >> >> > >> >> >> 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. >> > >> >> >> > >> >> 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 ? >> > >> > 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). 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. > > Chin Liang > >> >> Best regards, >> Marek Vasut > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands 2014-10-10 21:16 ` Maxime Hadjinlian @ 2014-10-11 16:22 ` Marek Vasut 0 siblings, 0 replies; 14+ messages in thread From: Marek Vasut @ 2014-10-11 16:22 UTC (permalink / raw) To: u-boot On Friday, October 10, 2014 at 11:16:05 PM, Maxime Hadjinlian wrote: > Hi all, Hi! [...] > >> +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). > > 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-10-11 16:22 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-05 16:39 [U-Boot] [PATCH] cmd_sf: add handler for +len arg for all commands Maxime Hadjinlian 2014-10-05 17:43 ` thomas.langer at lantiq.com 2014-10-05 18:40 ` Maxime Hadjinlian 2014-10-05 19:12 ` Marek Vasut 2014-10-05 19:19 ` thomas.langer at lantiq.com 2014-10-05 19:27 ` Maxime Hadjinlian 2014-10-05 19:45 ` Marek Vasut 2014-10-05 19:51 ` Maxime Hadjinlian 2014-10-05 20:28 ` Marek Vasut 2014-10-05 20:35 ` Maxime Hadjinlian 2014-10-05 20:55 ` Marek Vasut 2014-10-08 8:35 ` Chin Liang See 2014-10-10 21:16 ` Maxime Hadjinlian 2014-10-11 16:22 ` Marek Vasut
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox