← Documents Documentation/devicetree/bindings/net/dsa/lan9303.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings

SMSC Microchip LAN9303 Switch

LAN9303 3-port DSA switch의 I2C·MDIO 관리 방식과 논리 port mapping입니다.

Source pathDocumentation/devicetree/bindings/net/dsa/lan9303.txt
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약과 해설

lan9303.txt:1-100

CPU port 0과 두 외부 port를 I2C 또는 MDIO로 구성하는 두 예제를 비교합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 SMSC/MicroChip LAN9303 three port ethernet switch
2 -------------------------------------------------
3
4 Required properties:
5
6 - compatible: should be
7 - "smsc,lan9303-i2c" for I2C managed mode
8 or
9 - "smsc,lan9303-mdio" for mdio managed mode
10
11 Optional properties:
12
13 - reset-gpios: GPIO to be used to reset the whole device
14 - reset-duration: reset duration in milliseconds, defaults to 200 ms
15
16 Subnodes:
17
18 The integrated switch subnode should be specified according to the binding
19 described in dsa/dsa.txt. The CPU port of this switch is always port 0.
20
21 Note: always use 'reg = <0/1/2>;' for the three DSA ports, even if the device is
22 configured to use 1/2/3 instead. This hardware configuration will be
23 auto-detected and mapped accordingly.
24
25 Example:
26
27 I2C managed mode:
28
29 master: masterdevice@X {
30
31 fixed-link { /* RMII fixed link to LAN9303 */
32 speed = <100>;
33 full-duplex;
34 };
35 };
36
37 switch: switch@a {
38 compatible = "smsc,lan9303-i2c";
39 reg = <0xa>;
40 reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
41 reset-duration = <200>;
42
43 ports {
44 #address-cells = <1>;
45 #size-cells = <0>;
46
47 port@0 { /* RMII fixed link to master */
48 reg = <0>;
49 ethernet = <&master>;
50 };
51
52 port@1 { /* external port 1 */
53 reg = <1>;
54 label = "lan1";
55 };
56
57 port@2 { /* external port 2 */
58 reg = <2>;
59 label = "lan2";
60 };
61 };
62 };
63
64 MDIO managed mode:
65
66 master: masterdevice@X {
67 phy-handle = <&switch>;
68
69 mdio {
70 #address-cells = <1>;
71 #size-cells = <0>;
72
73 switch: switch-phy@0 {
74 compatible = "smsc,lan9303-mdio";
75 reg = <0>;
76 reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
77 reset-duration = <100>;
78
79 ports {
80 #address-cells = <1>;
81 #size-cells = <0>;
82
83 port@0 {
84 reg = <0>;
85 ethernet = <&master>;
86 };
87
88 port@1 { /* external port 1 */
89 reg = <1>;
90 label = "lan1";
91 };
92
93 port@2 { /* external port 2 */
94 reg = <2>;
95 label = "lan2";
96 };
97 };
98 };
99 };
100 };
101

3. 한국어 전문 번역

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

SMSC/Microchip LAN9303

1-15

LAN9303은 3-port Ethernet switch입니다. `compatible`은 I2C managed mode의 `smsc,lan9303-i2c` 또는 MDIO managed mode의 `smsc,lan9303-mdio`입니다.

선택 `reset-gpios`는 장치 전체를 reset하는 GPIO이고 `reset-duration`은 millisecond 단위 reset 지속 시간이며 기본값은 200ms입니다.

DSA port 번호 규칙

16-24

내장 switch subnode는 `dsa/dsa.txt`의 binding에 따라 기술하며 이 switch의 CPU port는 항상 port 0입니다.

Hardware가 1/2/3 구성을 사용하더라도 세 DSA port에는 항상 `reg = <0/1/2>;`를 사용해야 합니다. 드라이버가 hardware 구성을 자동 감지해 알맞게 매핑합니다.

LAN9303 논리 port mapping
DSA port 0CPU port
DSA port 1External LAN 1
DSA port 2External LAN 2
Hardware 1/2/3 modeAuto-detected mapping

Device Tree는 항상 논리 번호 0·1·2를 쓰고 실제 hardware 번호는 자동 매핑됩니다.

I2C managed mode 예제

25-63

Master와 LAN9303은 100Mbps full-duplex RMII fixed link로 연결됩니다. I2C 주소 `0xa`의 switch는 active-low reset GPIO와 200ms reset을 사용하며 port 0은 master, port 1과 2는 `lan1`, `lan2`입니다.

master: masterdevice@X {

        fixed-link { /* RMII fixed link to LAN9303 */
                speed = <100>;
                full-duplex;
        };
};

switch: switch@a {
        compatible = "smsc,lan9303-i2c";
        reg = <0xa>;
        reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
        reset-duration = <200>;

        ports {
                #address-cells = <1>;
                #size-cells = <0>;

                port@0 { /* RMII fixed link to master */
                        reg = <0>;
                        ethernet = <&master>;
                };

                port@1 { /* external port 1 */
                        reg = <1>;
                        label = "lan1";
                };

                port@2 { /* external port 2 */
                        reg = <2>;
                        label = "lan2";
                };
        };
};

MDIO managed mode 예제

64-100

MDIO mode에서는 master의 `phy-handle`이 MDIO 주소 0의 switch를 가리킵니다. Switch는 100ms reset을 사용하고 동일하게 port 0을 master, port 1과 2를 외부 LAN으로 배치합니다.

master: masterdevice@X {
        phy-handle = <&switch>;

        mdio {
                #address-cells = <1>;
                #size-cells = <0>;

                switch: switch-phy@0 {
                        compatible = "smsc,lan9303-mdio";
                        reg = <0>;
                        reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
                        reset-duration = <100>;

                        ports {
                                #address-cells = <1>;
                                #size-cells = <0>;

                                port@0 {
                                        reg = <0>;
                                        ethernet = <&master>;
                                };

                                port@1 { /* external port 1 */
                                        reg = <1>;
                                        label = "lan1";
                                };

                                port@2 { /* external port 2 */
                                        reg = <2>;
                                        label = "lan2";
                                };
                        };
                };
        };
};