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

Linux 6.18.37 · Devicetree Bindings

TI SoC Ethernet Switch Controller

TI CPSW 본체, CPDMA/ALE/CPTS와 두 slave의 PHY 연결 binding입니다.

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

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

1. 요약·해설

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

요약과 해설

cpsw.txt:1-132

직접 resource 등록과 OMAP hwmod 등록 방식, slave별 세 PHY 연결 방식의 제약을 해설합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 TI SoC Ethernet Switch Controller Device Tree Bindings
2 ------------------------------------------------------
3
4 Required properties:
5 - compatible : Should be one of the below:-
6 "ti,cpsw" for backward compatible
7 "ti,am335x-cpsw" for AM335x controllers
8 "ti,am4372-cpsw" for AM437x controllers
9 "ti,dra7-cpsw" for DRA7x controllers
10 - reg : physical base address and size of the cpsw
11 registers map
12 - interrupts : property with a value describing the interrupt
13 number
14 - cpdma_channels : Specifies number of channels in CPDMA
15 - ale_entries : Specifies No of entries ALE can hold
16 - bd_ram_size : Specifies internal descriptor RAM size
17 - mac_control : Specifies Default MAC control register content
18 for the specific platform
19 - slaves : Specifies number for slaves
20 - active_slave : Specifies the slave to use for time stamping,
21 ethtool and SIOCGMIIPHY
22 - cpsw-phy-sel : Specifies the phandle to the CPSW phy mode selection
23 device. See also cpsw-phy-sel.txt for its binding.
24 Note that in legacy cases cpsw-phy-sel may be
25 a child device instead of a phandle
26 (DEPRECATED, use phys property instead).
27
28 Optional properties:
29 - ti,hwmods : Must be "cpgmac0"
30 - dual_emac : Specifies Switch to act as Dual EMAC
31 - syscon : Phandle to the system control device node, which is
32 the control module device of the am33x
33 - mode-gpios : Should be added if one/multiple gpio lines are
34 required to be driven so that cpsw data lines
35 can be connected to the phy via selective mux.
36 For example in dra72x-evm, pcf gpio has to be
37 driven low so that cpsw slave 0 and phy data
38 lines are connected via mux.
39 - cpts_clock_mult : Numerator to convert input clock ticks into nanoseconds
40 - cpts_clock_shift : Denominator to convert input clock ticks into nanoseconds
41 Mult and shift will be calculated basing on CPTS
42 rftclk frequency if both cpts_clock_shift and
43 cpts_clock_mult properties are not provided.
44
45 Slave Properties:
46 Required properties:
47 - phy-mode : See ethernet.txt file in the same directory
48 - phys : phandle on phy-gmii-sel PHY (see phy/ti-phy-gmii-sel.txt)
49
50 Optional properties:
51 - dual_emac_res_vlan : Specifies VID to be used to segregate the ports
52 - phy_id : Specifies slave phy id (deprecated, use phy-handle)
53 - phy-handle : See ethernet.txt file in the same directory
54
55 The MAC address will be determined using the optional properties
56 defined in ethernet.txt.
57
58 Slave sub-nodes:
59 - fixed-link : See fixed-link.txt file in the same directory
60
61 Note: Exactly one of phy_id, phy-handle, or fixed-link must be specified.
62
63 Note: "ti,hwmods" field is used to fetch the base address and irq
64 resources from TI, omap hwmod data base during device registration.
65 Future plan is to migrate hwmod data base contents into device tree
66 blob so that, all the required data will be used from device tree dts
67 file.
68
69 Examples:
70
71 mac: ethernet@4a100000 {
72 compatible = "ti,cpsw";
73 reg = <0x4A100000 0x1000>;
74 interrupts = <55 0x4>;
75 interrupt-parent = <&intc>;
76 cpdma_channels = <8>;
77 ale_entries = <1024>;
78 bd_ram_size = <0x2000>;
79 rx_descs = <64>;
80 mac_control = <0x20>;
81 slaves = <2>;
82 active_slave = <0>;
83 cpts_clock_mult = <0x80000000>;
84 cpts_clock_shift = <29>;
85 syscon = <&cm>;
86 cpsw-phy-sel = <&phy_sel>;
87 cpsw_emac0: slave@0 {
88 phy_id = <&davinci_mdio>, <0>;
89 phy-mode = "rgmii-txid";
90 /* Filled in by U-Boot */
91 mac-address = [ 00 00 00 00 00 00 ];
92 phys = <&phy_gmii_sel 1 0>;
93 };
94 cpsw_emac1: slave@1 {
95 phy_id = <&davinci_mdio>, <1>;
96 phy-mode = "rgmii-txid";
97 /* Filled in by U-Boot */
98 mac-address = [ 00 00 00 00 00 00 ];
99 phys = <&phy_gmii_sel 2 0>;
100 };
101 };
102
103 (or)
104 mac: ethernet@4a100000 {
105 compatible = "ti,cpsw";
106 ti,hwmods = "cpgmac0";
107 cpdma_channels = <8>;
108 ale_entries = <1024>;
109 bd_ram_size = <0x2000>;
110 rx_descs = <64>;
111 mac_control = <0x20>;
112 slaves = <2>;
113 active_slave = <0>;
114 cpts_clock_mult = <0x80000000>;
115 cpts_clock_shift = <29>;
116 syscon = <&cm>;
117 cpsw-phy-sel = <&phy_sel>;
118 cpsw_emac0: slave@0 {
119 phy_id = <&davinci_mdio>, <0>;
120 phy-mode = "rgmii-txid";
121 /* Filled in by U-Boot */
122 mac-address = [ 00 00 00 00 00 00 ];
123 phys = <&phy_gmii_sel 1 0>;
124 };
125 cpsw_emac1: slave@1 {
126 phy_id = <&davinci_mdio>, <1>;
127 phy-mode = "rgmii-txid";
128 /* Filled in by U-Boot */
129 mac-address = [ 00 00 00 00 00 00 ];
130 phys = <&phy_gmii_sel 2 0>;
131 };
132 };
133

