162306a36Sopenharmony_ciAtmel NAND flash controller bindings
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciThe NAND flash controller node should be defined under the EBI bus (see
462306a36Sopenharmony_ciDocumentation/devicetree/bindings/memory-controllers/atmel,ebi.txt).
562306a36Sopenharmony_ciOne or several NAND devices can be defined under this NAND controller.
662306a36Sopenharmony_ciThe NAND controller might be connected to an ECC engine.
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci* NAND controller bindings:
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciRequired properties:
1162306a36Sopenharmony_ci- compatible: should be one of the following
1262306a36Sopenharmony_ci	"atmel,at91rm9200-nand-controller"
1362306a36Sopenharmony_ci	"atmel,at91sam9260-nand-controller"
1462306a36Sopenharmony_ci	"atmel,at91sam9261-nand-controller"
1562306a36Sopenharmony_ci	"atmel,at91sam9g45-nand-controller"
1662306a36Sopenharmony_ci	"atmel,sama5d3-nand-controller"
1762306a36Sopenharmony_ci	"microchip,sam9x60-nand-controller"
1862306a36Sopenharmony_ci- ranges: empty ranges property to forward EBI ranges definitions.
1962306a36Sopenharmony_ci- #address-cells: should be set to 2.
2062306a36Sopenharmony_ci- #size-cells: should be set to 1.
2162306a36Sopenharmony_ci- atmel,nfc-io: phandle to the NFC IO block. Only required for sama5d3
2262306a36Sopenharmony_ci		controllers.
2362306a36Sopenharmony_ci- atmel,nfc-sram: phandle to the NFC SRAM block. Only required for sama5d3
2462306a36Sopenharmony_ci		  controllers.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciOptional properties:
2762306a36Sopenharmony_ci- ecc-engine: phandle to the PMECC block. Only meaningful if the SoC embeds
2862306a36Sopenharmony_ci	      a PMECC engine.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci* NAND device/chip bindings:
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciRequired properties:
3362306a36Sopenharmony_ci- reg: describes the CS lines assigned to the NAND device. If the NAND device
3462306a36Sopenharmony_ci       exposes multiple CS lines (multi-dies chips), your reg property will
3562306a36Sopenharmony_ci       contain X tuples of 3 entries.
3662306a36Sopenharmony_ci       1st entry: the CS line this NAND chip is connected to
3762306a36Sopenharmony_ci       2nd entry: the base offset of the memory region assigned to this
3862306a36Sopenharmony_ci		  device (always 0)
3962306a36Sopenharmony_ci       3rd entry: the memory region size (always 0x800000)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciOptional properties:
4262306a36Sopenharmony_ci- rb-gpios: the GPIO(s) used to check the Ready/Busy status of the NAND.
4362306a36Sopenharmony_ci- cs-gpios: the GPIO(s) used to control the CS line.
4462306a36Sopenharmony_ci- det-gpios: the GPIO used to detect if a Smartmedia Card is present.
4562306a36Sopenharmony_ci- atmel,rb: an integer identifying the native Ready/Busy pin. Only meaningful
4662306a36Sopenharmony_ci	    on sama5 SoCs.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciAll generic properties are described in the generic yaml files under
4962306a36Sopenharmony_ciDocumentation/devicetree/bindings/mtd/.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci* ECC engine (PMECC) bindings:
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciRequired properties:
5462306a36Sopenharmony_ci- compatible: should be one of the following
5562306a36Sopenharmony_ci	"atmel,at91sam9g45-pmecc"
5662306a36Sopenharmony_ci	"atmel,sama5d4-pmecc"
5762306a36Sopenharmony_ci	"atmel,sama5d2-pmecc"
5862306a36Sopenharmony_ci	"microchip,sam9x60-pmecc"
5962306a36Sopenharmony_ci- reg: should contain 2 register ranges. The first one is pointing to the PMECC
6062306a36Sopenharmony_ci       block, and the second one to the PMECC_ERRLOC block.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci* SAMA5 NFC I/O bindings:
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciSAMA5 SoCs embed an advanced NAND controller logic to automate READ/WRITE page
6562306a36Sopenharmony_cioperations. This interface to this logic is placed in a separate I/O range and
6662306a36Sopenharmony_cishould thus have its own DT node.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci- compatible: should be "atmel,sama5d3-nfc-io", "syscon".
6962306a36Sopenharmony_ci- reg: should contain the I/O range used to interact with the NFC logic.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ciExample:
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci	nfc_io: nfc-io@70000000 {
7462306a36Sopenharmony_ci		compatible = "atmel,sama5d3-nfc-io", "syscon";
7562306a36Sopenharmony_ci		reg = <0x70000000 0x8000000>;
7662306a36Sopenharmony_ci	};
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci	pmecc: ecc-engine@ffffc070 {
7962306a36Sopenharmony_ci		compatible = "atmel,at91sam9g45-pmecc";
8062306a36Sopenharmony_ci                reg = <0xffffc070 0x490>,
8162306a36Sopenharmony_ci                      <0xffffc500 0x100>;
8262306a36Sopenharmony_ci	};
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci	ebi: ebi@10000000 {
8562306a36Sopenharmony_ci		compatible = "atmel,sama5d3-ebi";
8662306a36Sopenharmony_ci		#address-cells = <2>;
8762306a36Sopenharmony_ci		#size-cells = <1>;
8862306a36Sopenharmony_ci		atmel,smc = <&hsmc>;
8962306a36Sopenharmony_ci		reg = <0x10000000 0x10000000
9062306a36Sopenharmony_ci		       0x40000000 0x30000000>;
9162306a36Sopenharmony_ci		ranges = <0x0 0x0 0x10000000 0x10000000
9262306a36Sopenharmony_ci			  0x1 0x0 0x40000000 0x10000000
9362306a36Sopenharmony_ci			  0x2 0x0 0x50000000 0x10000000
9462306a36Sopenharmony_ci			  0x3 0x0 0x60000000 0x10000000>;
9562306a36Sopenharmony_ci		clocks = <&mck>;
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci                nand_controller: nand-controller {
9862306a36Sopenharmony_ci			compatible = "atmel,sama5d3-nand-controller";
9962306a36Sopenharmony_ci			atmel,nfc-sram = <&nfc_sram>;
10062306a36Sopenharmony_ci			atmel,nfc-io = <&nfc_io>;
10162306a36Sopenharmony_ci			ecc-engine = <&pmecc>;
10262306a36Sopenharmony_ci			#address-cells = <2>;
10362306a36Sopenharmony_ci			#size-cells = <1>;
10462306a36Sopenharmony_ci			ranges;
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci			nand@3 {
10762306a36Sopenharmony_ci				reg = <0x3 0x0 0x800000>;
10862306a36Sopenharmony_ci				atmel,rb = <0>;
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci				/*
11162306a36Sopenharmony_ci				 * Put generic NAND/MTD properties and
11262306a36Sopenharmony_ci				 * subnodes here.
11362306a36Sopenharmony_ci				 */
11462306a36Sopenharmony_ci			};
11562306a36Sopenharmony_ci		};
11662306a36Sopenharmony_ci	};
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci-----------------------------------------------------------------------
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ciDeprecated bindings (should not be used in new device trees):
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciRequired properties:
12362306a36Sopenharmony_ci- compatible: The possible values are:
12462306a36Sopenharmony_ci	"atmel,at91rm9200-nand"
12562306a36Sopenharmony_ci	"atmel,sama5d2-nand"
12662306a36Sopenharmony_ci	"atmel,sama5d4-nand"
12762306a36Sopenharmony_ci- reg : should specify localbus address and size used for the chip,
12862306a36Sopenharmony_ci	and hardware ECC controller if available.
12962306a36Sopenharmony_ci	If the hardware ECC is PMECC, it should contain address and size for
13062306a36Sopenharmony_ci	PMECC and PMECC Error Location controller.
13162306a36Sopenharmony_ci	The PMECC lookup table address and size in ROM is optional. If not
13262306a36Sopenharmony_ci	specified, driver will build it in runtime.
13362306a36Sopenharmony_ci- atmel,nand-addr-offset : offset for the address latch.
13462306a36Sopenharmony_ci- atmel,nand-cmd-offset : offset for the command latch.
13562306a36Sopenharmony_ci- #address-cells, #size-cells : Must be present if the device has sub-nodes
13662306a36Sopenharmony_ci  representing partitions.
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci- gpios : specifies the gpio pins to control the NAND device. detect is an
13962306a36Sopenharmony_ci  optional gpio and may be set to 0 if not present.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ciOptional properties:
14262306a36Sopenharmony_ci- atmel,nand-has-dma : boolean to support dma transfer for nand read/write.
14362306a36Sopenharmony_ci- nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default.
14462306a36Sopenharmony_ci  Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
14562306a36Sopenharmony_ci  "soft_bch".
14662306a36Sopenharmony_ci- atmel,has-pmecc : boolean to enable Programmable Multibit ECC hardware,
14762306a36Sopenharmony_ci  capable of BCH encoding and decoding, on devices where it is present.
14862306a36Sopenharmony_ci- atmel,pmecc-cap : error correct capability for Programmable Multibit ECC
14962306a36Sopenharmony_ci  Controller. Supported values are: 2, 4, 8, 12, 24. If the compatible string
15062306a36Sopenharmony_ci  is "atmel,sama5d2-nand", 32 is also valid.
15162306a36Sopenharmony_ci- atmel,pmecc-sector-size : sector size for ECC computation. Supported values
15262306a36Sopenharmony_ci  are: 512, 1024.
15362306a36Sopenharmony_ci- atmel,pmecc-lookup-table-offset : includes two offsets of lookup table in ROM
15462306a36Sopenharmony_ci  for different sector size. First one is for sector size 512, the next is for
15562306a36Sopenharmony_ci  sector size 1024. If not specified, driver will build the table in runtime.
15662306a36Sopenharmony_ci- nand-bus-width : 8 or 16 bus width if not present 8
15762306a36Sopenharmony_ci- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ciNand Flash Controller(NFC) is an optional sub-node
16062306a36Sopenharmony_ciRequired properties:
16162306a36Sopenharmony_ci- compatible : "atmel,sama5d3-nfc".
16262306a36Sopenharmony_ci- reg : should specify the address and size used for NFC command registers,
16362306a36Sopenharmony_ci        NFC registers and NFC SRAM. NFC SRAM address and size can be absent
16462306a36Sopenharmony_ci        if don't want to use it.
16562306a36Sopenharmony_ci- clocks: phandle to the peripheral clock
16662306a36Sopenharmony_ciOptional properties:
16762306a36Sopenharmony_ci- atmel,write-by-sram: boolean to enable NFC write by SRAM.
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ciExamples:
17062306a36Sopenharmony_cinand0: nand@40000000,0 {
17162306a36Sopenharmony_ci	compatible = "atmel,at91rm9200-nand";
17262306a36Sopenharmony_ci	#address-cells = <1>;
17362306a36Sopenharmony_ci	#size-cells = <1>;
17462306a36Sopenharmony_ci	reg = <0x40000000 0x10000000
17562306a36Sopenharmony_ci	       0xffffe800 0x200
17662306a36Sopenharmony_ci	      >;
17762306a36Sopenharmony_ci	atmel,nand-addr-offset = <21>;	/* ale */
17862306a36Sopenharmony_ci	atmel,nand-cmd-offset = <22>;	/* cle */
17962306a36Sopenharmony_ci	nand-on-flash-bbt;
18062306a36Sopenharmony_ci	nand-ecc-mode = "soft";
18162306a36Sopenharmony_ci	gpios = <&pioC 13 0	/* rdy */
18262306a36Sopenharmony_ci		 &pioC 14 0 	/* nce */
18362306a36Sopenharmony_ci		 0		/* cd */
18462306a36Sopenharmony_ci		>;
18562306a36Sopenharmony_ci	partition@0 {
18662306a36Sopenharmony_ci		...
18762306a36Sopenharmony_ci	};
18862306a36Sopenharmony_ci};
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci/* for PMECC supported chips */
19162306a36Sopenharmony_cinand0: nand@40000000 {
19262306a36Sopenharmony_ci	compatible = "atmel,at91rm9200-nand";
19362306a36Sopenharmony_ci	#address-cells = <1>;
19462306a36Sopenharmony_ci	#size-cells = <1>;
19562306a36Sopenharmony_ci	reg = < 0x40000000 0x10000000	/* bus addr & size */
19662306a36Sopenharmony_ci		0xffffe000 0x00000600	/* PMECC addr & size */
19762306a36Sopenharmony_ci		0xffffe600 0x00000200	/* PMECC ERRLOC addr & size */
19862306a36Sopenharmony_ci		0x00100000 0x00100000	/* ROM addr & size */
19962306a36Sopenharmony_ci		>;
20062306a36Sopenharmony_ci	atmel,nand-addr-offset = <21>;	/* ale */
20162306a36Sopenharmony_ci	atmel,nand-cmd-offset = <22>;	/* cle */
20262306a36Sopenharmony_ci	nand-on-flash-bbt;
20362306a36Sopenharmony_ci	nand-ecc-mode = "hw";
20462306a36Sopenharmony_ci	atmel,has-pmecc;	/* enable PMECC */
20562306a36Sopenharmony_ci	atmel,pmecc-cap = <2>;
20662306a36Sopenharmony_ci	atmel,pmecc-sector-size = <512>;
20762306a36Sopenharmony_ci	atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
20862306a36Sopenharmony_ci	gpios = <&pioD 5 0	/* rdy */
20962306a36Sopenharmony_ci		 &pioD 4 0	/* nce */
21062306a36Sopenharmony_ci		 0		/* cd */
21162306a36Sopenharmony_ci		>;
21262306a36Sopenharmony_ci	partition@0 {
21362306a36Sopenharmony_ci		...
21462306a36Sopenharmony_ci	};
21562306a36Sopenharmony_ci};
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci/* for NFC supported chips */
21862306a36Sopenharmony_cinand0: nand@40000000 {
21962306a36Sopenharmony_ci	compatible = "atmel,at91rm9200-nand";
22062306a36Sopenharmony_ci	#address-cells = <1>;
22162306a36Sopenharmony_ci	#size-cells = <1>;
22262306a36Sopenharmony_ci	ranges;
22362306a36Sopenharmony_ci        ...
22462306a36Sopenharmony_ci        nfc@70000000 {
22562306a36Sopenharmony_ci		compatible = "atmel,sama5d3-nfc";
22662306a36Sopenharmony_ci		#address-cells = <1>;
22762306a36Sopenharmony_ci		#size-cells = <1>;
22862306a36Sopenharmony_ci		clocks = <&hsmc_clk>
22962306a36Sopenharmony_ci		reg = <
23062306a36Sopenharmony_ci			0x70000000 0x10000000	/* NFC Command Registers */
23162306a36Sopenharmony_ci			0xffffc000 0x00000070	/* NFC HSMC regs */
23262306a36Sopenharmony_ci			0x00200000 0x00100000	/* NFC SRAM banks */
23362306a36Sopenharmony_ci		>;
23462306a36Sopenharmony_ci	};
23562306a36Sopenharmony_ci};
236