Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1983779yba; Sun, 5 May 2019 19:30:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBc0XJ1Q6Sw56x3YQZwva88O8kc7vWnkQNCQjcWyfzzVybAPtAdt6wUYGUSwqABwFUVEak X-Received: by 2002:a62:b418:: with SMTP id h24mr29790836pfn.145.1557109839404; Sun, 05 May 2019 19:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557109839; cv=none; d=google.com; s=arc-20160816; b=b3eceEpa7Poqr9qEyAhEdLBBkfWcY/tFrYoWpgVQauVlF6QWahN9oqB32yPTpKH5sh juXzKIZbJzCgAFi3PZvfF7MINUHgFINpI4nRD+DH/7lUnI3rSQ4Z6a0Kp9JFqX7e2AmS eRoa86t3XAx85XQ5fh3IkVorN6EFNu1j1QK4ijZ2tsPjdkKiF3FQoh1zBkG6pjLR01gd gVlGvVb1QPVX40kJsz72Dx9zyKtNXWCCoqdmFKY/shtdGFa5//EF9zTmmbbdLHm/4bEo bp3EbJ4wMkwY8udZdCkc3urfYBdV8jTdjIUO5UwW5OlYJgi0ZaTKYONN+N7NOgajW1/u TMxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=+2FmupkyKwgZqvjNXfK9Cm2QIK2IOZ+YkNObrSg0lgY=; b=UrWPFlhWXLdu0REXXqZHTdO8JWl8/mTYXOHFMO/oG53uotOeyOP65Qgub2BD6DFL7z POmyBi/suwP0TrF3y2OIYSJvr//q/csgBBSOBtzYCOROAODKU4eh3xC7l+AKVWpHgFtQ Oc5D4hlpHuMU9QISLZKjqQtbR5oyewikxSWSvGD0sRtGSZhP/swayR67e2laS3fgEUDA DAUiiU4sUzCAm1H4stx1/U1L2PMNLo6BnMHXWaI+2US30tPXzLq1R4M9A5rLYZx3He0N RpLGl2MVfrpngZAnInYDbc5vwABpmE/mNgbpa5Mkt7kw2x8pcpeg+44DIrwdIzeaFfKJ bFFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k91si14185076pld.36.2019.05.05.19.30.24; Sun, 05 May 2019 19:30:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725865AbfEFC26 (ORCPT + 99 others); Sun, 5 May 2019 22:28:58 -0400 Received: from inva021.nxp.com ([92.121.34.21]:56748 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbfEFC26 (ORCPT ); Sun, 5 May 2019 22:28:58 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E7870200100; Mon, 6 May 2019 04:28:55 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D1CB92001A2; Mon, 6 May 2019 04:28:52 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id A9B25402A6; Mon, 6 May 2019 10:28:48 +0800 (SGT) From: Peng Ma To: vkoul@kernel.org, dan.j.williams@intel.com, leoyang.li@nxp.com Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Ma Subject: [V2 1/2] dmaengine: fsl-qdma: fixed the source/destination descriptor format Date: Mon, 6 May 2019 10:21:10 +0800 Message-Id: <20190506022111.31751-1-peng.ma@nxp.com> X-Mailer: git-send-email 2.14.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CMD of Source/Destination descriptor format should be lower of struct fsl_qdma_engine number data address. Signed-off-by: Peng Ma --- changed for V2: - Fix descriptor spelling drivers/dma/fsl-qdma.c | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index aa1d0ae..2e8b46b 100644 --- a/drivers/dma/fsl-qdma.c +++ b/drivers/dma/fsl-qdma.c @@ -113,6 +113,7 @@ /* Field definition for Descriptor offset */ #define QDMA_CCDF_STATUS 20 #define QDMA_CCDF_OFFSET 20 +#define QDMA_SDDF_CMD(x) (((u64)(x)) << 32) /* Field definition for safe loop count*/ #define FSL_QDMA_HALT_COUNT 1500 @@ -214,6 +215,12 @@ struct fsl_qdma_engine { }; +static inline void +qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val) +{ + sddf->data = QDMA_SDDF_CMD(val); +} + static inline u64 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf) { @@ -341,6 +348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan) static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, dma_addr_t dst, dma_addr_t src, u32 len) { + u32 cmd; struct fsl_qdma_format *sdf, *ddf; struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest; @@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, memset(fsl_comp->virt_addr, 0, FSL_QDMA_COMMAND_BUFFER_SIZE); memset(fsl_comp->desc_virt_addr, 0, FSL_QDMA_DESCRIPTOR_BUFFER_SIZE); + /* Head Command Descriptor(Frame Descriptor) */ qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf)); @@ -369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, /* This entry is the last entry. */ qdma_csgf_set_f(csgf_dest, len); /* Descriptor Buffer */ - sdf->data = - cpu_to_le64(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); - ddf->data = - cpu_to_le64(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); - ddf->data |= - cpu_to_le64(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); + cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << + FSL_QDMA_CMD_RWTTYPE_OFFSET); + qdma_sddf_set_cmd(sdf, cmd); + + cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << + FSL_QDMA_CMD_RWTTYPE_OFFSET); + cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); + qdma_sddf_set_cmd(ddf, cmd); } /* -- 1.7.1