summaryrefslogtreecommitdiff
path: root/include/spi_flash.h
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-09-11 20:26:21 -0700
committerVadim Bendebury <vbendeb@chromium.org>2011-09-12 10:57:07 -0700
commite82ef9a5caec018af0a9bd2aea9870358b1f1313 (patch)
tree854c6ffd37b2908c371616fbe08d72cd7e044c54 /include/spi_flash.h
parent9f73d3dd20e1eac2e27d56992d94dc3d4bdbb883 (diff)
Allow smaller write units in SPI flash drivers.
There is a problem with x86 systems using Intel ICH chips as the SPI controller: whereas the SPI chips allow for 256 byte pages for write transactions, the controllers allow for only 64 bytes per transaction. This causes failures when the chip driver invokes the controller driver write() function passing a 256 byte page: only 64 bytes get written. This problem is not easy to fix in u-boot, this change suggests a scheme to allow the size override for certain SPI controllers. BUG=chromium-os:20105 TEST=manual . this change was tested combined with other modification, the ability to read and save the 16KB environment in a maconix SPI flash was demonstrated. Change-Id: Ic42f294da0e6abd554107d6189cabd7269370b96 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/7522 Reviewed-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'include/spi_flash.h')
-rw-r--r--include/spi_flash.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/spi_flash.h b/include/spi_flash.h
index a384071fbee..525a3497cd4 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -26,6 +26,16 @@
#include <spi.h>
#include <linux/types.h>
+#ifndef CONFIG_BOARDDIR
+#error Make sure config.h is included before this file
+#endif
+
+#ifdef CONFIG_ICH_SPI
+#define CONTROLLER_PAGE_LIMIT 64
+#else
+#define CONTROLLER_PAGE_LIMIT MAX_INT
+#endif
+
struct spi_flash {
struct spi_slave *spi;