← Documents Documentation/devicetree/bindings/i2c/i2c-pxa-pci-ce4100.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings

CE4100 PCI I2C Controllers

세 PCI BAR를 독립 I2C controller에 mapping하는 CE4100 바인딩입니다.

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

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

1. 요약·해설

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

요약과 해설

i2c-pxa-pci-ce4100.txt:1-93

PCI ranges 변환과 FalconFalls의 세 controller를 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 CE4100 I2C
2 ----------
3
4 CE4100 has one PCI device which is described as the I2C-Controller. This
5 PCI device has three PCI-bars, each bar contains a complete I2C
6 controller. So we have a total of three independent I2C-Controllers
7 which share only an interrupt line.
8 The driver is probed via the PCI-ID and is gathering the information of
9 attached devices from the devices tree.
10 Grant Likely recommended to use the ranges property to map the PCI-Bar
11 number to its physical address and to use this to find the child nodes
12 of the specific I2C controller. This were his exact words:
13
14 Here's where the magic happens. Each entry in
15 ranges describes how the parent pci address space
16 (middle group of 3) is translated to the local
17 address space (first group of 2) and the size of
18 each range (last cell). In this particular case,
19 the first cell of the local address is chosen to be
20 1:1 mapped to the BARs, and the second is the
21 offset from be base of the BAR (which would be
22 non-zero if you had 2 or more devices mapped off
23 the same BAR)
24
25 ranges allows the address mapping to be described
26 in a way that the OS can interpret without
27 requiring custom device driver code.
28
29 This is an example which is used on FalconFalls:
30 ------------------------------------------------
31 i2c-controller@b,2 {
32 #address-cells = <2>;
33 #size-cells = <1>;
34 compatible = "pci8086,2e68.2",
35 "pci8086,2e68",
36 "pciclass,ff0000",
37 "pciclass,ff00";
38
39 reg = <0x15a00 0x0 0x0 0x0 0x0>;
40 interrupts = <16 1>;
41
42 /* as described by Grant, the first number in the group of
43 * three is the bar number followed by the 64bit bar address
44 * followed by size of the mapping. The bar address
45 * requires also a valid translation in parents ranges
46 * property.
47 */
48 ranges = <0 0 0x02000000 0 0xdffe0500 0x100
49 1 0 0x02000000 0 0xdffe0600 0x100
50 2 0 0x02000000 0 0xdffe0700 0x100>;
51
52 i2c@0 {
53 #address-cells = <1>;
54 #size-cells = <0>;
55 compatible = "intel,ce4100-i2c-controller";
56
57 /* The first number in the reg property is the
58 * number of the bar
59 */
60 reg = <0 0 0x100>;
61
62 /* This I2C controller has no devices */
63 };
64
65 i2c@1 {
66 #address-cells = <1>;
67 #size-cells = <0>;
68 compatible = "intel,ce4100-i2c-controller";
69 reg = <1 0 0x100>;
70
71 /* This I2C controller has one gpio controller */
72 gpio@26 {
73 #gpio-cells = <2>;
74 compatible = "nxp,pcf8575";
75 reg = <0x26>;
76 gpio-controller;
77 };
78 };
79
80 i2c@2 {
81 #address-cells = <1>;
82 #size-cells = <0>;
83 compatible = "intel,ce4100-i2c-controller";
84 reg = <2 0 0x100>;
85
86 gpio@26 {
87 #gpio-cells = <2>;
88 compatible = "nxp,pcf8575";
89 reg = <0x26>;
90 gpio-controller;
91 };
92 };
93 };
94

3. 한국어 전문 번역

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

CE4100 PCI BAR address 변환

1-28

CE4100에는 I2C controller로 기술되는 PCI device가 하나 있습니다. 이 device의 PCI BAR 세 개에는 각각 완전한 I2C controller가 들어 있으므로, interrupt line만 공유하는 독립 controller가 모두 세 개입니다. Driver는 PCI ID로 probe되고 연결 device 정보는 device tree에서 수집합니다.

Grant Likely는 `ranges` property로 PCI BAR number를 physical address에 mapping하고, 이를 통해 특정 I2C controller의 child node를 찾도록 권장했습니다. 각 `ranges` entry에서 가운데 3-cell group인 parent PCI address space를 첫 2-cell group인 local address space로 변환하며 마지막 cell은 range size입니다.

이 예에서는 local address의 첫 cell을 BAR와 1:1로 대응시키고 둘째 cell을 BAR base로부터의 offset으로 사용합니다. 같은 BAR에 device를 둘 이상 mapping한다면 이 offset은 0이 아닐 수 있습니다. `ranges`는 OS가 custom device driver code 없이 해석할 수 있는 방식으로 address mapping을 기술합니다.

CE4100 PCI BAR to I2C mapping
PCI device 8086:2e68Shared interrupt 16
ranges BAR 0I2C controller 0
ranges BAR 1I2C controller 1
ranges BAR 2I2C controller 2
Child regBAR number + offset + size

한 PCI function의 세 BAR를 독립 I2C controller child로 변환합니다.

FalconFalls의 세 controller 예제

29-93

FalconFalls 예제는 BAR 0, 1, 2를 physical address `0xdffe0500`, `0xdffe0600`, `0xdffe0700`의 0x100-byte 영역에 mapping합니다. 각 child의 `reg` 첫 값은 BAR number입니다. Controller 0에는 device가 없고 controller 1과 2에는 각각 address `0x26`의 NXP PCF8575 GPIO controller가 있습니다.

i2c-controller@b,2 {
        #address-cells = <2>;
        #size-cells = <1>;
        compatible = "pci8086,2e68.2",
                        "pci8086,2e68",
                        "pciclass,ff0000",
                        "pciclass,ff00";

        reg = <0x15a00 0x0 0x0 0x0 0x0>;
        interrupts = <16 1>;

        /* as described by Grant, the first number in the group of
        * three is the bar number followed by the 64bit bar address
        * followed by size of the mapping. The bar address
        * requires also a valid translation in parents ranges
        * property.
        */
        ranges = <0 0   0x02000000 0 0xdffe0500 0x100
                  1 0   0x02000000 0 0xdffe0600 0x100
                  2 0   0x02000000 0 0xdffe0700 0x100>;

        i2c@0 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "intel,ce4100-i2c-controller";

                /* The first number in the reg property is the
                * number of the bar
                */
                reg = <0 0 0x100>;

                /* This I2C controller has no devices */
        };

        i2c@1 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "intel,ce4100-i2c-controller";
                reg = <1 0 0x100>;

                /* This I2C controller has one gpio controller */
                gpio@26 {
                        #gpio-cells = <2>;
                        compatible = "nxp,pcf8575";
                        reg = <0x26>;
                        gpio-controller;
                };
        };

        i2c@2 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "intel,ce4100-i2c-controller";
                reg = <2 0 0x100>;

                gpio@26 {
                        #gpio-cells = <2>;
                        compatible = "nxp,pcf8575";
                        reg = <0x26>;
                        gpio-controller;
                };
        };
};