0074-mtd-mediatek-device-tree-docs-for-MTK-Smart-Device-G.patch 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. From 5e1c00983efeca4522ac2e8574e3e3997d26a203 Mon Sep 17 00:00:00 2001
  2. From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
  3. Date: Fri, 29 Apr 2016 12:17:21 -0400
  4. Subject: [PATCH 074/102] mtd: mediatek: device tree docs for MTK Smart Device
  5. Gen1 NAND
  6. This patch adds documentation support for Smart Device Gen1 type of
  7. NAND controllers.
  8. Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
  9. ---
  10. Documentation/devicetree/bindings/mtd/mtk-nand.txt | 161 ++++++++++++++++++++
  11. 1 file changed, 161 insertions(+)
  12. create mode 100644 Documentation/devicetree/bindings/mtd/mtk-nand.txt
  13. --- /dev/null
  14. +++ b/Documentation/devicetree/bindings/mtd/mtk-nand.txt
  15. @@ -0,0 +1,161 @@
  16. +MTK SoCs NAND FLASH controller (NFC) DT binding
  17. +
  18. +This file documents the device tree bindings for MTK SoCs NAND controllers.
  19. +The functional split of the controller requires two drivers to operate:
  20. +the nand controller interface driver and the ECC engine driver.
  21. +
  22. +The hardware description for both devices must be captured as device
  23. +tree nodes.
  24. +
  25. +1) NFC NAND Controller Interface (NFI):
  26. +=======================================
  27. +
  28. +The first part of NFC is NAND Controller Interface (NFI) HW.
  29. +Required NFI properties:
  30. +- compatible: Should be "mediatek,mtxxxx-nfc".
  31. +- reg: Base physical address and size of NFI.
  32. +- interrupts: Interrupts of NFI.
  33. +- clocks: NFI required clocks.
  34. +- clock-names: NFI clocks internal name.
  35. +- status: Disabled default. Then set "okay" by platform.
  36. +- ecc-engine: Required ECC Engine node.
  37. +- #address-cells: NAND chip index, should be 1.
  38. +- #size-cells: Should be 0.
  39. +
  40. +Example:
  41. +
  42. + nandc: nfi@1100d000 {
  43. + compatible = "mediatek,mt2701-nfc";
  44. + reg = <0 0x1100d000 0 0x1000>;
  45. + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
  46. + clocks = <&pericfg CLK_PERI_NFI>,
  47. + <&pericfg CLK_PERI_NFI_PAD>;
  48. + clock-names = "nfi_clk", "pad_clk";
  49. + status = "disabled";
  50. + ecc-engine = <&bch>;
  51. + #address-cells = <1>;
  52. + #size-cells = <0>;
  53. + };
  54. +
  55. +Platform related properties, should be set in {platform_name}.dts:
  56. +- children nodes: NAND chips.
  57. +
  58. +Children nodes properties:
  59. +- reg: Chip Select Signal, default 0.
  60. + Set as reg = <0>, <1> when need 2 CS.
  61. +Optional:
  62. +- nand-on-flash-bbt: Store BBT on NAND Flash.
  63. +- nand-ecc-mode: the NAND ecc mode (check driver for supported modes)
  64. +- nand-ecc-step-size: Number of data bytes covered by a single ECC step.
  65. + The controller only supports 512 and 1024.
  66. + For large page NANDs ther recommended value is 1024.
  67. +- nand-ecc-strength: Number of bits to correct per ECC step.
  68. + The valid values that the controller supports are: 4, 6,
  69. + 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 40, 44,
  70. + 48, 52, 56, 60.
  71. + The strength should be calculated as follows:
  72. + E = (S - F) * 8 / 14
  73. + S = O / (P / Q)
  74. + E :nand-ecc-strength;
  75. + S :spare size per sector;
  76. + F : FDM size, should be in the range [1,8].
  77. + It is used to store free oob data.
  78. + O : oob size;
  79. + P : page size;
  80. + Q :nand-ecc-step-size
  81. + If the result does not match any one of the listed
  82. + choices above, please select the smaller valid value from
  83. + the list.
  84. + (otherwise the driver will do the clamping at runtime).
  85. +- vmch-supply: NAND power supply.
  86. +- pinctrl-names: Default NAND pin GPIO setting name.
  87. +- pinctrl-0: GPIO setting node.
  88. +
  89. +Example:
  90. + &pio {
  91. + nand_pins_default: nanddefault {
  92. + pins_dat {
  93. + pinmux = <MT2701_PIN_111_MSDC0_DAT7__FUNC_NLD7>,
  94. + <MT2701_PIN_112_MSDC0_DAT6__FUNC_NLD6>,
  95. + <MT2701_PIN_114_MSDC0_DAT4__FUNC_NLD4>,
  96. + <MT2701_PIN_118_MSDC0_DAT3__FUNC_NLD3>,
  97. + <MT2701_PIN_121_MSDC0_DAT0__FUNC_NLD0>,
  98. + <MT2701_PIN_120_MSDC0_DAT1__FUNC_NLD1>,
  99. + <MT2701_PIN_113_MSDC0_DAT5__FUNC_NLD5>,
  100. + <MT2701_PIN_115_MSDC0_RSTB__FUNC_NLD8>,
  101. + <MT2701_PIN_119_MSDC0_DAT2__FUNC_NLD2>;
  102. + input-enable;
  103. + drive-strength = <MTK_DRIVE_8mA>;
  104. + bias-pull-up;
  105. + };
  106. +
  107. + pins_we {
  108. + pinmux = <MT2701_PIN_117_MSDC0_CLK__FUNC_NWEB>;
  109. + drive-strength = <MTK_DRIVE_8mA>;
  110. + bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
  111. + };
  112. +
  113. + pins_ale {
  114. + pinmux = <MT2701_PIN_116_MSDC0_CMD__FUNC_NALE>;
  115. + drive-strength = <MTK_DRIVE_8mA>;
  116. + bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
  117. + };
  118. + };
  119. + };
  120. +
  121. + &nandc {
  122. + status = "okay";
  123. + pinctrl-names = "default";
  124. + pinctrl-0 = <&nand_pins_default>;
  125. + nand@0 {
  126. + reg = <0>;
  127. + nand-on-flash-bbt;
  128. + nand-ecc-mode = "hw";
  129. + nand-ecc-strength = <24>;
  130. + nand-ecc-step-size = <1024>;
  131. + };
  132. + };
  133. +
  134. +NAND chip optional subnodes:
  135. +- Partitions, see Documentation/devicetree/bindings/mtd/partition.txt
  136. +
  137. +Example:
  138. + nand@0 {
  139. + partitions {
  140. + compatible = "fixed-partitions";
  141. + #address-cells = <1>;
  142. + #size-cells = <1>;
  143. +
  144. + preloader@0 {
  145. + label = "pl";
  146. + read-only;
  147. + reg = <0x00000000 0x00400000>;
  148. + };
  149. + android@0x00400000 {
  150. + label = "android";
  151. + reg = <0x00400000 0x12c00000>;
  152. + };
  153. + };
  154. + };
  155. +
  156. +2) ECC Engine:
  157. +==============
  158. +
  159. +Required BCH properties:
  160. +- compatible: Should be "mediatek,mtxxxx-ecc".
  161. +- reg: Base physical address and size of ECC.
  162. +- interrupts: Interrupts of ECC.
  163. +- clocks: ECC required clocks.
  164. +- clock-names: ECC clocks internal name.
  165. +- status: Disabled default. Then set "okay" by platform.
  166. +
  167. +Example:
  168. +
  169. + bch: ecc@1100e000 {
  170. + compatible = "mediatek,mt2701-ecc";
  171. + reg = <0 0x1100e000 0 0x1000>;
  172. + interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_LOW>;
  173. + clocks = <&pericfg CLK_PERI_NFI_ECC>;
  174. + clock-names = "nfiecc_clk";
  175. + status = "disabled";
  176. + };