요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Atmel NAND flash controller bindings
The NAND flash controller node should be defined under the EBI bus (see
Documentation/devicetree/bindings/memory-controllers/atmel,ebi.txt).
One or several NAND devices can be defined under this NAND controller.
The NAND controller might be connected to an ECC engine.
* NAND controller bindings:
Required properties:
- compatible: should be one of the following
"atmel,at91rm9200-nand-controller"
"atmel,at91sam9260-nand-controller"
"atmel,at91sam9261-nand-controller"
"atmel,at91sam9g45-nand-controller"
"atmel,sama5d3-nand-controller"
"microchip,sam9x60-nand-controller"
- ranges: empty ranges property to forward EBI ranges definitions.
- #address-cells: should be set to 2.
- #size-cells: should be set to 1.
- atmel,nfc-io: phandle to the NFC IO block. Only required for sama5d3
controllers.
- atmel,nfc-sram: phandle to the NFC SRAM block. Only required for sama5d3
controllers.
Optional properties:
- ecc-engine: phandle to the PMECC block. Only meaningful if the SoC embeds
a PMECC engine.
* NAND device/chip bindings:
Required properties:
- reg: describes the CS lines assigned to the NAND device. If the NAND device
exposes multiple CS lines (multi-dies chips), your reg property will
contain X tuples of 3 entries.
1st entry: the CS line this NAND chip is connected to
2nd entry: the base offset of the memory region assigned to this
device (always 0)
3rd entry: the memory region size (always 0x800000)
Optional properties:
- rb-gpios: the GPIO(s) used to check the Ready/Busy status of the NAND.
- cs-gpios: the GPIO(s) used to control the CS line.
- det-gpios: the GPIO used to detect if a Smartmedia Card is present.
- atmel,rb: an integer identifying the native Ready/Busy pin. Only meaningful
on sama5 SoCs.
All generic properties are described in the generic yaml files under
Documentation/devicetree/bindings/mtd/.
* ECC engine (PMECC) bindings:
Required properties:
- compatible: should be one of the following
"atmel,at91sam9g45-pmecc"
"atmel,sama5d4-pmecc"
"atmel,sama5d2-pmecc"
"microchip,sam9x60-pmecc"
"microchip,sam9x7-pmecc", "atmel,at91sam9g45-pmecc"
- reg: should contain 2 register ranges. The first one is pointing to the PMECC
block, and the second one to the PMECC_ERRLOC block.
Example:
nfc_io: nfc-io@70000000 {
compatible = "atmel,sama5d3-nfc-io", "syscon";
reg = <0x70000000 0x8000000>;
};
pmecc: ecc-engine@ffffc070 {
compatible = "atmel,at91sam9g45-pmecc";
reg = <0xffffc070 0x490>,
<0xffffc500 0x100>;
};
ebi: ebi@10000000 {
compatible = "atmel,sama5d3-ebi";
#address-cells = <2>;
#size-cells = <1>;
atmel,smc = <&hsmc>;
reg = <0x10000000 0x10000000
0x40000000 0x30000000>;
ranges = <0x0 0x0 0x10000000 0x10000000
0x1 0x0 0x40000000 0x10000000
0x2 0x0 0x50000000 0x10000000
0x3 0x0 0x60000000 0x10000000>;
clocks = <&mck>;
nand_controller: nand-controller {
compatible = "atmel,sama5d3-nand-controller";
atmel,nfc-sram = <&nfc_sram>;
atmel,nfc-io = <&nfc_io>;
ecc-engine = <&pmecc>;
#address-cells = <2>;
#size-cells = <1>;
ranges;
nand@3 {
reg = <0x3 0x0 0x800000>;
atmel,rb = <0>;
/*
* Put generic NAND/MTD properties and
* subnodes here.
*/
};
};
};
-----------------------------------------------------------------------
Deprecated bindings (should not be used in new device trees):
Required properties:
- compatible: The possible values are:
"atmel,at91rm9200-nand"
"atmel,sama5d2-nand"
"atmel,sama5d4-nand"
- reg : should specify localbus address and size used for the chip,
and hardware ECC controller if available.
If the hardware ECC is PMECC, it should contain address and size for
PMECC and PMECC Error Location controller.
The PMECC lookup table address and size in ROM is optional. If not
specified, driver will build it in runtime.
- atmel,nand-addr-offset : offset for the address latch.
- atmel,nand-cmd-offset : offset for the command latch.
- #address-cells, #size-cells : Must be present if the device has sub-nodes
representing partitions.
- gpios : specifies the gpio pins to control the NAND device. detect is an
optional gpio and may be set to 0 if not present.
Optional properties:
- atmel,nand-has-dma : boolean to support dma transfer for nand read/write.
- nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default.
Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
"soft_bch".
- atmel,has-pmecc : boolean to enable Programmable Multibit ECC hardware,
capable of BCH encoding and decoding, on devices where it is present.
- atmel,pmecc-cap : error correct capability for Programmable Multibit ECC
Controller. Supported values are: 2, 4, 8, 12, 24. If the compatible string
is "atmel,sama5d2-nand", 32 is also valid.
- atmel,pmecc-sector-size : sector size for ECC computation. Supported values
are: 512, 1024.
- atmel,pmecc-lookup-table-offset : includes two offsets of lookup table in ROM
for different sector size. First one is for sector size 512, the next is for
sector size 1024. If not specified, driver will build the table in runtime.
- nand-bus-width : 8 or 16 bus width if not present 8
- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
Nand Flash Controller(NFC) is an optional sub-node
Required properties:
- compatible : "atmel,sama5d3-nfc".
- reg : should specify the address and size used for NFC command registers,
NFC registers and NFC SRAM. NFC SRAM address and size can be absent
if don't want to use it.
- clocks: phandle to the peripheral clock
Optional properties:
- atmel,write-by-sram: boolean to enable NFC write by SRAM.
Examples:
nand0: nand@40000000,0 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x40000000 0x10000000
0xffffe800 0x200
>;
atmel,nand-addr-offset = <21>; /* ale */
atmel,nand-cmd-offset = <22>; /* cle */
nand-on-flash-bbt;
nand-ecc-mode = "soft";
gpios = <&pioC 13 0 /* rdy */
&pioC 14 0 /* nce */
0 /* cd */
>;
partition@0 {
...
};
};
/* for PMECC supported chips */
nand0: nand@40000000 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = < 0x40000000 0x10000000 /* bus addr & size */
0xffffe000 0x00000600 /* PMECC addr & size */
0xffffe600 0x00000200 /* PMECC ERRLOC addr & size */
0x00100000 0x00100000 /* ROM addr & size */
>;
atmel,nand-addr-offset = <21>; /* ale */
atmel,nand-cmd-offset = <22>; /* cle */
nand-on-flash-bbt;
nand-ecc-mode = "hw";
atmel,has-pmecc; /* enable PMECC */
atmel,pmecc-cap = <2>;
atmel,pmecc-sector-size = <512>;
atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
gpios = <&pioD 5 0 /* rdy */
&pioD 4 0 /* nce */
0 /* cd */
>;
partition@0 {
...
};
};
/* for NFC supported chips */
nand0: nand@40000000 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
ranges;
...
nfc@70000000 {
compatible = "atmel,sama5d3-nfc";
#address-cells = <1>;
#size-cells = <1>;
clocks = <&hsmc_clk>
reg = <
0x70000000 0x10000000 /* NFC Command Registers */
0xffffc000 0x00000070 /* NFC HSMC regs */
0x00200000 0x00100000 /* NFC SRAM banks */
>;
};
};
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Atmel NAND controller 구성
1-7NAND flash controller node는 EBI bus 아래에 정의해야 합니다. EBI 바인딩은 `Documentation/devicetree/bindings/memory-controllers/atmel,ebi.txt`를 참조합니다.
하나의 NAND controller 아래에는 NAND device를 하나 이상 정의할 수 있으며, controller는 ECC engine에 연결될 수 있습니다.
EBI 아래 controller가 하나 이상의 chip을 관리하고 선택적으로 PMECC를 사용합니다.
NAND controller 필수 속성
8-29Controller `compatible`은 `atmel,at91rm9200-nand-controller`, `atmel,at91sam9260-nand-controller`, `atmel,at91sam9261-nand-controller`, `atmel,at91sam9g45-nand-controller`, `atmel,sama5d3-nand-controller`, `microchip,sam9x60-nand-controller` 중 하나입니다.
`ranges`는 EBI의 range 정의를 전달하는 빈 속성입니다. `#address-cells`는 2, `#size-cells`는 1이어야 합니다.
`atmel,nfc-io`는 NFC I/O block의 phandle이고 `atmel,nfc-sram`은 NFC SRAM block의 phandle입니다. 둘 다 SAMA5D3 controller에서만 필수입니다.
선택 `ecc-engine`은 PMECC block의 phandle입니다. SoC에 PMECC engine이 내장된 경우에만 의미가 있습니다.
Controller compatible과 추가 필수 resource를 구분합니다.
NAND device·chip 속성
30-50Chip의 필수 `reg`는 NAND device에 할당된 chip-select line을 기술합니다. 여러 CS line을 노출하는 multi-die chip이라면 `reg`에 세 entry로 이루어진 tuple을 X개 넣습니다.
각 tuple의 첫 entry는 chip이 연결된 CS line이고, 두 번째는 device에 할당된 memory 영역의 base offset으로 항상 0이며, 세 번째는 memory 영역 크기로 항상 `0x800000`입니다.
선택 `rb-gpios`는 Ready/Busy 상태를 확인하는 GPIO, `cs-gpios`는 CS line 제어 GPIO, `det-gpios`는 SmartMedia Card 존재 감지 GPIO입니다. `atmel,rb`는 native Ready/Busy pin을 식별하는 정수이며 SAMA5 SoC에서만 의미가 있습니다.
모든 generic 속성은 `Documentation/devicetree/bindings/mtd/` 아래의 generic YAML 파일에 설명되어 있습니다.
Multi-die chip은 같은 세 entry 형식을 CS line마다 반복합니다.
PMECC engine 바인딩
51-62PMECC `compatible`은 `atmel,at91sam9g45-pmecc`, `atmel,sama5d4-pmecc`, `atmel,sama5d2-pmecc`, `microchip,sam9x60-pmecc` 중 하나입니다. SAM9X7은 `microchip,sam9x7-pmecc`와 fallback `atmel,at91sam9g45-pmecc`를 함께 사용합니다.
`reg`에는 register 범위 두 개를 넣습니다. 첫 범위는 PMECC block, 두 번째 범위는 `PMECC_ERRLOC` block을 가리킵니다.
ECC 계산 block과 error-location block이 함께 NAND data의 오류를 정정합니다.
SAMA5D3 EBI·PMECC 예제
63-109예제는 `nfc_io` syscon, 두 register 범위를 갖는 PMECC, SAMA5D3 EBI, 그 아래 NAND controller와 CS3의 NAND chip을 계층적으로 정의합니다.
Controller는 NFC SRAM·I/O와 PMECC를 phandle로 연결하고 `#address-cells = <2>`, `#size-cells = <1>`, 빈 `ranges`를 사용합니다. `nand@3`의 tuple은 CS3, offset 0, 크기 `0x800000`이며 native Ready/Busy pin 0을 선택합니다.
nfc_io: nfc-io@70000000 {
compatible = "atmel,sama5d3-nfc-io", "syscon";
reg = <0x70000000 0x8000000>;
};
pmecc: ecc-engine@ffffc070 {
compatible = "atmel,at91sam9g45-pmecc";
reg = <0xffffc070 0x490>,
<0xffffc500 0x100>;
};
ebi: ebi@10000000 {
compatible = "atmel,sama5d3-ebi";
#address-cells = <2>;
#size-cells = <1>;
atmel,smc = <&hsmc>;
reg = <0x10000000 0x10000000
0x40000000 0x30000000>;
ranges = <0x0 0x0 0x10000000 0x10000000
0x1 0x0 0x40000000 0x10000000
0x2 0x0 0x50000000 0x10000000
0x3 0x0 0x60000000 0x10000000>;
clocks = <&mck>;
nand_controller: nand-controller {
compatible = "atmel,sama5d3-nand-controller";
atmel,nfc-sram = <&nfc_sram>;
atmel,nfc-io = <&nfc_io>;
ecc-engine = <&pmecc>;
#address-cells = <2>;
#size-cells = <1>;
ranges;
nand@3 {
reg = <0x3 0x0 0x800000>;
atmel,rb = <0>;
/*
* Put generic NAND/MTD properties and
* subnodes here.
*/
};
};
};
Deprecated 단일-node 필수 속성
110-132구식 바인딩은 새 device tree에서 사용하면 안 됩니다. 가능한 `compatible`은 `atmel,at91rm9200-nand`, `atmel,sama5d2-nand`, `atmel,sama5d4-nand`입니다.
`reg`는 chip의 localbus 주소와 크기, 사용 가능한 hardware ECC controller를 지정합니다. PMECC를 쓸 때는 PMECC와 PMECC Error Location controller의 주소·크기를 포함하며, ROM의 PMECC lookup table 주소·크기는 선택입니다. 생략하면 driver가 runtime에 table을 생성합니다.
`atmel,nand-addr-offset`은 address latch offset, `atmel,nand-cmd-offset`은 command latch offset입니다. Partition subnode가 있으면 `#address-cells`와 `#size-cells`가 필수입니다.
`gpios`는 NAND를 제어하는 GPIO pin을 지정합니다. Detect GPIO는 선택이며 없으면 0으로 설정할 수 있습니다.
Deprecated DMA·ECC 선택 속성
133-150`atmel,nand-has-dma`는 NAND read/write DMA 전송을 활성화합니다. `nand-ecc-mode`의 기본값은 `soft`이고 허용값은 `none`, `soft`, `hw`, `hw_syndrome`, `hw_oob_first`, `soft_bch`입니다.
`atmel,has-pmecc`는 BCH encode·decode가 가능한 Programmable Multibit ECC hardware를 활성화합니다. `atmel,pmecc-cap`의 지원 correction capability는 2, 4, 8, 12, 24이고, `atmel,sama5d2-nand`에서는 32도 유효합니다. `atmel,pmecc-sector-size`는 512 또는 1024입니다.
`atmel,pmecc-lookup-table-offset`은 ROM에 있는 두 lookup table offset을 담으며 첫 값은 sector 512, 다음 값은 sector 1024용입니다. 생략하면 driver가 runtime에 table을 만듭니다.
`nand-bus-width`는 8 또는 16이고 생략 시 8입니다. `nand-on-flash-bbt`는 on-flash BBT를 활성화하는 boolean이며 생략 시 false입니다.
Correction capability, sector와 lookup table의 대응입니다.
Deprecated NFC 하위 node
151-160NAND Flash Controller인 NFC는 선택 subnode입니다. 필수 `compatible`은 `atmel,sama5d3-nfc`이고, `reg`는 NFC command register, NFC register, NFC SRAM의 주소와 크기를 지정합니다. NFC SRAM을 사용하지 않으면 그 범위는 생략할 수 있습니다.
`clocks`는 peripheral clock의 phandle입니다. 선택 boolean `atmel,write-by-sram`은 SRAM을 통한 NFC write를 활성화합니다.
NFC subnode가 command, controller와 선택 SRAM 범위를 한 node에 모읍니다.
Legacy software ECC 예제
161-181첫 legacy 예제는 localbus와 hardware ECC register 범위, ALE offset 21, CLE offset 22, on-flash BBT와 software ECC를 설정합니다. GPIO 순서는 ready, chip-enable, 선택 card-detect이며 partition subnode를 포함합니다.
nand0: nand@40000000,0 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x40000000 0x10000000
0xffffe800 0x200
>;
atmel,nand-addr-offset = <21>; /* ale */
atmel,nand-cmd-offset = <22>; /* cle */
nand-on-flash-bbt;
nand-ecc-mode = "soft";
gpios = <&pioC 13 0 /* rdy */
&pioC 14 0 /* nce */
0 /* cd */
>;
partition@0 {
...
};
};
Legacy PMECC 예제
182-208두 번째 예제는 bus, PMECC, `PMECC ERRLOC`, ROM lookup table 범위를 함께 제공하고 hardware ECC와 PMECC를 활성화합니다. Correction capability는 2, sector는 512, lookup table offset은 `0x8000`과 `0x10000`입니다.
/* for PMECC supported chips */
nand0: nand@40000000 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = < 0x40000000 0x10000000 /* bus addr & size */
0xffffe000 0x00000600 /* PMECC addr & size */
0xffffe600 0x00000200 /* PMECC ERRLOC addr & size */
0x00100000 0x00100000 /* ROM addr & size */
>;
atmel,nand-addr-offset = <21>; /* ale */
atmel,nand-cmd-offset = <22>; /* cle */
nand-on-flash-bbt;
nand-ecc-mode = "hw";
atmel,has-pmecc; /* enable PMECC */
atmel,pmecc-cap = <2>;
atmel,pmecc-sector-size = <512>;
atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
gpios = <&pioD 5 0 /* rdy */
&pioD 4 0 /* nce */
0 /* cd */
>;
partition@0 {
...
};
};
Legacy NFC 예제
209-227세 번째 예제는 NAND node 아래에 `atmel,sama5d3-nfc` subnode를 두고 command register, HSMC register, SRAM bank의 세 범위를 지정합니다. 원문에서 `clocks = <&hsmc_clk>` 뒤 semicolon이 빠진 상태도 그대로 보존합니다.
/* for NFC supported chips */
nand0: nand@40000000 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
#size-cells = <1>;
ranges;
...
nfc@70000000 {
compatible = "atmel,sama5d3-nfc";
#address-cells = <1>;
#size-cells = <1>;
clocks = <&hsmc_clk>
reg = <
0x70000000 0x10000000 /* NFC Command Registers */
0xffffc000 0x00000070 /* NFC HSMC regs */
0x00200000 0x00100000 /* NFC SRAM banks */
>;
};
};
요약과 해설
atmel-nand.txt:1-227현대 계층형 binding과 세 legacy 구성을 분리해 설명합니다.