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