mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
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>
This commit is contained in:
parent
1dfe0ff174
commit
b8afecd0f5
2
flash.h
2
flash.h
@ -84,6 +84,7 @@ extern int programmer;
|
|||||||
#define PROGRAMMER_DUMMY 0x01
|
#define PROGRAMMER_DUMMY 0x01
|
||||||
#define PROGRAMMER_NIC3COM 0x02
|
#define PROGRAMMER_NIC3COM 0x02
|
||||||
#define PROGRAMMER_SATASII 0x03
|
#define PROGRAMMER_SATASII 0x03
|
||||||
|
#define PROGRAMMER_IT87SPI 0x04
|
||||||
|
|
||||||
struct programmer_entry {
|
struct programmer_entry {
|
||||||
const char *vendor;
|
const char *vendor;
|
||||||
@ -752,6 +753,7 @@ int ich_spi_write_256(struct flashchip *flash, uint8_t * buf);
|
|||||||
extern uint16_t it8716f_flashport;
|
extern uint16_t it8716f_flashport;
|
||||||
void enter_conf_mode_ite(uint16_t port);
|
void enter_conf_mode_ite(uint16_t port);
|
||||||
void exit_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 it87xx_probe_spi_flash(const char *name);
|
||||||
int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt,
|
int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt,
|
||||||
const unsigned char *writearr, unsigned char *readarr);
|
const unsigned char *writearr, unsigned char *readarr);
|
||||||
|
@ -133,6 +133,8 @@ Specify the programmer device. Currently supported are:
|
|||||||
.sp
|
.sp
|
||||||
.BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)"
|
.BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)"
|
||||||
.sp
|
.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
|
If you have multiple supported PCI cards which can program flash chips
|
||||||
(NICs, SATA/IDE controllers, etc.) in your system, you must use the
|
(NICs, SATA/IDE controllers, etc.) in your system, you must use the
|
||||||
.B "flashrom -p xxxx=bb:dd.f"
|
.B "flashrom -p xxxx=bb:dd.f"
|
||||||
|
17
flashrom.c
17
flashrom.c
@ -87,6 +87,19 @@ const struct programmer_entry programmer_table[] = {
|
|||||||
.chip_writel = fallback_chip_writel,
|
.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"
|
" -i | --image <name>: only flash image name from flash layout\n"
|
||||||
" -L | --list-supported: print supported devices\n"
|
" -L | --list-supported: print supported devices\n"
|
||||||
" -p | --programmer <name>: specify the programmer device\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"
|
" -h | --help: print this help text\n"
|
||||||
" -R | --version: print the version (release)\n"
|
" -R | --version: print the version (release)\n"
|
||||||
"\nIf no file is specified, then all that happens"
|
"\nIf no file is specified, then all that happens"
|
||||||
@ -532,6 +545,8 @@ int main(int argc, char *argv[])
|
|||||||
programmer = PROGRAMMER_SATASII;
|
programmer = PROGRAMMER_SATASII;
|
||||||
if (optarg[7] == '=')
|
if (optarg[7] == '=')
|
||||||
pcidev_bdf = strdup(optarg + 8);
|
pcidev_bdf = strdup(optarg + 8);
|
||||||
|
} else if (strncmp(optarg, "it87spi", 7) == 0) {
|
||||||
|
programmer = PROGRAMMER_IT87SPI;
|
||||||
} else {
|
} else {
|
||||||
printf("Error: Unknown programmer.\n");
|
printf("Error: Unknown programmer.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
19
it87spi.c
19
it87spi.c
@ -93,7 +93,7 @@ static uint16_t find_ite_spi_flash_port(uint16_t port)
|
|||||||
return flashport;
|
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);
|
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);
|
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
|
* 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.
|
* 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;
|
int i;
|
||||||
fast_spi = 0;
|
fast_spi = 0;
|
||||||
|
|
||||||
if (total_size > 512 * 1024) {
|
if ((programmer == PROGRAMMER_IT87SPI) || (total_size > 512 * 1024)) {
|
||||||
for (i = 0; i < total_size; i += 3) {
|
for (i = 0; i < total_size; i += 3) {
|
||||||
int toread = 3;
|
int toread = 3;
|
||||||
if (total_size - i < toread)
|
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
|
* IT8716F only allows maximum of 512 kb SPI chip size for memory
|
||||||
* mapped access.
|
* mapped access.
|
||||||
*/
|
*/
|
||||||
if (total_size > 512 * 1024) {
|
if ((programmer == PROGRAMMER_IT87SPI) || (total_size > 512 * 1024)) {
|
||||||
it8716f_spi_chip_write_1(flash, buf);
|
it8716f_spi_chip_write_1(flash, buf);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < total_size / 256; i++) {
|
for (i = 0; i < total_size / 256; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user