Add IT87xx SPI as external flasher option. This is a fast way to test if a IT87xx board_enable() would work.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-it87spi_external/flash.h =================================================================== --- flashrom-it87spi_external/flash.h (Revision 555) +++ flashrom-it87spi_external/flash.h (Arbeitskopie) @@ -84,6 +84,7 @@ #define PROGRAMMER_DUMMY 0x01 #define PROGRAMMER_NIC3COM 0x02 #define PROGRAMMER_SATASII 0x03 +#define PROGRAMMER_IT87SPI 0x04
struct programmer_entry { const char *vendor; @@ -741,6 +742,7 @@ extern uint16_t it8716f_flashport; void enter_conf_mode_ite(uint16_t port); void exit_conf_mode_ite(uint16_t port); +int it87spi_init(void); int it87xx_probe_spi_flash(const char *name); int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); Index: flashrom-it87spi_external/it87spi.c =================================================================== --- flashrom-it87spi_external/it87spi.c (Revision 555) +++ flashrom-it87spi_external/it87spi.c (Arbeitskopie) @@ -93,7 +93,7 @@ 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 @@ 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 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 @@ * 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++) { Index: flashrom-it87spi_external/flashrom.c =================================================================== --- flashrom-it87spi_external/flashrom.c (Revision 555) +++ flashrom-it87spi_external/flashrom.c (Arbeitskopie) @@ -87,6 +87,19 @@ .chip_writel = fallback_chip_writel, },
+ { + .init = it87spi_init, + .shutdown = dummy_shutdown, + .map_flash_region = dummy_map, + .unmap_flash_region = dummy_unmap, + .chip_readb = dummy_chip_readb, + .chip_readw = dummy_chip_readw, + .chip_readl = dummy_chip_readl, + .chip_writeb = dummy_chip_writeb, + .chip_writew = dummy_chip_writew, + .chip_writel = dummy_chip_writel, + }, + {}, };
@@ -532,6 +545,8 @@ programmer = PROGRAMMER_SATASII; if (optarg[7] == '=') pcidev_bdf = strdup(optarg + 8); + } else if (strncmp(optarg, "it87spi", 7) == 0) { + programmer = PROGRAMMER_IT87SPI; } else { printf("Error: Unknown programmer.\n"); exit(1);