xref: /freebsd/sys/contrib/device-tree/Bindings/mtd/brcm,brcmnand.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot* Broadcom STB NAND Controller
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe Broadcom Set-Top Box NAND controller supports low-level access to raw NAND
4*c66ec88fSEmmanuel Vadotflash chips. It has a memory-mapped register interface for both control
5*c66ec88fSEmmanuel Vadotregisters and for its data input/output buffer. On some SoCs, this controller is
6*c66ec88fSEmmanuel Vadotpaired with a custom DMA engine (inventively named "Flash DMA") which supports
7*c66ec88fSEmmanuel Vadotbasic PROGRAM and READ functions, among other features.
8*c66ec88fSEmmanuel Vadot
9*c66ec88fSEmmanuel VadotThis controller was originally designed for STB SoCs (BCM7xxx) but is now
10*c66ec88fSEmmanuel Vadotavailable on a variety of Broadcom SoCs, including some BCM3xxx, BCM63xx, and
11*c66ec88fSEmmanuel VadotiProc/Cygnus. Its history includes several similar (but not fully register
12*c66ec88fSEmmanuel Vadotcompatible) versions.
13*c66ec88fSEmmanuel Vadot
14*c66ec88fSEmmanuel VadotRequired properties:
15*c66ec88fSEmmanuel Vadot- compatible       : May contain an SoC-specific compatibility string (see below)
16*c66ec88fSEmmanuel Vadot                     to account for any SoC-specific hardware bits that may be
17*c66ec88fSEmmanuel Vadot                     added on top of the base core controller.
18*c66ec88fSEmmanuel Vadot                     In addition, must contain compatibility information about
19*c66ec88fSEmmanuel Vadot                     the core NAND controller, of the following form:
20*c66ec88fSEmmanuel Vadot                     "brcm,brcmnand" and an appropriate version compatibility
21*c66ec88fSEmmanuel Vadot                     string, like "brcm,brcmnand-v7.0"
22*c66ec88fSEmmanuel Vadot                     Possible values:
23*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v2.1
24*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v2.2
25*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v4.0
26*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v5.0
27*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v6.0
28*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v6.1
29*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v6.2
30*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v7.0
31*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v7.1
32*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v7.2
33*c66ec88fSEmmanuel Vadot                         brcm,brcmnand-v7.3
34*c66ec88fSEmmanuel Vadot                         brcm,brcmnand
35*c66ec88fSEmmanuel Vadot- reg              : the register start and length for NAND register region.
36*c66ec88fSEmmanuel Vadot                     (optional) Flash DMA register range (if present)
37*c66ec88fSEmmanuel Vadot                     (optional) NAND flash cache range (if at non-standard offset)
38*c66ec88fSEmmanuel Vadot- reg-names        : a list of the names corresponding to the previous register
39*c66ec88fSEmmanuel Vadot                     ranges. Should contain "nand" and (optionally)
40*c66ec88fSEmmanuel Vadot                     "flash-dma" or "flash-edu" and/or "nand-cache".
41*c66ec88fSEmmanuel Vadot- interrupts       : The NAND CTLRDY interrupt, (if Flash DMA is available)
42*c66ec88fSEmmanuel Vadot                     FLASH_DMA_DONE and if EDU is avaialble and used FLASH_EDU_DONE
43*c66ec88fSEmmanuel Vadot- interrupt-names  : May be "nand_ctlrdy" or "flash_dma_done" or "flash_edu_done",
44*c66ec88fSEmmanuel Vadot                     if broken out as individual interrupts.
45*c66ec88fSEmmanuel Vadot                     May be "nand", if the SoC has the individual NAND
46*c66ec88fSEmmanuel Vadot                     interrupts multiplexed behind another custom piece of
47*c66ec88fSEmmanuel Vadot                     hardware
48*c66ec88fSEmmanuel Vadot- #address-cells   : <1> - subnodes give the chip-select number
49*c66ec88fSEmmanuel Vadot- #size-cells      : <0>
50*c66ec88fSEmmanuel Vadot
51*c66ec88fSEmmanuel VadotOptional properties:
52*c66ec88fSEmmanuel Vadot- clock                     : reference to the clock for the NAND controller
53*c66ec88fSEmmanuel Vadot- clock-names               : "nand" (required for the above clock)
54*c66ec88fSEmmanuel Vadot- brcm,nand-has-wp          : Some versions of this IP include a write-protect
55*c66ec88fSEmmanuel Vadot                              (WP) control bit. It is always available on >=
56*c66ec88fSEmmanuel Vadot                              v7.0. Use this property to describe the rare
57*c66ec88fSEmmanuel Vadot                              earlier versions of this core that include WP
58*c66ec88fSEmmanuel Vadot
59*c66ec88fSEmmanuel Vadot -- Additional SoC-specific NAND controller properties --
60*c66ec88fSEmmanuel Vadot
61*c66ec88fSEmmanuel VadotThe NAND controller is integrated differently on the variety of SoCs on which it
62*c66ec88fSEmmanuel Vadotis found. Part of this integration involves providing status and enable bits
63*c66ec88fSEmmanuel Vadotwith which to control the 8 exposed NAND interrupts, as well as hardware for
64*c66ec88fSEmmanuel Vadotconfiguring the endianness of the data bus. On some SoCs, these features are
65*c66ec88fSEmmanuel Vadothandled via standard, modular components (e.g., their interrupts look like a
66*c66ec88fSEmmanuel Vadotnormal IRQ chip), but on others, they are controlled in unique and interesting
67*c66ec88fSEmmanuel Vadotways, sometimes with registers that lump multiple NAND-related functions
68*c66ec88fSEmmanuel Vadottogether. The former case can be described simply by the standard interrupts
69*c66ec88fSEmmanuel Vadotproperties in the main controller node. But for the latter exceptional cases,
70*c66ec88fSEmmanuel Vadotwe define additional 'compatible' properties and associated register resources within the NAND controller node above.
71*c66ec88fSEmmanuel Vadot
72*c66ec88fSEmmanuel Vadot - compatible: Can be one of several SoC-specific strings. Each SoC may have
73*c66ec88fSEmmanuel Vadot   different requirements for its additional properties, as described below each
74*c66ec88fSEmmanuel Vadot   bullet point below.
75*c66ec88fSEmmanuel Vadot
76*c66ec88fSEmmanuel Vadot   * "brcm,nand-bcm63138"
77*c66ec88fSEmmanuel Vadot     - reg: (required) the 'NAND_INT_BASE' register range, with separate status
78*c66ec88fSEmmanuel Vadot       and enable registers
79*c66ec88fSEmmanuel Vadot     - reg-names: (required) "nand-int-base"
80*c66ec88fSEmmanuel Vadot
81*c66ec88fSEmmanuel Vadot   * "brcm,nand-bcm6368"
82*c66ec88fSEmmanuel Vadot     - compatible: should contain "brcm,nand-bcm<soc>", "brcm,nand-bcm6368"
83*c66ec88fSEmmanuel Vadot     - reg: (required) the 'NAND_INTR_BASE' register range, with combined status
84*c66ec88fSEmmanuel Vadot       and enable registers, and boot address registers
85*c66ec88fSEmmanuel Vadot     - reg-names: (required) "nand-int-base"
86*c66ec88fSEmmanuel Vadot
87*c66ec88fSEmmanuel Vadot   * "brcm,nand-iproc"
88*c66ec88fSEmmanuel Vadot     - reg: (required) the "IDM" register range, for interrupt enable and APB
89*c66ec88fSEmmanuel Vadot       bus access endianness configuration, and the "EXT" register range,
90*c66ec88fSEmmanuel Vadot       for interrupt status/ack.
91*c66ec88fSEmmanuel Vadot     - reg-names: (required) a list of the names corresponding to the previous
92*c66ec88fSEmmanuel Vadot       register ranges. Should contain "iproc-idm" and "iproc-ext".
93*c66ec88fSEmmanuel Vadot
94*c66ec88fSEmmanuel Vadot
95*c66ec88fSEmmanuel Vadot* NAND chip-select
96*c66ec88fSEmmanuel Vadot
97*c66ec88fSEmmanuel VadotEach controller (compatible: "brcm,brcmnand") may contain one or more subnodes
98*c66ec88fSEmmanuel Vadotto represent enabled chip-selects which (may) contain NAND flash chips. Their
99*c66ec88fSEmmanuel Vadotproperties are as follows.
100*c66ec88fSEmmanuel Vadot
101*c66ec88fSEmmanuel VadotRequired properties:
102*c66ec88fSEmmanuel Vadot- compatible                : should contain "brcm,nandcs"
103*c66ec88fSEmmanuel Vadot- reg                       : a single integer representing the chip-select
104*c66ec88fSEmmanuel Vadot                              number (e.g., 0, 1, 2, etc.)
105*c66ec88fSEmmanuel Vadot- #address-cells            : see partition.txt
106*c66ec88fSEmmanuel Vadot- #size-cells               : see partition.txt
107*c66ec88fSEmmanuel Vadot
108*c66ec88fSEmmanuel VadotOptional properties:
109*c66ec88fSEmmanuel Vadot- nand-ecc-strength         : see nand-controller.yaml
110*c66ec88fSEmmanuel Vadot- nand-ecc-step-size        : must be 512 or 1024. See nand-controller.yaml
111*c66ec88fSEmmanuel Vadot- nand-on-flash-bbt         : boolean, to enable the on-flash BBT for this
112*c66ec88fSEmmanuel Vadot                              chip-select. See nand-controller.yaml
113*c66ec88fSEmmanuel Vadot- brcm,nand-oob-sector-size : integer, to denote the spare area sector size
114*c66ec88fSEmmanuel Vadot                              expected for the ECC layout in use. This size, in
115*c66ec88fSEmmanuel Vadot                              addition to the strength and step-size,
116*c66ec88fSEmmanuel Vadot                              determines how the hardware BCH engine will lay
117*c66ec88fSEmmanuel Vadot                              out the parity bytes it stores on the flash.
118*c66ec88fSEmmanuel Vadot                              This property can be automatically determined by
119*c66ec88fSEmmanuel Vadot                              the flash geometry (particularly the NAND page
120*c66ec88fSEmmanuel Vadot                              and OOB size) in many cases, but when booting
121*c66ec88fSEmmanuel Vadot                              from NAND, the boot controller has only a limited
122*c66ec88fSEmmanuel Vadot                              number of available options for its default ECC
123*c66ec88fSEmmanuel Vadot                              layout.
124*c66ec88fSEmmanuel Vadot
125*c66ec88fSEmmanuel VadotEach nandcs device node may optionally contain sub-nodes describing the flash
126*c66ec88fSEmmanuel Vadotpartition mapping. See partition.txt for more detail.
127*c66ec88fSEmmanuel Vadot
128*c66ec88fSEmmanuel Vadot
129*c66ec88fSEmmanuel VadotExample:
130*c66ec88fSEmmanuel Vadot
131*c66ec88fSEmmanuel Vadotnand@f0442800 {
132*c66ec88fSEmmanuel Vadot	compatible = "brcm,brcmnand-v7.0", "brcm,brcmnand";
133*c66ec88fSEmmanuel Vadot	reg = <0xF0442800 0x600>,
134*c66ec88fSEmmanuel Vadot	      <0xF0443000 0x100>;
135*c66ec88fSEmmanuel Vadot	reg-names = "nand", "flash-dma";
136*c66ec88fSEmmanuel Vadot	interrupt-parent = <&hif_intr2_intc>;
137*c66ec88fSEmmanuel Vadot	interrupts = <24>, <4>;
138*c66ec88fSEmmanuel Vadot
139*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
140*c66ec88fSEmmanuel Vadot	#size-cells = <0>;
141*c66ec88fSEmmanuel Vadot
142*c66ec88fSEmmanuel Vadot	nandcs@1 {
143*c66ec88fSEmmanuel Vadot		compatible = "brcm,nandcs";
144*c66ec88fSEmmanuel Vadot		reg = <1>; // Chip select 1
145*c66ec88fSEmmanuel Vadot		nand-on-flash-bbt;
146*c66ec88fSEmmanuel Vadot		nand-ecc-strength = <12>;
147*c66ec88fSEmmanuel Vadot		nand-ecc-step-size = <512>;
148*c66ec88fSEmmanuel Vadot
149*c66ec88fSEmmanuel Vadot		// Partitions
150*c66ec88fSEmmanuel Vadot		#address-cells = <1>;  // <2>, for 64-bit offset
151*c66ec88fSEmmanuel Vadot		#size-cells = <1>;     // <2>, for 64-bit length
152*c66ec88fSEmmanuel Vadot		flash0.rootfs@0 {
153*c66ec88fSEmmanuel Vadot			reg = <0 0x10000000>;
154*c66ec88fSEmmanuel Vadot		};
155*c66ec88fSEmmanuel Vadot		flash0@0 {
156*c66ec88fSEmmanuel Vadot			reg = <0 0>; // MTDPART_SIZ_FULL
157*c66ec88fSEmmanuel Vadot		};
158*c66ec88fSEmmanuel Vadot		flash0.kernel@10000000 {
159*c66ec88fSEmmanuel Vadot			reg = <0x10000000 0x400000>;
160*c66ec88fSEmmanuel Vadot		};
161*c66ec88fSEmmanuel Vadot	};
162*c66ec88fSEmmanuel Vadot};
163*c66ec88fSEmmanuel Vadot
164*c66ec88fSEmmanuel Vadotnand@10000200 {
165*c66ec88fSEmmanuel Vadot	compatible = "brcm,nand-bcm63168", "brcm,nand-bcm6368",
166*c66ec88fSEmmanuel Vadot		"brcm,brcmnand-v4.0", "brcm,brcmnand";
167*c66ec88fSEmmanuel Vadot	reg = <0x10000200 0x180>,
168*c66ec88fSEmmanuel Vadot	      <0x10000600 0x200>,
169*c66ec88fSEmmanuel Vadot	      <0x100000b0 0x10>;
170*c66ec88fSEmmanuel Vadot	reg-names = "nand", "nand-cache", "nand-int-base";
171*c66ec88fSEmmanuel Vadot	interrupt-parent = <&periph_intc>;
172*c66ec88fSEmmanuel Vadot	interrupts = <50>;
173*c66ec88fSEmmanuel Vadot	clocks = <&periph_clk 20>;
174*c66ec88fSEmmanuel Vadot	clock-names = "nand";
175*c66ec88fSEmmanuel Vadot
176*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
177*c66ec88fSEmmanuel Vadot	#size-cells = <0>;
178*c66ec88fSEmmanuel Vadot
179*c66ec88fSEmmanuel Vadot	nand0: nandcs@0 {
180*c66ec88fSEmmanuel Vadot		compatible = "brcm,nandcs";
181*c66ec88fSEmmanuel Vadot		reg = <0>;
182*c66ec88fSEmmanuel Vadot		nand-on-flash-bbt;
183*c66ec88fSEmmanuel Vadot		nand-ecc-strength = <1>;
184*c66ec88fSEmmanuel Vadot		nand-ecc-step-size = <512>;
185*c66ec88fSEmmanuel Vadot	};
186*c66ec88fSEmmanuel Vadot};
187