On Mon, Jul 01, 2002 at 07:07:54AM -0700, Thomas D. Dean wrote:
> The ASUS A7N266-E motherboard has the nVidia 420D chipset.  Of course,
> ASUS and nVidia will not provide datasheets...
> 
> This is not a production machine...

So, have you -current installed?

Here is the nForce diff from Linux lm_sensors. Do you feel like trying the change by
yourself? Otherwise, I'll have to do it...

Nicholas

-- 
Nicholas Souchu - [EMAIL PROTECTED] - [EMAIL PROTECTED]
Index: i2c-amd756.c
===================================================================
RCS file: /home/cvs/lm_sensors2/kernel/busses/i2c-amd756.c,v
retrieving revision 1.16
retrieving revision 1.19
diff -u -r1.16 -r1.19
--- i2c-amd756.c        2002/05/01 23:17:25     1.16
+++ i2c-amd756.c        2002/05/02 14:44:31     1.19
@@ -2,7 +2,7 @@
     amd756.c - Part of lm_sensors, Linux kernel modules for hardware
               monitoring
 
-    Copyright (c) 1999 Merlin Hughes <[EMAIL PROTECTED]>
+    Copyright (c) 1999-2002 Merlin Hughes <[EMAIL PROTECTED]>
 
     Shamelessly ripped from i2c-piix4.c:
 
@@ -25,7 +25,11 @@
 */
 
 /*
-   Supports AMD756, AMD766, and AMD768.
+    2002-04-08: Added nForce support. (Csaba Halasz)
+*/
+
+/*
+   Supports AMD756, AMD766, AMD768 and nVidia nForce
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
@@ -41,21 +45,31 @@
 #include "version.h"
 #include <linux/init.h>
 
-#ifdef MODULE_LICENSE
-MODULE_LICENSE("GPL");
-#endif
-
 #ifndef PCI_DEVICE_ID_AMD_756
 #define PCI_DEVICE_ID_AMD_756 0x740B
 #endif
 #ifndef PCI_DEVICE_ID_AMD_766
 #define PCI_DEVICE_ID_AMD_766 0x7413
 #endif
+#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01B4
+#endif
+
+struct sd {
+    const unsigned short vendor;
+    const unsigned short device;
+    const unsigned short function;
+    const char* name;
+    int amdsetup:1;
+};
 
-static int supported[] = {PCI_DEVICE_ID_AMD_756,
-                          PCI_DEVICE_ID_AMD_766,
-                         0x7443, /* AMD768 */
-                          0 };
+static struct sd supported[] = {
+    {PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_756, 3, "AMD756", 1},
+    {PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_766, 3, "AMD766", 1},
+    {PCI_VENDOR_ID_AMD, 0x7443, 3, "AMD768", 1},
+    {PCI_VENDOR_ID_NVIDIA, 0x01B4, 1, "nVidia nForce", 0},
+    {0, 0, 0}
+};
 
 /* AMD756 SMBus address offsets */
 #define SMB_ADDR_OFFSET        0xE0
@@ -141,6 +155,7 @@
 };
 
 static int __initdata amd756_initialized;
