Add registers for the it8671f chip.
[coreboot.git] / util / superiotool / ite.c
index 1cfa3170379fd4ea97fdf2b4192f0f1ad547b600..0d21850df0690acddd0c20a93144eb3ce52df8ef 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the superiotool project.
  *
  * Copyright (C) 2007 Carl-Daniel Hailfinger
- * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2007-2008 Uwe Hermann <uwe@hermann-uwe.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #define ISA_PNP_ADDR           0x279
 
 static const struct superio_registers reg_table[] = {
+       {0x8228, "IT8228E", {
+               {EOT}}},
+       {0x8510, "IT8510E/TE/G", {
+               {EOT}}},
+       {0x8511, "IT8511E/TE/G", {
+               {EOT}}},
        {0x8661, "IT8661F/IT8770F", {
                {NOLDN, NULL,
                        {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x20,0x21,0x22,
@@ -63,6 +69,75 @@ static const struct superio_registers reg_table[] = {
        {0x8673, "IT8673F", {
                {EOT}}},
        {0x8681, "IT8671F/IT8687R", {
+               {NOLDN, NULL,
+                       {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x2E,0x2F,EOT},
+                       {NANA,NANA,NANA,NANA,NANA,NANA,0x00,NANA,0x86,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
+               {0x0, "Floppy disk controller",
+                       {0x30,0x31,0x60,0x61,0x70,0x71,0x74,0xF0,EOT},
+                       {0x00,0x00,0x03,0xF0,0x06,0x02,0x02,0x00,EOT}},
+               {0x1, "COM1",
+                       {0x30,0x31,0x60,0x61,0x70,0x71,0xF0,EOT},
+                       {0x00,0x00,0x03,0xF8,0x04,0x02,0x00,EOT}},
+               {0x2, "COM2",
+                       {0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0x72,0x73,0x74,0x75,0xF0,0xF1,EOT},
+                       {0x00,0x00,0x02,0xF8,0x03,0x00,0x03,0x02,0x0A,0x02,0x00,0x01,0x00,0x00,EOT}},
+               {0x3, "Parallel port",
+                       {0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0xF0,EOT},
+                       {0x00,0x00,0x01,0x78,0x07,0x78,0x07,0x02,0x03,0x03,EOT}},
+               {0x4, "APC",
+                       {0x30,0xF0,0xF1,0xF2,0xF4,0xF5,0xF6,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,0x00,NANA,EOT}},
+               {0x5, "Keyboard",
+                       {0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0xF0,EOT},
+                       {0x01,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x00,EOT}},
+               {0x6, "Mouse",
+                       {0x30,0x70,0x71,0xF0,EOT},
+                       {0x00,0x0C,0x02,0x00,EOT}},
+               {0x7, "GPIO and Alternative function",
+                       {0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x70,0x71,0x72,0x73,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0xE0,0xE1,0xE2,0xE3,0xE4,EOT},
+                       {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
+               {EOT}}},
+       {0x8701, "IT8703F", {
+               {NOLDN, NULL,
+                       {0x20,0x21,0x23,0x24,0x26,0x29,0x2A,0x2B,EOT},
+                       {0x87,0x00,0x00,0x80,0x00,0x00,0x7C,0xC0,EOT}},
+               {0x0, "Floppy disk controller",
+                       {0x30,0x60,0x61,0x70,0x74,0xF0,0xF1,0xF2,0xF3,0xF4,
+                        0xF5,EOT},
+                       {0x00,0x03,0xf0,0x06,0x02,0x0E,0x00,0xFF,0x00,0x00,
+                        0x00,EOT}},
+               {0x1, "Parallel port",
+                       {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,EOT},
+                       {0x00,0x03,0x78,0x00,0x80,0x07,0x03,0x03,EOT}},
+               {0x2, "Serial port 1",
+                       {0x30,0x60,0x61,0x70,0xf0,EOT},
+                       {0x00,0x03,0xf8,0x04,0x00,EOT}},
+               {0x3, "Serial port 2",
+                       {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,0xf3,EOT},
+                       {0x00,0x02,0xf8,0x03,0x00,0x00,0x00,0x7f,EOT}},
+               {0x5, "Keyboard controller",
+                       {0x30,0x60,0x61,0x62,0x63,0x70,0x71,0xf0,EOT},
+                       {0x01,0x00,0x60,0x00,0x64,0x01,0x0C,0x80,EOT}},
+               {0x6, "Consumer IR",
+                       {0x30,0x60,0x61,0x70,EOT},
+                       {0x00,0x00,0x00,0x00,EOT}},
+               {0x7, "Game port, MIDI, GPIO set 1",
+                       {0x30,0x60,0x61,0x62,0x63,0x70,0xF0,0xF1,0xF2,EOT},
+                       {0x00,0x02,0x01,0x03,0x30,0x00,0xFF,0x00,0x00,EOT}},
+               {0x8, "GPIO set 2",
+                       {0x30,0xF0,0xF1,0xF2,0xF3,0xF5,EOT},
+                       {0x00,0xFF,0x00,0x00,0x00,0x00,EOT}},
+               {0x9, "GPIO set 3 and 4",
+                       {0x30,0x60,0x61,0xF0,0xF1,0xF2,0xF3,0xF4,EOT},
+                       {0x00,0x02,0x90,0xFF,0x00,0x00,0x00,0x00,EOT}},
+               {0xA, "ACPI",
+                       {0x30,0x70,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
+                        0xF3,0xF4,0xF6,0xF7,0xF9,EOT},
+                       {0x00,0x00,0x00,0x00,NANA,NANA,0x00,0x00,0x00,0x00,
+                        NANA,NANA,0x00,0x00,0x00,EOT}},
+               {0xC, "GPIO set 5, 6 and 7",
+                       {0x30,0x60,0x61,0xF0,0xF3,0xF6,EOT},
+                       {0x00,0x03,0x70,0x00,0xFF,0xFF,EOT}},
                {EOT}}},
        {0x8702, "IT8702F", {
                {EOT}}},
@@ -174,6 +249,8 @@ static const struct superio_registers reg_table[] = {
                {EOT}}},
        {0x8710, "IT8710F", {   /* TODO: Not yet in sensors-detect */
                {EOT}}},
+       {0x8711, "IT8711F", {   /* 0x8711 is a guess, not found in datasheet. */
+               {EOT}}},
        {0x8712, "IT8712F", {
                {NOLDN, NULL,
                        {0x20,0x21,0x22,0x23,0x24,0x2b,EOT},
@@ -325,6 +402,8 @@ static const struct superio_registers reg_table[] = {
                {EOT}}},
        {0x8720, "IT8720F", {   /* From sensors-detect */
                {EOT}}},
+       {0x8722, "IT8722F", {
+               {EOT}}},
        {0x8726, "IT8726F", {
                /* Datasheet wrongly says that the ID is 0x8716. */
                {NOLDN, NULL,
@@ -378,6 +457,10 @@ static const struct superio_registers reg_table[] = {
                        {0x30,0x60,0x61,0x70,0xf0,EOT},
                        {0x00,0x03,0x10,0x0b,0x00,EOT}},
                {EOT}}},
+       {0x8761, "IT8761E", {
+               {EOT}}},
+       {0x8780, "IT8780F", {
+               {EOT}}},
        {EOT}
 };
 
@@ -475,11 +558,6 @@ static void enter_conf_mode_ite_legacy(uint16_t port, const uint8_t init[][4])
                OUTB(initkey_mbpnp[i], port);
 }
 
-/**
- * IT871[01]F and IT8708F use 0x87, 0x87
- * IT8761F uses 0x87, 0x61, 0x55, 0x55/0xaa
- * IT86xxF series uses different ports
- */
 static void enter_conf_mode_ite(uint16_t port)
 {
        OUTB(0x87, port);
@@ -488,6 +566,22 @@ static void enter_conf_mode_ite(uint16_t port)
        OUTB((port == 0x2e) ? 0x55 : 0xaa, port);
 }
 
+static void enter_conf_mode_ite_it8761e(uint16_t port)
+{
+       OUTB(0x87, port);
+       OUTB(0x61, port);
+       OUTB(0x55, port);
+       OUTB((port == 0x2e) ? 0x55 : 0xaa, port);
+}
+
+static void enter_conf_mode_ite_it8228e(uint16_t port)
+{
+       OUTB(0x82, port);
+       OUTB(0x28, port);
+       OUTB(0x55, port);
+       OUTB((port == 0x2e) ? 0x55 : 0xaa, port);
+}
+
 static void exit_conf_mode_ite(uint16_t port)
 {
        regwrite(port, 0x02, 0x02);
@@ -513,10 +607,10 @@ static void probe_idregs_ite_helper(const char *init, uint16_t port)
               get_superio_name(reg_table, id), id, chipver, port);
        chip_found = 1;
 
-       dump_superio("ITE", reg_table, port, id);
+       dump_superio("ITE", reg_table, port, id, LDN_SEL);
 
        if (extra_dump) {
-               regwrite(port, 0x07, 0x04); /* Select LDN 4 (EC). */
+               regwrite(port, LDN_SEL, 0x04); /* Select LDN 4 (EC). */
 
                /* Get EC base address (stored in LDN 4, index 0x60/0x61). */
                ecport = regval(port, 0x60) << 8;
@@ -526,7 +620,7 @@ static void probe_idregs_ite_helper(const char *init, uint16_t port)
                ecport += 5;
 
                printf("Environment controller (0x%04x)\n", ecport);
-               dump_superio("ITE-EC", ec_table, ecport, id);
+               dump_superio("ITE-EC", ec_table, ecport, id, LDN_SEL);
        }
 }
 
@@ -542,7 +636,15 @@ void probe_idregs_ite(uint16_t port)
                exit_conf_mode_ite(port);
        } else {
                enter_conf_mode_ite(port);
-               probe_idregs_ite_helper("(init=0x87,0x01,0x55,0x55/0xaa) ", port);
+               probe_idregs_ite_helper("(init=standard) ", port);
+               exit_conf_mode_ite(port);
+
+               enter_conf_mode_ite_it8761e(port);
+               probe_idregs_ite_helper("(init=it8761e) ", port);
+               exit_conf_mode_ite(port);
+
+               enter_conf_mode_ite_it8228e(port);
+               probe_idregs_ite_helper("(init=it8228e) ", port);
                exit_conf_mode_ite(port);
 
                enter_conf_mode_winbond_fintek_ite_8787(port);
@@ -554,5 +656,5 @@ void probe_idregs_ite(uint16_t port)
 void print_ite_chips(void)
 {
        print_vendor_chips("ITE", reg_table);
-       print_vendor_chips("ITE EC", ec_table);
+       print_vendor_chips("ITE-EC", ec_table);
 }