← Documents Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings

Register-based I2C Bus Mux

Memory-mapped register 값으로 child I2C bus를 선택하는 mux 바인딩입니다.

Source pathDocumentation/devicetree/bindings/i2c/i2c-mux-reg.txt
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약과 해설

i2c-mux-reg.txt:1-74

Register width, endianness와 idle-state 동작을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 Register-based I2C Bus Mux
2
3 This binding describes an I2C bus multiplexer that uses a single register
4 to route the I2C signals.
5
6 Required properties:
7 - compatible: i2c-mux-reg
8 - i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
9 port is connected to.
10 * Standard I2C mux properties. See i2c-mux.yaml in this directory.
11 * I2C child bus nodes. See i2c-mux.yaml in this directory.
12
13 Optional properties:
14 - reg: this pair of <offset size> specifies the register to control the mux.
15 The <offset size> depends on its parent node. It can be any memory-mapped
16 address. The size must be either 1, 2, or 4 bytes. If reg is omitted, the
17 resource of this device will be used.
18 - little-endian: The existence indicates the register is in little endian.
19 - big-endian: The existence indicates the register is in big endian.
20 If both little-endian and big-endian are omitted, the endianness of the
21 CPU will be used.
22 - write-only: The existence indicates the register is write-only.
23 - idle-state: value to set the muxer to when idle. When no value is
24 given, it defaults to the last value used.
25
26 Whenever an access is made to a device on a child bus, the value set
27 in the relevant node's reg property will be output to the register.
28
29 If an idle state is defined, using the idle-state (optional) property,
30 whenever an access is not being made to a device on a child bus, the
31 register will be set according to the idle value.
32
33 If an idle state is not defined, the most recently used value will be
34 left programmed into the register.
35
36 Example of a mux on PCIe card, the host is a powerpc SoC (big endian):
37
38 i2c-mux {
39 /* the <offset size> depends on the address translation
40 * of the parent device. If omitted, device resource
41 * will be used instead. The size is to determine
42 * whether iowrite32, iowrite16, or iowrite8 will be used.
43 */
44 reg = <0x6028 0x4>;
45 little-endian; /* little endian register on PCIe */
46 compatible = "i2c-mux-reg";
47 #address-cells = <1>;
48 #size-cells = <0>;
49 i2c-parent = <&i2c1>;
50 i2c@0 {
51 reg = <0>;
52 #address-cells = <1>;
53 #size-cells = <0>;
54
55 si5338: clock-generator@70 {
56 compatible = "silabs,si5338";
57 reg = <0x70>;
58 /* other stuff */
59 };
60 };
61
62 i2c@1 {
63 /* data is written using iowrite32 */
64 reg = <1>;
65 #address-cells = <1>;
66 #size-cells = <0>;
67
68 si5338: clock-generator@70 {
69 compatible = "silabs,si5338";
70 reg = <0x70>;
71 /* other stuff */
72 };
73 };
74 };
75

3. 한국어 전문 번역

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

Register 기반 I2C mux 동작

1-35

이 binding은 단일 register 값으로 I2C signal 경로를 선택하는 bus multiplexer를 설명합니다. 필수 `compatible`은 `i2c-mux-reg`, `i2c-parent`는 master-side port가 연결된 I2C bus의 phandle입니다. 표준 mux property와 child bus node는 같은 directory의 `i2c-mux.yaml`을 따릅니다.

선택 `reg`의 `<offset size>` pair는 mux control register를 지정합니다. Offset과 size의 해석은 parent node의 address translation에 따르며 임의의 memory-mapped address일 수 있습니다. Size는 1, 2, 4 byte 중 하나여야 하고, `reg`를 생략하면 이 device의 resource를 사용합니다.

`little-endian` 또는 `big-endian`은 register byte order를 지정합니다. 둘 다 생략하면 CPU endianness를 사용합니다. `write-only`는 register가 write-only임을 나타냅니다. `idle-state`는 idle 때 쓸 값이며 값을 지정하지 않으면 마지막 사용 값을 기본으로 합니다.

Child bus device에 접근할 때 해당 child node의 `reg` 값을 mux register에 출력합니다. `idle-state`가 정의되어 있으면 child 접근이 없을 때 idle value를 register에 쓰고, 정의하지 않으면 가장 최근에 사용한 값을 그대로 유지합니다.

Register mux 선택 규칙
상태Register value
Child access해당 child node의 reg
Idle + idle-state설정한 idle value
Idle without idle-state가장 최근 child value

Access와 idle 상태에서 register에 남는 값을 정리합니다.

PCIe little-endian mux 예제

36-74

예제는 big-endian PowerPC host의 PCIe card에 있는 little-endian register를 사용합니다. `reg = <0x6028 0x4>`의 4-byte size 때문에 `iowrite32`를 사용하며, `i2c1`을 parent로 삼습니다. Child bus 0과 1은 각 값을 register에 쓰고 둘 다 address `0x70`의 Silicon Labs Si5338 clock generator를 연결합니다.

i2c-mux {
        /* the <offset size> depends on the address translation
         * of the parent device. If omitted, device resource
         * will be used instead. The size is to determine
         * whether iowrite32, iowrite16, or iowrite8 will be used.
         */
        reg = <0x6028 0x4>;
        little-endian;                /* little endian register on PCIe */
        compatible = "i2c-mux-reg";
        #address-cells = <1>;
        #size-cells = <0>;
        i2c-parent = <&i2c1>;
        i2c@0 {
                reg = <0>;
                #address-cells = <1>;
                #size-cells = <0>;

                si5338: clock-generator@70 {
                        compatible = "silabs,si5338";
                        reg = <0x70>;
                        /* other stuff */
                };
        };

        i2c@1 {
                /* data is written using iowrite32 */
                reg = <1>;
                #address-cells = <1>;
                #size-cells = <0>;

                si5338: clock-generator@70 {
                        compatible = "silabs,si5338";
                        reg = <0x70>;
                        /* other stuff */
                };
        };
};