+static struct sd *amd756_sd = NULL;
 static unsigned short amd756_smba = 0;
 
 /* Detect whether a AMD756 can be found, and initialize it, where necessary.
@@ -150,7 +165,7 @@
 int amd756_setup(void)
 {
        unsigned char temp;
-       int *num = supported;
+       struct sd *currdev;
        struct pci_dev *AMD756_dev = NULL;
 
        if (pci_present() == 0) {
@@ -158,38 +173,41 @@
                return(-ENODEV);
        }
 
-       /* Look for the AMD756, function 3 */
-       /* Note: we keep on searching until we have found 'function 3' */
-       do {
-               if((AMD756_dev = pci_find_device(PCI_VENDOR_ID_AMD,
-                                             *num, AMD756_dev))) {
-                       if(PCI_FUNC(AMD756_dev->devfn) != 3)
-                               continue;
-                       break;
+       /* Look for a supported chip */
+       for(currdev = supported; currdev->vendor; ) {
+               AMD756_dev = pci_find_device(currdev->vendor,
+                                               currdev->device, AMD756_dev);
+               if (AMD756_dev != NULL) {
+                       if (PCI_FUNC(AMD756_dev->devfn) == currdev->function)
+                               break;
+               } else {
+                   currdev++;
                }
-               num++;
-       } while (*num != 0);
+       }
 
        if (AMD756_dev == NULL) {
                printk
-                   ("i2c-amd756.o: Error: Can't detect AMD756, function 3!\n");
+                   ("i2c-amd756.o: Error: No AMD756 or compatible device 
+detected!\n");
                return(-ENODEV);
        }
+       printk(KERN_INFO "i2c-amd756.o: Found %s SMBus controller.\n", currdev->name);
 
+       if (currdev->amdsetup)
+       {
+               pci_read_config_byte(AMD756_dev, SMBGCFG, &temp);
+               if ((temp & 128) == 0) {
+                       printk("i2c-amd756.o: Error: SMBus controller I/O not 
+enabled!\n");
+                       return(-ENODEV);
+               }
 
-       pci_read_config_byte(AMD756_dev, SMBGCFG, &temp);
-       if ((temp & 128) == 0) {
-               printk
-                 ("i2c-amd756.o: Error: SMBus controller I/O not enabled!\n");
-               return(-ENODEV);
+               /* Determine the address of the SMBus areas */
+               /* Technically it is a dword but... */
+               pci_read_config_word(AMD756_dev, SMBBA, &amd756_smba);
+               amd756_smba &= 0xff00;
+               amd756_smba += SMB_ADDR_OFFSET;
+       } else {
+               amd756_smba = 0x5500;
        }
-
-       /* Determine the address of the SMBus areas */
-       /* Technically it is a dword but... */
-       pci_read_config_word(AMD756_dev, SMBBA, &amd756_smba);
-       amd756_smba &= 0xff00;
-       amd756_smba += SMB_ADDR_OFFSET;
-
        if (check_region(amd756_smba, SMB_IOSIZE)) {
                printk
                    ("i2c-amd756.o: SMB region 0x%x already in use!\n",
@@ -206,6 +224,9 @@
        printk("i2c-amd756.o: AMD756_smba = 0x%X\n", amd756_smba);
 #endif                         /* DEBUG */
 
+       /* store struct sd * for future reference */
+        amd756_sd = currdev;
+
        return 0;
 }
 
@@ -464,13 +485,13 @@
        amd756_initialized = 0;
        if ((res = amd756_setup())) {
                printk
-                   ("i2c-amd756.o: AMD756/766 not detected, module not inserted.\n");
+                   ("i2c-amd756.o: AMD756 or compatible device not detected, module 
+not inserted.\n");
                amd756_cleanup();
                return res;
        }
        amd756_initialized++;
-       sprintf(amd756_adapter.name, "SMBus AMD7X6 adapter at %04x",
-               amd756_smba);
+       sprintf(amd756_adapter.name, "SMBus %s adapter at %04x",
+               amd756_sd->name, amd756_smba);
        if ((res = i2c_add_adapter(&amd756_adapter))) {
                printk
                    ("i2c-amd756.o: Adapter registration failed, module not 
inserted.\n");
@@ -478,7 +499,8 @@
                return res;
        }
        amd756_initialized++;
-       printk("i2c-amd756.o: AMD756/766 bus detected and initialized\n");
+       printk("i2c-amd756.o: %s bus detected and initialized\n",
+               amd756_sd->name);
        return 0;
 }
 
@@ -505,7 +527,11 @@
 #ifdef MODULE
 
 MODULE_AUTHOR("Merlin Hughes <[EMAIL PROTECTED]>");
-MODULE_DESCRIPTION("AMD756/766 SMBus driver");
+MODULE_DESCRIPTION("AMD756/766/768/nVidia nForce SMBus driver");
+
+#ifdef MODULE_LICENSE
+MODULE_LICENSE("GPL");
+#endif
 
 int init_module(void)
 {

Reply via email to