Skip to contentSkip to conversation

sf: winbond: fix page_size

PATCH New Stephen Warren 2 participants 2 messages Aug 13, 2012 – Aug 14, 2012 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sf: winbond: fix page_size

From: Stephen Warren <[email protected]>

Commit a4ed3b6 "sf: inline data constants" modified winbond.c's page_size from 256 to 4096. This prevents either/both of "sf write" writing the correct data, or "sf read" from reading the correct data back.

This allows U-Boot running on Compulab Tegra to upgrade itself.

---
I'm not convinced there aren't other similar problems. At least eon.c's values don't make much sense to me; sector_size=256*16*16, yet total device size is just 256*16*nr_sectors. That was a pre-existing issue though. Another audit might make sense. This might be due to the apparent separation between page/sector/block, yet struct spi_flash only knowing about page and sectors, not blocks, leaving sf authors to wonder whether blocks are really sectors, or just to ignore blocks?

---
 drivers/mtd/spi/winbond.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/spi/winbond.c +1 -1
index 427b71f..1d90c1e 100644
@@ -94,7 +94,7 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
 	flash->write = spi_flash_cmd_write_multi;
 	flash->erase = spi_flash_cmd_erase;
 	flash->read = spi_flash_cmd_read_fast;
-	flash->page_size = 4096;
+	flash->page_size = 256;
 	flash->sector_size = 4096;
 	flash->size = 4096 * 16 * params->nr_blocks;
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 sf: winbond: fix page_size

Quoted 3 lines · On Monday 13 August 2012 18:46:21 Stephen Warren wrote:

Commit a4ed3b6 "sf: inline data constants" modified winbond.c's page_size from 256 to 4096. This prevents either/both of "sf write" writing the correct data, or "sf read" from reading the correct data back.

yeah, sorry about that. merged into my branch.

Quoted 4 lines

I'm not convinced there aren't other similar problems. At least eon.c's values don't make much sense to me; sector_size=256*16*16, yet total device size is just 256*16*nr_sectors. That was a pre-existing issue though.

yes, i get the feeling most spi drivers just copied an existing one, switched out some constants until it worked, and then moved on. i don't have an EON flashes, so i haven't looked too much.

Quoted 4 lines

Another audit might make sense. This might be due to the apparent separation between page/sector/block, yet struct spi_flash only knowing about page and sectors, not blocks, leaving sf authors to wonder whether blocks are really sectors, or just to ignore blocks?

part of it is that SPI flashes themselves aren't constant in terms of what they call blocks, sectors, and pages. so people have to read the datasheet and try and coordinate the meanings in that with how the spi flash code represents things, and coordinate with the erase commands that get used.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120814/2810c121/attachment.pgp>