summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-02-21 18:13:26 +0100
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>2014-03-17 21:54:57 +0530
commitbf64035a159f114d0fb93391acb7f5e73eb020e6 (patch)
tree053a7dba54ab462cc95f7e92c99c7ab826229912
parent7dfc4dbd2d1592ee420945afe6a82003c374b0de (diff)
downloadu-boot-imx-bf64035a159f114d0fb93391acb7f5e73eb020e6.zip
u-boot-imx-bf64035a159f114d0fb93391acb7f5e73eb020e6.tar.gz
u-boot-imx-bf64035a159f114d0fb93391acb7f5e73eb020e6.tar.bz2
mtd: spi: Fix page size for S25FL032P,S25FL064P
The commit 6af8dc3ebccb3b1e4b2e479315e49545e7f53150 broke support for S25FL032P and S25FL064P by carelessly removing the code handling special page size for these two SPI NOR flashes and unifying the code under the assumption that Extended JEDEC ID of 0x4d00 always implies 512b page size. Add special case handling for these two SPI NOR flashes. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
-rw-r--r--drivers/mtd/spi/sf_probe.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index e84ab13..0a46fe3 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -146,7 +146,21 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
/* Compute the flash size */
flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
- flash->page_size = ((ext_jedec == 0x4d00) ? 512 : 256) << flash->shift;
+ /*
+ * The Spansion S25FL032P and S25FL064P have 256b pages, yet use the
+ * 0x4d00 Extended JEDEC code. The rest of the Spansion flashes with
+ * the 0x4d00 Extended JEDEC code have 512b pages. All of the others
+ * have 256b pages.
+ */
+ if (ext_jedec == 0x4d00) {
+ if ((jedec == 0x0215) || (jedec == 0x216))
+ flash->page_size = 256;
+ else
+ flash->page_size = 512;
+ } else {
+ flash->page_size = 256;
+ }
+ flash->page_size <<= flash->shift;
flash->sector_size = params->sector_size << flash->shift;
flash->size = flash->sector_size * params->nr_sectors << flash->shift;
#ifdef CONFIG_SF_DUAL_FLASH