[flashrom] Autodetect ITE IT87* LPC->SPI translation

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Mar 22 14:33:40 CET 2010


On 22.03.2010 05:02, Ian-Xue Li wrote:
> On Mon, Mar 22, 2010 at 04:17:35AM +0100, Carl-Daniel Hailfinger wrote:
>   
>> flashrom -p it87spi -V
>> superiotool -deV
>> lspci -nnvvxxx
>>     
>
> Okay, wow, the first line seems to do the trick. :)
>   

Nice. Could you try the attached patch with
flashrom -V
and send the log? I tried to enable autodetection.


> The flash chip is now found, has only an UNTESTED feature: ERASE.
> Anyways, I still attach the infomation you requested.
>   

Thanks.

Autodetect ITE IT87* LPC->SPI translation on all boards without the need
for a board enable.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: flashrom-it87_autodetect/it87spi.c
===================================================================
--- flashrom-it87_autodetect/it87spi.c	(Revision 968)
+++ flashrom-it87_autodetect/it87spi.c	(Arbeitskopie)
@@ -106,6 +106,14 @@
 		enter_conf_mode_ite(port);
 		/* NOLDN, reg 0x24, mask out lowest bit (suspend) */
 		tmp = sio_read(port, 0x24) & 0xFE;
+		/* If IT87SPI was not explicitly selected, we want to check
+		 * quickly if LPC->SPI translation is active.
+		 */
+		if ((programmer == PROGRAMMER_INTERNAL) && !(tmp & (0x0E))) {
+			msg_pdbg("No IT87* serial flash segment enabled.\n");
+			exit_conf_mode_ite(port);
+			break;
+		}
 		msg_pdbg("Serial flash segment 0x%08x-0x%08x %sabled\n",
 		       0xFFFE0000, 0xFFFFFFFF, (tmp & 1 << 1) ? "en" : "dis");
 		msg_pdbg("Serial flash segment 0x%08x-0x%08x %sabled\n",
@@ -135,12 +143,17 @@
 			free(programmer_param);
 			programmer_param = NULL;
 		}
-		if (programmer_param && (portpos = strstr(programmer_param, "port="))) {
-			portpos += 5;
-			flashport = strtol(portpos, (char **)NULL, 0);
-			msg_pinfo("Forcing serial flash port 0x%04x\n", flashport);
-			sio_write(port, 0x64, (flashport >> 8));
-			sio_write(port, 0x65, (flashport & 0xff));
+		if (programmer_param) {
+			portpos = extract_param(&programmer_param,
+						"it87spiport=", ",:");
+			if (portpos) {
+				flashport = strtol(portpos, (char **)NULL, 0);
+				msg_pinfo("Forcing serial flash port 0x%04x\n",
+					  flashport);
+				sio_write(port, 0x64, (flashport >> 8));
+				sio_write(port, 0x65, (flashport & 0xff));
+				free(portpos);
+			}
 		}
 		exit_conf_mode_ite(port);
 		break;
Index: flashrom-it87_autodetect/internal.c
===================================================================
--- flashrom-it87_autodetect/internal.c	(Revision 968)
+++ flashrom-it87_autodetect/internal.c	(Arbeitskopie)
@@ -173,6 +173,9 @@
 		       "will most likely fail.\n");
 	}
 
+	/* Probe for IT87* LPC->SPI translation unconditionally. */
+	it87xx_probe_spi_flash(NULL);
+
 	board_flash_enable(lb_vendor, lb_part);
 
 	/* Even if chipset init returns an error code, we don't want to abort.


-- 
"I do consider assignment statements and pointer variables to be among
computer science's most valuable treasures."
-- Donald E. Knuth





More information about the flashrom mailing list