From patchwork Fri Apr 26 08:06:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10918785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B144D1515 for ; Fri, 26 Apr 2019 08:06:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2D8428AB0 for ; Fri, 26 Apr 2019 08:06:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 966CB28AE3; Fri, 26 Apr 2019 08:06:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 392A328AB0 for ; Fri, 26 Apr 2019 08:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726069AbfDZIGO (ORCPT ); Fri, 26 Apr 2019 04:06:14 -0400 Received: from mail-eopbgr50051.outbound.protection.outlook.com ([40.107.5.51]:17411 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725995AbfDZIGN (ORCPT ); Fri, 26 Apr 2019 04:06:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4UjQhbbFy/T++EXKpz6DWKpF/v1EFMO+s48zlvDjTsc=; b=IUvDw4ySXU0bkSiuUUTVpHTRHCInGW//fCCH3dV6DDh8crQ50NnpWzT6za8/EI8cKnNVQrVOFmxBJFZocdud9bvFpoPfZ1A2OzGxO/y19JOqbxHfeMuYxwnbA4YqQyHY/vCtSdNI7YDBiYwVwaHPa9k/RmcyUceJOgYm+4hOc/o= Received: from VI1PR04MB4543.eurprd04.prod.outlook.com (20.177.55.90) by VI1PR04MB6109.eurprd04.prod.outlook.com (20.179.26.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.13; Fri, 26 Apr 2019 08:06:09 +0000 Received: from VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::5d07:911b:18e1:1525]) by VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::5d07:911b:18e1:1525%4]) with mapi id 15.20.1835.010; Fri, 26 Apr 2019 08:06:09 +0000 From: Robin Gong To: "broonie@kernel.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "u.kleine-koenig@pengutronix.de" , "plyatov@gmail.com" , "dan.j.williams@intel.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" CC: dl-linux-imx , "linux-spi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "dmaengine@vger.kernel.org" , "devicetree@vger.kernel.org" , "kernel@pengutronix.de" Subject: [PATCH v2 11/15] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm Thread-Topic: [PATCH v2 11/15] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm Thread-Index: AQHU/AboNnaR79Yf70iMJSIYBzTGoQ== Date: Fri, 26 Apr 2019 08:06:09 +0000 Message-ID: <1556265512-9130-12-git-send-email-yibin.gong@nxp.com> References: <1556265512-9130-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1556265512-9130-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR01CA0024.apcprd01.prod.exchangelabs.com (2603:1096:203:92::36) To VI1PR04MB4543.eurprd04.prod.outlook.com (2603:10a6:803:6d::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 19d6d4ab-c627-4869-13bc-08d6ca1e0a79 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB6109; x-ms-traffictypediagnostic: VI1PR04MB6109: x-microsoft-antispam-prvs: x-forefront-prvs: 001968DD50 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(396003)(346002)(366004)(376002)(39860400002)(189003)(199004)(68736007)(478600001)(110136005)(99286004)(186003)(53936002)(102836004)(76176011)(25786009)(386003)(6506007)(2501003)(4326008)(52116002)(446003)(11346002)(6512007)(97736004)(26005)(486006)(316002)(2616005)(476003)(7736002)(54906003)(71190400001)(305945005)(71200400001)(14444005)(256004)(14454004)(2906002)(7416002)(8676002)(81156014)(81166006)(36756003)(6486002)(8936002)(50226002)(66946007)(66476007)(66556008)(64756008)(66066001)(66446008)(2201001)(6436002)(86362001)(6116002)(5660300002)(3846002)(73956011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB6109;H:VI1PR04MB4543.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: t24skTUxrKZgve0BU5RhAFR+URKY/E5DD3gndNiQxHfDl+bmF1BP/Ge0yrgFBoWzhiG04sZib5zikzxEQnHU4FPpCgd98p8Hzr5cCISWPuWrS9j+khXj/TH4WBa/6cXtlSLARvt1hS5BlNGR4+g0oud+B0aHE9DzyaxaRwQyc47Fr5EMciufAeWE+hrNGjmgN5uEI5z00vsNo01qZDVUTZlCyfsEY+OPSWXgkoMYG9sHd1BgUv9/WGEYGsREVfqeeAYjz5rmUnBjj4CFUOfABrgaQKZ5ry7Ji1huo+5eWzRPnPdlJKM3BARyMCCnpeOTIFc10KnGI5Hzg9SveQIkAq98sWZ/g98rohjGaYo99cgsn0FeoQec4heESXTSuW1hkMSoPVXqRfd4Gc52DiI1SCW7//OsNdPIyZLDyb2hn6s= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19d6d4ab-c627-4869-13bc-08d6ca1e0a79 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2019 08:06:09.6783 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6109 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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, checking event_id1 is enough for DEV_2_DEV case because it's so lucky that event_id1 never be 0. Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 3e912b6..4b2b7ca 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1371,8 +1371,8 @@ 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); + sdma_event_disable(sdmac, sdmac->event_id0); + if (sdmac->event_id1) sdma_event_disable(sdmac, sdmac->event_id1); @@ -1671,11 +1671,9 @@ 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->event_id1 >= sdmac->sdma->drvdata->num_events)