Changeset 1466


Ignore:
Timestamp:
11/14/11 14:00:12 (6 months ago)
Author:
stefanct
Message:

board_enable.c: Make it8712f_gpio_set generic

This looks suspiciously like intel_ich_gpio_set.

Based on that, add board enables for the ASUS P5N-D and P5N-E SLI.
This was tested by Guillaume Poirier-Morency on a P5N-D:
http://www.flashrom.org/pipermail/flashrom/2011-August/007706.html

Signed-off-by: Joshua Roys <roysjosh@…>
Small changes were also contributed and
Signed-off-by: Stefan Tauner <stefan.tauner@…>
Acked-by: Stefan Tauner <stefan.tauner@…>

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/board_enable.c

    r1463 r1466  
    19181918 
    19191919/* 
    1920  * General routine for raising/dropping GPIO lines on the ITE IT8712F. 
    1921  * There is only some limited checking on the port numbers. 
    1922  */ 
    1923 static int it8712f_gpio_set(unsigned int line, int raise) 
    1924 { 
     1920 * General routine for raising/dropping GPIO lines on the ITE IT87xx. 
     1921 */ 
     1922static int it87_gpio_set(unsigned int gpio, int raise) 
     1923{ 
     1924        int allowed, sio; 
    19251925        unsigned int port; 
    1926         uint16_t id, base; 
     1926        uint16_t base, sioport; 
    19271927        uint8_t tmp; 
    19281928 
    1929         port = line / 10; 
    1930         port--; 
    1931         line %= 10; 
    1932  
    1933         /* Check line */ 
    1934         if ((port > 4) || /* also catches unsigned -1 */ 
    1935             ((port < 4) && (line > 7)) || ((port == 4) && (line > 5))) { 
    1936                 msg_perr("\nERROR: Unsupported IT8712F GPIO line %02d.\n", line); 
    1937                 return -1; 
    1938         } 
    1939  
    1940         /* Find the IT8712F. */ 
    1941         enter_conf_mode_ite(0x2E); 
    1942         id = (sio_read(0x2E, 0x20) << 8) | sio_read(0x2E, 0x21); 
    1943         exit_conf_mode_ite(0x2E); 
    1944  
    1945         if (id != 0x8712) { 
    1946                 msg_perr("\nERROR: IT8712F Super I/O not found.\n"); 
    1947                 return -1; 
    1948         } 
    1949  
    1950         /* Get the GPIO base */ 
    1951         enter_conf_mode_ite(0x2E); 
    1952         sio_write(0x2E, 0x07, 0x07); 
    1953         base = (sio_read(0x2E, 0x62) << 8) | sio_read(0x2E, 0x63); 
    1954         exit_conf_mode_ite(0x2E); 
     1929        /* IT87 GPIO configuration table */ 
     1930        static const struct it87cfg { 
     1931                uint16_t id; 
     1932                uint8_t base_reg; 
     1933                uint32_t bank0; 
     1934                uint32_t bank1; 
     1935                uint32_t bank2; 
     1936        } it87_gpio_table[] = { 
     1937                {0x8712, 0x62, 0xCFF3FC00, 0x00FCFF3F,          0}, 
     1938                {0x8718, 0x62, 0xCFF37C00, 0xF3FCDF3F, 0x0000000F}, 
     1939                {0, 0, 0, 0, 0} /* end marker */ 
     1940        }; 
     1941        const struct it87cfg *cfg = NULL; 
     1942 
     1943        /* Find the Super I/O in the probed list */ 
     1944        for (sio = 0; sio < superio_count; sio++) { 
     1945                int i; 
     1946                if (superios[sio].vendor != SUPERIO_VENDOR_ITE) 
     1947                        continue; 
     1948 
     1949                /* Is this device in our list? */ 
     1950                for (i = 0; it87_gpio_table[i].id; i++) 
     1951                        if (superios[sio].model == it87_gpio_table[i].id) { 
     1952                                cfg = &it87_gpio_table[i]; 
     1953                                goto found; 
     1954                        } 
     1955        } 
     1956 
     1957        if (cfg == NULL) { 
     1958                msg_perr("\nERROR: No IT87 Super I/O GPIO configuration " 
     1959                         "found.\n"); 
     1960                return -1; 
     1961        } 
     1962 
     1963found: 
     1964        /* Check whether the gpio is allowed. */ 
     1965        if (gpio < 32) 
     1966                allowed = (cfg->bank0 >> gpio) & 0x01; 
     1967        else if (gpio < 64) 
     1968                allowed = (cfg->bank1 >> (gpio - 32)) & 0x01; 
     1969        else if (gpio < 96) 
     1970                allowed = (cfg->bank2 >> (gpio - 64)) & 0x01; 
     1971        else 
     1972                allowed = 0; 
     1973 
     1974        if (!allowed) { 
     1975                msg_perr("\nERROR: IT%02X does not allow setting GPIO%02u.\n", 
     1976                         cfg->id, gpio); 
     1977                return -1; 
     1978        } 
     1979 
     1980        /* Read the Simple I/O Base Address Register */ 
     1981        sioport = superios[sio].port; 
     1982        enter_conf_mode_ite(sioport); 
     1983        sio_write(sioport, 0x07, 0x07); 
     1984        base = (sio_read(sioport, cfg->base_reg) << 8) | 
     1985                sio_read(sioport, cfg->base_reg + 1); 
     1986        exit_conf_mode_ite(sioport); 
    19551987 
    19561988        if (!base) { 
    1957                 msg_perr("\nERROR: Failed to read IT8712F Super I/O GPIO" 
    1958                         " Base.\n"); 
    1959                 return -1; 
    1960         } 
    1961  
    1962         /* Set GPIO. */ 
     1989                msg_perr("\nERROR: Failed to read IT87 Super I/O GPIO Base.\n"); 
     1990                return -1; 
     1991        } 
     1992 
     1993        msg_pdbg("Using IT87 GPIO base 0x%04x\n", base); 
     1994 
     1995        port = gpio / 10 - 1; 
     1996        gpio %= 10; 
     1997 
     1998        /* set GPIO. */ 
    19631999        tmp = INB(base + port); 
    19642000        if (raise) 
    1965             tmp |= 1 << line; 
     2001                tmp |= 1 << gpio; 
    19662002        else 
    1967             tmp &= ~(1 << line); 
     2003                tmp &= ~(1 << gpio); 
    19682004        OUTB(tmp, base + port); 
    19692005 
     
    19762012 * - ASUS A7V8X-X: VIA KT400 + VT8235 + IT8712F 
    19772013 */ 
    1978 static int it8712f_gpio3_1_raise(void) 
    1979 { 
    1980         return it8712f_gpio_set(32, 1); 
     2014static int it8712f_gpio31_raise(void) 
     2015{ 
     2016        return it87_gpio_set(32, 1); 
     2017} 
     2018 
     2019/* 
     2020 * Suited for: 
     2021 * - ASUS P5N-D: NVIDIA MCP51 + IT8718F 
     2022 * - ASUS P5N-E SLI: NVIDIA MCP51 + IT8718F 
     2023 */ 
     2024static int it8718f_gpio63_raise(void) 
     2025{ 
     2026        return it87_gpio_set(63, 1); 
    19812027} 
    19822028 
     
    20482094        {0x8086, 0x24D4, 0x1849, 0x24D0,  0x8086, 0x24D5, 0x1849, 0x9739, NULL,         NULL, NULL,           P3, "ASRock",      "P4i65GV",               0,   OK, intel_ich_gpio23_raise}, 
    20492095        {0x8086, 0x2570, 0x1849, 0x2570,  0x8086, 0x24d3, 0x1849, 0x24d0, NULL,         NULL, NULL,           P3, "ASRock",      "775i65G",               0,   OK, intel_ich_gpio23_raise}, 
    2050         {0x1106, 0x3189, 0x1043, 0x807F,  0x1106, 0x3065, 0x1043, 0x80ED, NULL,         NULL, NULL,           P3, "ASUS",        "A7V600-X",              0,   OK, it8712f_gpio3_1_raise}, 
     2096        {0x1106, 0x3189, 0x1043, 0x807F,  0x1106, 0x3065, 0x1043, 0x80ED, NULL,         NULL, NULL,           P3, "ASUS",        "A7V600-X",              0,   OK, it8712f_gpio31_raise}, 
    20512097        {0x1106, 0x3177, 0x1043, 0x80A1,  0x1106, 0x3205, 0x1043, 0x8118, NULL,         NULL, NULL,           P3, "ASUS",        "A7V8X-MX SE",           0,   OK, w836xx_memw_enable_2e}, 
    20522098        {0x1106, 0x3189, 0x1043, 0x807F,  0x1106, 0x3177, 0x1043, 0x808C, NULL,         NULL, NULL,           P3, "ASUS",        "A7V8X",                 0,   OK, it8703f_gpio51_raise}, 
    20532099        {0x1106, 0x3099, 0x1043, 0x807F,  0x1106, 0x3147, 0x1043, 0x808C, NULL,         NULL, NULL,           P3, "ASUS",        "A7V333",                0,   OK, it8703f_gpio51_raise}, 
    2054         {0x1106, 0x3189, 0x1043, 0x807F,  0x1106, 0x3177, 0x1043, 0x80A1, NULL,         NULL, NULL,           P3, "ASUS",        "A7V8X-X",               0,   OK, it8712f_gpio3_1_raise}, 
     2100        {0x1106, 0x3189, 0x1043, 0x807F,  0x1106, 0x3177, 0x1043, 0x80A1, NULL,         NULL, NULL,           P3, "ASUS",        "A7V8X-X",               0,   OK, it8712f_gpio31_raise}, 
    20552101        {0x1002, 0x4372, 0x103c, 0x2a26,  0x1002, 0x4377, 0x103c, 0x2a26, NULL,         NULL, NULL,           P3, "ASUS",        "A8AE-LE",               0,   OK, amd_sbxxx_gpio9_raise}, 
    20562102        {0x8086, 0x27A0, 0x1043, 0x1287,  0x8086, 0x27DF, 0x1043, 0x1287, "^A8J",       NULL, NULL,           P3, "ASUS",        "A8Jm",                  0,   NT, intel_ich_gpio34_raise}, 
     
    20852131        {0x8086, 0x27da, 0x1043, 0x8179,  0x8086, 0x27b8, 0x1043, 0x8179, "^P5LD2$",    NULL, NULL,           P3, "ASUS",        "P5LD2",                 0,   NT, intel_ich_gpio16_raise}, 
    20862132        {0x10DE, 0x0030, 0x1043, 0x818a,  0x8086, 0x100E, 0x1043, 0x80EE, NULL,         NULL, NULL,           P3, "ASUS",        "P5ND2-SLI Deluxe",      0,   OK, nvidia_mcp_gpio10_raise}, 
     2133        {0x10DE, 0x0260, 0x1043, 0x81BC,  0x10DE, 0x026C, 0x1043, 0x829E, "^P5N-D$",    NULL, NULL,           P3, "ASUS",        "P5N-D",                 0,   OK, it8718f_gpio63_raise}, 
     2134        {0x10DE, 0x0260, 0x1043, 0x81BC,  0x10DE, 0x026C, 0x1043, 0x8249, "^P5N-E SLI$",NULL, NULL,           P3, "ASUS",        "P5N-E SLI",             0,   NT, it8718f_gpio63_raise}, 
    20872135        {0x8086, 0x24dd, 0x1043, 0x80a6,  0x8086, 0x2570, 0x1043, 0x8157, NULL,         NULL, NULL,           P3, "ASUS",        "P5PE-VM",               0,   OK, intel_ich_gpio21_raise}, 
    20882136        {0x10b7, 0x9055, 0x1028, 0x0082,  0x8086, 0x7190,      0,      0, NULL,         NULL, NULL,           P3, "Dell",        "OptiPlex GX1",          0,   OK, intel_piix4_gpo30_lower}, 
  • trunk/print.c

    r1459 r1466  
    662662        B("ASUS",       "P5LP-LE",              0, NULL, "This designation is used for OEM boards from HP, Epson and maybe others. The HP names vary and not all of them have been tested yet. Please report any success or failure, thanks."), 
    663663        B("ASUS",       "P5N-E SLI",            0, "http://www.asus.com/product.aspx?P_ID=KyHOsOKWujC2QguJ", "Needs a board enable (http://patchwork.coreboot.org/patch/3298/)."), 
     664        B("ASUS",       "P5N-D",                1, "http://www.asus.com/Motherboards/Intel_Socket_775/P5ND/", NULL), 
     665        B("ASUS",       "P5N-E SLI",            0, "http://www.asus.com/Motherboards/Intel_Socket_775/P5NE_SLI/", "Untested board enable."), 
    664666        B("ASUS",       "P5N32-E SLI",          1, "http://www.asus.com/product.aspx?P_ID=vBZLIBtPzYB2bLcb", NULL), 
    665667        B("ASUS",       "P5ND2-SLI Deluxe",     1, "http://www.asus.com/product.aspx?P_ID=WY7XroDuUImVbgp5", NULL), 
Note: See TracChangeset for help on using the changeset viewer.