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