Changeset 1196

Show
Ignore:
Timestamp:
10/07/01 00:20:41 (7 years ago)
Author:
mds
Message:

add VT8233 support to i2c-viapro.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r1194 r1196  
    20202.6.2 (2001????) 
    2121  Chip Modules (all): malloc.h -> slab.h 
     22  File doc/FAQ: More updates and additions 
    2223  Module fscpos: new (Fujitsu-Siemens Poseidon driver) 
    2324  Module i2c-amd756: Improve busy handling/printk's 
    2425  Module i2c-piix4: Add Intel 82443MX and SMSC Victory66 support 
     26  Module i2c-viapro: Add Via VT8233 support 
    2527  Module via686a: Make limit initializations reliable 
    2628  Program sensors-detect: Add ALI1535 detection, 
    2729                          add Intel 82443MX detection,                   
    28                           add Via VT8233 detection (no driver yet)
     30                          add Via VT8233 detection
    2931                          add ITE 8172G detection (driver in kernel 2.4.10) 
    3032 
  • lm-sensors/trunk/README

    r1188 r1196  
    4444  SMSC Victory66 
    4545  3Dfx Voodoo 3 and Banshee 
    46   VIA Technologies VT82C586B, VT82C596A/B, and VT82C686A/B 
     46  VIA Technologies VT82C586B, VT82C596A/B, VT82C686A/B, and VT8233 
    4747 
    4848 
  • lm-sensors/trunk/doc/busses/i2c-viapro

    r521 r1196  
    11Kernel driver `i2c-viapro.o' 
    22 
    3 Status: Complete but untested 
     3Status: Stable 
    44 
    55Supported adapters: 
    6   * VIA Technologies, InC. VT82C686     
    7     Datasheet: Publicly available at the VIA website 
     6  * VIA Technologies, Inc. VT82C596A/B 
     7    Datasheet: Sometimes available at the VIA website 
    88 
    9   * VIA Technologies, InC. VT82C596 
    10     Datasheet: Available per request 
     9  * VIA Technologies, Inc. VT82C686     
     10    Datasheet: Sometimes available at the VIA website 
     11 
     12  * VIA Technologies, Inc. VT8233 
     13    Datasheet: not available? 
    1114 
    1215Author: Kyösti Mälkki <kmalkki@cc.hut.fi> 
     16 
    1317 
    1418Module Parameters 
     
    2024  Forcibly enable the SMBus at the given address. EXTREMELY DANGEROUS! 
    2125 
     26 
    2227Description 
    2328----------- 
     
    2631supported VIA southbridges. 
    2732 
    28 Your /proc/pci or lspci -n listing must show either of these : 
     33Your /proc/pci or lspci -n listing must show one of these : 
    2934 
    3035 device 1106:3050   (vt82c596 function 3) 
     36 device 1106:3051   (vt82c596 function 3) 
    3137 device 1106:3057   (vt82c686 function 4) 
     38 device 1106:3074   (vt8233 function 4) 
    3239 
    33 If neither of these show up, you should look in the BIOS for settings like 
     40If none of these show up, you should look in the BIOS for settings like 
    3441enable ACPI / SMBus or even USB. 
    3542 
  • lm-sensors/trunk/kernel/busses/i2c-viapro.c

    r949 r1196  
    22    i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware 
    33              monitoring 
    4     Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl>,  
    5     Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi> 
     4    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>,  
     5    Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, 
     6    Mark D. Studebaker <mdsxyz123@yahoo.com> 
    67 
    78    This program is free software; you can redistribute it and/or modify 
     
    2021*/ 
    2122 
    22 /* Note: we assume there can only be one VT596A/B, with one SMBus interface */ 
     23/* 
     24   Supports Via devices: 
     25        82C596A/B (0x3050) 
     26        82C596B (0x3051) 
     27        82C686A/B 
     28        8233 
     29   Note: we assume there can only be one device, with one SMBus interface. 
     30*/ 
    2331 
    2432#include <linux/version.h> 
     
    3644 
    3745#ifndef PCI_DEVICE_ID_VIA_82C596_3 
    38 #define PCI_DEVICE_ID_VIA_82C596_3 0x3050 
     46#define PCI_DEVICE_ID_VIA_82C596_3     0x3050 
    3947#endif 
    4048#ifndef PCI_DEVICE_ID_VIA_82C596B_3 
     
    4250#endif 
    4351#ifndef PCI_DEVICE_ID_VIA_82C686_4 
    44 #define PCI_DEVICE_ID_VIA_82C686_4 0x3057 
    45 #endif 
     52#define PCI_DEVICE_ID_VIA_82C686_4      0x3057 
     53#endif 
     54#ifndef PCI_DEVICE_ID_VIA_8233_0 
     55#define PCI_DEVICE_ID_VIA_8233_0        0x3074 
     56#endif 
     57 
     58#define SMBBA1      0x90 
     59#define SMBBA2      0x80 
     60#define SMBBA3      0xD0 
     61 
     62struct sd { 
     63        const unsigned short dev; 
     64        const unsigned char base; 
     65        const unsigned char hstcfg; 
     66        const char *name; 
     67}; 
     68 
     69static struct sd supported[] = { 
     70        {PCI_DEVICE_ID_VIA_82C596_3, SMBBA1, 0xD2, "VT82C596A/B"}, 
     71        {PCI_DEVICE_ID_VIA_82C596B_3, SMBBA1, 0xD2, "VT82C596B"}, 
     72        {PCI_DEVICE_ID_VIA_82C686_4, SMBBA1, 0xD2, "VT82C686A/B"}, 
     73        {PCI_DEVICE_ID_VIA_8233_0, SMBBA3, 0xD2, "VT8233"}, 
     74        {0, 0, 0, NULL} 
     75}; 
     76 
     77static struct sd *num = supported; 
    4678 
    4779/* SMBus address offsets */ 
     
    6496   We try to select the better one*/ 
    6597 
    66 static unsigned short smb_cf_base; 
    6798static unsigned short smb_cf_hstcfg; 
    6899 
    69 #define SMBBA1      0x90 
    70 #define SMBBA2      0x80 
    71 #define SMBBA       (smb_cf_base) 
    72100#define SMBHSTCFG   (smb_cf_hstcfg) 
    73101#define SMBSLVC     (SMBHSTCFG+1) 
     
    93121static int force = 0; 
    94122MODULE_PARM(force, "i"); 
    95 MODULE_PARM_DESC(force, "Forcibly enable the VT82C596 SMBus. DANGEROUS!"); 
     123MODULE_PARM_DESC(force, "Forcibly enable the SMBus. DANGEROUS!"); 
    96124 
    97125/* If force_addr is set to anything different from 0, we forcibly enable 
     
    100128MODULE_PARM(force_addr, "i"); 
    101129MODULE_PARM_DESC(force_addr, 
    102                  "Forcibly enable the VT82C596 SMBus at the given address. " 
     130                 "Forcibly enable the SMBus at the given address. " 
    103131                 "EXTREMELY DANGEROUS!"); 
    104132 
     
    151179 
    152180 
    153 /* Detect whether a VT596 can be found, and initialize it, where necessary. 
    154    Note the differences between kernels with the old PCI BIOS interface and 
    155    newer kernels with the real PCI interface. In compat.h some things are 
    156    defined to make the transition easier. */ 
     181/* Detect whether a compatible device can be found, and initialize it. */ 
    157182int vt596_setup(void) 
    158183{ 
    159         int error_return = 0; 
    160184        unsigned char temp; 
    161185 
    162         struct pci_dev *VT596_dev
     186        struct pci_dev *VT596_dev = NULL
    163187 
    164188        /* First check whether we can access PCI at all */ 
    165         if (pci_present() == 0) { 
    166                 printk("i2c-viapro.o: Error: No PCI-bus found!\n"); 
    167                 error_return = -ENODEV; 
    168                goto END; 
    169         } 
    170  
    171         /* Look for the VT596 function 3   _or_  VT686 function 4 */ 
    172         VT596_dev = NULL
    173         VT596_dev = pci_find_device(PCI_VENDOR_ID_VIA, 
    174                                     PCI_DEVICE_ID_VIA_82C596_3, VT596_dev); 
     189        if (pci_present() == 0) 
     190                return(-ENODEV); 
     191 
     192        /* Look for a supported device/function */ 
     193        do { 
     194                if((VT596_dev = pci_find_device(PCI_VENDOR_ID_VIA, num->dev, 
     195                                               VT596_dev))) 
     196                       break
     197        } while ((++num)->dev); 
     198 
    175199        if (VT596_dev == NULL) 
    176                 VT596_dev = pci_find_device(PCI_VENDOR_ID_VIA, 
    177                                             PCI_DEVICE_ID_VIA_82C686_4, 
    178                                             VT596_dev); 
    179  
    180         if (VT596_dev == NULL) 
    181                 VT596_dev = pci_find_device(PCI_VENDOR_ID_VIA, 
    182                                             PCI_DEVICE_ID_VIA_82C596B_3, 
    183                                             VT596_dev); 
    184  
    185         if (VT596_dev == NULL) { 
    186                 printk 
    187                     ("i2c-viapro.o: Error: Can't detect vt82c596 or vt82c686"); 
    188                 error_return = -ENODEV; 
    189                 goto END; 
    190         } 
    191  
    192 /* Determine the configuration space registers for the SMBus areas */ 
    193         if ((!pci_read_config_word(VT596_dev, SMBBA1, &vt596_smba)) 
    194             && (vt596_smba & 0x1)) { 
    195                 smb_cf_base = SMBBA1; 
    196                 smb_cf_hstcfg = 0xD2; 
    197         } else if ((!pci_read_config_word(VT596_dev, SMBBA2, &vt596_smba)) 
    198                    && (vt596_smba & 0x1)) { 
    199                 smb_cf_base = SMBBA2; 
    200                 smb_cf_hstcfg = 0x84; 
    201         } else { 
    202                 printk 
    203                     ("i2c-viapro.o: Cannot configure SMBus I/O Base address\n"); 
    204                 error_return = -ENODEV; 
    205                 goto END; 
    206         } 
     200                return(-ENODEV); 
     201        printk("i2c-viapro.o: Found Via %s device\n", num->name); 
    207202 
    208203/* Determine the address of the SMBus areas */ 
     204        smb_cf_hstcfg = num->hstcfg; 
    209205        if (force_addr) { 
    210                 vt596_smba = force_addr & 0xfff0
     206                vt596_smba = force_addr
    211207                force = 0; 
    212208        } else { 
    213                 vt596_smba &= 0xfff0; 
    214         } 
     209                if ((pci_read_config_word(VT596_dev, num->base, &vt596_smba)) 
     210                    || !(vt596_smba & 0x1)) { 
     211                        /* try 2nd address and config reg. for 596 */ 
     212                        if((num->dev == PCI_DEVICE_ID_VIA_82C596_3) && 
     213                           (!pci_read_config_word(VT596_dev, SMBBA2, &vt596_smba)) && 
     214                           (vt596_smba & 0x1)) 
     215                                smb_cf_hstcfg = 0x84; 
     216                        else 
     217                                goto FAIL; 
     218                } else { 
     219FAIL: 
     220                        printk 
     221                            ("i2c-viapro.o: Cannot configure SMBus I/O Base address\n"); 
     222                        return(-ENODEV); 
     223                } 
     224        } 
     225        vt596_smba &= 0xfff0; 
    215226 
    216227        if (check_region(vt596_smba, 8)) { 
    217                 printk 
    218                     ("i2c-viapro.o: vt82c596_smb region 0x%x already in use!\n", 
    219                      vt596_smba); 
    220                 error_return = -ENODEV; 
    221                 goto END; 
     228                printk("i2c-viapro.o: SMB region 0x%x already in use!\n", 
     229                        vt596_smba); 
     230                return(-ENODEV); 
    222231        } 
    223232 
     
    227236        if (force_addr) { 
    228237                pci_write_config_byte(VT596_dev, SMBHSTCFG, temp & 0xfe); 
    229                 pci_write_config_word(VT596_dev, SMBBA, vt596_smba); 
     238                pci_write_config_word(VT596_dev, num->base, vt596_smba); 
    230239                pci_write_config_byte(VT596_dev, SMBHSTCFG, temp | 0x01); 
    231240                printk 
    232                     ("i2c-viapro.o: WARNING: VT596 SMBus interface set to new " 
    233                      "address %04x!\n", vt596_smba); 
     241                    ("i2c-viapro.o: WARNING: SMBus interface set to new " 
     242                     "address 0x%04x!\n", vt596_smba); 
    234243        } else if ((temp & 1) == 0) { 
    235244                if (force) { 
     
    246255                        printk 
    247256                            ("SMBUS: Error: Host SMBus controller not enabled!\n"); 
    248                         error_return = -ENODEV; 
    249                         goto END; 
     257                        return(-ENODEV); 
    250258                } 
    251259        } 
     
    269277#endif                          /* DEBUG */ 
    270278 
    271       END: 
    272         return error_return; 
     279        return(0); 
    273280} 
    274281 
     
    298305        if ((temp = inb_p(SMBHSTSTS)) != 0x00) { 
    299306#ifdef DEBUG 
    300                 printk("i2c-viapro.o: SMBus busy (%02x). Resetting... \n", 
     307                printk("i2c-viapro.o: SMBus busy (0x%02x). Resetting... \n", 
    301308                       temp); 
    302309#endif 
     
    304311                if ((temp = inb_p(SMBHSTSTS)) != 0x00) { 
    305312#ifdef DEBUG 
    306                         printk("i2c-viapro.o: Failed! (%02x)\n", temp); 
     313                        printk("i2c-viapro.o: Failed! (0x%02x)\n", temp); 
    307314#endif 
    308315                        return -1; 
     
    499506        if ((res = vt596_setup())) { 
    500507                printk 
    501                     ("i2c-viapro.o: vt82c596 not detected, module not inserted.\n"); 
     508                    ("i2c-viapro.o: Can't detect vt82c596 or compatible device, module not inserted.\n"); 
    502509                vt596_cleanup(); 
    503510                return res; 
    504511        } 
    505512        vt596_initialized++; 
    506         sprintf(vt596_adapter.name, "SMBus vt82c596 adapter at %04x", 
     513        sprintf(vt596_adapter.name, "SMBus Via Pro adapter at %04x", 
    507514                vt596_smba); 
    508515        if ((res = i2c_add_adapter(&vt596_adapter))) { 
     
    513520        } 
    514521        vt596_initialized++; 
    515         printk("i2c-viapro.o: vt82c596 bus detected and initialized\n"); 
     522        printk("i2c-viapro.o: Via Pro SMBus detected and initialized\n"); 
    516523        return 0; 
    517524} 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r1194 r1196  
    9393       devid  => 0x3040, 
    9494       func => 3, 
    95        procid => "VIA Technologies VT 82C586B Apollo ACPI", 
     95       procid => "VIA Technologies VT82C586B Apollo ACPI", 
    9696       driver => "i2c-via", 
    9797       match => sub { $_[0] =~ /^VIA i2c/ }, 
     
    101101       devid  => 0x3050, 
    102102       func => 3, 
    103        procid => "VIA Technologies VT 82C596 Apollo ACPI", 
     103       procid => "VIA Technologies VT82C596 Apollo ACPI", 
    104104       driver => "i2c-viapro", 
    105        match => sub { $_[0] =~ /^SMBus vt82c596 adapter at [0-9,a-f]{4}/ }, 
     105       match => sub { $_[0] =~ /^SMBus Via Pro adapter at/ }, 
    106106     } , 
    107107     {  
     
    109109       devid  => 0x3051, 
    110110       func => 3, 
    111        procid => "VIA Technologies VT 82C596B ACPI", 
     111       procid => "VIA Technologies VT82C596B ACPI", 
    112112       driver => "i2c-viapro", 
    113        match => sub { $_[0] =~ /^SMBus vt82c596 adapter at [0-9,a-f]{4}/ }, 
     113       match => sub { $_[0] =~ /^SMBus Via Pro adapter at/ }, 
    114114     } , 
    115115     {  
     
    117117       devid  => 0x3057, 
    118118       func => 4, 
    119        procid => "VIA Technologies VT 82C686 Apollo ACPI", 
     119       procid => "VIA Technologies VT82C686 Apollo ACPI", 
    120120       driver => "i2c-viapro", 
    121        match => sub { $_[0] =~ /^SMBus vt82c596 adapter at [0-9,a-f]{4}/ }, 
     121       match => sub { $_[0] =~ /^SMBus Via Pro adapter at/ }, 
    122122     } , 
    123123     {  
     
    125125       devid  => 0x3074, 
    126126       func => 0, 
    127        procid => "VIA Technologies VT8233 Apollo 266 South Bridge", 
    128        match => sub { $_[0] =~ /^dontmatchthis/ }, 
     127       procid => "VIA Technologies VT8233 VLink South Bridge", 
     128       driver => "i2c-viapro", 
     129       match => sub { $_[0] =~ /^SMBus Via Pro adapter at/ }, 
    129130     } , 
    130131     {