Commit b8afecd0 authored by Carl-Daniel Hailfinger's avatar Carl-Daniel Hailfinger
Browse files

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: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: default avatarHarald Gutmann <harald.gutmann@gmx.net>
Acked-by: default avatarHarald Gutmann <harald.gutmann@gmx.net>
parent 1dfe0ff1
......@@ -84,6 +84,7 @@ extern int programmer;
#define PROGRAMMER_DUMMY 0x01
#define PROGRAMMER_NIC3COM 0x02
#define PROGRAMMER_SATASII 0x03
#define PROGRAMMER_IT87SPI 0x04
struct programmer_entry {
const char *vendor;
......@@ -752,6 +753,7 @@ int ich_spi_write_256(struct flashchip *flash, uint8_t * buf);
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);
......
......@@ -133,6 +133,8 @@ Specify the programmer device. Currently supported are:
.sp
.BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)"
.sp
.BR "* it87spi" " (for flash ROMs behind a IT87xx SuperI/O LPC/SPI translation unit)"
.sp
If you have multiple supported PCI cards which can program flash chips
(NICs, SATA/IDE controllers, etc.) in your system, you must use the
.B "flashrom -p xxxx=bb:dd.f"
......
......@@ -87,6 +87,19 @@ const struct programmer_entry programmer_table[] = {
.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,
},
{},
};
......@@ -400,7 +413,7 @@ void usage(const char *name)
" -i | --image <name>: only flash image name from flash layout\n"
" -L | --list-supported: print supported devices\n"
" -p | --programmer <name>: specify the programmer device\n"
" (internal, dummy, nic3com, satasii)\n"
" (internal, dummy, nic3com, satasii, it87spi)\n"
" -h | --help: print this help text\n"
" -R | --version: print the version (release)\n"
"\nIf no file is specified, then all that happens"
......@@ -532,6 +545,8 @@ int main(int argc, char *argv[])
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);
......
......@@ -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++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment