Skip to content

Commit 2cd457f

Browse files
Christophe Kerellomiquelraynal
authored andcommitted
mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver
The driver adds the support for the STMicroelectronics FMC2 NAND Controller found on STM32MP SOCs. This patch is based on FMC2 command sequencer. The purpose of the command sequencer is to facilitate the programming and the reading of NAND flash pages with the ECC and to free the CPU of sequencing tasks. It requires one DMA channel for write and two DMA channels for read operations. Only NAND_ECC_HW mode is actually supported. The driver supports a maximum 8k page size. The following ECC strength and step size are currently supported: - nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8) - nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4) - nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC based on Hamming) This patch has been tested on Micron MT29F8G08ABACAH4 and MT29F8G16ABACAH4 Signed-off-by: Christophe Kerello <christophe.kerello@st.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 8c6e7fd commit 2cd457f

File tree

3 files changed

+1818
-0
lines changed

3 files changed

+1818
-0
lines changed

drivers/mtd/nand/raw/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,4 +541,13 @@ config MTD_NAND_TEGRA
541541
is supported. Extra OOB bytes when using HW ECC are currently
542542
not supported.
543543

544+
config MTD_NAND_STM32_FMC2
545+
tristate "Support for NAND controller on STM32MP SoCs"
546+
depends on MACH_STM32MP157 || COMPILE_TEST
547+
help
548+
Enables support for NAND Flash chips on SoCs containing the FMC2
549+
NAND controller. This controller is found on STM32MP SoCs.
550+
The controller supports a maximum 8k page size and supports
551+
a maximum 8-bit correction error per sector of 512 bytes.
552+
544553
endif # MTD_NAND

drivers/mtd/nand/raw/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/
5656
obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o
5757
obj-$(CONFIG_MTD_NAND_MTK) += mtk_ecc.o mtk_nand.o
5858
obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o
59+
obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm32_fmc2_nand.o
5960

6061
nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o
6162
nand-objs += nand_onfi.o

0 commit comments

Comments
 (0)