요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
MPC5200 Device Tree Bindings
----------------------------
(c) 2006-2009 Secret Lab Technologies Ltd
Grant Likely <[email protected]>
Naming conventions
------------------
For mpc5200 on-chip devices, the format for each compatible value is
<chip>-<device>[-<mode>]. The OS should be able to match a device driver
to the device based solely on the compatible value. If two drivers
match on the compatible list; the 'most compatible' driver should be
selected.
The split between the MPC5200 and the MPC5200B leaves a bit of a
conundrum. How should the compatible property be set up to provide
maximum compatibility information; but still accurately describe the
chip? For the MPC5200; the answer is easy. Most of the SoC devices
originally appeared on the MPC5200. Since they didn't exist anywhere
else; the 5200 compatible properties will contain only one item;
"fsl,mpc5200-<device>".
The 5200B is almost the same as the 5200, but not quite. It fixes
silicon bugs and it adds a small number of enhancements. Most of the
devices either provide exactly the same interface as on the 5200. A few
devices have extra functions but still have a backwards compatible mode.
To express this information as completely as possible, 5200B device trees
should have two items in the compatible list:
compatible = "fsl,mpc5200b-<device>","fsl,mpc5200-<device>";
It is *strongly* recommended that 5200B device trees follow this convention
(instead of only listing the base mpc5200 item).
ie. ethernet on mpc5200: compatible = "fsl,mpc5200-fec";
ethernet on mpc5200b: compatible = "fsl,mpc5200b-fec", "fsl,mpc5200-fec";
Modal devices, like PSCs, also append the configured function to the
end of the compatible field. ie. A PSC in i2s mode would specify
"fsl,mpc5200-psc-i2s", not "fsl,mpc5200-i2s". This convention is chosen to
avoid naming conflicts with non-psc devices providing the same
function. For example, "fsl,mpc5200-spi" and "fsl,mpc5200-psc-spi" describe
the mpc5200 simple spi device and a PSC spi mode respectively.
At the time of writing, exact chip may be either 'fsl,mpc5200' or
'fsl,mpc5200b'.
The soc node
------------
This node describes the on chip SOC peripherals. Every mpc5200 based
board will have this node, and as such there is a common naming
convention for SOC devices.
Required properties:
name description
---- -----------
ranges Memory range of the internal memory mapped registers.
Should be <0 [baseaddr] 0xc000>
reg Should be <[baseaddr] 0x100>
compatible mpc5200: "fsl,mpc5200-immr"
mpc5200b: "fsl,mpc5200b-immr"
system-frequency 'fsystem' frequency in Hz; XLB, IPB, USB and PCI
clocks are derived from the fsystem clock.
bus-frequency IPB bus frequency in Hz. Clock rate
used by most of the soc devices.
soc child nodes
---------------
Any on chip SOC devices available to Linux must appear as soc5200 child nodes.
Note: The tables below show the value for the mpc5200. A mpc5200b device
tree should use the "fsl,mpc5200b-<device>","fsl,mpc5200-<device>" form.
Required soc5200 child nodes:
name compatible Description
---- ---------- -----------
cdm@<addr> fsl,mpc5200-cdm Clock Distribution
interrupt-controller@<addr> fsl,mpc5200-pic need an interrupt
controller to boot
bestcomm@<addr> fsl,mpc5200-bestcomm Bestcomm DMA controller
Recommended soc5200 child nodes; populate as needed for your board
name compatible Description
---- ---------- -----------
timer@<addr> fsl,mpc5200-gpt General purpose timers
gpio@<addr> fsl,mpc5200-gpio MPC5200 simple gpio controller
gpio@<addr> fsl,mpc5200-gpio-wkup MPC5200 wakeup gpio controller
rtc@<addr> fsl,mpc5200-rtc Real time clock
mscan@<addr> fsl,mpc5200-mscan CAN bus controller
pci@<addr> fsl,mpc5200-pci PCI bridge
serial@<addr> fsl,mpc5200-psc-uart PSC in serial mode
i2s@<addr> fsl,mpc5200-psc-i2s PSC in i2s mode
ac97@<addr> fsl,mpc5200-psc-ac97 PSC in ac97 mode
spi@<addr> fsl,mpc5200-psc-spi PSC in spi mode
irda@<addr> fsl,mpc5200-psc-irda PSC in IrDA mode
spi@<addr> fsl,mpc5200-spi MPC5200 spi device
ethernet@<addr> fsl,mpc5200-fec MPC5200 ethernet device
ata@<addr> fsl,mpc5200-ata IDE ATA interface
i2c@<addr> fsl,mpc5200-i2c I2C controller
usb@<addr> fsl,mpc5200-ohci,ohci-be USB controller
xlb@<addr> fsl,mpc5200-xlb XLB arbitrator
fsl,mpc5200-gpt nodes
---------------------
On the mpc5200 and 5200b, GPT0 has a watchdog timer function. If the board
design supports the internal wdt, then the device node for GPT0 should
include the empty property 'fsl,has-wdt'. Note that this does not activate
the watchdog. The timer will function as a GPT if the timer api is used, and
it will function as watchdog if the watchdog device is used. The watchdog
mode has priority over the gpt mode, i.e. if the watchdog is activated, any
gpt api call to this timer will fail with -EBUSY.
If you add the property
fsl,wdt-on-boot = <n>;
GPT0 will be marked as in-use watchdog, i.e. blocking every gpt access to it.
If n>0, the watchdog is started with a timeout of n seconds. If n=0, the
configuration of the watchdog is not touched. This is useful in two cases:
- just mark GPT0 as watchdog, blocking gpt accesses, and configure it later;
- do not touch a configuration assigned by the boot loader which supervises
the boot process itself.
The watchdog will respect the CONFIG_WATCHDOG_NOWAYOUT option.
An mpc5200-gpt can be used as a single line GPIO controller. To do so,
add the following properties to the gpt node:
gpio-controller;
#gpio-cells = <2>;
When referencing the GPIO line from another node, the first cell must always
be zero and the second cell represents the gpio flags and described in the
gpio device tree binding.
An mpc5200-gpt can be used as a single line edge sensitive interrupt
controller. To do so, add the following properties to the gpt node:
interrupt-controller;
#interrupt-cells = <1>;
When referencing the IRQ line from another node, the cell represents the
sense mode; 1 for edge rising, 2 for edge falling.
fsl,mpc5200-psc nodes
---------------------
The PSCs should include a cell-index which is the index of the PSC in
hardware. cell-index is used to determine which shared SoC registers to
use when setting up PSC clocking. cell-index number starts at '0'. ie:
PSC1 has 'cell-index = <0>'
PSC4 has 'cell-index = <3>'
PSC in i2s mode: The mpc5200 and mpc5200b PSCs are not compatible when in
i2s mode. An 'mpc5200b-psc-i2s' node cannot include 'mpc5200-psc-i2s' in the
compatible field.
fsl,mpc5200-gpio and fsl,mpc5200-gpio-wkup nodes
------------------------------------------------
Each GPIO controller node should have the empty property gpio-controller and
#gpio-cells set to 2. First cell is the GPIO number which is interpreted
according to the bit numbers in the GPIO control registers. The second cell
is for flags which is currently unused.
fsl,mpc5200-fec nodes
---------------------
The FEC node can specify one of the following properties to configure
the MII link:
- fsl,7-wire-mode - An empty property that specifies the link uses 7-wire
mode instead of MII
- current-speed - Specifies that the MII should be configured for a fixed
speed. This property should contain two cells. The
first cell specifies the speed in Mbps and the second
should be '0' for half duplex and '1' for full duplex
- phy-handle - Contains a phandle to an Ethernet PHY.
Interrupt controller (fsl,mpc5200-pic) node
-------------------------------------------
The mpc5200 pic binding splits hardware IRQ numbers into two levels. The
split reflects the layout of the PIC hardware itself, which groups
interrupts into one of three groups; CRIT, MAIN or PERP. Also, the
Bestcomm dma engine has its own set of interrupt sources which are
cascaded off of peripheral interrupt 0, which the driver interprets as a
fourth group, SDMA.
The interrupts property for device nodes using the mpc5200 pic consists
of three cells; <L1 L2 level>
L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3]
L2 := interrupt number; directly mapped from the value in the
"ICTL PerStat, MainStat, CritStat Encoded Register"
level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3]
For external IRQs, use the following interrupt property values (how to
specify external interrupts is a frequently asked question):
External interrupts:
external irq0: interrupts = <0 0 n>;
external irq1: interrupts = <1 1 n>;
external irq2: interrupts = <1 2 n>;
external irq3: interrupts = <1 3 n>;
'n' is sense (0: level high, 1: edge rising, 2: edge falling 3: level low)
fsl,mpc5200-mscan nodes
-----------------------
See file Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
문서 소개
1-6이 문서는 MPC5200 Device Tree Binding을 정의합니다. 저작권은 2006-2009 Secret Lab Technologies Ltd에 있으며 작성자는 Grant Likely `<[email protected]>`입니다.
Compatible 명명 규칙
7-45MPC5200 on-chip device의 `compatible` 값은 `<chip>-<device>[-<mode>]` 형식을 사용합니다. OS는 `compatible` 값만으로 device driver를 일치시킬 수 있어야 하며, 둘 이상의 driver가 목록과 일치하면 가장 호환성이 높은 driver를 선택해야 합니다.
MPC5200 SoC device 대부분은 MPC5200에서 처음 등장했으므로 MPC5200의 `compatible`에는 `fsl,mpc5200-<device>` 하나만 둡니다. MPC5200B는 MPC5200과 거의 같지만 silicon bug 수정과 일부 기능 향상이 있습니다. 같은 interface나 backward-compatible mode를 정확히 표현하기 위해 MPC5200B device tree는 두 값을 나열해야 합니다.
compatible = "fsl,mpc5200b-<device>","fsl,mpc5200-<device>";
MPC5200B에서 base `mpc5200` 항목만 쓰지 말고 이 두 항목 규칙을 따르는 것을 강하게 권장합니다. Ethernet device의 비교 예제는 다음과 같습니다.
ie. ethernet on mpc5200: compatible = "fsl,mpc5200-fec";
ethernet on mpc5200b: compatible = "fsl,mpc5200b-fec", "fsl,mpc5200-fec";
PSC 같은 modal device는 설정한 기능을 `compatible` 끝에 붙입니다. I2S mode의 PSC는 `fsl,mpc5200-i2s`가 아니라 `fsl,mpc5200-psc-i2s`를 사용합니다. 이는 같은 기능을 제공하는 non-PSC device와의 이름 충돌을 피하기 위한 것으로, `fsl,mpc5200-spi`는 simple SPI device, `fsl,mpc5200-psc-spi`는 PSC SPI mode를 뜻합니다.
문서 작성 시점의 정확한 chip compatible은 `fsl,mpc5200` 또는 `fsl,mpc5200b`입니다.
SoC node
46-65SoC node는 on-chip peripheral을 기술합니다. 모든 MPC5200 기반 board에 이 node가 있으므로 공통 SoC device 명명 규칙을 사용합니다.
| 필수 property | 설명 |
|---|---|
| ranges | 내부 memory-mapped register의 memory range입니다. `<0 [baseaddr] 0xc000>`이어야 합니다. |
| reg | `<[baseaddr] 0x100>`이어야 합니다. |
| compatible | MPC5200은 `fsl,mpc5200-immr`, MPC5200B는 `fsl,mpc5200b-immr`입니다. |
| system-frequency | `fsystem` frequency를 Hz로 지정합니다. XLB, IPB, USB, PCI clock은 fsystem clock에서 파생됩니다. |
| bus-frequency | IPB bus frequency를 Hz로 지정하며 대부분의 SoC device가 사용하는 clock rate입니다. |
SoC child node
66-101Linux에서 사용할 수 있는 모든 on-chip SoC device는 `soc5200` child node로 나타나야 합니다. 아래 표의 값은 MPC5200 기준이며 MPC5200B device tree는 `fsl,mpc5200b-<device>`, `fsl,mpc5200-<device>` 형식을 사용해야 합니다.
| 필수 node | compatible | 설명 |
|---|---|---|
| cdm@<addr> | fsl,mpc5200-cdm | Clock Distribution |
| interrupt-controller@<addr> | fsl,mpc5200-pic | Boot에 필요한 interrupt controller |
| bestcomm@<addr> | fsl,mpc5200-bestcomm | Bestcomm DMA controller |
다음 child node는 권장 항목이며 board에 필요한 device만 채웁니다.
| 권장 node | compatible | 설명 |
|---|---|---|
| timer@<addr> | fsl,mpc5200-gpt | General-purpose timer |
| gpio@<addr> | fsl,mpc5200-gpio | Simple GPIO controller |
| gpio@<addr> | fsl,mpc5200-gpio-wkup | Wakeup GPIO controller |
| rtc@<addr> | fsl,mpc5200-rtc | Real-time clock |
| mscan@<addr> | fsl,mpc5200-mscan | CAN bus controller |
| pci@<addr> | fsl,mpc5200-pci | PCI bridge |
| serial@<addr> | fsl,mpc5200-psc-uart | PSC serial mode |
| i2s@<addr> | fsl,mpc5200-psc-i2s | PSC I2S mode |
| ac97@<addr> | fsl,mpc5200-psc-ac97 | PSC AC97 mode |
| spi@<addr> | fsl,mpc5200-psc-spi | PSC SPI mode |
| irda@<addr> | fsl,mpc5200-psc-irda | PSC IrDA mode |
| spi@<addr> | fsl,mpc5200-spi | MPC5200 SPI device |
| ethernet@<addr> | fsl,mpc5200-fec | Ethernet device |
| ata@<addr> | fsl,mpc5200-ata | IDE ATA interface |
| i2c@<addr> | fsl,mpc5200-i2c | I2C controller |
| usb@<addr> | fsl,mpc5200-ohci,ohci-be | USB controller |
| xlb@<addr> | fsl,mpc5200-xlb | XLB arbitrator |
GPT watchdog
102-121MPC5200과 MPC5200B에서 GPT0은 watchdog timer 기능을 가집니다. Board가 내부 watchdog을 지원하면 GPT0 node에 빈 `fsl,has-wdt` property를 넣습니다. 이 property 자체는 watchdog을 활성화하지 않습니다.
Timer API를 사용하면 GPT로, watchdog device를 사용하면 watchdog으로 동작합니다. Watchdog mode가 GPT mode보다 우선하므로 watchdog을 활성화한 뒤 이 timer에 GPT API를 호출하면 `-EBUSY`로 실패합니다.
다음 property를 추가하면 GPT0을 사용 중인 watchdog으로 표시합니다.
fsl,wdt-on-boot = <n>;
n이 0보다 크면 timeout n초로 watchdog을 시작합니다. n이 0이면 기존 watchdog 설정을 건드리지 않습니다. 이를 통해 GPT0을 watchdog으로 예약하고 나중에 설정하거나, boot process를 감독하는 boot loader가 배정한 설정을 유지할 수 있습니다.
Watchdog은 `CONFIG_WATCHDOG_NOWAYOUT` option을 따릅니다.
GPT GPIO와 interrupt controller
122-137MPC5200 GPT는 single-line GPIO controller로 사용할 수 있습니다. GPT node에 다음 property를 추가합니다.
gpio-controller;
#gpio-cells = <2>;
다른 node에서 이 GPIO line을 참조할 때 첫 cell은 항상 0이고 두 번째 cell은 GPIO device-tree binding이 정의한 GPIO flag입니다.
MPC5200 GPT는 single-line edge-sensitive interrupt controller로도 사용할 수 있습니다. GPT node에 다음 property를 추가합니다.
interrupt-controller;
#interrupt-cells = <1>;
다른 node에서 IRQ line을 참조할 때 cell은 sense mode를 뜻합니다. 1은 rising edge, 2는 falling edge입니다.
PSC node
138-150PSC node는 hardware 안의 PSC index를 나타내는 `cell-index`를 포함해야 합니다. PSC clock 설정에서 사용할 shared SoC register를 선택하는 데 이 값이 쓰이며 번호는 0부터 시작합니다.
PSC1 has 'cell-index = <0>'
PSC4 has 'cell-index = <3>'
I2S mode에서는 MPC5200 PSC와 MPC5200B PSC가 호환되지 않습니다. 따라서 `mpc5200b-psc-i2s` node의 compatible field에 `mpc5200-psc-i2s`를 함께 넣을 수 없습니다.
GPIO controller node
151-157`fsl,mpc5200-gpio`와 `fsl,mpc5200-gpio-wkup` node에는 빈 `gpio-controller` property와 값 2인 `#gpio-cells`를 넣어야 합니다. 첫 cell은 GPIO control register의 bit 번호에 따라 해석하는 GPIO 번호이고, 두 번째 cell은 현재 사용하지 않는 flag입니다.
FEC node
158-169FEC node는 MII link를 설정하기 위해 다음 property 중 하나를 지정할 수 있습니다.
- `fsl,7-wire-mode`: MII 대신 7-wire mode를 사용함을 나타내는 빈 property입니다.
- `current-speed`: MII를 fixed speed로 설정합니다. 첫 cell은 Mbps 단위 speed이고 두 번째 cell은 half duplex이면 0, full duplex이면 1입니다.
- `phy-handle`: Ethernet PHY를 가리키는 phandle입니다.
MPIC interrupt controller
170-195`fsl,mpc5200-pic` binding은 hardware IRQ 번호를 두 level로 나눕니다. PIC hardware가 interrupt를 CRIT, MAIN, PERP 세 group으로 묶는 구조를 반영한 것입니다. Bestcomm DMA engine의 자체 interrupt source는 peripheral interrupt 0에 cascade되며 driver는 이를 네 번째 group SDMA로 해석합니다.
MPC5200 PIC를 사용하는 device node의 `interrupts` property는 `<L1 L2 level>` 세 cell로 구성됩니다.
| Cell | 값과 의미 |
|---|---|
| L1 | CRIT=0, MAIN=1, PERP=2, SDMA=3 |
| L2 | `ICTL PerStat, MainStat, CritStat Encoded Register` 값에서 직접 mapping한 interrupt 번호 |
| level | LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3 |
외부 IRQ는 다음 `interrupts` 값을 사용합니다. n은 sense이며 0은 level high, 1은 rising edge, 2는 falling edge, 3은 level low입니다.
external irq0: interrupts = <0 0 n>;
external irq1: interrupts = <1 1 n>;
external irq2: interrupts = <1 2 n>;
external irq3: interrupts = <1 3 n>;
MSCAN node
196-198`fsl,mpc5200-mscan` node에 대해서는 원문이 `Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt` 파일을 참조하라고 안내합니다.
요약과 해설
mpc5200.txt:1-1985200B의 backward-compatible 명명 규칙부터 SoC child 목록과 GPT watchdog·GPIO·interrupt, PSC mode, MII와 MPIC cell encoding까지 한 문서에서 정리합니다.