Avoid false detection of SMSC FDC37N972 when Infineon TPM is present
[coreboot.git] / util / superiotool / smsc.c
index 260f3bb20851f085713f95c1987a226c065c311f..012ffbd7daf11a7f3e2aff6ad28a944106be9b1b 100644 (file)
@@ -396,7 +396,7 @@ static const struct superio_registers reg_table[] = {
        {0x4d, "MEC1308", {
                {NOLDN, NULL,
                        {0x02,0x03,0x07,0x17,0x20,0x21,0x22,0x23,0x24,0x25,
-                        0x26,0x27,0X28,0X29,0X2a,0X2b,0X2c,0X2d,0X2e,0X2f,
+                        0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
                         EOT},
                        {0x00,RSVD,0x00,RSVD,0x4d,0x00,0x00,0x00,0x04,0x04,
                         MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,
@@ -408,7 +408,7 @@ static const struct superio_registers reg_table[] = {
                        {0x30,0x60,0x61,0x70,EOT},
                        {0x00,0x00,0x00,0x00,EOT}},
                {0x7, "KBD",
-                       {0x30,0x70,0x72,0xF0,EOT},
+                       {0x30,0x70,0x72,0xf0,EOT},
                        {0x00,0x00,0x00,0x00,EOT}},
                {0x8, "EC/ACPI",
                        {0x30,0x60,0x61,EOT},
@@ -678,6 +678,37 @@ static const struct superio_registers reg_table[] = {
        {0x7c, "SCH3112", {
                {EOT}}},
        {0x7d, "SCH3114", {
+               {NOLDN, NULL,
+                       {0x02,0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,
+                        0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
+                       {0x00,RSVD,0x7D,RSVD,0x00,RSVD,0x44,MISC,0x00,
+                        RSVD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
+               {0x0, "Floppy",
+                       {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
+                        0xf5,EOT},
+                       {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
+                        0x00,EOT}},
+               {0x3, "Parallel port",
+                       {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
+                       {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
+               {0x4, "COM1",
+                       {0x30,0x60,0x61,0x70,0xf0,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,EOT}},
+               {0x5, "COM2",
+                       {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
+               {0x7, "Keyboard",
+                       {0x30,0x70,0x72,0xf0,EOT},
+                       {0x00,0x00,0x00,0x00,EOT}},
+               {0xa, "Runtime registers",
+                       {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,NANA,0x00,0x04,EOT}},
+               {0xb, "COM3",
+                       {0x30,0x60,0x61,0x70,0xf0,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,EOT}},
+               {0xc, "COM4",
+                       {0x30,0x60,0x61,0x70,0xf0,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,EOT}},
                {EOT}}},
        {0x7f, "SCH3116", {
                {EOT}}},
@@ -813,6 +844,19 @@ static void probe_idregs_smsc_helper(uint16_t port, uint8_t idreg,
                return;
        }
 
+       /* Infineon TPM causes false match of FDC37N972 */
+       if (idreg == DEVICE_ID_REG && revreg == DEVICE_REV_REG &&
+           id == 0x0b && rev == 0x00) {
+               /* Infineon sets config port in 0x27:0x26, but SMSC does not */
+               if (((regval(port, 0x27)<<8)|regval(port, 0x26)) == port) {
+                       if (verbose)
+                               printf(NOTFOUND "id=0x%02x, rev=0x%02x\n",
+                                       id, rev);
+                       exit_conf_mode_smsc(port);
+                       return;
+               }
+       }
+
        printf("Found %s %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
               (id == 0x77 ? "ASUS" : "SMSC"), get_superio_name(reg_table, id),
               id, rev, port);