summaryrefslogtreecommitdiffstats
path: root/it87spi.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-05-31 18:00:57 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-05-31 18:00:57 +0000
commitb8afecd0f5b87d319e5be385d670bb6bf368d7f8 (patch)
tree97fc6f5f98b27d821d7a3a917742ea8020bd4528 /it87spi.c
parent1dfe0ff1745118406f2ca0d03340dd346cc39770 (diff)
downloadflashrom-b8afecd0f5b87d319e5be385d670bb6bf368d7f8.tar.gz
flashrom-b8afecd0f5b87d319e5be385d670bb6bf368d7f8.tar.bz2
flashrom-b8afecd0f5b87d319e5be385d670bb6bf368d7f8.zip
Add IT87xx SPI as external flasher option
This is a fast way to test if a IT87xx board_enable() would work. Corresponding to flashrom svn r557. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Tested-by: Harald Gutmann <harald.gutmann@gmx.net> Acked-by: Harald Gutmann <harald.gutmann@gmx.net>
Diffstat (limited to 'it87spi.c')
-rw-r--r--it87spi.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/it87spi.c b/it87spi.c
index 2a7be850e..d9f93e632 100644
--- a/it87spi.c
+++ b/it87spi.c
@@ -93,7 +93,7 @@ static uint16_t find_ite_spi_flash_port(uint16_t port)
return flashport;
}
-int it87xx_probe_spi_flash(const char *name)
+int it87spi_common_init(void)
{
it8716f_flashport = find_ite_spi_flash_port(ITE_SUPERIO_PORT1);
@@ -106,6 +106,19 @@ int it87xx_probe_spi_flash(const char *name)
return (!it8716f_flashport);
}
+
+int it87spi_init(void)
+{
+ get_io_perms();
+
+ return it87spi_common_init();
+}
+
+int it87xx_probe_spi_flash(const char *name)
+{
+ return it87spi_common_init();
+}
+
/*
* The IT8716F only supports commands with length 1,2,4,5 bytes including
* command byte and can not read more than 3 bytes from the device.
@@ -241,7 +254,7 @@ int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf)
int i;
fast_spi = 0;
- if (total_size > 512 * 1024) {
+ if ((programmer == PROGRAMMER_IT87SPI) || (total_size > 512 * 1024)) {
for (i = 0; i < total_size; i += 3) {
int toread = 3;
if (total_size - i < toread)
@@ -264,7 +277,7 @@ int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf)
* IT8716F only allows maximum of 512 kb SPI chip size for memory
* mapped access.
*/
- if (total_size > 512 * 1024) {
+ if ((programmer == PROGRAMMER_IT87SPI) || (total_size > 512 * 1024)) {
it8716f_spi_chip_write_1(flash, buf);
} else {
for (i = 0; i < total_size / 256; i++) {