Skip to content

Commit 1ed1069

Browse files
Merge tag 'nand/for-4.8' of github.com:linux-nand/linux into mtd
Pull NAND changes from Boris Brezillon: """ This pull request contains only one notable change: * Addition of the MTK NAND controller driver And a bunch of specific NAND driver improvements/fixes. Here are the changes that are worth mentioning: * A few fixes/improvements for the xway NAND controller driver * A few fixes for the sunxi NAND controller driver * Support for DMA in the sunxi NAND driver * Support for the sunxi NAND controller IP embedded in A23/A33 SoCs * Addition for bitflips detection in erased pages to the brcmnand driver * Support for new brcmnand IPs * Update of the OMAP-GPMC binding to support DMA channel description """
2 parents 7ddf7c1 + 8490c03 commit 1ed1069

19 files changed

Lines changed: 2981 additions & 124 deletions

File tree

‎Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ Required properties:
4646
0 maps to GPMC_WAIT0 pin.
4747
- gpio-cells: Must be set to 2
4848

49+
Required properties when using NAND prefetch dma:
50+
- dmas GPMC NAND prefetch dma channel
51+
- dma-names Must be set to "rxtx"
52+
4953
Timing properties for child nodes. All are optional and default to 0.
5054

5155
- gpmc,sync-clk-ps: Minimum clock period for synchronous mode, in picoseconds
@@ -137,7 +141,8 @@ Example for an AM33xx board:
137141
ti,hwmods = "gpmc";
138142
reg = <0x50000000 0x2000>;
139143
interrupts = <100>;
140-
144+
dmas = <&edma 52 0>;
145+
dma-names = "rxtx";
141146
gpmc,num-cs = <8>;
142147
gpmc,num-waitpins = <2>;
143148
#address-cells = <2>;

‎Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Required properties:
2727
brcm,brcmnand-v6.2
2828
brcm,brcmnand-v7.0
2929
brcm,brcmnand-v7.1
30+
brcm,brcmnand-v7.2
3031
brcm,brcmnand
3132
- reg : the register start and length for NAND register region.
3233
(optional) Flash DMA register range (if present)

‎Documentation/devicetree/bindings/mtd/gpmc-nand.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Optional properties:
3939

4040
"prefetch-polled" Prefetch polled mode (default)
4141
"polled" Polled mode, without prefetch
42-
"prefetch-dma" Prefetch enabled sDMA mode
42+
"prefetch-dma" Prefetch enabled DMA mode
4343
"prefetch-irq" Prefetch enabled irq mode
4444

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

‎Documentation/devicetree/bindings/mtd/sunxi-nand.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ Required properties:
1111
* "ahb" : AHB gating clock
1212
* "mod" : nand controller clock
1313

14+
Optional properties:
15+
- dmas : shall reference DMA channel associated to the NAND controller.
16+
- dma-names : shall be "rxtx".
17+
1418
Optional children nodes:
1519
Children nodes represent the available nand chips.
1620

1721
Optional properties:
22+
- reset : phandle + reset specifier pair
23+
- reset-names : must contain "ahb"
1824
- allwinner,rb : shall contain the native Ready/Busy ids.
1925
or
2026
- rb-gpios : shall contain the gpios used as R/B pins.

‎drivers/mtd/nand/Kconfig‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ config MTD_NAND_FSMC
539539
config MTD_NAND_XWAY
540540
tristate "Support for NAND on Lantiq XWAY SoC"
541541
depends on LANTIQ && SOC_TYPE_XWAY
542-
select MTD_NAND_PLATFORM
543542
help
544543
Enables support for NAND Flash chips on Lantiq XWAY SoCs. NAND is attached
545544
to the External Bus Unit (EBU).
@@ -563,4 +562,11 @@ config MTD_NAND_QCOM
563562
Enables support for NAND flash chips on SoCs containing the EBI2 NAND
564563
controller. This controller is found on IPQ806x SoC.
565564

565+
config MTD_NAND_MTK
566+
tristate "Support for NAND controller on MTK SoCs"
567+
depends on HAS_DMA
568+
help
569+
Enables support for NAND controller on MTK SoCs.
570+
This controller is found on mt27xx, mt81xx, mt65xx SoCs.
571+
566572
endif # MTD_NAND

‎drivers/mtd/nand/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o
5757
obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
5858
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/
5959
obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o
60+
obj-$(CONFIG_MTD_NAND_MTK) += mtk_nand.o mtk_ecc.o
6061

6162
nand-objs := nand_base.o nand_bbt.o nand_timings.o

0 commit comments

Comments
 (0)