Changeset 999

Show
Ignore:
Timestamp:
01/20/01 04:43:50 (12 years ago)
Author:
mds
Message:

Allow force and force_via686a parameters. Driver will take the

address and program the base address in the 686a.
This is NOT a PCI force; the 3057 device must
be present in lspci.
Should work for Asus A7V/K7V boards which don't set the
base address (because they also have a as99127f on them!??).
Some rough edges remain, because
via686a_find() does not know there is a force; that only
is apparent to via686a_detect().
Notably, the driver will stay loaded even if the address is
uninitialized and there is no force; also, the driver complains
that a force is needed even when you give it one.

Location:
lm-sensors/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r998 r999  
    2121  Module lm78: Recognize chipid=0x20 
    2222  Module sensors: Add xxx_init() calls for drivers added to mkpatch in 2.5.5. 
     23  Module via686a: Allow force=9191,address (for A7V/K7V boards) 
    2324  Program mkpatch.pl: Fix adm9240 typos 
    2425  Program sensors-detect: Recognize lm78 with chipid=0x20 
  • lm-sensors/trunk/doc/chips/via686a

    r755 r999  
    1919----------------- 
    2020 
    21 none 
     21force=9191,address      Set the I/O base address. Useful for Asus A7V boards that 
     22                        don't set the address in the BIOS. Does not do a PCI 
     23                        force; the via686a must still be present in lspci. 
     24                        Don't use this unless the driver complains that the 
     25                        base address is not set. Otherwise the driver will 
     26                        recognize both the old and the forced address. 
     27 
     28force_via686a=9191,address      Same as force. 
    2229 
    2330 
  • lm-sensors/trunk/kernel/chips/via686a.c

    r933 r999  
    2525*/ 
    2626 
     27/* 
     28    Warning - only supports a single via686a device. 
     29*/ 
    2730#include <linux/version.h> 
    2831#include <linux/module.h> 
     
    375378#endif                          /* MODULE */ 
    376379 
    377 /* This module may seem overly long and complicated. In fact, it is not so 
    378    bad. Quite a lot of bookkeeping is done. A real driver can often cut 
    379    some corners. */ 
    380  
    381 /* For each registered VIA686A, we need to keep some data in memory. That 
     380/* For the VIA686A, we need to keep some data in memory. That 
    382381   data is pointed to by via686a_list[NR]->data. The structure itself is 
    383382   dynamically allocated, at the same time when a new via686a client is 
     
    403402}; 
    404403 
     404static struct pci_dev *s_bridge;        /* pointer to the (only) via686a */ 
    405405 
    406406#ifdef MODULE 
     
    512512int via686a_find(int *address) 
    513513{ 
    514         struct pci_dev *s_bridge; 
    515514        u16 val; 
    516515 
     
    525524            pci_read_config_word(s_bridge, VIA686A_BASE_REG, &val)) 
    526525                return -ENODEV; 
    527         *address = (val & 0xff80); 
     526        *address = val & ~(VIA686A_EXTENT - 1); 
    528527        if (*address == 0) { 
    529                 printk("via686a.o: sensors not enabled - upgrade BIOS?\n"); 
     528                printk("via686a.o: base address not set - upgrade BIOS or use force=9191,addr\n"); 
     529/* 
     530   If we do this then the module won't load and force won't work. 
     531   But unfortunately the above printk is printed even if we are doing a force. 
    530532                return -ENODEV; 
    531         } 
    532  
     533*/ 
     534        } 
     535/* 
     536   Moved below. 
    533537        if (PCIBIOS_SUCCESSFUL != 
    534538            pci_read_config_word(s_bridge, VIA686A_ENABLE_REG, &val)) 
     
    539543                                      val | 0x01); 
    540544        } 
     545*/ 
    541546        return 0; 
    542547} 
     
    550555        int err = 0; 
    551556        const char *type_name = "via686a"; 
     557        u16 val; 
    552558 
    553559        /* Make sure we are probing the ISA bus!!  */ 
     
    558564        } 
    559565 
     566        if(kind >= 0)           /* force or force_via686a */ 
     567                address &= ~(VIA686A_EXTENT - 1); 
    560568        if (check_region(address, VIA686A_EXTENT)) { 
    561569                printk("via686a.o: region 0x%x already in use!\n", 
    562570                       address); 
    563                 err = -ENODEV; 
    564                 goto ERROR0; 
     571                return -ENODEV; 
     572        } 
     573 
     574        if(kind >= 0) {         /* treat force and force_via686a equally */ 
     575                printk("via686a.o: forcing ISA address 0x%04X\n", address); 
     576                if (PCIBIOS_SUCCESSFUL != 
     577                    pci_write_config_word(s_bridge, VIA686A_BASE_REG, address)) 
     578                        return -ENODEV; 
     579        } 
     580        if (PCIBIOS_SUCCESSFUL != 
     581            pci_read_config_word(s_bridge, VIA686A_ENABLE_REG, &val)) 
     582                return -ENODEV; 
     583        if (!(val & 0x0001)) { 
     584                printk("via686a.o: enabling sensors\n"); 
     585                if (PCIBIOS_SUCCESSFUL != 
     586                    pci_write_config_word(s_bridge, VIA686A_ENABLE_REG, 
     587                                      val | 0x0001)) 
     588                        return -ENODEV; 
    565589        } 
    566590 
     
    581605 
    582606        /* Reserve the ISA region */ 
    583         request_region(address, VIA686A_EXTENT, type_name); 
     607        request_region(address, VIA686A_EXTENT, "via686a-sensors"); 
    584608 
    585609        /* Fill in the remaining client fields and put into the global list */ 
     
    697721        via686a_write_value(client, VIA686A_REG_TEMP_MODE,  
    698722                            via686a_read_value(client, VIA686A_REG_TEMP_MODE) & 
    699                             !VIA686A_TEMP_MODE_MASK | VIA686A_TEMP_MODE_CONTINUOUS); 
     723                            !(VIA686A_TEMP_MODE_MASK | VIA686A_TEMP_MODE_CONTINUOUS)); 
    700724} 
    701725