Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2062917yba; Fri, 19 Apr 2019 11:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoIMhe+FvWqW8y0d2ilSjsRmWIPBpFkhQNKEfY4yE62y/nQCmjFVj59Ry92gpMnUhfR55m X-Received: by 2002:a17:902:d24:: with SMTP id 33mr5267758plu.246.1555698131022; Fri, 19 Apr 2019 11:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555698131; cv=none; d=google.com; s=arc-20160816; b=M03mHY8iwuF87sozgal83v+0XM6ox4mynMUpXeiEHeW66tAoGbVjwROidqJ+zZltlO HoUL3EgG23IH3Di7rRREW0deOF7FEaFavriXKkQNllf8QZctlcxUAnzNR83K9Yg9k7KW /+7QxE8DhkAPdW1HvL337kf/JsyjO755tuwWYNjEj/Pvz56vOiOKbUEC0AI9LnaWSFqH 0IxhwctPYY/X9rjGPpE7x/8rZATynEmot0JlszDb9HNznflE2dJOdJm+oEf1dp+8KR2W gF9ltuecAtoEPk9aO6tht0RAqSC01AoBxf2/9eqBmSb/8tM2FTVM6QdrOdqtGKz8aYZd SOlA== 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=3Cs5yqSYY6qOxw9Ei27oL7yLv9h9qTlqGWmulbzDBuE=; b=arwqv2rDTtrIUbeyXi/EaYz/FFi9eTRNkXYy4fsm6XgcykpFsmEIaj6Okd9vtHYiSI iEentymm5YRqR4IxQJ1J4aNq6NANEFwjVarKhnGHZaiAikrey4JmRIQRhuwu1i12j8cO jFT3ig9OxZJtRPeMU2WjCXah8sEGcGzcpzxk5UEiPER6HvLpSz0KZqZEzuhaNkcQls74 t2ti87Qi40HHEntInB0HSEUp0Q9h6M7U83DVseAef1bAc9F0/RiJo3sdjXEInr5BjVWC xKcQuHU9oflzBv9lFLnvQcJCQhcTid5UOBj7yhQq0WHkmRXuViUGVuE+BPkMldz6y39t 2hYQ== 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 z4si5612741plk.385.2019.04.19.11.21.55; Fri, 19 Apr 2019 11:22:11 -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 S1727445AbfDSSVG (ORCPT + 99 others); Fri, 19 Apr 2019 14:21:06 -0400 Received: from inva021.nxp.com ([92.121.34.21]:58650 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727371AbfDSSVF (ORCPT ); Fri, 19 Apr 2019 14:21:05 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id ED4D0200176; Fri, 19 Apr 2019 10:53:32 +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 C3C572000D0; Fri, 19 Apr 2019 10:53:29 +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 857E9402BB; Fri, 19 Apr 2019 16:53:25 +0800 (SGT) From: Peng Ma To: dan.j.williams@intel.com, vkoul@kernel.org Cc: leoyang.li@nxp.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Ma Subject: [PATCH] dmaengine: fsl-qdma: fixed the source/destination descriptior format Date: Fri, 19 Apr 2019 08:46:29 +0000 Message-Id: <20190419084629.41742-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 descriptior format should be lower of struct fsl_qdma_engine number data address. Signed-off-by: Peng Ma --- drivers/dma/fsl-qdma.c | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index aa1d0ae..542765a 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); } /* @@ -701,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id) intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR); - if (intr) { + if (intr) dev_err(fsl_qdma->dma_dev.dev, "DMA transaction error!\n"); - return IRQ_NONE; - } qdma_writel(fsl_qdma, FSL_QDMA_DEDR_CLEAR, status + FSL_QDMA_DEDR); return IRQ_HANDLED; -- 1.7.1