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