Sean Anderson | 326422b | 2023-11-04 16:37:52 -0400 | [diff] [blame] | 1 | Sandbox NAND |
| 2 | ============ |
| 3 | |
| 4 | The sandbox NAND controller emulates a NAND controller and attached devices. |
| 5 | |
| 6 | Required properties: |
| 7 | - compatible: "sandbox,nand" |
| 8 | - #address-cells: Must be 1 |
| 9 | - #size-cells: Must be 0 |
| 10 | |
| 11 | Any number of child nodes may be present, each representing a NAND device: |
| 12 | |
| 13 | Required Properties: |
| 14 | - reg: The chip-select(s) to use. Only single-die devices are supported for now. |
| 15 | - sandbox,id: An array of bytes to be reported by the READID (0x90) command |
| 16 | - sandbox,erasesize: The block size (erase size) of the device, in bytes. Must |
| 17 | be a power-of-two multiple of the page size. |
| 18 | - sandbox,oobsize: The size of the OOB area per page, in bytes. |
| 19 | - sandbox,pagesize: The page size (write size) of the device, in bytes. Must be |
| 20 | a power of two. |
| 21 | - sandbox,pages: The total number of pages in the device. |
| 22 | - sandbox,err-count: Number of bit errors to inject per step. |
| 23 | - sandbox,err-step-size: Size of the step to use when injecting errors, in |
| 24 | bytes. Must evenly divide the page size. |
| 25 | |
| 26 | Optional properties: |
| 27 | - sandbox,onfi: The complete ONFI parameter page, including the CRC. Should be |
| 28 | exactly 256 bytes. |
| 29 | - Any common NAND chip properties as documented by Linux's |
| 30 | Documentation/devicetree/bindings/mtd/raw-nand-chip.yaml |
| 31 | |
| 32 | To match U-Boot's error correction capabilities, errors are only injected into |
| 33 | the data area and the ECC codes. Other data in the OOB area is never corrupted. |
| 34 | Generally, sandbox,err-step-size should be the same as the ECC step size, and |
| 35 | sandbox,err-count should be less than the number of correctable bit errors (the |
| 36 | ECC strength). |
| 37 | |
| 38 | Example |
| 39 | ------- |
| 40 | |
| 41 | nand-controller { |
| 42 | #address-cells = <1>; |
| 43 | #size-cells = <0>; |
| 44 | compatible = "sandbox,nand"; |
| 45 | |
| 46 | nand@0 { |
| 47 | reg = <0>; |
| 48 | nand-ecc-mode = "soft"; |
| 49 | sandbox,id = [00 e3]; |
| 50 | sandbox,erasesize = <(8 * 1024)>; |
| 51 | sandbox,oobsize = <16>; |
| 52 | sandbox,pagesize = <512>; |
| 53 | sandbox,pages = <0x2000>; |
| 54 | sandbox,err-count = <1>; |
| 55 | sandbox,err-step-size = <512>; |
| 56 | }; |
| 57 | }; |