blob: ad419ac22a5b067743d403ac4b82b86eee2b44a2 [file] [log] [blame]
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -03001=====================
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -04002Kernel driver max6875
3=====================
4
5Supported chips:
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -03006
Jean Delvare089bd862005-06-23 23:37:53 +02007 * Maxim MAX6874, MAX6875
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -03008
Jean Delvare089bd862005-06-23 23:37:53 +02009 Prefix: 'max6875'
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030010
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050011 Addresses scanned: None (see below)
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030012
13 Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040014
15Author: Ben Gardner <bgardner@wabtec.com>
16
17
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040018Description
19-----------
20
Jean Delvare089bd862005-06-23 23:37:53 +020021The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040022It provides timed outputs that can be used as a watchdog, if properly wired.
23It also provides 512 bytes of user EEPROM.
24
Jean Delvare089bd862005-06-23 23:37:53 +020025At reset, the MAX6875 reads the configuration EEPROM into its configuration
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040026registers. The chip then begins to operate according to the values in the
27registers.
28
Masanari Iida96d8d5f2015-09-17 00:54:58 +090029The Maxim MAX6874 is a similar, mostly compatible device, with more inputs
Jean Delvare089bd862005-06-23 23:37:53 +020030and outputs:
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030031
32=========== === === ====
33- vin gpi vout
34=========== === === ====
Jean Delvare089bd862005-06-23 23:37:53 +020035MAX6874 6 4 8
36MAX6875 4 3 5
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030037=========== === === ====
Jean Delvare089bd862005-06-23 23:37:53 +020038
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050039See the datasheet for more information.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040040
41
42Sysfs entries
43-------------
44
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050045eeprom - 512 bytes of user-defined EEPROM space.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -040046
47
48General Remarks
49---------------
50
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050051Valid addresses for the MAX6875 are 0x50 and 0x52.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030052
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050053Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030054
Jean Delvareb835d7f2009-10-04 22:53:41 +020055The driver does not probe any address, so you explicitly instantiate the
56devices.
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050057
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030058Example::
59
60 $ modprobe max6875
61 $ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050062
63The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
64addresses. For example, for address 0x50, it also reserves 0x51.
Jean Delvarebd8d4212008-07-16 19:30:07 +020065The even-address instance is called 'max6875', the odd one is 'dummy'.
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050066
67
68Programming the chip using i2c-dev
69----------------------------------
70
71Use the i2c-dev interface to access and program the chips.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030072
bgardner@wabtec.com0283fe62005-07-27 12:43:21 -050073Reads and writes are performed differently depending on the address range.
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050074
75The configuration registers are at addresses 0x00 - 0x45.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030076
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050077Use i2c_smbus_write_byte_data() to write a register and
78i2c_smbus_read_byte_data() to read a register.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030079
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050080The command is the register number.
81
82Examples:
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030083
84To write a 1 to register 0x45::
85
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050086 i2c_smbus_write_byte_data(fd, 0x45, 1);
87
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030088To read register 0x45::
89
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050090 value = i2c_smbus_read_byte_data(fd, 0x45);
91
92
93The configuration EEPROM is at addresses 0x8000 - 0x8045.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -030094
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -050095The user EEPROM is at addresses 0x8100 - 0x82ff.
96
97Use i2c_smbus_write_word_data() to write a byte to EEPROM.
98
99The command is the upper byte of the address: 0x80, 0x81, or 0x82.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300100The data word is the lower part of the address or'd with data << 8::
101
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500102 cmd = address >> 8;
103 val = (address & 0xff) | (data << 8);
104
105Example:
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300106
107To write 0x5a to address 0x8003::
108
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500109 i2c_smbus_write_word_data(fd, 0x80, 0x5a03);
110
111
112Reading data from the EEPROM is a little more complicated.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300113
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500114Use i2c_smbus_write_byte_data() to set the read address and then
115i2c_smbus_read_byte() or i2c_smbus_read_i2c_block_data() to read the data.
116
117Example:
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300118
119To read data starting at offset 0x8100, first set the address::
120
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500121 i2c_smbus_write_byte_data(fd, 0x81, 0x00);
122
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300123And then read the data::
124
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500125 value = i2c_smbus_read_byte(fd);
126
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300127or::
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500128
Jean Delvare4b2643d2007-07-12 14:12:29 +0200129 count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer);
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -0500130
131The block read should read 16 bytes.
Mauro Carvalho Chehab9b5db892019-06-28 18:23:13 -0300132
bgardner@wabtec.com93ffa432005-07-12 13:21:50 -05001330x84 is the block read command.
134
135See the datasheet for more details.
BGardner@Wabtec.comc3bc4ca2005-06-03 13:03:27 -0400136