Skip to contentSkip to conversation

Add support for Arasan NAND Flash controller

PATCH Superseded Naga Sureshkumar Relli 3 participants 5 messages Dec 14, 2017

Subsystems (3)

v8 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v8 cover Add support for Arasan NAND Flash controller

This patch series adds the basic driver support for Arasan NAND Flash controller.
We are reinitiating the patch series by fixing the comments given by Boris and Rob.

Previous Patch reference:
https://lkml.org/lkml/2017/1/8/245

Naga Sureshkumar Relli (2):
mtd: arasan: Add device tree binding documentation
mtd: nand: Add support for Arasan NAND Flash Controller

 .../devicetree/bindings/mtd/arasan_nand.txt        |   38 +
 drivers/mtd/nand/Kconfig                           |    8 +
 drivers/mtd/nand/Makefile                          |    1 +
 drivers/mtd/nand/arasan_nand.c                     | 1020 ++++++++++++++++++++
 4 files changed, 1067 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/arasan_nand.txt
 create mode 100644 drivers/mtd/nand/arasan_nand.c
Signature · 1 line
2.13.0
#1 lore raw

PATCH v8 1/2 mtd: arasan: Add device tree binding documentation

This patch adds the dts binding document for arasan nand flash controller.

---
Changes in v8:
- Updated compatible and clock-names as per Boris comments Changes in v7:
- Corrected the acronyms those should be in caps changes in v6:
- Removed num-cs property
- Separated nandchip from nand controller
changes in v5:
- None
Changes in v4:
- Added num-cs property
- Added clock support
Changes in v3:
- None
Changes in v2:
- None

---
 .../devicetree/bindings/mtd/arasan_nand.txt        | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/arasan_nand.txt
Documentation/devicetree/bindings/mtd/arasan_nand.txt new file +38 -0
new file mode 100644
index 000000000000..1a870153a909
@@ -0,0 +1,38 @@
+Arasan NAND Flash Controller with ONFI 3.1 support
+
+Required properties:
+- compatible: Should be "xlnx,zynqmp-nand" or "arasan,nfc-v3p10"
+- reg: Memory map for module access
+- interrupt-parent: Interrupt controller the interrupt is routed through
+- interrupts: Should contain the interrupt for the device
+- clock-name: List of input clocks - "sys", "flash"
+	      (See clock bindings for details)
+- clocks: Clock phandles (see clock bindings for details)
+
+Optional properties:
+- arasan,has-mdma: Enables DMA support
+
+For NAND partition information please refer the below file
+Documentation/devicetree/bindings/mtd/partition.txt
+
+Example:
+	nand0: nand@ff100000 {
+		compatible = "xlnx,zynqmp-nand", "arasan,nfc-v3p10"
+		reg = <0x0 0xff100000 0x1000>;
+		clock-name = "sys", "flash"
+		clocks = <&misc_clk &misc_clk>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 14 4>;
+		arasan,has-mdma;
+		#address-cells = <1>;
+		#size-cells = <0>
+
+		nand@0 {
+			reg = <0>
+			partition@0 {
+				label = "filesystem";
+				reg = <0x0 0x0 0x1000000>;
+			};
+			(...)
+		};
+	};
Signature · 1 line
2.13.0
#2 lore raw

PATCH v8 2/2 mtd: nand: Add support for Arasan NAND Flash Controller

In reply to Naga Sureshkumar Relli

Added the basic driver for Arasan NAND Flash Controller used in Zynq UltraScale+ MPSoC. It supports only Hw ECC and upto 24bit correction.

---
Changes in v8:
- Implemented setup_data_interface hook
- fixed checkpatch --strict warnings
- Added anfc_config_ecc in read_page_hwecc
- Fixed returning status value by reading flash status in read_byte() instead of reading previous value.
Changes in v7:
- Implemented Marek suggestions and comments
- Corrected the acronyms those should be in caps
- Modified kconfig/Make file to keep arasan entry in sorted order
- Added is_vmlloc_addr check
- Used ioread/write32_rep variants to avoid compilation error for intel platforms
- separated PIO and DMA mode read/write functions
- Minor cleanup
Chnages in v6:
- Addressed most of the Brian and Boris comments
- Separated the nandchip from the nand controller
- Removed the ecc lookup table from driver
- Now use framework nand waitfunction and readoob
- Fixed the compiler warning
- Adapted the new frameowrk changes related to ecc and ooblayout
- Disabled the clocks after the nand_reelase
- Now using only one completion object
- Boris suggessions like adapting cmd_ctrl and rework on read/write byte are not implemented and i will patch them later
- Also check_erased_ecc_chunk for erase and check for is_vmalloc_addr will implement later once the basic driver is mainlined.
Changes in v5:
- Renamed the driver filei as arasan_nand.c
- Fixed all comments relaqted coding style
- Fixed comments related to propagating the errors
- Modified the anfc_write_page_hwecc as per the write_page prototype
Changes in v4:
- Added support for onfi timing mode configuration
- Added clock supppport
- Added support for multiple chipselects
Changes in v3:
- Removed unused variables
- Avoided busy loop and used jifies based implementation
- Fixed compiler warnings "right shift count >= width of type"
- Removed unneeded codei and improved error reporting
- Added onfi version check to ensure reading the valid address cycles Changes in v2:
- Added missing of.h to avoid kbuild system report erro

