From patchwork Thu Dec 15 09:55:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Abhishek Sahu X-Patchwork-Id: 9475791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9DE67607EE for ; Thu, 15 Dec 2016 09:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BF512867A for ; Thu, 15 Dec 2016 09:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76AA928740; Thu, 15 Dec 2016 09:58:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B78D2867A for ; Thu, 15 Dec 2016 09:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757929AbcLOJ4c (ORCPT ); Thu, 15 Dec 2016 04:56:32 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:59530 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754603AbcLOJ41 (ORCPT ); Thu, 15 Dec 2016 04:56:27 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 159E4615F0; Thu, 15 Dec 2016 09:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1481795787; bh=D6SuFGApfmurjeXqatMifV1c/4kMHrlj/dyvfQ87hy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N00M8VHkByQ6r8VvV499Hth2lSBWj/tlNQ7G3TgwBr3+XW+jryUz3OkXh+dauLQiX UIkC+nwptZu/kmsTbcrYteUHEfsM2SHAuCuL9R7afwBicEmhZoEsiKGCJAIraOvhfX wY7azGgmNyMvSE9zY71QK37xK5G2c/8Zxh+8C4S0= Received: from chen-lnxbld15.qualcomm.com (unknown [202.46.23.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A9D4F61616; Thu, 15 Dec 2016 09:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1481795786; bh=D6SuFGApfmurjeXqatMifV1c/4kMHrlj/dyvfQ87hy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FfOf7PtO4SbV/HZa83kXWI5YPRUlXQIuzLMKUUXDA1hl+K3lqlCfpfeGvR8FPcagN aP3NbnHpyehZogzjkP6eswPR9xJhuB81M2wzE2c3ns0flNTse0yvm8lK4hMV4GGDy6 xnd1vF5aWpTlG4oQXcKEXbgdMYKnf/b/TBZBENz4= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org A9D4F61616 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: vinod.koul@intel.com, dan.j.williams@intel.com, andy.gross@linaro.org Cc: stanimir.varbanov@linaro.org, mcgrof@suse.com, okaya@codeaurora.org, pramod.gurav@linaro.org, arnd@arndb.de, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-msm@vger.kernel.org, Abhishek Sahu Subject: [PATCH 2/5] dmaengine: Add support for custom data mapping Date: Thu, 15 Dec 2016 15:25:52 +0530 Message-Id: <1481795755-15302-3-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481795755-15302-1-git-send-email-absahu@codeaurora.org> References: <1481795755-15302-1-git-send-email-absahu@codeaurora.org> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current DMA APIs only support SGL or data in generic format. The QCA BAM DMA engine data cannot be mapped with already available APIs due to following reasons. 1. The QCA BAM DMA engine uses custom flags which cannot be mapped with generic DMA engine flags. 2. Some peripheral driver like QCA QPIC NAND/LCD requires to set specific flags (Like NWD, EOT) for some of the descriptors in scatter gather list. The already available mapping APIs take flags parameter in API itself and there is no support for passing DMA specific flags for each SGL entry. Now this patch adds the support for making the DMA descriptor from custom data with new DMA mapping function prep_dma_custom_mapping. The peripheral driver will pass the custom data in this function and DMA engine driver will form the descriptor according to its own logic. In future, this API can be used by any other DMA engine drivers also which are unable to do DMA mapping with already available API’s. Signed-off-by: Abhishek Sahu --- include/linux/dmaengine.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index cc535a4..6324c1f 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -692,6 +692,8 @@ struct dma_filter { * be called after period_len bytes have been transferred. * @device_prep_interleaved_dma: Transfer expression in a generic way. * @device_prep_dma_imm_data: DMA's 8 byte immediate data to the dst address + * @device_prep_dma_custom_mapping: prepares a dma operation from dma driver + * specific custom data * @device_config: Pushes a new configuration to a channel, return 0 or an error * code * @device_pause: Pauses any transfer happening on a channel. Returns @@ -783,6 +785,9 @@ struct dma_device { struct dma_async_tx_descriptor *(*device_prep_dma_imm_data)( struct dma_chan *chan, dma_addr_t dst, u64 data, unsigned long flags); + struct dma_async_tx_descriptor *(*device_prep_dma_custom_mapping)( + struct dma_chan *chan, void *data, + unsigned long flags); int (*device_config)(struct dma_chan *chan, struct dma_slave_config *config);