xref: /freebsd/sys/contrib/device-tree/Bindings/mtd/atmel-nand.txt (revision 8bab661a3316d8bd9b9fbd11a3b4371b91507bd2)
1c66ec88fSEmmanuel VadotAtmel NAND flash controller bindings
2c66ec88fSEmmanuel Vadot
3c66ec88fSEmmanuel VadotThe NAND flash controller node should be defined under the EBI bus (see
4c66ec88fSEmmanuel VadotDocumentation/devicetree/bindings/memory-controllers/atmel,ebi.txt).
5c66ec88fSEmmanuel VadotOne or several NAND devices can be defined under this NAND controller.
6c66ec88fSEmmanuel VadotThe NAND controller might be connected to an ECC engine.
7c66ec88fSEmmanuel Vadot
8c66ec88fSEmmanuel Vadot* NAND controller bindings:
9c66ec88fSEmmanuel Vadot
10c66ec88fSEmmanuel VadotRequired properties:
11c66ec88fSEmmanuel Vadot- compatible: should be one of the following
12c66ec88fSEmmanuel Vadot	"atmel,at91rm9200-nand-controller"
13c66ec88fSEmmanuel Vadot	"atmel,at91sam9260-nand-controller"
14c66ec88fSEmmanuel Vadot	"atmel,at91sam9261-nand-controller"
15c66ec88fSEmmanuel Vadot	"atmel,at91sam9g45-nand-controller"
16c66ec88fSEmmanuel Vadot	"atmel,sama5d3-nand-controller"
17c66ec88fSEmmanuel Vadot	"microchip,sam9x60-nand-controller"
18c66ec88fSEmmanuel Vadot- ranges: empty ranges property to forward EBI ranges definitions.
19c66ec88fSEmmanuel Vadot- #address-cells: should be set to 2.
20c66ec88fSEmmanuel Vadot- #size-cells: should be set to 1.
21c66ec88fSEmmanuel Vadot- atmel,nfc-io: phandle to the NFC IO block. Only required for sama5d3
22c66ec88fSEmmanuel Vadot		controllers.
23c66ec88fSEmmanuel Vadot- atmel,nfc-sram: phandle to the NFC SRAM block. Only required for sama5d3
24c66ec88fSEmmanuel Vadot		  controllers.
25c66ec88fSEmmanuel Vadot
26c66ec88fSEmmanuel VadotOptional properties:
27c66ec88fSEmmanuel Vadot- ecc-engine: phandle to the PMECC block. Only meaningful if the SoC embeds
28c66ec88fSEmmanuel Vadot	      a PMECC engine.
29c66ec88fSEmmanuel Vadot
30c66ec88fSEmmanuel Vadot* NAND device/chip bindings:
31c66ec88fSEmmanuel Vadot
32c66ec88fSEmmanuel VadotRequired properties:
33c66ec88fSEmmanuel Vadot- reg: describes the CS lines assigned to the NAND device. If the NAND device
34c66ec88fSEmmanuel Vadot       exposes multiple CS lines (multi-dies chips), your reg property will
35c66ec88fSEmmanuel Vadot       contain X tuples of 3 entries.
36c66ec88fSEmmanuel Vadot       1st entry: the CS line this NAND chip is connected to
37c66ec88fSEmmanuel Vadot       2nd entry: the base offset of the memory region assigned to this
38c66ec88fSEmmanuel Vadot		  device (always 0)
39c66ec88fSEmmanuel Vadot       3rd entry: the memory region size (always 0x800000)
40c66ec88fSEmmanuel Vadot
41c66ec88fSEmmanuel VadotOptional properties:
42c66ec88fSEmmanuel Vadot- rb-gpios: the GPIO(s) used to check the Ready/Busy status of the NAND.
43c66ec88fSEmmanuel Vadot- cs-gpios: the GPIO(s) used to control the CS line.
44c66ec88fSEmmanuel Vadot- det-gpios: the GPIO used to detect if a Smartmedia Card is present.
45c66ec88fSEmmanuel Vadot- atmel,rb: an integer identifying the native Ready/Busy pin. Only meaningful
46c66ec88fSEmmanuel Vadot	    on sama5 SoCs.
47c66ec88fSEmmanuel Vadot
48*8bab661aSEmmanuel VadotAll generic properties are described in the generic yaml files under
49*8bab661aSEmmanuel VadotDocumentation/devicetree/bindings/mtd/.
50c66ec88fSEmmanuel Vadot
51c66ec88fSEmmanuel Vadot* ECC engine (PMECC) bindings:
52c66ec88fSEmmanuel Vadot
53c66ec88fSEmmanuel VadotRequired properties:
54c66ec88fSEmmanuel Vadot- compatible: should be one of the following
55c66ec88fSEmmanuel Vadot	"atmel,at91sam9g45-pmecc"
56c66ec88fSEmmanuel Vadot	"atmel,sama5d4-pmecc"
57c66ec88fSEmmanuel Vadot	"atmel,sama5d2-pmecc"
58c66ec88fSEmmanuel Vadot	"microchip,sam9x60-pmecc"
59c66ec88fSEmmanuel Vadot- reg: should contain 2 register ranges. The first one is pointing to the PMECC
60c66ec88fSEmmanuel Vadot       block, and the second one to the PMECC_ERRLOC block.
61c66ec88fSEmmanuel Vadot
62c66ec88fSEmmanuel Vadot* SAMA5 NFC I/O bindings:
63c66ec88fSEmmanuel Vadot
64c66ec88fSEmmanuel VadotSAMA5 SoCs embed an advanced NAND controller logic to automate READ/WRITE page
65c66ec88fSEmmanuel Vadotoperations. This interface to this logic is placed in a separate I/O range and
66c66ec88fSEmmanuel Vadotshould thus have its own DT node.
67c66ec88fSEmmanuel Vadot
68c66ec88fSEmmanuel Vadot- compatible: should be "atmel,sama5d3-nfc-io", "syscon".
69c66ec88fSEmmanuel Vadot- reg: should contain the I/O range used to interact with the NFC logic.
70c66ec88fSEmmanuel Vadot
71c66ec88fSEmmanuel VadotExample:
72c66ec88fSEmmanuel Vadot
73c66ec88fSEmmanuel Vadot	nfc_io: nfc-io@70000000 {
74c66ec88fSEmmanuel Vadot		compatible = "atmel,sama5d3-nfc-io", "syscon";
75c66ec88fSEmmanuel Vadot		reg = <0x70000000 0x8000000>;
76c66ec88fSEmmanuel Vadot	};
77c66ec88fSEmmanuel Vadot
78c66ec88fSEmmanuel Vadot	pmecc: ecc-engine@ffffc070 {
79c66ec88fSEmmanuel Vadot		compatible = "atmel,at91sam9g45-pmecc";
80c66ec88fSEmmanuel Vadot                reg = <0xffffc070 0x490>,
81c66ec88fSEmmanuel Vadot                      <0xffffc500 0x100>;
82c66ec88fSEmmanuel Vadot	};
83c66ec88fSEmmanuel Vadot
84c66ec88fSEmmanuel Vadot	ebi: ebi@10000000 {
85c66ec88fSEmmanuel Vadot		compatible = "atmel,sama5d3-ebi";
86c66ec88fSEmmanuel Vadot		#address-cells = <2>;
87c66ec88fSEmmanuel Vadot		#size-cells = <1>;
88c66ec88fSEmmanuel Vadot		atmel,smc = <&hsmc>;
89c66ec88fSEmmanuel Vadot		reg = <0x10000000 0x10000000
90c66ec88fSEmmanuel Vadot		       0x40000000 0x30000000>;
91c66ec88fSEmmanuel Vadot		ranges = <0x0 0x0 0x10000000 0x10000000
92c66ec88fSEmmanuel Vadot			  0x1 0x0 0x40000000 0x10000000
93c66ec88fSEmmanuel Vadot			  0x2 0x0 0x50000000 0x10000000
94c66ec88fSEmmanuel Vadot			  0x3 0x0 0x60000000 0x10000000>;
95c66ec88fSEmmanuel Vadot		clocks = <&mck>;
96c66ec88fSEmmanuel Vadot
97c66ec88fSEmmanuel Vadot                nand_controller: nand-controller {
98c66ec88fSEmmanuel Vadot			compatible = "atmel,sama5d3-nand-controller";
99c66ec88fSEmmanuel Vadot			atmel,nfc-sram = <&nfc_sram>;
100c66ec88fSEmmanuel Vadot			atmel,nfc-io = <&nfc_io>;
101c66ec88fSEmmanuel Vadot			ecc-engine = <&pmecc>;
102c66ec88fSEmmanuel Vadot			#address-cells = <2>;
103c66ec88fSEmmanuel Vadot			#size-cells = <1>;
104c66ec88fSEmmanuel Vadot			ranges;
105c66ec88fSEmmanuel Vadot
106c66ec88fSEmmanuel Vadot			nand@3 {
107c66ec88fSEmmanuel Vadot				reg = <0x3 0x0 0x800000>;
108c66ec88fSEmmanuel Vadot				atmel,rb = <0>;
109c66ec88fSEmmanuel Vadot
110c66ec88fSEmmanuel Vadot				/*
111c66ec88fSEmmanuel Vadot				 * Put generic NAND/MTD properties and
112c66ec88fSEmmanuel Vadot				 * subnodes here.
113c66ec88fSEmmanuel Vadot				 */
114c66ec88fSEmmanuel Vadot			};
115c66ec88fSEmmanuel Vadot		};
116c66ec88fSEmmanuel Vadot	};
117c66ec88fSEmmanuel Vadot
118c66ec88fSEmmanuel Vadot-----------------------------------------------------------------------
119c66ec88fSEmmanuel Vadot
120c66ec88fSEmmanuel VadotDeprecated bindings (should not be used in new device trees):
121c66ec88fSEmmanuel Vadot
122c66ec88fSEmmanuel VadotRequired properties:
123c66ec88fSEmmanuel Vadot- compatible: The possible values are:
124c66ec88fSEmmanuel Vadot	"atmel,at91rm9200-nand"
125c66ec88fSEmmanuel Vadot	"atmel,sama5d2-nand"
126c66ec88fSEmmanuel Vadot	"atmel,sama5d4-nand"
127c66ec88fSEmmanuel Vadot- reg : should specify localbus address and size used for the chip,
128c66ec88fSEmmanuel Vadot	and hardware ECC controller if available.
129c66ec88fSEmmanuel Vadot	If the hardware ECC is PMECC, it should contain address and size for
130c66ec88fSEmmanuel Vadot	PMECC and PMECC Error Location controller.
131c66ec88fSEmmanuel Vadot	The PMECC lookup table address and size in ROM is optional. If not
132c66ec88fSEmmanuel Vadot	specified, driver will build it in runtime.
133c66ec88fSEmmanuel Vadot- atmel,nand-addr-offset : offset for the address latch.
134c66ec88fSEmmanuel Vadot- atmel,nand-cmd-offset : offset for the command latch.
135c66ec88fSEmmanuel Vadot- #address-cells, #size-cells : Must be present if the device has sub-nodes
136c66ec88fSEmmanuel Vadot  representing partitions.
137c66ec88fSEmmanuel Vadot
138c66ec88fSEmmanuel Vadot- gpios : specifies the gpio pins to control the NAND device. detect is an
139c66ec88fSEmmanuel Vadot  optional gpio and may be set to 0 if not present.
140c66ec88fSEmmanuel Vadot
141c66ec88fSEmmanuel VadotOptional properties:
142c66ec88fSEmmanuel Vadot- atmel,nand-has-dma : boolean to support dma transfer for nand read/write.
143c66ec88fSEmmanuel Vadot- nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default.
144c66ec88fSEmmanuel Vadot  Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
145c66ec88fSEmmanuel Vadot  "soft_bch".
146c66ec88fSEmmanuel Vadot- atmel,has-pmecc : boolean to enable Programmable Multibit ECC hardware,
147c66ec88fSEmmanuel Vadot  capable of BCH encoding and decoding, on devices where it is present.
148c66ec88fSEmmanuel Vadot- atmel,pmecc-cap : error correct capability for Programmable Multibit ECC
149c66ec88fSEmmanuel Vadot  Controller. Supported values are: 2, 4, 8, 12, 24. If the compatible string
150c66ec88fSEmmanuel Vadot  is "atmel,sama5d2-nand", 32 is also valid.
151c66ec88fSEmmanuel Vadot- atmel,pmecc-sector-size : sector size for ECC computation. Supported values
152c66ec88fSEmmanuel Vadot  are: 512, 1024.
153c66ec88fSEmmanuel Vadot- atmel,pmecc-lookup-table-offset : includes two offsets of lookup table in ROM
154c66ec88fSEmmanuel Vadot  for different sector size. First one is for sector size 512, the next is for
155c66ec88fSEmmanuel Vadot  sector size 1024. If not specified, driver will build the table in runtime.
156c66ec88fSEmmanuel Vadot- nand-bus-width : 8 or 16 bus width if not present 8
157c66ec88fSEmmanuel Vadot- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
158c66ec88fSEmmanuel Vadot
159c66ec88fSEmmanuel VadotNand Flash Controller(NFC) is an optional sub-node
160c66ec88fSEmmanuel VadotRequired properties:
161c66ec88fSEmmanuel Vadot- compatible : "atmel,sama5d3-nfc".
162c66ec88fSEmmanuel Vadot- reg : should specify the address and size used for NFC command registers,
163c66ec88fSEmmanuel Vadot        NFC registers and NFC SRAM. NFC SRAM address and size can be absent
164c66ec88fSEmmanuel Vadot        if don't want to use it.
165c66ec88fSEmmanuel Vadot- clocks: phandle to the peripheral clock
166c66ec88fSEmmanuel VadotOptional properties:
167c66ec88fSEmmanuel Vadot- atmel,write-by-sram: boolean to enable NFC write by SRAM.
168c66ec88fSEmmanuel Vadot
169c66ec88fSEmmanuel VadotExamples:
170c66ec88fSEmmanuel Vadotnand0: nand@40000000,0 {
171c66ec88fSEmmanuel Vadot	compatible = "atmel,at91rm9200-nand";
172c66ec88fSEmmanuel Vadot	#address-cells = <1>;
173c66ec88fSEmmanuel Vadot	#size-cells = <1>;
174c66ec88fSEmmanuel Vadot	reg = <0x40000000 0x10000000
175c66ec88fSEmmanuel Vadot	       0xffffe800 0x200
176c66ec88fSEmmanuel Vadot	      >;
177c66ec88fSEmmanuel Vadot	atmel,nand-addr-offset = <21>;	/* ale */
178c66ec88fSEmmanuel Vadot	atmel,nand-cmd-offset = <22>;	/* cle */
179c66ec88fSEmmanuel Vadot	nand-on-flash-bbt;
180c66ec88fSEmmanuel Vadot	nand-ecc-mode = "soft";
181c66ec88fSEmmanuel Vadot	gpios = <&pioC 13 0	/* rdy */
182c66ec88fSEmmanuel Vadot		 &pioC 14 0 	/* nce */
183c66ec88fSEmmanuel Vadot		 0		/* cd */
184c66ec88fSEmmanuel Vadot		>;
185c66ec88fSEmmanuel Vadot	partition@0 {
186c66ec88fSEmmanuel Vadot		...
187c66ec88fSEmmanuel Vadot	};
188c66ec88fSEmmanuel Vadot};
189c66ec88fSEmmanuel Vadot
190c66ec88fSEmmanuel Vadot/* for PMECC supported chips */
191c66ec88fSEmmanuel Vadotnand0: nand@40000000 {
192c66ec88fSEmmanuel Vadot	compatible = "atmel,at91rm9200-nand";
193c66ec88fSEmmanuel Vadot	#address-cells = <1>;
194c66ec88fSEmmanuel Vadot	#size-cells = <1>;
195c66ec88fSEmmanuel Vadot	reg = < 0x40000000 0x10000000	/* bus addr & size */
196c66ec88fSEmmanuel Vadot		0xffffe000 0x00000600	/* PMECC addr & size */
197c66ec88fSEmmanuel Vadot		0xffffe600 0x00000200	/* PMECC ERRLOC addr & size */
198c66ec88fSEmmanuel Vadot		0x00100000 0x00100000	/* ROM addr & size */
199c66ec88fSEmmanuel Vadot		>;
200c66ec88fSEmmanuel Vadot	atmel,nand-addr-offset = <21>;	/* ale */
201c66ec88fSEmmanuel Vadot	atmel,nand-cmd-offset = <22>;	/* cle */
202c66ec88fSEmmanuel Vadot	nand-on-flash-bbt;
203c66ec88fSEmmanuel Vadot	nand-ecc-mode = "hw";
204c66ec88fSEmmanuel Vadot	atmel,has-pmecc;	/* enable PMECC */
205c66ec88fSEmmanuel Vadot	atmel,pmecc-cap = <2>;
206c66ec88fSEmmanuel Vadot	atmel,pmecc-sector-size = <512>;
207c66ec88fSEmmanuel Vadot	atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
208c66ec88fSEmmanuel Vadot	gpios = <&pioD 5 0	/* rdy */
209c66ec88fSEmmanuel Vadot		 &pioD 4 0	/* nce */
210c66ec88fSEmmanuel Vadot		 0		/* cd */
211c66ec88fSEmmanuel Vadot		>;
212c66ec88fSEmmanuel Vadot	partition@0 {
213c66ec88fSEmmanuel Vadot		...
214c66ec88fSEmmanuel Vadot	};
215c66ec88fSEmmanuel Vadot};
216c66ec88fSEmmanuel Vadot
217c66ec88fSEmmanuel Vadot/* for NFC supported chips */
218c66ec88fSEmmanuel Vadotnand0: nand@40000000 {
219c66ec88fSEmmanuel Vadot	compatible = "atmel,at91rm9200-nand";
220c66ec88fSEmmanuel Vadot	#address-cells = <1>;
221c66ec88fSEmmanuel Vadot	#size-cells = <1>;
222c66ec88fSEmmanuel Vadot	ranges;
223c66ec88fSEmmanuel Vadot        ...
224c66ec88fSEmmanuel Vadot        nfc@70000000 {
225c66ec88fSEmmanuel Vadot		compatible = "atmel,sama5d3-nfc";
226c66ec88fSEmmanuel Vadot		#address-cells = <1>;
227c66ec88fSEmmanuel Vadot		#size-cells = <1>;
228c66ec88fSEmmanuel Vadot		clocks = <&hsmc_clk>
229c66ec88fSEmmanuel Vadot		reg = <
230c66ec88fSEmmanuel Vadot			0x70000000 0x10000000	/* NFC Command Registers */
231c66ec88fSEmmanuel Vadot			0xffffc000 0x00000070	/* NFC HSMC regs */
232c66ec88fSEmmanuel Vadot			0x00200000 0x00100000	/* NFC SRAM banks */
233c66ec88fSEmmanuel Vadot		>;
234c66ec88fSEmmanuel Vadot	};
235c66ec88fSEmmanuel Vadot};
236