← Documents Documentation/misc-devices/max6875.rst GitHub 원문 ↗

Linux 6.18.37 · Misc devices

Kernel Driver MAX6875

MAX6874/MAX6875 power sequencer의 주소 예약, sysfs EEPROM과 i2c-dev register·EEPROM programming을 설명합니다.

Source pathDocumentation/misc-devices/max6875.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

max6875.rst:1-136

Driver는 address bit 0을 무시하는 chip 특성 때문에 짝수 주소와 다음 홀수 주소를 함께 reserve합니다. Configuration register는 byte-data command로, EEPROM은 주소 상·하위 byte를 나눈 word-data command로 접근합니다.

MAX6874/MAX6875 접근 범위
영역주소접근 방식
Configuration registers0x00~0x45SMBus byte data
Configuration EEPROM0x8000~0x8045Word write·addressed read
User EEPROM0x8100~0x82ffWord write·addressed read

Register와 두 EEPROM 영역은 주소 범위와 SMBus operation이 다릅니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

지원 chip과 식별 정보

1-16

이 kernel driver는 Maxim MAX6874와 MAX6875를 지원합니다. Prefix는 `max6875`이며 주소를 자동 검색하지 않습니다. Datasheet URL은 `http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf`이고 저자는 Ben Gardner <bgardner@wabtec.com>입니다.

=====================
Kernel driver max6875
=====================

Supported chips:

  * Maxim MAX6874, MAX6875

    Prefix: 'max6875'

    Addresses scanned: None (see below)

    Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf

Author: Ben Gardner <bgardner@wabtec.com>

Sequencer와 EEPROM

17-39

Maxim MAX6875는 EEPROM으로 programming할 수 있는 power-supply sequencer/supervisor입니다. 적절히 배선하면 watchdog으로 사용할 수 있는 timed output을 제공하며, 사용자용 EEPROM 512 byte도 갖습니다.

Reset 시 MAX6875는 configuration EEPROM을 configuration register로 읽어 들인 뒤 register 값에 따라 동작을 시작합니다.

MAX6874는 더 많은 input과 output을 가진 유사하고 대부분 호환되는 device입니다. MAX6874는 vin 6개, gpi 4개, vout 8개이고 MAX6875는 vin 4개, gpi 3개, vout 5개입니다. 자세한 내용은 datasheet를 참조합니다.

Devicevingpivout
MAX6874648
MAX6875435

Description
-----------

The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
It provides timed outputs that can be used as a watchdog, if properly wired.
It also provides 512 bytes of user EEPROM.

At reset, the MAX6875 reads the configuration EEPROM into its configuration
registers.  The chip then begins to operate according to the values in the
registers.

The Maxim MAX6874 is a similar, mostly compatible device, with more inputs
and outputs:

===========  ===     ===    ====
-            vin     gpi    vout
===========  ===     ===    ====
MAX6874        6       4       8
MAX6875        4       3       5
===========  ===     ===    ====

See the datasheet for more information.

Sysfs attribute

40-46

`eeprom` attribute는 사용자가 정의할 수 있는 512 byte EEPROM 공간을 제공합니다.



Sysfs entries
-------------

eeprom        - 512 bytes of user-defined EEPROM space.

주소와 명시적 생성

47-66

MAX6875의 유효 주소는 `0x50`, `0x52`이고 MAX6874는 여기에 `0x54`, `0x56`이 추가됩니다. Driver는 어떤 주소도 probe하지 않으므로 device를 명시적으로 instantiate해야 합니다.

$ modprobe max6875
$ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device

MAX6874/MAX6875는 address bit 0을 무시하므로 driver는 여러 주소를 함께 차지합니다. 예를 들어 `0x50` instance는 `0x51`도 reserve합니다. 짝수 주소 instance의 이름은 `max6875`, 홀수 주소 instance는 `dummy`입니다.


General Remarks
---------------

Valid addresses for the MAX6875 are 0x50 and 0x52.

Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.

The driver does not probe any address, so you explicitly instantiate the
devices.

Example::

  $ modprobe max6875
  $ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device

The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
addresses.  For example, for address 0x50, it also reserves 0x51.
The even-address instance is called 'max6875', the odd one is 'dummy'.

Configuration register 접근

67-91

Chip 접근과 programming에는 `i2c-dev` interface를 사용합니다. 주소 범위에 따라 read·write 방식이 달라집니다.

Configuration register는 `0x00`부터 `0x45`까지입니다. Register write에는 `i2c_smbus_write_byte_data()`, read에는 `i2c_smbus_read_byte_data()`를 사용하며 command 값은 register 번호입니다.

예를 들어 register `0x45`에 1을 쓰려면 `i2c_smbus_write_byte_data(fd, 0x45, 1)`을 호출합니다. 같은 register를 읽으려면 `value = i2c_smbus_read_byte_data(fd, 0x45)`를 사용합니다.


Programming the chip using i2c-dev
----------------------------------

Use the i2c-dev interface to access and program the chips.

Reads and writes are performed differently depending on the address range.

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);

EEPROM byte 쓰기

92-110

Configuration EEPROM 주소 범위는 `0x8000`~`0x8045`, user EEPROM은 `0x8100`~`0x82ff`입니다. EEPROM에 byte 하나를 쓸 때는 `i2c_smbus_write_word_data()`를 사용합니다.

Command는 주소의 상위 byte인 `0x80`, `0x81`, `0x82` 중 하나입니다. Data word는 주소 하위 byte와 `data << 8`을 OR해 만듭니다.

cmd = address >> 8;
val = (address & 0xff) | (data << 8);

따라서 주소 `0x8003`에 `0x5a`를 쓰는 호출은 `i2c_smbus_write_word_data(fd, 0x80, 0x5a03)`입니다.


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);

EEPROM 읽기

111-136

EEPROM read는 먼저 `i2c_smbus_write_byte_data()`로 read address를 설정한 뒤 `i2c_smbus_read_byte()` 또는 `i2c_smbus_read_i2c_block_data()`로 data를 읽습니다.

Offset `0x8100`부터 읽으려면 먼저 `i2c_smbus_write_byte_data(fd, 0x81, 0x00)`로 주소를 설정하고, 단일 byte는 `value = i2c_smbus_read_byte(fd)`로 읽습니다.

Block read는 `count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer)`처럼 수행합니다. `0x84`는 block-read command이고 이 호출은 16 byte를 읽어야 합니다. 자세한 내용은 datasheet를 참조합니다.


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::

  count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer);

The block read should read 16 bytes.

0x84 is the block read command.

See the datasheet for more details.