Author: hailfinger
Date: 2009-05-31 20:00:57 +0200 (Sun, 31 May 2009)
New Revision: 557

Modified:
   trunk/flash.h
   trunk/flashrom.8
   trunk/flashrom.c
   trunk/it87spi.c
Log:
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 <[email protected]>
Tested-by: Harald Gutmann <[email protected]>
Acked-by: Harald Gutmann <[email protected]>


Modified: trunk/flash.h
===================================================================
--- trunk/flash.h       2009-05-31 17:57:34 UTC (rev 556)
+++ trunk/flash.h       2009-05-31 18:00:57 UTC (rev 557)
@@ -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;
@@ -752,6 +753,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);

Modified: trunk/flashrom.8
===================================================================
--- trunk/flashrom.8    2009-05-31 17:57:34 UTC (rev 556)
+++ trunk/flashrom.8    2009-05-31 18:00:57 UTC (rev 557)
@@ -133,6 +133,8 @@
 .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"

Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c    2009-05-31 17:57:34 UTC (rev 556)
+++ trunk/flashrom.c    2009-05-31 18:00:57 UTC (rev 557)
@@ -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,
+       },
+
        {},
 };
 
@@ -400,7 +413,7 @@
             "   -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 @@
                                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);

Modified: trunk/it87spi.c
===================================================================
--- trunk/it87spi.c     2009-05-31 17:57:34 UTC (rev 556)
+++ trunk/it87spi.c     2009-05-31 18:00:57 UTC (rev 557)
@@ -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++) {


-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to