3. 한국어 전문 번역

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

TI SoC CPSW 필수 속성

1-27

`compatible`은 이전 버전 호환용 `ti,cpsw`, AM335x controller용 `ti,am335x-cpsw`, AM437x용 `ti,am4372-cpsw`, DRA7x용 `ti,dra7-cpsw` 중 하나입니다.

`reg`는 CPSW register map의 physical base address와 크기이고 `interrupts`는 interrupt number입니다. `cpdma_channels`는 CPDMA channel 수, `ale_entries`는 ALE가 담을 수 있는 entry 수, `bd_ram_size`는 internal descriptor RAM 크기입니다.

`mac_control`은 플랫폼별 default MAC control register 내용입니다. `slaves`는 slave 수, `active_slave`는 time stamping, ethtool과 `SIOCGMIIPHY`에 사용할 slave를 지정합니다.

`cpsw-phy-sel`은 CPSW PHY mode selection device의 phandle이며 binding은 `cpsw-phy-sel.txt`를 참조합니다. Legacy 환경에서는 phandle 대신 child device일 수 있지만 이 방식은 deprecated이며 `phys` 속성을 사용해야 합니다.

선택 속성과 slave node

28-61

선택 `ti,hwmods`는 `cpgmac0`이어야 합니다. `dual_emac`은 switch를 Dual EMAC으로 동작시키고 `syscon`은 AM33x control module인 system control device node의 phandle입니다.

`mode-gpios`는 선택 mux를 거쳐 CPSW data line과 PHY data line을 연결하려고 하나 이상의 GPIO를 구동해야 할 때 추가합니다. 예를 들어 DRA72x EVM에서는 CPSW slave 0와 PHY line을 연결하도록 PCF GPIO를 LOW로 구동해야 합니다.

`cpts_clock_mult`는 input clock tick을 nanosecond로 바꾸는 numerator이고 `cpts_clock_shift`는 denominator입니다. 둘 다 없으면 CPTS `rftclk` frequency를 바탕으로 mult와 shift를 계산합니다.

Slave 필수 속성 `phy-mode`는 같은 디렉터리의 `ethernet.txt`를, `phys`는 `phy/ti-phy-gmii-sel.txt`의 `phy-gmii-sel` PHY phandle을 참조합니다.

