Add detection and dump support for the Winbond WPCD376I.

Signed-off-by: Sean Young <sean@mess.org>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4931 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/util/superiotool/nsc.c b/util/superiotool/nsc.c
index c5d5b52..982a01d 100644
--- a/util/superiotool/nsc.c
+++ b/util/superiotool/nsc.c
@@ -400,7 +400,7 @@
 		{EOT}}},
 	{0xf0, "PC87372", {
 		{EOT}}},
-	{0xf1, "PC8374L", {
+	{0x0f1, "PC8374L", {
 		{NOLDN, NULL,
 			{0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26,
 			 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
@@ -442,6 +442,45 @@
 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x05,EOT}},
 		{EOT}}},
+	{0x8f1, "WPCD376I", {
+		{NOLDN, NULL,
+			{0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26,
+			 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
+			{0x00,0x00,0x00,0xf1,0x11,0x00,0x00,0x00,RSVD,0x00,
+			 MISC,RSVD,0x01,0x2e,RSVD,RSVD,RSVD,RSVD,RSVD,EOT}},
+		{0x0, "Floppy",
+			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf8,
+			 EOT},
+			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,0x24,
+			 EOT}},
+		{0x1, "Parallel port",
+			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf8,EOT},
+			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,0x07,EOT}},
+		{0x2, "IR",
+			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
+			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
+		{0x3, "COM1",
+			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
+			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
+		{0x4, "System wake-up control (SWC)",
+			{0x30,0x50,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
+			 EOT},
+			{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,
+			 EOT}},
+		{0x5, "Mouse",
+			{0x30,0x70,0x71,0x74,0x75,EOT},
+			{0x00,0x0c,0x02,0x04,0x04,EOT}},
+		{0x6, "Keyboard",
+			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
+			 EOT},
+			{0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
+			 EOT}},
+		{0x7, "GPIO",
+			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
+			 0xf2,0xf3,0xf8,EOT},
+			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC,
+			 0x00,MISC,0x01,EOT}},
+		{EOT}}},
 	{0xf2, "PC87427", {
 		/* SRID[7..5] is marked as "not applicable for the PC87427". */
 		{NOLDN, NULL,
@@ -512,6 +551,7 @@
 void probe_idregs_nsc(uint16_t port)
 {
 	uint8_t id, rev;
+	uint16_t magic;
 
 	probing_for("NSC", "", port);
 
@@ -532,17 +572,28 @@
 		rev = INB(port + 1);
 	}
 
-	if (superio_unknown(reg_table, id)) {
+	/*
+	 * NSC PC8374L has ID 0xf1, rev 0b000xxxxx according to datasheet.
+	 * Winbond WPCD376I has ID 0xf1, rev 0b100xxxxx according to datasheet.
+	 */
+	if (id == 0xf1)
+		magic = ((rev & 0xe0) << 4) | id;
+	else
+		magic = id;
+
+	if (superio_unknown(reg_table, magic)) {
 		if (verbose)
 			printf(NOTFOUND "sid=0x%02x, srid=0x%02x\n", id, rev);
 		return;
 	}
 
-	printf("Found NSC %s (sid=0x%02x, srid=0x%02x) at 0x%x\n",
-	       get_superio_name(reg_table, id), id, rev, port);
+	printf("Found %s %s (sid=0x%02x, srid=0x%02x) at 0x%x\n",
+	       magic == 0x8f1 ? "Winbond" : "NSC",
+	       get_superio_name(reg_table, magic), id, rev, port);
 	chip_found = 1;
 
-	dump_superio("NSC", reg_table, port, id, LDN_SEL);
+	dump_superio(magic == 0x8f1 ? "Winbond" : "NSC",
+		     reg_table, port, magic, LDN_SEL);
 }
 
 void print_nsc_chips(void)