gpmc-nand.txt 5.3 KB

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