요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Micrel KSZ9021/KSZ9031/KSZ9131 Gigabit Ethernet PHY
Some boards require special tuning values, particularly when it comes
to clock delays. You can specify clock delay values in the PHY OF
device node. Deprecated, but still supported, these properties can
also be added to an Ethernet OF device node.
Note that these settings are applied after any phy-specific fixup from
phy_fixup_list (see phy_init_hw() from drivers/net/phy/phy_device.c),
and therefore may overwrite them.
KSZ9021:
All skew control options are specified in picoseconds. The minimum
value is 0, the maximum value is 3000, and it can be specified in 200ps
steps, *but* these values are in no way what you get because this chip's
skew values actually increase in 120ps steps, starting from -840ps. The
incorrect values came from an error in the original KSZ9021 datasheet
before it was corrected in revision 1.2 (Feb 2014), but it is too late to
change the driver now because of the many existing device trees that have
been created using values that go up in increments of 200.
The following table shows the actual skew delay you will get for each of the
possible devicetree values, and the number that will be programmed into the
corresponding pad skew register:
Device Tree Value Delay Pad Skew Register Value
-----------------------------------------------------
0 -840ps 0000
200 -720ps 0001
400 -600ps 0010
600 -480ps 0011
800 -360ps 0100
1000 -240ps 0101
1200 -120ps 0110
1400 0ps 0111
1600 120ps 1000
1800 240ps 1001
2000 360ps 1010
2200 480ps 1011
2400 600ps 1100
2600 720ps 1101
2800 840ps 1110
3000 960ps 1111
Optional properties:
- rxc-skew-ps : Skew control of RXC pad
- rxdv-skew-ps : Skew control of RX CTL pad
- txc-skew-ps : Skew control of TXC pad
- txen-skew-ps : Skew control of TX CTL pad
- rxd0-skew-ps : Skew control of RX data 0 pad
- rxd1-skew-ps : Skew control of RX data 1 pad
- rxd2-skew-ps : Skew control of RX data 2 pad
- rxd3-skew-ps : Skew control of RX data 3 pad
- txd0-skew-ps : Skew control of TX data 0 pad
- txd1-skew-ps : Skew control of TX data 1 pad
- txd2-skew-ps : Skew control of TX data 2 pad
- txd3-skew-ps : Skew control of TX data 3 pad
KSZ9031:
All skew control options are specified in picoseconds. The minimum
value is 0, and the maximum is property-dependent. The increment
step is 60ps. The default value is the neutral setting, so setting
rxc-skew-ps=<0> actually results in -900 picoseconds adjustment.
The KSZ9031 hardware supports a range of skew values from negative to
positive, where the specific range is property dependent. All values
specified in the devicetree are offset by the minimum value so they
can be represented as positive integers in the devicetree since it's
difficult to represent a negative number in the devictree.
The following 5-bit values table apply to rxc-skew-ps and txc-skew-ps.
Pad Skew Value Delay (ps) Devicetree Value
------------------------------------------------------
0_0000 -900ps 0
0_0001 -840ps 60
0_0010 -780ps 120
0_0011 -720ps 180
0_0100 -660ps 240
0_0101 -600ps 300
0_0110 -540ps 360
0_0111 -480ps 420
0_1000 -420ps 480
0_1001 -360ps 540
0_1010 -300ps 600
0_1011 -240ps 660
0_1100 -180ps 720
0_1101 -120ps 780
0_1110 -60ps 840
0_1111 0ps 900
1_0000 60ps 960
1_0001 120ps 1020
1_0010 180ps 1080
1_0011 240ps 1140
1_0100 300ps 1200
1_0101 360ps 1260
1_0110 420ps 1320
1_0111 480ps 1380
1_1000 540ps 1440
1_1001 600ps 1500
1_1010 660ps 1560
1_1011 720ps 1620
1_1100 780ps 1680
1_1101 840ps 1740
1_1110 900ps 1800
1_1111 960ps 1860
The following 4-bit values table apply to the txdX-skew-ps, rxdX-skew-ps
data pads, and the rxdv-skew-ps, txen-skew-ps control pads.
Pad Skew Value Delay (ps) Devicetree Value
------------------------------------------------------
0000 -420ps 0
0001 -360ps 60
0010 -300ps 120
0011 -240ps 180
0100 -180ps 240
0101 -120ps 300
0110 -60ps 360
0111 0ps 420
1000 60ps 480
1001 120ps 540
1010 180ps 600
1011 240ps 660
1100 300ps 720
1101 360ps 780
1110 420ps 840
1111 480ps 900
Optional properties:
Maximum value of 1860, default value 900:
- rxc-skew-ps : Skew control of RX clock pad
- txc-skew-ps : Skew control of TX clock pad
Maximum value of 900, default value 420:
- rxdv-skew-ps : Skew control of RX CTL pad
- txen-skew-ps : Skew control of TX CTL pad
- rxd0-skew-ps : Skew control of RX data 0 pad
- rxd1-skew-ps : Skew control of RX data 1 pad
- rxd2-skew-ps : Skew control of RX data 2 pad
- rxd3-skew-ps : Skew control of RX data 3 pad
- txd0-skew-ps : Skew control of TX data 0 pad
- txd1-skew-ps : Skew control of TX data 1 pad
- txd2-skew-ps : Skew control of TX data 2 pad
- txd3-skew-ps : Skew control of TX data 3 pad
- micrel,force-master:
Boolean, force phy to master mode. Only set this option if the phy
reference clock provided at CLK125_NDO pin is used as MAC reference
clock because the clock jitter in slave mode is too high (errata#2).
Attention: The link partner must be configurable as slave otherwise
no link will be established.
KSZ9131:
LAN8841:
All skew control options are specified in picoseconds. The increment
step is 100ps. Unlike KSZ9031, the values represent picoseccond delays.
A negative value can be assigned as rxc-skew-psec = <(-100)>;.
Optional properties:
Range of the value -700 to 2400, default value 0:
- rxc-skew-psec : Skew control of RX clock pad
- txc-skew-psec : Skew control of TX clock pad
Range of the value -700 to 800, default value 0:
- rxdv-skew-psec : Skew control of RX CTL pad
- txen-skew-psec : Skew control of TX CTL pad
- rxd0-skew-psec : Skew control of RX data 0 pad
- rxd1-skew-psec : Skew control of RX data 1 pad
- rxd2-skew-psec : Skew control of RX data 2 pad
- rxd3-skew-psec : Skew control of RX data 3 pad
- txd0-skew-psec : Skew control of TX data 0 pad
- txd1-skew-psec : Skew control of TX data 1 pad
- txd2-skew-psec : Skew control of TX data 2 pad
- txd3-skew-psec : Skew control of TX data 3 pad
Examples:
/* Attach to an Ethernet device with autodetected PHY */
&enet {
rxc-skew-ps = <1800>;
rxdv-skew-ps = <0>;
txc-skew-ps = <1800>;
txen-skew-ps = <0>;
status = "okay";
};
/* Attach to an explicitly-specified PHY */
mdio {
phy0: ethernet-phy@0 {
rxc-skew-ps = <1800>;
rxdv-skew-ps = <0>;
txc-skew-ps = <1800>;
txen-skew-ps = <0>;
reg = <0>;
};
};
ethernet@70000 {
phy = <&phy0>;
phy-mode = "rgmii-id";
};
References
Micrel ksz9021rl/rn Data Sheet, Revision 1.2. Dated 2/13/2014.
http://www.micrel.com/_PDF/Ethernet/datasheets/ksz9021rl-rn_ds.pdf
Micrel ksz9031rnx Data Sheet, Revision 2.1. Dated 11/20/2014.
http://www.micrel.com/_PDF/Ethernet/datasheets/KSZ9031RNX.pdf
Notes:
Note that a previous version of the Micrel ksz9021rl/rn Data Sheet
was missing extended register 106 (transmit data pad skews), and
incorrectly specified the ps per step as 200ps/step instead of
120ps/step. The latest update to this document reflects the latest
revision of the Micrel specification even though usage in the kernel
still reflects that incorrect document.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Micrel KSZ90x1 clock delay 조정
1-11Micrel KSZ9021/KSZ9031/KSZ9131 Gigabit Ethernet PHY 중 일부 board는 특히 clock delay에 별도 tuning 값이 필요합니다. PHY OF device node에서 clock delay를 지정할 수 있습니다.
더 이상 권장하지 않지만 Ethernet OF device node에 이 속성을 두는 방식도 계속 지원합니다. 설정은 `phy_fixup_list`의 PHY별 fixup 뒤에 적용되므로 `drivers/net/phy/phy_device.c`의 `phy_init_hw()`에서 적용한 값을 덮어쓸 수 있습니다.
KSZ9021 skew 값의 실제 의미
12-25KSZ9021 skew control 값은 picosecond 단위로 0부터 3000까지 200ps 간격으로 지정합니다. 그러나 chip의 실제 skew는 -840ps에서 시작해 120ps씩 증가하므로 지정값과 실제 delay가 일치하지 않습니다.
이 잘못된 값은 2014년 2월의 KSZ9021 datasheet revision 1.2에서 수정되기 전 원본 datasheet 오류에서 비롯되었습니다. 이미 수많은 Device Tree가 200 단위 값을 사용하므로 driver 의미를 바꾸기에는 늦었습니다. 다음 표는 각 DT 값이 만드는 실제 skew delay와 pad skew register 값을 보여줍니다.
KSZ9021 Device Tree 값과 실제 delay
26-45원문의 16개 Device Tree 값, 실제 delay와 4-bit pad register 값을 보존합니다.
KSZ9021 선택 skew 속성
46-60`rxc-skew-ps`, `rxdv-skew-ps`, `txc-skew-ps`, `txen-skew-ps`는 각각 RXC, RX CTL, TXC, TX CTL pad의 skew를 제어합니다.
`rxd0-skew-ps`부터 `rxd3-skew-ps`까지는 RX data pad 0-3, `txd0-skew-ps`부터 `txd3-skew-ps`까지는 TX data pad 0-3의 skew를 제어합니다.
KSZ9031 skew 값 encoding
61-73KSZ9031 skew control도 picosecond 단위지만 최소값은 0이고 최대값은 속성마다 다르며 증가 간격은 60ps입니다. 기본값은 neutral setting이므로 `rxc-skew-ps=<0>`은 실제로 -900ps 조정을 만듭니다.
Hardware는 속성별로 음수부터 양수까지 skew 범위를 지원합니다. Device Tree에서 음수를 표현하기 어려우므로 지정값에는 실제 최소값만큼 offset을 더해 양의 정수로 표현합니다.
KSZ9031 clock pad 5-bit 값
74-110다음 5-bit 값은 `rxc-skew-ps`와 `txc-skew-ps`에 적용됩니다.
Clock pad register 값, 실제 delay와 Device Tree offset 값의 대응입니다.
KSZ9031 data/control pad 4-bit 값
111-132다음 4-bit 값은 `txdX-skew-ps`, `rxdX-skew-ps` data pad와 `rxdv-skew-ps`, `txen-skew-ps` control pad에 적용됩니다.
Data/control pad register 값과 60ps 간격 Device Tree 값의 대응입니다.
KSZ9031 선택 속성과 master mode
133-159`rxc-skew-ps`와 `txc-skew-ps`의 최대값은 1860, 기본값은 900입니다. `rxdv-skew-ps`, `txen-skew-ps`, RX data 0-3과 TX data 0-3 skew 속성의 최대값은 900, 기본값은 420입니다.
Boolean `micrel,force-master`는 PHY를 master mode로 강제합니다. Slave mode clock jitter가 너무 큰 errata #2 때문에 `CLK125_NDO` pin의 PHY reference clock을 MAC reference clock으로 사용할 때만 설정해야 합니다. Link partner를 slave로 구성할 수 없으면 link가 성립하지 않습니다.
KSZ9131과 LAN8841 skew 속성
160-186KSZ9131과 LAN8841의 skew control은 picosecond 단위이고 100ps씩 증가합니다. KSZ9031과 달리 값 자체가 picosecond delay를 나타내며 `rxc-skew-psec = <(-100)>;`처럼 음수를 지정할 수 있습니다.
`rxc-skew-psec`와 `txc-skew-psec` 범위는 -700부터 2400, 기본값은 0입니다. `rxdv-skew-psec`, `txen-skew-psec`, `rxd0-skew-psec`부터 `rxd3-skew-psec`, `txd0-skew-psec`부터 `txd3-skew-psec` 범위는 -700부터 800, 기본값은 0입니다.
Autodetect PHY와 명시적 PHY 예제
187-212첫 예제는 autodetect된 PHY의 Ethernet device에 clock/control skew를 직접 둡니다. 두 번째 예제는 MDIO 주소 0의 명시적 PHY node에 같은 skew를 두고 Ethernet controller가 `rgmii-id` mode로 그 PHY를 참조합니다.
/* Attach to an Ethernet device with autodetected PHY */
&enet {
rxc-skew-ps = <1800>;
rxdv-skew-ps = <0>;
txc-skew-ps = <1800>;
txen-skew-ps = <0>;
status = "okay";
};
/* Attach to an explicitly-specified PHY */
mdio {
phy0: ethernet-phy@0 {
rxc-skew-ps = <1800>;
rxdv-skew-ps = <0>;
txc-skew-ps = <1800>;
txen-skew-ps = <0>;
reg = <0>;
};
};
ethernet@70000 {
phy = <&phy0>;
phy-mode = "rgmii-id";
};
Datasheet와 호환성 주의
213-228참조 문서는 2014-02-13의 Micrel KSZ9021RL/RN Data Sheet revision 1.2와 2014-11-20의 KSZ9031RNX Data Sheet revision 2.1입니다.
KSZ9021 자료: `http://www.micrel.com/_PDF/Ethernet/datasheets/ksz9021rl-rn_ds.pdf`, KSZ9031 자료: `http://www.micrel.com/_PDF/Ethernet/datasheets/KSZ9031RNX.pdf`.
이전 KSZ9021RL/RN datasheet는 transmit data pad skew용 extended register 106을 빠뜨렸고 step을 실제 120ps가 아닌 200ps로 잘못 기재했습니다. 이 문서는 최신 specification을 반영하지만 kernel의 기존 사용 방식은 여전히 잘못된 이전 문서 의미를 유지합니다.
요약과 해설
micrel-ksz90x1.txt:1-228세 세대의 skew encoding 차이와 datasheet 호환성 제약을 표로 정리합니다.