xref: /openbmc/linux/Documentation/devicetree/bindings/mtd/atmel-nand.txt (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
182d0bf34SBoris BrezillonAtmel NAND flash controller bindings
282d0bf34SBoris Brezillon
382d0bf34SBoris BrezillonThe NAND flash controller node should be defined under the EBI bus (see
482d0bf34SBoris BrezillonDocumentation/devicetree/bindings/memory-controllers/atmel,ebi.txt).
582d0bf34SBoris BrezillonOne or several NAND devices can be defined under this NAND controller.
682d0bf34SBoris BrezillonThe NAND controller might be connected to an ECC engine.
782d0bf34SBoris Brezillon
882d0bf34SBoris Brezillon* NAND controller bindings:
982d0bf34SBoris Brezillon
1082d0bf34SBoris BrezillonRequired properties:
1182d0bf34SBoris Brezillon- compatible: should be one of the following
1282d0bf34SBoris Brezillon	"atmel,at91rm9200-nand-controller"
1382d0bf34SBoris Brezillon	"atmel,at91sam9260-nand-controller"
1482d0bf34SBoris Brezillon	"atmel,at91sam9261-nand-controller"
1582d0bf34SBoris Brezillon	"atmel,at91sam9g45-nand-controller"
1682d0bf34SBoris Brezillon	"atmel,sama5d3-nand-controller"
17b1e8e0aaSTudor Ambarus	"microchip,sam9x60-nand-controller"
1882d0bf34SBoris Brezillon- ranges: empty ranges property to forward EBI ranges definitions.
1982d0bf34SBoris Brezillon- #address-cells: should be set to 2.
2082d0bf34SBoris Brezillon- #size-cells: should be set to 1.
2182d0bf34SBoris Brezillon- atmel,nfc-io: phandle to the NFC IO block. Only required for sama5d3
2282d0bf34SBoris Brezillon		controllers.
2382d0bf34SBoris Brezillon- atmel,nfc-sram: phandle to the NFC SRAM block. Only required for sama5d3
2482d0bf34SBoris Brezillon		  controllers.
2582d0bf34SBoris Brezillon
2682d0bf34SBoris BrezillonOptional properties:
2782d0bf34SBoris Brezillon- ecc-engine: phandle to the PMECC block. Only meaningful if the SoC embeds
2882d0bf34SBoris Brezillon	      a PMECC engine.
2982d0bf34SBoris Brezillon
3082d0bf34SBoris Brezillon* NAND device/chip bindings:
3182d0bf34SBoris Brezillon
3282d0bf34SBoris BrezillonRequired properties:
3382d0bf34SBoris Brezillon- reg: describes the CS lines assigned to the NAND device. If the NAND device
3482d0bf34SBoris Brezillon       exposes multiple CS lines (multi-dies chips), your reg property will
3582d0bf34SBoris Brezillon       contain X tuples of 3 entries.
3682d0bf34SBoris Brezillon       1st entry: the CS line this NAND chip is connected to
3782d0bf34SBoris Brezillon       2nd entry: the base offset of the memory region assigned to this
3882d0bf34SBoris Brezillon		  device (always 0)
3982d0bf34SBoris Brezillon       3rd entry: the memory region size (always 0x800000)
4082d0bf34SBoris Brezillon
4182d0bf34SBoris BrezillonOptional properties:
4282d0bf34SBoris Brezillon- rb-gpios: the GPIO(s) used to check the Ready/Busy status of the NAND.
4382d0bf34SBoris Brezillon- cs-gpios: the GPIO(s) used to control the CS line.
4482d0bf34SBoris Brezillon- det-gpios: the GPIO used to detect if a Smartmedia Card is present.
4582d0bf34SBoris Brezillon- atmel,rb: an integer identifying the native Ready/Busy pin. Only meaningful
4682d0bf34SBoris Brezillon	    on sama5 SoCs.
4782d0bf34SBoris Brezillon
48*f902baa9SMiquel RaynalAll generic properties are described in the generic yaml files under
49*f902baa9SMiquel RaynalDocumentation/devicetree/bindings/mtd/.
5082d0bf34SBoris Brezillon
5182d0bf34SBoris Brezillon* ECC engine (PMECC) bindings:
5282d0bf34SBoris Brezillon
5382d0bf34SBoris BrezillonRequired properties:
5482d0bf34SBoris Brezillon- compatible: should be one of the following
5582d0bf34SBoris Brezillon	"atmel,at91sam9g45-pmecc"
5682d0bf34SBoris Brezillon	"atmel,sama5d4-pmecc"
5782d0bf34SBoris Brezillon	"atmel,sama5d2-pmecc"
587402b7faSClaudiu Beznea	"microchip,sam9x60-pmecc"
5982d0bf34SBoris Brezillon- reg: should contain 2 register ranges. The first one is pointing to the PMECC
6082d0bf34SBoris Brezillon       block, and the second one to the PMECC_ERRLOC block.
6182d0bf34SBoris Brezillon
623a689dcbSBoris Brezillon* SAMA5 NFC I/O bindings:
633a689dcbSBoris Brezillon
643a689dcbSBoris BrezillonSAMA5 SoCs embed an advanced NAND controller logic to automate READ/WRITE page
653a689dcbSBoris Brezillonoperations. This interface to this logic is placed in a separate I/O range and
663a689dcbSBoris Brezillonshould thus have its own DT node.
673a689dcbSBoris Brezillon
683a689dcbSBoris Brezillon- compatible: should be "atmel,sama5d3-nfc-io", "syscon".
693a689dcbSBoris Brezillon- reg: should contain the I/O range used to interact with the NFC logic.
703a689dcbSBoris Brezillon
7182d0bf34SBoris BrezillonExample:
7282d0bf34SBoris Brezillon
733a689dcbSBoris Brezillon	nfc_io: nfc-io@70000000 {
743a689dcbSBoris Brezillon		compatible = "atmel,sama5d3-nfc-io", "syscon";
753a689dcbSBoris Brezillon		reg = <0x70000000 0x8000000>;
763a689dcbSBoris Brezillon	};
773a689dcbSBoris Brezillon
7882d0bf34SBoris Brezillon	pmecc: ecc-engine@ffffc070 {
7982d0bf34SBoris Brezillon		compatible = "atmel,at91sam9g45-pmecc";
8082d0bf34SBoris Brezillon                reg = <0xffffc070 0x490>,
8182d0bf34SBoris Brezillon                      <0xffffc500 0x100>;
8282d0bf34SBoris Brezillon	};
8382d0bf34SBoris Brezillon
8482d0bf34SBoris Brezillon	ebi: ebi@10000000 {
8582d0bf34SBoris Brezillon		compatible = "atmel,sama5d3-ebi";
8682d0bf34SBoris Brezillon		#address-cells = <2>;
8782d0bf34SBoris Brezillon		#size-cells = <1>;
8882d0bf34SBoris Brezillon		atmel,smc = <&hsmc>;
8982d0bf34SBoris Brezillon		reg = <0x10000000 0x10000000
9082d0bf34SBoris Brezillon		       0x40000000 0x30000000>;
9182d0bf34SBoris Brezillon		ranges = <0x0 0x0 0x10000000 0x10000000
9282d0bf34SBoris Brezillon			  0x1 0x0 0x40000000 0x10000000
9382d0bf34SBoris Brezillon			  0x2 0x0 0x50000000 0x10000000
9482d0bf34SBoris Brezillon			  0x3 0x0 0x60000000 0x10000000>;
9582d0bf34SBoris Brezillon		clocks = <&mck>;
9682d0bf34SBoris Brezillon
9782d0bf34SBoris Brezillon                nand_controller: nand-controller {
9882d0bf34SBoris Brezillon			compatible = "atmel,sama5d3-nand-controller";
9982d0bf34SBoris Brezillon			atmel,nfc-sram = <&nfc_sram>;
10082d0bf34SBoris Brezillon			atmel,nfc-io = <&nfc_io>;
10182d0bf34SBoris Brezillon			ecc-engine = <&pmecc>;
10282d0bf34SBoris Brezillon			#address-cells = <2>;
10382d0bf34SBoris Brezillon			#size-cells = <1>;
10482d0bf34SBoris Brezillon			ranges;
10582d0bf34SBoris Brezillon
10682d0bf34SBoris Brezillon			nand@3 {
10782d0bf34SBoris Brezillon				reg = <0x3 0x0 0x800000>;
10882d0bf34SBoris Brezillon				atmel,rb = <0>;
10982d0bf34SBoris Brezillon
11082d0bf34SBoris Brezillon				/*
11182d0bf34SBoris Brezillon				 * Put generic NAND/MTD properties and
11282d0bf34SBoris Brezillon				 * subnodes here.
11382d0bf34SBoris Brezillon				 */
11482d0bf34SBoris Brezillon			};
11582d0bf34SBoris Brezillon		};
11682d0bf34SBoris Brezillon	};
11782d0bf34SBoris Brezillon
11882d0bf34SBoris Brezillon-----------------------------------------------------------------------
11982d0bf34SBoris Brezillon
12082d0bf34SBoris BrezillonDeprecated bindings (should not be used in new device trees):
121d6a01661SJean-Christophe PLAGNIOL-VILLARD
122d6a01661SJean-Christophe PLAGNIOL-VILLARDRequired properties:
12355750756SRomain Izard- compatible: The possible values are:
12455750756SRomain Izard	"atmel,at91rm9200-nand"
12555750756SRomain Izard	"atmel,sama5d2-nand"
12655750756SRomain Izard	"atmel,sama5d4-nand"
127d6a01661SJean-Christophe PLAGNIOL-VILLARD- reg : should specify localbus address and size used for the chip,
128a41b51a1SJosh Wu	and hardware ECC controller if available.
129a41b51a1SJosh Wu	If the hardware ECC is PMECC, it should contain address and size for
130abb1cd00SJosh Wu	PMECC and PMECC Error Location controller.
131abb1cd00SJosh Wu	The PMECC lookup table address and size in ROM is optional. If not
132abb1cd00SJosh Wu	specified, driver will build it in runtime.
133d6a01661SJean-Christophe PLAGNIOL-VILLARD- atmel,nand-addr-offset : offset for the address latch.
134d6a01661SJean-Christophe PLAGNIOL-VILLARD- atmel,nand-cmd-offset : offset for the command latch.
135d6a01661SJean-Christophe PLAGNIOL-VILLARD- #address-cells, #size-cells : Must be present if the device has sub-nodes
136d6a01661SJean-Christophe PLAGNIOL-VILLARD  representing partitions.
137d6a01661SJean-Christophe PLAGNIOL-VILLARD
138d6a01661SJean-Christophe PLAGNIOL-VILLARD- gpios : specifies the gpio pins to control the NAND device. detect is an
139d6a01661SJean-Christophe PLAGNIOL-VILLARD  optional gpio and may be set to 0 if not present.
140d6a01661SJean-Christophe PLAGNIOL-VILLARD
141d6a01661SJean-Christophe PLAGNIOL-VILLARDOptional properties:
1421b719265SJosh Wu- atmel,nand-has-dma : boolean to support dma transfer for nand read/write.
143d6a01661SJean-Christophe PLAGNIOL-VILLARD- nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default.
144d6a01661SJean-Christophe PLAGNIOL-VILLARD  Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
145d6a01661SJean-Christophe PLAGNIOL-VILLARD  "soft_bch".
146ec4ee5fbSRomain Izard- atmel,has-pmecc : boolean to enable Programmable Multibit ECC hardware,
147ec4ee5fbSRomain Izard  capable of BCH encoding and decoding, on devices where it is present.
148a41b51a1SJosh Wu- atmel,pmecc-cap : error correct capability for Programmable Multibit ECC
14994248462SRomain Izard  Controller. Supported values are: 2, 4, 8, 12, 24. If the compatible string
15094248462SRomain Izard  is "atmel,sama5d2-nand", 32 is also valid.
151a41b51a1SJosh Wu- atmel,pmecc-sector-size : sector size for ECC computation. Supported values
152a41b51a1SJosh Wu  are: 512, 1024.
153a41b51a1SJosh Wu- atmel,pmecc-lookup-table-offset : includes two offsets of lookup table in ROM
154a41b51a1SJosh Wu  for different sector size. First one is for sector size 512, the next is for
155abb1cd00SJosh Wu  sector size 1024. If not specified, driver will build the table in runtime.
156d6a01661SJean-Christophe PLAGNIOL-VILLARD- nand-bus-width : 8 or 16 bus width if not present 8
157d6a01661SJean-Christophe PLAGNIOL-VILLARD- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
158ec4ee5fbSRomain Izard
159ec4ee5fbSRomain IzardNand Flash Controller(NFC) is an optional sub-node
160ec4ee5fbSRomain IzardRequired properties:
16153b74ed2SWenyou Yang- compatible : "atmel,sama5d3-nfc".
1627dc37de7SJosh Wu- reg : should specify the address and size used for NFC command registers,
163ec4ee5fbSRomain Izard        NFC registers and NFC SRAM. NFC SRAM address and size can be absent
1647dc37de7SJosh Wu        if don't want to use it.
1652d405ec5SBoris BREZILLON- clocks: phandle to the peripheral clock
166ec4ee5fbSRomain IzardOptional properties:
167ec4ee5fbSRomain Izard- atmel,write-by-sram: boolean to enable NFC write by SRAM.
168d6a01661SJean-Christophe PLAGNIOL-VILLARD
169d6a01661SJean-Christophe PLAGNIOL-VILLARDExamples:
170d6a01661SJean-Christophe PLAGNIOL-VILLARDnand0: nand@40000000,0 {
171d6a01661SJean-Christophe PLAGNIOL-VILLARD	compatible = "atmel,at91rm9200-nand";
172d6a01661SJean-Christophe PLAGNIOL-VILLARD	#address-cells = <1>;
173d6a01661SJean-Christophe PLAGNIOL-VILLARD	#size-cells = <1>;
174d6a01661SJean-Christophe PLAGNIOL-VILLARD	reg = <0x40000000 0x10000000
175d6a01661SJean-Christophe PLAGNIOL-VILLARD	       0xffffe800 0x200
176d6a01661SJean-Christophe PLAGNIOL-VILLARD	      >;
177c16524e6SNicolas Ferre	atmel,nand-addr-offset = <21>;	/* ale */
178c16524e6SNicolas Ferre	atmel,nand-cmd-offset = <22>;	/* cle */
179d6a01661SJean-Christophe PLAGNIOL-VILLARD	nand-on-flash-bbt;
180d6a01661SJean-Christophe PLAGNIOL-VILLARD	nand-ecc-mode = "soft";
181c16524e6SNicolas Ferre	gpios = <&pioC 13 0	/* rdy */
182c16524e6SNicolas Ferre		 &pioC 14 0 	/* nce */
183c16524e6SNicolas Ferre		 0		/* cd */
184d6a01661SJean-Christophe PLAGNIOL-VILLARD		>;
185d6a01661SJean-Christophe PLAGNIOL-VILLARD	partition@0 {
186d6a01661SJean-Christophe PLAGNIOL-VILLARD		...
187d6a01661SJean-Christophe PLAGNIOL-VILLARD	};
188d6a01661SJean-Christophe PLAGNIOL-VILLARD};
189a41b51a1SJosh Wu
190a41b51a1SJosh Wu/* for PMECC supported chips */
191a41b51a1SJosh Wunand0: nand@40000000 {
192a41b51a1SJosh Wu	compatible = "atmel,at91rm9200-nand";
193a41b51a1SJosh Wu	#address-cells = <1>;
194a41b51a1SJosh Wu	#size-cells = <1>;
195a41b51a1SJosh Wu	reg = < 0x40000000 0x10000000	/* bus addr & size */
196a41b51a1SJosh Wu		0xffffe000 0x00000600	/* PMECC addr & size */
197a41b51a1SJosh Wu		0xffffe600 0x00000200	/* PMECC ERRLOC addr & size */
198a41b51a1SJosh Wu		0x00100000 0x00100000	/* ROM addr & size */
199a41b51a1SJosh Wu		>;
200a41b51a1SJosh Wu	atmel,nand-addr-offset = <21>;	/* ale */
201a41b51a1SJosh Wu	atmel,nand-cmd-offset = <22>;	/* cle */
202a41b51a1SJosh Wu	nand-on-flash-bbt;
203a41b51a1SJosh Wu	nand-ecc-mode = "hw";
204a41b51a1SJosh Wu	atmel,has-pmecc;	/* enable PMECC */
205a41b51a1SJosh Wu	atmel,pmecc-cap = <2>;
206a41b51a1SJosh Wu	atmel,pmecc-sector-size = <512>;
207a41b51a1SJosh Wu	atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
208a41b51a1SJosh Wu	gpios = <&pioD 5 0	/* rdy */
209a41b51a1SJosh Wu		 &pioD 4 0	/* nce */
210a41b51a1SJosh Wu		 0		/* cd */
211a41b51a1SJosh Wu		>;
212a41b51a1SJosh Wu	partition@0 {
213a41b51a1SJosh Wu		...
214a41b51a1SJosh Wu	};
215a41b51a1SJosh Wu};
2167dc37de7SJosh Wu
2177dc37de7SJosh Wu/* for NFC supported chips */
2187dc37de7SJosh Wunand0: nand@40000000 {
2197dc37de7SJosh Wu	compatible = "atmel,at91rm9200-nand";
2207dc37de7SJosh Wu	#address-cells = <1>;
2217dc37de7SJosh Wu	#size-cells = <1>;
2227dc37de7SJosh Wu	ranges;
2237dc37de7SJosh Wu        ...
2247dc37de7SJosh Wu        nfc@70000000 {
2257dc37de7SJosh Wu		compatible = "atmel,sama5d3-nfc";
2267dc37de7SJosh Wu		#address-cells = <1>;
2277dc37de7SJosh Wu		#size-cells = <1>;
2282d405ec5SBoris BREZILLON		clocks = <&hsmc_clk>
2297dc37de7SJosh Wu		reg = <
2307dc37de7SJosh Wu			0x70000000 0x10000000	/* NFC Command Registers */
2317dc37de7SJosh Wu			0xffffc000 0x00000070	/* NFC HSMC regs */
2327dc37de7SJosh Wu			0x00200000 0x00100000	/* NFC SRAM banks */
2337dc37de7SJosh Wu		>;
2347dc37de7SJosh Wu	};
2357dc37de7SJosh Wu};
236