From patchwork Thu Dec 15 09:55:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Sahu X-Patchwork-Id: 9475777 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 BA4E9607EE for ; Thu, 15 Dec 2016 09:57:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A75552867A for ; Thu, 15 Dec 2016 09:57:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98D212873D; Thu, 15 Dec 2016 09:57:42 +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 1AD3A28668 for ; Thu, 15 Dec 2016 09:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757433AbcLOJ4p (ORCPT ); Thu, 15 Dec 2016 04:56:45 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:59850 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757939AbcLOJ4n (ORCPT ); Thu, 15 Dec 2016 04:56:43 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8A416615F0; Thu, 15 Dec 2016 09:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1481795802; bh=cFTkzUbnZacwTSRNm6ONCMKXRnmnZu56MzKWfrRu5J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VgYgGxiz32FGwphDMsUcRIYkzSirWsPbR+3WE65FPfKaZSj+Mvt956XDfLgB/vhdK IuoF3zjMdX+DY3BWoD0iIx6312YOowSSeYHpmll52JE4FQo6h18zZGy1IGmc+n7Ocj sSD7Fa3zpUWPfk7v22OmzRHD84j/CnLZfj7YeMbE= 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 63B5D615E1; Thu, 15 Dec 2016 09:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1481795801; bh=cFTkzUbnZacwTSRNm6ONCMKXRnmnZu56MzKWfrRu5J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qe7bEO9pIPRFPSDcSi5jtPg7lMVz+nS7JlW1hTxfuzruKbQt04TGw0J0Jqx14OyDC taLHHpelcSdgtOjsA/f/MGkL6g6NLkkUnzSBnqohGAt9PNez6Vx2U7k8DrWA+qAVQX ANQ6wAddAXkuvNdGIfgiv6jPEnj8RBQqwNhJWNWY= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 63B5D615E1 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 5/5] dmaengine: qca: bam_dma: implement command descriptor Date: Thu, 15 Dec 2016 15:25:55 +0530 Message-Id: <1481795755-15302-6-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> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP QCA BAM also support command descriptor which allows the SW to create descriptors of type command which does not generate any data transmissions but configures registers in the peripheral. In command descriptor the 32bit address point to the start of the command block which holds the command elements and the 16bit size define the size of the command block. Each Command Element is structured by 4 words: Write command: address + cmd register data register mask reserved Read command: address + cmd read data result address, reserved reserved Signed-off-by: Abhishek Sahu --- include/linux/dma/qcom_bam_dma.h | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/include/linux/dma/qcom_bam_dma.h b/include/linux/dma/qcom_bam_dma.h index 46344cf..7e317d7 100644 --- a/include/linux/dma/qcom_bam_dma.h +++ b/include/linux/dma/qcom_bam_dma.h @@ -23,6 +23,7 @@ #define DESC_FLAG_EOT BIT(14) #define DESC_FLAG_EOB BIT(13) #define DESC_FLAG_NWD BIT(12) +#define DESC_FLAG_CMD BIT(11) /* * QCOM BAM DMA SGL struct @@ -49,6 +50,34 @@ struct qcom_bam_custom_data { }; /* + * This data type corresponds to the native Command Element + * supported by BAM DMA Engine. + * + * @addr - register address. + * @command - command type. + * @data - for write command: content to be written into peripheral register. + * for read command: dest addr to write peripheral register value to. + * @mask - register mask. + * @reserved - for future usage. + * + */ +struct bam_cmd_element { + __le32 addr:24; + __le32 command:8; + __le32 data; + __le32 mask; + __le32 reserved; +}; + +/* + * This enum indicates the command type in a command element + */ +enum bam_command_type { + BAM_WRITE_COMMAND = 0, + BAM_READ_COMMAND, +}; + +/* * qcom_bam_sg_init_table - Init QCOM BAM SGL * @bam_sgl: bam sgl * @nents: number of entries in bam sgl @@ -113,4 +142,21 @@ static inline int qcom_bam_map_sg(struct device *dev, return ret; } + +/* + * qcom_prep_bam_ce - Wrapper function to prepare a single BAM command element + * with the data that is passed to this function. + * @bam_ce: bam command element + * @addr: target address + * @command: command in bam_command_type + * @data: actual data for write and dest addr for read + */ +static inline void qcom_prep_bam_ce(struct bam_cmd_element *bam_ce, + uint32_t addr, uint32_t command, uint32_t data) +{ + bam_ce->addr = cpu_to_le32(addr); + bam_ce->command = cpu_to_le32(command); + bam_ce->data = cpu_to_le32(data); + bam_ce->mask = 0xFFFFFFFF; +} #endif