Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2947412ybi; Mon, 10 Jun 2019 01:18:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTGhvZ78LjMDd8ynKbrzRy52qqmQq78Jdfxt/vKUEfn/3XejxvW6Jjw6rTe992ylhBG7QF X-Received: by 2002:aa7:83d0:: with SMTP id j16mr55603717pfn.208.1560154708121; Mon, 10 Jun 2019 01:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560154708; cv=none; d=google.com; s=arc-20160816; b=qMox3KNE5H2r/f3EopLGcUuDlfkOfLawfz0+AcUwx70U1JtiE8Km7StR1gZO1aBDfY P2EfQ+a8TKpDWzMQnTYqWiEHQvpGs2DSxUetxnzIU8EoTup8cy5vL1I2SUHfqUM/VBF6 9Md0MLkdZALNTg8ivIId8n09C3/5pcTLL2aBn2Mt6JjrhwUftuAlJTdcu/1hHdWJOoOf UV65SFCNNuX9Jpb4x3SFwBoG0VRx8e3Id/mBgqIcid1KZtSfqm4BLflHjDG/73yW6Pj0 HtuTRLrpQ/CSRECHh6o/6P7JCLL7ecRLcL92TfNSW+aOpIw7heIJYxsR5jvDFCRTw9lg 5PRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=kT5idkaH1ma85t/Q10D4aUKb6oXMofGuu2miSh4XvRY=; b=m/x04Ez6O8rStLDTb08aud7/vt0a4XYhpPXRKP+jFqqEx2udmVrbwG0quO+8TJ7HaO 2OOyNQreSthuZEoMsctASvIjWr/JyWac7Aj+Pb5f25zWyVRr01rw/Ar83q9k4qwGph3l shvRSz6ljFJZQx/zauxy3PnJb4LkqY+ETeh1gp6TcjN5dgKGq3k5qEH1CVCspnVU2dEB RsFqlXV0e2q734liIxYRnXjHBnsMODj5iMfvRHx5Jd84EddSEEL+3zhdodvjU9oYsLzO N/Nsc8Wp8qPQ+gNXCOsNJ3VqM4ytDva+MmYiQFEzkNSZGSSaz5qo5+jMAX556OBoSZ3W aW8Q== 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 x9si9244581pgq.125.2019.06.10.01.18.13; Mon, 10 Jun 2019 01:18:28 -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 S2388508AbfFJIQl (ORCPT + 99 others); Mon, 10 Jun 2019 04:16:41 -0400 Received: from inva021.nxp.com ([92.121.34.21]:37768 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388480AbfFJIQk (ORCPT ); Mon, 10 Jun 2019 04:16:40 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id AFB9A200737; Mon, 10 Jun 2019 10:16:38 +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 ADBB7200733; Mon, 10 Jun 2019 10:16:30 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 174EC402FB; Mon, 10 Jun 2019 16:16:21 +0800 (SGT) From: yibin.gong@nxp.com To: robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, broonie@kernel.org, festevam@gmail.com, vkoul@kernel.org, dan.j.williams@intel.com, u.kleine-koenig@pengutronix.de, catalin.marinas@arm.com, l.stach@pengutronix.de, will.deacon@arm.com Cc: linux-spi@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 11/15] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm Date: Mon, 10 Jun 2019 16:17:49 +0800 Message-Id: <20190610081753.11422-12-yibin.gong@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610081753.11422-1-yibin.gong@nxp.com> References: <20190610081753.11422-1-yibin.gong@nxp.com> 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 From: Robin Gong Because the number of ecspi1 rx event on i.mx8mm is 0, the condition check ignore such special case without dma channel enabled, which caused ecspi1 rx works failed. Actually, no need to check event_id0/event_id1 and replace checking 'event_id1' with 'DMA_DEV_TO_DEV', so that configure event_id1 only in case DEV_TO_DEV. Signed-off-by: Robin Gong Acked-by: Vinod Koul --- drivers/dma/imx-sdma.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 525ca89..f7c150d 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1202,7 +1202,7 @@ static int sdma_config_channel(struct dma_chan *chan) if ((sdmac->peripheral_type != IMX_DMATYPE_MEMORY) && (sdmac->peripheral_type != IMX_DMATYPE_DSP)) { /* Handle multiple event channels differently */ - if (sdmac->event_id1) { + if (sdmac->direction == DMA_DEV_TO_DEV) { if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP || sdmac->peripheral_type == IMX_DMATYPE_ASRC) sdma_set_watermarklevel_for_p2p(sdmac); @@ -1370,9 +1370,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan) sdma_channel_synchronize(chan); - if (sdmac->event_id0) - sdma_event_disable(sdmac, sdmac->event_id0); - if (sdmac->event_id1) + sdma_event_disable(sdmac, sdmac->event_id0); + + if (sdmac->direction == DMA_DEV_TO_DEV) sdma_event_disable(sdmac, sdmac->event_id1); sdmac->event_id0 = 0; @@ -1670,13 +1670,11 @@ static int sdma_config(struct dma_chan *chan, memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg)); /* Set ENBLn earlier to make sure dma request triggered after that */ - if (sdmac->event_id0) { - if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events) - return -EINVAL; - sdma_event_enable(sdmac, sdmac->event_id0); - } + if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events) + return -EINVAL; + sdma_event_enable(sdmac, sdmac->event_id0); - if (sdmac->event_id1) { + if (sdmac->direction == DMA_DEV_TO_DEV) { if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events) return -EINVAL; sdma_event_enable(sdmac, sdmac->event_id1); -- 2.7.4