Changeset 4054

Show
Ignore:
Timestamp:
06/23/06 17:53:26 (9 years ago)
Author:
khali
Message:

Add support for the new nForce4 MCP51 (also known as nForce 410 or
430) and nForce4 MCP55 to the i2c-nforce2 driver. Some code changes
were required because the base I/O address registers have changed in
these versions. Standard BARs are now being used, while the original
nForce2 chips used non-standard ones. (2.6 backport)

Location:
lm-sensors/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4053 r4054  
    1717  Module i2c-i801: Disable PEC mode after every transaction (2.6 backport) 
    1818                   Add ICH8 support (2.6 backport) 
     19  Module i2c-nforce2: Add nForce4 MCP51, MCP55 support (2.6 backport) 
    1920  Module i2c-piix4: Add ServerWorks HT-1000 support (2.6 backport) 
    2021                    Add ATI IXP200, IXP300, IXP400 support (2.6 backport) 
  • lm-sensors/trunk/doc/busses/i2c-nforce2

    r3223 r4054  
    1919      (10de:0052, included in nForce4 MCP) 
    2020      (10de:0034, included in nForce4 MCP-04) 
     21      (10de:0264, included in nForce4 MCP51) 
     22      (10de:0368, included in nForce4 MCP55) 
    2123      Datasheet: same as for nForce2 SMBus PCI interface 
    2224 
  • lm-sensors/trunk/kernel/busses/i2c-nforce2.c

    r3223 r4054  
    3030    nForce4 MCP                 0052 
    3131    nForce4 MCP-04              0034 
     32    nForce4 MCP51               0264 
     33    nForce4 MCP55               0368 
    3234 
    3335    This driver supports the 2 SMBuses that are included in the MCP of the 
     
    7577#endif 
    7678 
    77 #ifndef PCI_DEVICE_ID_NVIDIA_NFORCE_MPC04_SMBUS 
    78 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MPC04_SMBUS 0x0034 
    79 #endif 
     79#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 
     80#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS 0x0264 
     81#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS 0x0368 
    8082 
    8183 
     
    9092/* 
    9193 * nVidia nForce2 SMBus control register definitions 
     94 * (Newer incarnations use standard BARs 4 and 5 instead) 
    9295 */ 
    9396#define NFORCE_PCI_SMB1 0x50 
     
    302305        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS, 
    303306                PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
    304         { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MPC04_SMBUS, 
     307        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS, 
     308                PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
     309        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS, 
     310                PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
     311        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS, 
    305312                PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
    306313        { 0 } 
     
    308315 
    309316 
    310 static int __devinit nforce2_probe_smb (struct pci_dev *dev, int reg, struct nforce2_smbus *smbus, char *name) 
    311 { 
    312         u16 iobase; 
     317static int __devinit nforce2_probe_smb(struct pci_dev *dev, int bar, 
     318        int alt_reg, struct nforce2_smbus *smbus, char *name) 
     319{ 
    313320        int error; 
    314321 
    315         if (pci_read_config_word(dev, reg, &iobase) != PCIBIOS_SUCCESSFUL) { 
    316                 printk (KERN_ERR "i2c-nforce2.o: Error reading PCI config for %s\n", name); 
    317                 return -1; 
    318         } 
    319         smbus->dev  = dev; 
    320         smbus->base = iobase & 0xfffc; 
    321         smbus->size = 8; 
     322        smbus->base = pci_resource_start(dev, bar); 
     323        if (smbus->base) { 
     324                smbus->size = pci_resource_len(dev, bar); 
     325        } else { 
     326                /* Older incarnations of the device used non-standard BARs */ 
     327                u16 iobase; 
     328 
     329                if (pci_read_config_word(dev, alt_reg, &iobase) 
     330                    != PCIBIOS_SUCCESSFUL) { 
     331                        printk(KERN_ERR "i2c-nforce2.o: Error reading PCI " 
     332                               "config for %s\n", name); 
     333                        return -1; 
     334                } 
     335 
     336                smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; 
     337                smbus->size = 8; 
     338        } 
     339        smbus->dev = dev; 
    322340 
    323341        if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { 
     
    356374 
    357375        /* SMBus adapter 1 */ 
    358         res1 = nforce2_probe_smb (dev, NFORCE_PCI_SMB1, &smbuses[0], "SMB1"); 
     376        res1 = nforce2_probe_smb(dev, 4, NFORCE_PCI_SMB1, &smbuses[0], "SMB1"); 
    359377        if (res1 < 0) { 
    360378                printk (KERN_ERR "i2c-nforce2.o: Error probing SMB1.\n"); 
    361379                smbuses[0].base = 0;    /* to have a check value */ 
    362380        } 
    363         res2 = nforce2_probe_smb (dev, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); 
     381        /* SMBus adapter 2 */ 
     382        res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); 
    364383        if (res2 < 0) { 
    365384                printk (KERN_ERR "i2c-nforce2.o: Error probing SMB2.\n");