hc
2023-10-25 6c2073b7aa40e29d0eca7d571dd7bc590c7ecaa7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
* Ingenic JZ4780 NAND/BCH
 
This file documents the device tree bindings for NAND flash devices on the
JZ4780. NAND devices are connected to the NEMC controller (described in
memory-controllers/ingenic,jz4780-nemc.txt), and thus NAND device nodes must
be children of the NEMC node.
 
Required NAND controller device properties:
- compatible: Should be set to "ingenic,jz4780-nand".
- reg: For each bank with a NAND chip attached, should specify a bank number,
  an offset of 0 and a size of 0x1000000 (i.e. the whole NEMC bank).
 
Optional NAND controller device properties:
- ingenic,bch-controller: To make use of the hardware BCH controller, this
  property must contain a phandle for the BCH controller node. The required
  properties for this node are described below. If this is not specified,
  software BCH will be used instead.
 
Optional children nodes:
- Individual NAND chips are children of the NAND controller node.
 
Required children node properties:
- reg: An integer ranging from 1 to 6 representing the CS line to use.
 
Optional children node properties:
- nand-ecc-step-size: ECC block size in bytes.
- nand-ecc-strength: ECC strength (max number of correctable bits).
- nand-ecc-mode: String, operation mode of the NAND ecc mode. "hw" by default
- nand-on-flash-bbt: boolean to enable on flash bbt option, if not present false
- rb-gpios: GPIO specifier for the busy pin.
- wp-gpios: GPIO specifier for the write protect pin.
 
Optional child node of NAND chip nodes:
- partitions: see Documentation/devicetree/bindings/mtd/partition.txt
 
Example:
 
nemc: nemc@13410000 {
   ...
 
   nandc: nand-controller@1 {
       compatible = "ingenic,jz4780-nand";
       reg = <1 0 0x1000000>;    /* Bank 1 */
 
       #address-cells = <1>;
       #size-cells = <0>;
 
       ingenic,bch-controller = <&bch>;
 
       nand@1 {
           reg = <1>;
 
           nand-ecc-step-size = <1024>;
           nand-ecc-strength = <24>;
           nand-ecc-mode = "hw";
           nand-on-flash-bbt;
 
           rb-gpios = <&gpa 20 GPIO_ACTIVE_LOW>;
           wp-gpios = <&gpf 22 GPIO_ACTIVE_LOW>;
 
           partitions {
               #address-cells = <2>;
               #size-cells = <2>;
               ...
           }
       };
   };
};
 
The BCH controller is a separate SoC component used for error correction on
NAND devices. The following is a description of the device properties for a
BCH controller.
 
Required BCH properties:
- compatible: Should be set to "ingenic,jz4780-bch".
- reg: Should specify the BCH controller registers location and length.
- clocks: Clock for the BCH controller.
 
Example:
 
bch: bch@134d0000 {
   compatible = "ingenic,jz4780-bch";
   reg = <0x134d0000 0x10000>;
 
   clocks = <&cgu JZ4780_CLK_BCH>;
};