---
 drivers/mtd/nand/Kconfig       |    8 +
 drivers/mtd/nand/Makefile      |    1 +
 drivers/mtd/nand/arasan_nand.c | 1020 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1029 insertions(+)
 create mode 100644 drivers/mtd/nand/arasan_nand.c
drivers/mtd/nand/Kconfig +8 -0
index 3f2036f31da4..bdc97510f758 100644
@@ -40,6 +40,14 @@ config MTD_SM_COMMON
 	tristate
 	default n
 
+config MTD_NAND_ARASAN
+	tristate "Support for Arasan Nand Flash controller"
+	depends on HAS_IOMEM
+	depends on HAS_DMA
+	help
+	  Enables the driver for the Arasan NAND Flash controller on
+	  Zynq UltraScale+ MPSoC.
+
 config MTD_NAND_DENALI
 	tristate
 
drivers/mtd/nand/Makefile +1 -0
index 6e2db700d923..b96965a95daf 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_NAND_ECC)		+= nand_ecc.o
 obj-$(CONFIG_MTD_NAND_BCH)		+= nand_bch.o
 obj-$(CONFIG_MTD_SM_COMMON) 		+= sm_common.o
 
+obj-$(CONFIG_MTD_NAND_ARASAN)		+= arasan_nand.o
 obj-$(CONFIG_MTD_NAND_CAFE)		+= cafe_nand.o
 obj-$(CONFIG_MTD_NAND_AMS_DELTA)	+= ams-delta.o
 obj-$(CONFIG_MTD_NAND_DENALI)		+= denali.o
drivers/mtd/nand/arasan_nand.c new file +1020 -0

1,020 lines not on this page · raw message

Signature · 1 line
2.13.0
#3 lore raw

Re: [PATCH v8 2/2] mtd: nand: Add support for Arasan NAND Flash Controller

Dear Naga,

Quoted 6 lines · Naga Sureshkumar Relli

Added the basic driver for Arasan NAND Flash Controller used in Zynq UltraScale+ MPSoC. It supports only Hw ECC and upto 24bit correction.

<snip>

drivers/mtd/nand/arasan_nand.c line 10

Quoted 13 lines
drivers/mtd/nand/arasan_nand.c new file +10 -0
@@ -0,0 +1,1020 @@
+/*
+ * Arasan NAND Flash Controller Driver
+ *
+ * Copyright (C) 2014 - 2017 Xilinx, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */

Could you use the new SPDX tags instead of this fine and long boilerplate? See Thomas doc for details [1]

[1] https://lkml.org/lkml/2017/12/4/934

Thanks!

Signature · 2 lines
Cordially
Philippe Ombredanne
#4 lore raw

RE: [PATCH v8 2/2] mtd: nand: Add support for Arasan NAND Flash Controller

Hi Philippe,

Thanks for the review.
I will update it in next version.

Thanks,
Naga Sureshkumar Relli.

Quoted 52 lines

-----Original Message-----
From: Philippe Ombredanne [mailto:[email protected]]
Sent: Thursday, December 14, 2017 2:42 PM
To: Naga Sureshkumar Relli <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; LKML <[email protected]>; Michal Simek <[email protected]>; Punnaiah Choudary Kalluri <[email protected]>; [email protected]
Subject: Re: [PATCH v8 2/2] mtd: nand: Add support for Arasan NAND Flash Controller

Dear Naga,

Quoted 5 lines · Naga Sureshkumar Relli

Added the basic driver for Arasan NAND Flash Controller used in Zynq UltraScale+ MPSoC. It supports only Hw ECC and upto 24bit correction.

<snip>

Quoted 6 lines
drivers/mtd/nand/arasan_nand.c new file +3 -0
@@ -0,0 +1,1020 @@
+/*
+ * Arasan NAND Flash Controller Driver
+ *

drivers/mtd/nand/arasan_nand.c line 13

Quoted 10 lines
drivers/mtd/nand/arasan_nand.c new file +10 -0
+ * Copyright (C) 2014 - 2017 Xilinx, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+modify it under
+ * the terms of the GNU General Public License version 2 as published
+by the
+ * Free Software Foundation; either version 2 of the License, or (at
+your
+ * option) any later version.
+ */

Could you use the new SPDX tags instead of this fine and long boilerplate? See Thomas doc for details [1]

[1] https://lkml.org/lkml/2017/12/4/934

Thanks!

--
Cordially
Philippe Ombredanne