gpmc-nand.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. Device tree bindings for GPMC connected NANDs
  2. GPMC connected NAND (found on OMAP boards) are represented as child nodes of
  3. the GPMC controller with a name of "nand".
  4. All timing relevant properties as well as generic gpmc child properties are
  5. explained in a separate documents - please refer to
  6. Documentation/devicetree/bindings/bus/ti-gpmc.txt
  7. For NAND specific properties such as ECC modes or bus width, please refer to
  8. Documentation/devicetree/bindings/mtd/nand.txt
  9. Required properties:
  10. - reg: The CS line the peripheral is connected to
  11. Optional properties:
  12. - nand-bus-width: Set this numeric value to 16 if the hardware
  13. is wired that way. If not specified, a bus
  14. width of 8 is assumed.
  15. - ti,nand-ecc-opt: A string setting the ECC layout to use. One of:
  16. "sw" 1-bit Hamming ecc code via software
  17. "hw" <deprecated> use "ham1" instead
  18. "hw-romcode" <deprecated> use "ham1" instead
  19. "ham1" 1-bit Hamming ecc code
  20. "bch4" 4-bit BCH ecc code
  21. "bch8" 8-bit BCH ecc code
  22. "bch16" 16-bit BCH ECC code
  23. Refer below "How to select correct ECC scheme for your device ?"
  24. - ti,nand-xfer-type: A string setting the data transfer type. One of:
  25. "prefetch-polled" Prefetch polled mode (default)
  26. "polled" Polled mode, without prefetch
  27. "prefetch-dma" Prefetch enabled sDMA mode
  28. "prefetch-irq" Prefetch enabled irq mode
  29. - elm_id: <deprecated> use "ti,elm-id" instead
  30. - ti,elm-id: Specifies phandle of the ELM devicetree node.
  31. ELM is an on-chip hardware engine on TI SoC which is used for
  32. locating ECC errors for BCHx algorithms. SoC devices which have
  33. ELM hardware engines should specify this device node in .dtsi
  34. Using ELM for ECC error correction frees some CPU cycles.
  35. For inline partition table parsing (optional):
  36. - #address-cells: should be set to 1
  37. - #size-cells: should be set to 1
  38. Example for an AM33xx board:
  39. gpmc: gpmc@50000000 {
  40. compatible = "ti,am3352-gpmc";
  41. ti,hwmods = "gpmc";
  42. reg = <0x50000000 0x1000000>;
  43. interrupts = <100>;
  44. gpmc,num-cs = <8>;
  45. gpmc,num-waitpins = <2>;
  46. #address-cells = <2>;
  47. #size-cells = <1>;
  48. ranges = <0 0 0x08000000 0x2000>; /* CS0: NAND */
  49. elm_id = <&elm>;
  50. nand@0,0 {
  51. reg = <0 0 0>; /* CS0, offset 0 */
  52. nand-bus-width = <16>;
  53. ti,nand-ecc-opt = "bch8";
  54. ti,nand-xfer-type = "polled";
  55. gpmc,sync-clk-ps = <0>;
  56. gpmc,cs-on-ns = <0>;
  57. gpmc,cs-rd-off-ns = <44>;
  58. gpmc,cs-wr-off-ns = <44>;
  59. gpmc,adv-on-ns = <6>;
  60. gpmc,adv-rd-off-ns = <34>;
  61. gpmc,adv-wr-off-ns = <44>;
  62. gpmc,we-off-ns = <40>;
  63. gpmc,oe-off-ns = <54>;
  64. gpmc,access-ns = <64>;
  65. gpmc,rd-cycle-ns = <82>;
  66. gpmc,wr-cycle-ns = <82>;
  67. gpmc,wr-access-ns = <40>;
  68. gpmc,wr-data-mux-bus-ns = <0>;
  69. #address-cells = <1>;
  70. #size-cells = <1>;
  71. /* partitions go here */
  72. };
  73. };
  74. How to select correct ECC scheme for your device ?
  75. --------------------------------------------------
  76. Higher ECC scheme usually means better protection against bit-flips and
  77. increased system lifetime. However, selection of ECC scheme is dependent
  78. on various other factors also like;
  79. (1) support of built in hardware engines.
  80. Some legacy OMAP SoC do not have ELM harware engine, so those SoC cannot
  81. support ecc-schemes with hardware error-correction (BCHx_HW). However
  82. such SoC can use ecc-schemes with software library for error-correction
  83. (BCHx_HW_DETECTION_SW). The error correction capability with software
  84. library remains equivalent to their hardware counter-part, but there is
  85. slight CPU penalty when too many bit-flips are detected during reads.
  86. (2) Device parameters like OOBSIZE.
  87. Other factor which governs the selection of ecc-scheme is oob-size.
  88. Higher ECC schemes require more OOB/Spare area to store ECC syndrome,
  89. so the device should have enough free bytes available its OOB/Spare
  90. area to accommodate ECC for entire page. In general following expression
  91. helps in determining if given device can accommodate ECC syndrome:
  92. "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE"
  93. where
  94. OOBSIZE number of bytes in OOB/spare area
  95. PAGESIZE number of bytes in main-area of device page
  96. ECC_BYTES number of ECC bytes generated to protect
  97. 512 bytes of data, which is:
  98. '3' for HAM1_xx ecc schemes
  99. '7' for BCH4_xx ecc schemes
  100. '14' for BCH8_xx ecc schemes
  101. '26' for BCH16_xx ecc schemes
  102. Example(a): For a device with PAGESIZE = 2048 and OOBSIZE = 64 and
  103. trying to use BCH16 (ECC_BYTES=26) ecc-scheme.
  104. Number of ECC bytes per page = (2 + (2048 / 512) * 26) = 106 B
  105. which is greater than capacity of NAND device (OOBSIZE=64)
  106. Hence, BCH16 cannot be supported on given device. But it can
  107. probably use lower ecc-schemes like BCH8.
  108. Example(b): For a device with PAGESIZE = 2048 and OOBSIZE = 128 and
  109. trying to use BCH16 (ECC_BYTES=26) ecc-scheme.
  110. Number of ECC bytes per page = (2 + (2048 / 512) * 26) = 106 B
  111. which can be accommodated in the OOB/Spare area of this device
  112. (OOBSIZE=128). So this device can use BCH16 ecc-scheme.