Blame view

Documentation/misc-devices/max6875 3.01 KB
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
1
2
3
4
  Kernel driver max6875
  =====================
  
  Supported chips:
089bd8663   Jean Delvare   [PATCH] I2C: max6...
5
6
    * Maxim MAX6874, MAX6875
      Prefix: 'max6875'
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
7
      Addresses scanned: None (see below)
089bd8663   Jean Delvare   [PATCH] I2C: max6...
8
      Datasheet:
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
9
10
11
          http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
  
  Author: Ben Gardner <bgardner@wabtec.com>
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
12
13
  Description
  -----------
089bd8663   Jean Delvare   [PATCH] I2C: max6...
14
  The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
15
16
  It provides timed outputs that can be used as a watchdog, if properly wired.
  It also provides 512 bytes of user EEPROM.
089bd8663   Jean Delvare   [PATCH] I2C: max6...
17
  At reset, the MAX6875 reads the configuration EEPROM into its configuration
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
18
19
  registers.  The chip then begins to operate according to the values in the
  registers.
089bd8663   Jean Delvare   [PATCH] I2C: max6...
20
21
  The Maxim MAX6874 is a similar, mostly compatible device, with more intputs
  and outputs:
089bd8663   Jean Delvare   [PATCH] I2C: max6...
22
23
24
               vin     gpi    vout
  MAX6874        6       4       8
  MAX6875        4       3       5
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
25
  See the datasheet for more information.
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
26
27
28
29
  
  
  Sysfs entries
  -------------
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
30
  eeprom        - 512 bytes of user-defined EEPROM space.
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
31
32
33
34
  
  
  General Remarks
  ---------------
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
35
36
  Valid addresses for the MAX6875 are 0x50 and 0x52.
  Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.
b835d7fbd   Jean Delvare   max6875: Discard ...
37
38
  The driver does not probe any address, so you explicitly instantiate the
  devices.
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
39
40
  
  Example:
b835d7fbd   Jean Delvare   max6875: Discard ...
41
42
  $ modprobe max6875
  $ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
43
44
45
  
  The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
  addresses.  For example, for address 0x50, it also reserves 0x51.
bd8d421f7   Jean Delvare   i2c: Convert the ...
46
  The even-address instance is called 'max6875', the odd one is 'dummy'.
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
47
48
49
50
51
52
  
  
  Programming the chip using i2c-dev
  ----------------------------------
  
  Use the i2c-dev interface to access and program the chips.
0283fe6c3   Ben Gardner   [PATCH] I2C: max6...
53
  Reads and writes are performed differently depending on the address range.
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  
  The configuration registers are at addresses 0x00 - 0x45.
  Use i2c_smbus_write_byte_data() to write a register and
  i2c_smbus_read_byte_data() to read a register.
  The command is the register number.
  
  Examples:
  To write a 1 to register 0x45:
    i2c_smbus_write_byte_data(fd, 0x45, 1);
  
  To read register 0x45:
    value = i2c_smbus_read_byte_data(fd, 0x45);
  
  
  The configuration EEPROM is at addresses 0x8000 - 0x8045.
  The user EEPROM is at addresses 0x8100 - 0x82ff.
  
  Use i2c_smbus_write_word_data() to write a byte to EEPROM.
  
  The command is the upper byte of the address: 0x80, 0x81, or 0x82.
  The data word is the lower part of the address or'd with data << 8.
    cmd = address >> 8;
    val = (address & 0xff) | (data << 8);
  
  Example:
  To write 0x5a to address 0x8003:
    i2c_smbus_write_word_data(fd, 0x80, 0x5a03);
  
  
  Reading data from the EEPROM is a little more complicated.
  Use i2c_smbus_write_byte_data() to set the read address and then
  i2c_smbus_read_byte() or i2c_smbus_read_i2c_block_data() to read the data.
  
  Example:
  To read data starting at offset 0x8100, first set the address:
    i2c_smbus_write_byte_data(fd, 0x81, 0x00);
  
  And then read the data
    value = i2c_smbus_read_byte(fd);
  
    or
4b2643d7d   Jean Delvare   i2c: Fix the i2c_...
95
    count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer);
93ffa4351   Ben Gardner   [PATCH] I2C: upda...
96
97
98
99
100
  
  The block read should read 16 bytes.
  0x84 is the block read command.
  
  See the datasheet for more details.
c3bc4caed   Ben Gardner   [PATCH] max6875: ...
101