Changeset 2448

Show
Ignore:
Timestamp:
04/18/04 02:38:28 (11 years ago)
Author:
mds
Message:

support detection of eeprom shadows we now know are

software write-protect registers.
prevent Vaio detection from running more than once.
update eeprom driver documentation.

Location:
lm-sensors/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r2443 r2448  
    4646                          Scan all logical devices of PC87365 and PC87366 
    4747                          Detect LM92, LM76, MAX6633, MAX6634, MAX6635 
     48                          Detect eeproms with software write protect 
    4849 
    4950 
  • lm-sensors/trunk/doc/chips/eeprom

    r1907 r2448  
    88    Prefix `eeprom' 
    99    Addresses scanned: I2C 0x50 - 0x57 (inclusive) 
    10     Datasheets: Publicly available from Atmel (www.atmel.com), 
    11                 Fairchild (www.fairchildsemi.com), and 
    12                 Microchip (www.microchip.com) 
     10    Datasheets: Publicly available from: 
     11                Atmel (www.atmel.com), 
     12                Catalyst (www.catsemi.com), 
     13                Fairchild (www.fairchildsemi.com), 
     14                Microchip (www.microchip.com), 
     15                Philips (www.semiconductor.philips.com), 
     16                Rohm (www.rohm.com), 
     17                ST (www.st.com),         
     18                Xicor (www.xicor.com)            
    1319 
    1420        Chip     Size (bits)    Address 
     
    2228        24C16    16K            0x50 (additional data at 0x51 - 0x57) 
    2329        Sony      2K            0x57 
     30        Microchip 24AA52  2K    0x50 - 0x57, SW write protect at 0x30-37 
     31        ST M34C02         2K    0x50 - 0x57, SW write protect at 0x30-37 
    2432 
    2533 
     
    7381specification, so it is guess work and far from being complete. 
    7482 
     83The Microchip 24AA52/24LCS52 and the ST M34C02 support an additional 
     84software write protect register at 0x30 - 0x37 (0x20 less than the 
     85memory location). The chip responds to "write quick" detection at this 
     86address but does not respond to byte reads. 
     87If this register is present, the lower 128 bytes of the memory 
     88array are not write protected. Any byte data write to this address 
     89will write protect the memory array permanently, and the device 
     90will no longer respond at the 0x30-37 address. 
     91The eeprom driver does not support this register. 
    7592 
    7693Lacking functionality: 
     
    85102* Enable Writing.  Again, no technical reason why not, but making it easy 
    86103to change the contents of the EEPROMs (on DIMMs anyway) also makes it easy 
    87 to disable the DIMMs until the values are restored somehow. 
     104to disable the DIMMs (potentially preventing the computer from booting) 
     105until the values are restored somehow. 
    88106 
    89107 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r2439 r2448  
    12451245       i2c_addrs => [0x57], 
    12461246       i2c_detect => sub { eeprom_detect 1, @_ }, 
     1247     }, 
     1248     { 
     1249       name => "SPD EEPROM with Software Write-Protect", 
     1250       driver => "eeprom", 
     1251       i2c_addrs => [0x50..0x57], 
     1252       i2c_detect => sub { eeprom_detect 2, @_ }, 
    12471253     }, 
    12481254     { 
     
    36733679} 
    36743680 
    3675 # $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM) 
     3681# $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM 
     3682#                        2 = SPD EEPROM with Software Write Protect) 
    36763683# $_[1]: A reference to the file descriptor to access this chip 
    36773684# $_[2]: Address 
     
    36883695{ 
    36893696  my ($chip,$file,$addr) = @_; 
     3697  my $checksum = 0; 
    36903698 
    36913699  # Check the checksum for validity (works for most DIMMs and RIMMs) 
    3692   my $checksum = 0; 
    3693   for (my $i = 0; $i <= 62; $i ++) { 
    3694     $checksum += i2c_smbus_read_byte_data($file,$i); 
    3695   } 
    3696   $checksum &= 255; 
    3697   return 8 
    3698     if $chip == 0 and i2c_smbus_read_byte_data($file,63) == $checksum; 
    3699  
    3700   # Look for a Sony Vaio EEPROM 
     3700  if ($chip != 1) { 
     3701          for (my $i = 0; $i <= 62; $i ++) { 
     3702            $checksum += i2c_smbus_read_byte_data($file,$i); 
     3703          } 
     3704          $checksum &= 255; 
     3705          $checksum -= i2c_smbus_read_byte_data($file,63); 
     3706  }      
     3707  if ($chip == 0) { 
     3708        if($checksum == 0) { 
     3709                return 8; 
     3710        } else { 
     3711                return 1; 
     3712        } 
     3713  }      
     3714  if ($chip == 2) { 
     3715        # check for 'shadow' write-protect register at 0x30-37 
     3716        i2c_set_slave_addr($file,$addr - 0x20); 
     3717        if(i2c_smbus_write_quick($file,$SMBUS_WRITE) >= 0 && 
     3718           i2c_smbus_read_byte_data($file,0x80) == -1) { 
     3719                if($checksum == 0) { 
     3720                        return (9, $addr - 0x20); 
     3721                } else { 
     3722                        return (2, $addr - 0x20); 
     3723                } 
     3724        } 
     3725  } 
     3726 
     3727  # Look for a Sony Vaio EEPROM ($chip == 1) 
    37013728  my $vaioconf = 1; 
    37023729  $vaioconf += 4 
     
    37193746 
    37203747  if ($vaioconf > 1) { 
    3721     return if $chip != 1; 
    37223748    return $vaioconf; 
    37233749  } 
    3724  
    3725   # Even if all tests fail, it still may be an eeprom 
    3726   return if $chip != 0; 
    3727   # Default to SPD EEPROM 
    3728   return 1; 
     3750  return; 
    37293751} 
    37303752