Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933019AbcCHLPe (ORCPT ); Tue, 8 Mar 2016 06:15:34 -0500 Received: from down.free-electrons.com ([37.187.137.238]:40352 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932261AbcCHLP1 (ORCPT ); Tue, 8 Mar 2016 06:15:27 -0500 From: Boris Brezillon To: Andrew Morton , Dave Gordon , David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org Cc: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Maxime Ripard , Chen-Yu Tsai , linux-sunxi@googlegroups.com, Vinod Koul , Dan Williams , dmaengine@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , linux-media@vger.kernel.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree@vger.kernel.org, Boris Brezillon Subject: [PATCH 0/7] mtd: nand: sunxi: add support for DMA operations Date: Tue, 8 Mar 2016 12:15:08 +0100 Message-Id: <1457435715-24740-1-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2733 Lines: 70 Hello, This patch series aims at adding support for DMA assisted operations to the sunxi_nand driver. The first 3 patches are just reworks in the existing driver preparing things for DMA ->read/write_page() operations. Those ones are mainly re-arranging existing functions, and moving some code into dedicated functions so we can reuse them when adding the read/write_page() implementation. Patch 4 is an attempt to generalize some logic that are duplicated in a lot of places. It provides a generic solution to create an SG table from a buffer (passed by virtual address) and its length. This generic implementation tries to take all possible constraints into account, like: - vmallocated buffers - alignement requirement/preference - maximum DMA transfer length I may have missed other things (is there a need for a minimum DMA transfer constraint?), so don't hesitate to point problems or missing elements in this implementation. Note that other subsystems doing the same kind of thing (like SPI of V4L) could use this implementation. This is why I've put the SPI and V4L maintainers in Cc. Patch 5 is providing functions to map/unmap buffers for DMA operations at the MTD level. This will hopefully limit the number of open-coded implementations we're currently seeing in a lot of NAND drivers. Of course, it's making use of sg_alloc_table_from_buf(), introduced in patch 4. Patch 6 and 7 are patching the sunxi NAND driver and its DT binding doc to add DMA support. I'm particularly interested in getting feedbacks on patch 4 and 5. Is there a reason nobody ever tried to create such generic functions (at the scatterlist and MTD levels), and if there are, could you detail them? Thanks, Boris Side note: patches touching the sunxi NAND driver are depending on a series posted yesterday [1]. [1]https://lkml.org/lkml/2016/3/7/444 Boris Brezillon (7): mtd: nand: sunxi: move some ECC related operations to their own functions mtd: nand: sunxi: make OOB retrieval optional mtd: nand: sunxi: make cur_off parameter optional in extra oob helpers scatterlist: add sg_alloc_table_from_buf() helper mtd: provide helper to prepare buffers for DMA operations mtd: nand: sunxi: add support for DMA assisted operations mtd: nand: sunxi: update DT bindings .../devicetree/bindings/mtd/sunxi-nand.txt | 4 + drivers/mtd/mtdcore.c | 66 +++ drivers/mtd/nand/sunxi_nand.c | 483 ++++++++++++++++++--- include/linux/mtd/mtd.h | 25 ++ include/linux/scatterlist.h | 24 + lib/scatterlist.c | 142 ++++++ 6 files changed, 679 insertions(+), 65 deletions(-) -- 2.1.4