blob: 10ca43cd1a72aa9d2d5bafc77a1116c126d7d892 [file] [log] [blame]
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -04001Kernel driver max6875
2=====================
3
4Supported chips:
Jean Delvare089bd862005-06-23 23:37:53 +02005 * Maxim MAX6874, MAX6875
6 Prefix: 'max6875'
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -05007 Addresses scanned: None (see below)
Jean Delvare089bd862005-06-23 23:37:53 +02008 Datasheet:
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -04009 http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
10
11Author: Ben Gardner <bgardner@wabtec.com>
12
13
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040014Description
15-----------
16
Jean Delvare089bd862005-06-23 23:37:53 +020017The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040018It provides timed outputs that can be used as a watchdog, if properly wired.
19It also provides 512 bytes of user EEPROM.
20
Jean Delvare089bd862005-06-23 23:37:53 +020021At reset, the MAX6875 reads the configuration EEPROM into its configuration
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040022registers. The chip then begins to operate according to the values in the
23registers.
24
Jean Delvare089bd862005-06-23 23:37:53 +020025The Maxim MAX6874 is a similar, mostly compatible device, with more intputs
26and outputs:
Jean Delvare089bd862005-06-23 23:37:53 +020027 vin gpi vout
28MAX6874 6 4 8
29MAX6875 4 3 5
30
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050031See the datasheet for more information.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040032
33
34Sysfs entries
35-------------
36
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050037eeprom - 512 bytes of user-defined EEPROM space.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040038
39
40General Remarks
41---------------
42
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050043Valid addresses for the MAX6875 are 0x50 and 0x52.
44Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.
45The driver does not probe any address, so you must force the address.
46
47Example:
48$ modprobe max6875 force=0,0x50
49
50The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
51addresses. For example, for address 0x50, it also reserves 0x51.
Jean Delvarebd8d4212008-07-16 19:30:07 +020052The even-address instance is called 'max6875', the odd one is 'dummy'.
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050053
54
55Programming the chip using i2c-dev
56----------------------------------
57
58Use the i2c-dev interface to access and program the chips.
bgardner@wabtec.com0283fe62005-07-27 12:43:21 -050059Reads and writes are performed differently depending on the address range.
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050060
61The configuration registers are at addresses 0x00 - 0x45.
62Use i2c_smbus_write_byte_data() to write a register and
63i2c_smbus_read_byte_data() to read a register.
64The command is the register number.
65
66Examples:
67To write a 1 to register 0x45:
68 i2c_smbus_write_byte_data(fd, 0x45, 1);
69
70To read register 0x45:
71 value = i2c_smbus_read_byte_data(fd, 0x45);
72
73
74The configuration EEPROM is at addresses 0x8000 - 0x8045.
75The user EEPROM is at addresses 0x8100 - 0x82ff.
76
77Use i2c_smbus_write_word_data() to write a byte to EEPROM.
78
79The command is the upper byte of the address: 0x80, 0x81, or 0x82.
80The data word is the lower part of the address or'd with data << 8.
81 cmd = address >> 8;
82 val = (address & 0xff) | (data << 8);
83
84Example:
85To write 0x5a to address 0x8003:
86 i2c_smbus_write_word_data(fd, 0x80, 0x5a03);
87
88
89Reading data from the EEPROM is a little more complicated.
90Use i2c_smbus_write_byte_data() to set the read address and then
91i2c_smbus_read_byte() or i2c_smbus_read_i2c_block_data() to read the data.
92
93Example:
94To read data starting at offset 0x8100, first set the address:
95 i2c_smbus_write_byte_data(fd, 0x81, 0x00);
96
97And then read the data
98 value = i2c_smbus_read_byte(fd);
99
100 or
101
Jean Delvare4b2643d2007-07-12 14:12:29 +0200102 count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer);
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500103
104The block read should read 16 bytes.
1050x84 is the block read command.
106
107See the datasheet for more details.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -0400108