Slave 선택 `dual_emac_res_vlan`은 port 분리에 사용할 VID입니다. `phy_id`는 slave PHY ID를 지정하는 deprecated 속성이므로 `phy-handle`을 사용하며, `phy-handle`의 정의와 선택적인 MAC address 결정 방법은 `ethernet.txt`를 참조합니다.

Slave sub-node `fixed-link`는 같은 디렉터리의 `fixed-link.txt`를 참조합니다. `phy_id`, `phy-handle`, `fixed-link` 중 정확히 하나만 지정해야 합니다.

CPSW slave link 방식
방식상태
phy_idDeprecated
phy-handle권장 PHY reference
fixed-link고정 link sub-node

각 slave는 세 PHY 연결 방식 중 정확히 하나를 선택합니다.

TI hwmod 이관 메모

62-68

`ti,hwmods` field는 device 등록 중 TI OMAP hwmod database에서 base address와 IRQ resource를 가져오는 데 사용합니다. 향후에는 hwmod database 내용을 Device Tree blob으로 옮겨 필요한 모든 데이터를 DTS 파일에서 사용하도록 할 계획입니다.

CPSW 두 등록 방식 예제

69-132

첫 예제는 `reg`와 `interrupts`를 직접 제공하고 두 번째는 `ti,hwmods = "cpgmac0"`에서 resource를 가져옵니다. 둘 다 CPDMA channel 8개, ALE entry 1024개, descriptor RAM `0x2000`, RX descriptor 64개와 slave 두 개를 구성합니다.

두 slave는 각각 MDIO PHY 0과 1, `rgmii-txid` mode, U-Boot가 채울 MAC address, GMII selector PHY 1과 2를 사용합니다. CPTS 변환에는 multiplier `0x80000000`과 shift 29를 지정합니다.

        mac: ethernet@4a100000 {
                compatible = "ti,cpsw";
                reg = <0x4A100000 0x1000>;
                interrupts = <55 0x4>;
                interrupt-parent = <&intc>;
                cpdma_channels = <8>;
                ale_entries = <1024>;
                bd_ram_size = <0x2000>;
                rx_descs = <64>;
                mac_control = <0x20>;
                slaves = <2>;
                active_slave = <0>;
                cpts_clock_mult = <0x80000000>;
                cpts_clock_shift = <29>;
                syscon = <&cm>;
                cpsw-phy-sel = <&phy_sel>;
                cpsw_emac0: slave@0 {
                        phy_id = <&davinci_mdio>, <0>;
                        phy-mode = "rgmii-txid";
                        /* Filled in by U-Boot */
                        mac-address = [ 00 00 00 00 00 00 ];
                        phys = <&phy_gmii_sel 1 0>;
                };
                cpsw_emac1: slave@1 {
                        phy_id = <&davinci_mdio>, <1>;
                        phy-mode = "rgmii-txid";
                        /* Filled in by U-Boot */
                        mac-address = [ 00 00 00 00 00 00 ];
                        phys = <&phy_gmii_sel 2 0>;
                };
        };

(or)
        mac: ethernet@4a100000 {
                compatible = "ti,cpsw";
                ti,hwmods = "cpgmac0";
                cpdma_channels = <8>;
                ale_entries = <1024>;
                bd_ram_size = <0x2000>;
                rx_descs = <64>;
                mac_control = <0x20>;
                slaves = <2>;
                active_slave = <0>;
                cpts_clock_mult = <0x80000000>;
                cpts_clock_shift = <29>;
                syscon = <&cm>;
                cpsw-phy-sel = <&phy_sel>;
                cpsw_emac0: slave@0 {
                        phy_id = <&davinci_mdio>, <0>;
                        phy-mode = "rgmii-txid";
                        /* Filled in by U-Boot */
                        mac-address = [ 00 00 00 00 00 00 ];
                        phys = <&phy_gmii_sel 1 0>;
                };
                cpsw_emac1: slave@1 {
                        phy_id = <&davinci_mdio>, <1>;
                        phy-mode = "rgmii-txid";
                        /* Filled in by U-Boot */
                        mac-address = [ 00 00 00 00 00 00 ];
                        phys = <&phy_gmii_sel 2 0>;
                };
        };