Commit 5c7ae65899a4c5b05b6277f856018d1eeeb98907

Authored by Jean Delvare
Committed by Greg Kroah-Hartman
1 parent f9ba6c04ef

[PATCH] I2C: i2c-nforce2: Add support for the nForce4 MCP51 and MCP55

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.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 3 changed files with 31 additions and 11 deletions Side-by-side Diff

Documentation/i2c/busses/i2c-nforce2
... ... @@ -7,6 +7,8 @@
7 7 * nForce3 250Gb MCP 10de:00E4
8 8 * nForce4 MCP 10de:0052
9 9 * nForce4 MCP-04 10de:0034
  10 + * nForce4 MCP51 10de:0264
  11 + * nForce4 MCP55 10de:0368
10 12  
11 13 Datasheet: not publically available, but seems to be similar to the
12 14 AMD-8111 SMBus 2.0 adapter.
drivers/i2c/busses/i2c-nforce2.c
... ... @@ -31,6 +31,8 @@
31 31 nForce3 250Gb MCP 00E4
32 32 nForce4 MCP 0052
33 33 nForce4 MCP-04 0034
  34 + nForce4 MCP51 0264
  35 + nForce4 MCP55 0368
34 36  
35 37 This driver supports the 2 SMBuses that are included in the MCP of the
36 38 nForce2/3/4 chipsets.
... ... @@ -64,6 +66,7 @@
64 66  
65 67 /*
66 68 * nVidia nForce2 SMBus control register definitions
  69 + * (Newer incarnations use standard BARs 4 and 5 instead)
67 70 */
68 71 #define NFORCE_PCI_SMB1 0x50
69 72 #define NFORCE_PCI_SMB2 0x54
... ... @@ -259,6 +262,8 @@
259 262 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) },
260 263 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) },
261 264 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS) },
  265 + { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS) },
  266 + { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS) },
262 267 { 0 }
263 268 };
264 269  
265 270  
266 271  
267 272  
... ... @@ -266,19 +271,29 @@
266 271 MODULE_DEVICE_TABLE (pci, nforce2_ids);
267 272  
268 273  
269   -static int __devinit nforce2_probe_smb (struct pci_dev *dev, int reg,
270   - struct nforce2_smbus *smbus, char *name)
  274 +static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
  275 + int alt_reg, struct nforce2_smbus *smbus, const char *name)
271 276 {
272   - u16 iobase;
273 277 int error;
274 278  
275   - if (pci_read_config_word(dev, reg, &iobase) != PCIBIOS_SUCCESSFUL) {
276   - dev_err(&smbus->adapter.dev, "Error reading PCI config for %s\n", name);
277   - return -1;
  279 + smbus->base = pci_resource_start(dev, bar);
  280 + if (smbus->base) {
  281 + smbus->size = pci_resource_len(dev, bar);
  282 + } else {
  283 + /* Older incarnations of the device used non-standard BARs */
  284 + u16 iobase;
  285 +
  286 + if (pci_read_config_word(dev, alt_reg, &iobase)
  287 + != PCIBIOS_SUCCESSFUL) {
  288 + dev_err(&dev->dev, "Error reading PCI config for %s\n",
  289 + name);
  290 + return -1;
  291 + }
  292 +
  293 + smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK;
  294 + smbus->size = 8;
278 295 }
279   - smbus->dev = dev;
280   - smbus->base = iobase & 0xfffc;
281   - smbus->size = 8;
  296 + smbus->dev = dev;
282 297  
283 298 if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
284 299 dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
285 300  
... ... @@ -313,12 +328,13 @@
313 328 pci_set_drvdata(dev, smbuses);
314 329  
315 330 /* SMBus adapter 1 */
316   - res1 = nforce2_probe_smb (dev, NFORCE_PCI_SMB1, &smbuses[0], "SMB1");
  331 + res1 = nforce2_probe_smb(dev, 4, NFORCE_PCI_SMB1, &smbuses[0], "SMB1");
317 332 if (res1 < 0) {
318 333 dev_err(&dev->dev, "Error probing SMB1.\n");
319 334 smbuses[0].base = 0; /* to have a check value */
320 335 }
321   - res2 = nforce2_probe_smb (dev, NFORCE_PCI_SMB2, &smbuses[1], "SMB2");
  336 + /* SMBus adapter 2 */
  337 + res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2");
322 338 if (res2 < 0) {
323 339 dev_err(&dev->dev, "Error probing SMB2.\n");
324 340 smbuses[1].base = 0; /* to have a check value */
include/linux/pci_ids.h
... ... @@ -1130,9 +1130,11 @@
1130 1130 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258
1131 1131 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259
1132 1132 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B
  1133 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS 0x0264
1133 1134 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265
1134 1135 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1135 1136 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
  1137 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS 0x0368
1136 1138 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1137 1139 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E
1138 1140 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F