Skip to contentSkip to conversation

mtd: rawnand: add STM32 FMC2 NAND flash controller driver

PATCH Superseded Christophe Kerello 1 participant 3 messages Feb 20, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover mtd: rawnand: add STM32 FMC2 NAND flash controller driver

This patchset adds the support for the STMicroelectronics FMC2 NAND flash controller found on STM32MP SOCs.

This patchset supports:
- the polling mode feature
- a maximum 8k page size
- following ECC strength and step size
- 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 patchset has been tested on Micron MT29F8G08ABACAH4 (8-bit SLC NAND).

Christophe Kerello (2):
dt-bindings: mtd: stm32_fmc2: add STM32 FMC2 NAND controller
documentation
mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

 doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt |   59 ++
 drivers/mtd/nand/raw/Kconfig                     |   11 +
 drivers/mtd/nand/raw/Makefile                    |    1 +
 drivers/mtd/nand/raw/stm32_fmc2_nand.c           | 1092 ++++++++++++++++++++++
 4 files changed, 1163 insertions(+)
 create mode 100644 doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt
 create mode 100644 drivers/mtd/nand/raw/stm32_fmc2_nand.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 dt-bindings: mtd: stm32_fmc2: add STM32 FMC2 NAND controller documentation

This patch adds the documentation of the device tree bindings for the STM32 FMC2 NAND controller.

---

 doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt | 59 ++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt
doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt new file +59 -0
new file mode 100644
index 0000000..70e76be
@@ -0,0 +1,59 @@
+STMicroelectronics Flexible Memory Controller 2 (FMC2)
+NAND Interface
+
+Required properties:
+- compatible: Should be one of:
+              * st,stm32mp15-fmc2
+- reg: NAND flash controller memory areas.
+       First region contains the register location.
+       Regions 2 to 4 respectively contain the data, command,
+       and address space for CS0.
+       Regions 5 to 7 contain the same areas for CS1.
+- interrupts: The interrupt number
+- pinctrl-0: Standard Pinctrl phandle (see: pinctrl/pinctrl-bindings.txt)
+- clocks: The clock needed by the NAND flash controller
+
+Optional properties:
+- resets: Reference to a reset controller asserting the FMC controller
+- dmas: DMA specifiers (see: dma/stm32-mdma.txt)
+- dma-names: Must be "tx", "rx" and "ecc"
+
+Optional children nodes:
+Children nodes represent the available NAND chips.
+
+Optional properties:
+- nand-on-flash-bbt: see nand.txt
+- nand-ecc-strength: see nand.txt
+- nand-ecc-step-size: see nand.txt
+
+The following ECC strength and step size are currently supported:
+ - nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Hamming)
+ - nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
+ - nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8) (default)
+
+Example:
+
+	fmc: nand-controller at 58002000 {
+		compatible = "st,stm32mp15-fmc2";
+		reg = <0x58002000 0x1000>,
+		      <0x80000000 0x1000>,
+		      <0x88010000 0x1000>,
+		      <0x88020000 0x1000>,
+		      <0x81000000 0x1000>,
+		      <0x89010000 0x1000>,
+		      <0x89020000 0x1000>;
+		interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&rcc FMC_K>;
+		resets = <&rcc FMC_R>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&fmc_pins_a>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		nand at 0 {
+			reg = <0>;
+			nand-on-flash-bbt;
+			#address-cells = <1>;
+			#size-cells = <1>;
+		};
+	};
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

In reply to Christophe Kerello

The driver adds the support for the STMicroelectronics FMC2 NAND Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need any DMA channels.

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.

---

 drivers/mtd/nand/raw/Kconfig           |   11 +
 drivers/mtd/nand/raw/Makefile          |    1 +
 drivers/mtd/nand/raw/stm32_fmc2_nand.c | 1092 ++++++++++++++++++++++++++++++++
 3 files changed, 1104 insertions(+)
 create mode 100644 drivers/mtd/nand/raw/stm32_fmc2_nand.c
drivers/mtd/nand/raw/Kconfig +11 -0
index 7f76e5e..dc087ab 100644
@@ -256,6 +256,17 @@ config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
 	  This flag prevent U-boot reconfigure NAND flash controller and reuse
 	  the NAND timing from 1st stage bootloader.
 
+config NAND_STM32_FMC2
+	bool "Support for NAND controller on STM32MP SoCs"
+	depends on ARCH_STM32MP
+	select SYS_NAND_SELF_INIT
+	imply CMD_NAND
+	help
+	  Enables support for NAND Flash chips on SoCs containing the FMC2
+	  NAND controller. This controller is found on STM32MP SoCs.
+	  The controller supports a maximum 8k page size and supports
+	  a maximum 8-bit correction error per sector of 512 bytes.
+
 comment "Generic NAND options"
 
 config SYS_NAND_BLOCK_SIZE
drivers/mtd/nand/raw/Makefile +1 -0
index c61e3f3..b10e718 100644
@@ -65,6 +65,7 @@ obj-$(CONFIG_NAND_OMAP_ELM) += omap_elm.o
 obj-$(CONFIG_NAND_PLAT) += nand_plat.o
 obj-$(CONFIG_NAND_SUNXI) += sunxi_nand.o
 obj-$(CONFIG_NAND_ZYNQ) += zynq_nand.o
+obj-$(CONFIG_NAND_STM32_FMC2) += stm32_fmc2_nand.o
 
 else  # minimal SPL drivers
 
drivers/mtd/nand/raw/stm32_fmc2_nand.c new file +1092 -0

1,092 lines not on this page · raw message

Signature · 1 line
1.9.1