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