From patchwork Fri May 26 14:36:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 99517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp529127vqr; Fri, 26 May 2023 07:44:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7FK+6/5qJ8zuDloYG/uXmNx9ym2iYAl1QKL9hDgYLtMZBbwMXarco14Tdv9Dl/YQMrNveS X-Received: by 2002:a05:6a00:c85:b0:64d:2487:5b20 with SMTP id a5-20020a056a000c8500b0064d24875b20mr4168771pfv.9.1685112254454; Fri, 26 May 2023 07:44:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685112254; cv=pass; d=google.com; s=arc-20160816; b=y7mr4/OlWYjJKCHfwnlO9MGGFtgV3sH9iEbm4QJpQlYQPWVdTUNP/arGCOkW0k75MI q/C/ApWz8uS+BzK0ie7qoqudDsN5q+IlVuJczibERmQ6z+6Bhx67qMphcGqE8VHxCXfM eF2KzM92h3kR+kNZcUA5AyOrp13/bGta1/8Vsj0qyHfBi57xmw8N2z46Ehp/rWoErZFX YB07409JEU8ud1kwynABfiFlSMKv1wYvJ076ZmK3lxeOqo3TwDn9xSwZSS4Jxp12moC9 PdCOpPYcRuZp6l+vAzafREFpWvYZwgejBC2YeRLWGhTY/CfMi12roh5vJNn7hmoB0B8k S/FA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=msrt5RHHs6IHX/f7JbgffOTIryNu0J13mXMJS9oOE4A=; b=oBtYtJPNRxd+o8VulAbVWo2xVOvV2C1M1MZewvsLxFLQO6iIt1ai1HRqc507DKqGEb zeW8D9oyuUQOU1KBFacGyFXQXSpNdLC8H4R1OeSffZ+ZIEaWmIdPLCX/dl1wKE97pJVl AplbSJJzMbyHMEmOOA0jr/1ElX8swobqygbGu1taBVYlYMCW5/TtiUEoWr/LJ1zjOv63 wGXMAGLYJmVIPBEAwPsbkv1D7nHMrZZS0qCmvpYtN6qknBm6UQlVnyRZGuOeNySyU1Pt jwJXbEJXvnvKwaTm3csqK5f0Lw8BmgtVf5oyYisANC3DEMebvEuYitf4KG6TvMb+yC2m P2gg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lvBsHsAT; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020aa7990a000000b0063f1cb928bdsi4012745pff.313.2023.05.26.07.44.00; Fri, 26 May 2023 07:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lvBsHsAT; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243954AbjEZOjA (ORCPT + 99 others); Fri, 26 May 2023 10:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243923AbjEZOiy (ORCPT ); Fri, 26 May 2023 10:38:54 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2044.outbound.protection.outlook.com [40.107.104.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62ED710C4; Fri, 26 May 2023 07:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GbWOkhxjYa05hLMBXB4Kbq6RzNZft/uCAquvn6idVvDu+PuFITHqcXnJ6IAJmFQmwV1kR2nnb3oPTN38vcZfe9V3fM3dUZH+4jhykHSnTmNKWSrAzt+vDq9PWLXDrXD2NbHNfNUxnQ1j/FZ/WNR9va9gF2fcibK0h4HukkpnOMO7kA1F+LVbdsojfCytcL2//PrHHWVYVIl7nd2VGpmmPXaCH3zYiga61dq8r9W2iSzZQz3hGc8WeRJ9MHb/qtQ2T+KlOJFqAzuCwkhf7KAM5/MRzKcDY5VY6YmKHBrz4QUA5RzThFWaz56uKZmSX004bX0VKVzM9bkGE+jhzHhuSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=msrt5RHHs6IHX/f7JbgffOTIryNu0J13mXMJS9oOE4A=; b=PTTtXrwBvpTiL19ZdOCuc4IYxMTwB9W0vsno6slW5Wzr9VxITBX7RqcymibmfYymBrnmfhb4UB8cO2BN5JwpI89lCRXi5hS002K/n7bcMaAfnAOAUlM5+KQx1Z92+qI82Q7qY8FaSCr/52QAt9HQLLH52602ANmxxSwa83NY2vHVgUznUIy8mGvJ5d75QEJToM2GRtfTbnhl5j2iADnCeHF9/mROxs3jv0LdBYCrJfvNa7d43pblP+IcGYaHZFrUsE2st20werzI3pNmduDRkomLOaXFI/yDRrJmI5gEJ1V1zCBv4yYgHNwLh4O5msvR0fDWcWwbyqqQrDSg2+Az8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=msrt5RHHs6IHX/f7JbgffOTIryNu0J13mXMJS9oOE4A=; b=lvBsHsATzLkT+TyaoNPqjmbdvlvDzAQBEp5bKCmeMKPCh55gtpMAe6PdZE5ESyGNlvKSDWh8UDQi9hk2MAKqbtSDVaAIVDvaV0ELgA6vvgfqDPE221C0QWwbjJKtsLZhSDMykW1Gxd1Tk4fxzS4kyt/c1rJ1PXlqud9P/I8K+6c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS8PR04MB8070.eurprd04.prod.outlook.com (2603:10a6:20b:3f2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.18; Fri, 26 May 2023 14:37:11 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884%4]) with mapi id 15.20.6411.028; Fri, 26 May 2023 14:37:11 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v1 05/12] dmaengine: fsl-edma: move common IRQ handler to common.c Date: Fri, 26 May 2023 10:36:32 -0400 Message-Id: <20230526143639.1037099-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230526143639.1037099-1-Frank.Li@nxp.com> References: <20230526143639.1037099-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0212.namprd13.prod.outlook.com (2603:10b6:a03:2c1::7) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8070:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cbe387d-67fb-4c02-16f3-08db5df6b0db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y4qY9lHNgRfPCcD3PXcIKTg2zYCTySwqEjgYZbAp3OPUPTIE6UY+hZNcgnMHD+ZxsdjXYf5MfStkucxMNgeWqZCWaFc+yKV82DWJsMHBQuxPJrSJSRsEMeG7zCgGyFLaGMPKW1opn4Nb8foNNd1/CCMKB7RI6dyibLg7TxyalGUQg1naJA8P48vN6Nw9Y5EVko8nIhkf0Hrql4bvvdaRUbxt+6SCQczU0fJxk8S3dPfL9PCZBDpqWpi0sscJyuUIlNrYANmBDidBE/ONq6vtJ3+ei7sXwb+Iz05I5+IQV3yM6rvUDSFhk4EMBeLir2BXpXrR30w7g3n6orEpFza3EoLSP3e04pHuLbYgyVCI27goA+whx/H5wTKIwSBlU2gXfS8fJRzKE8tXfj/H5xaKo/tJYd1/qriYJKqIjXvDX1WVu+IHWLbAmjCBqylcv5oXnKQnmR3Cscs+0dUv0BDnrRPGp9yCB9eweQTMy085fc6qym/ye5QqRbLgKf6h157hOp0B7qq16zotYkHzlBzS+2CXmZNTfRBgPN3a4FrPCdhBi9BYO7OVhRlgxmpqHihrKsgKqKW6Ks/shGFdUpzSYiiFjACHulsh8ittT1x2e3bSgGIk9l9ZLcqcjZIkkCglRyKV25QzO3nG0J2XyUwpBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(346002)(376002)(366004)(136003)(451199021)(38350700002)(38100700002)(8936002)(8676002)(5660300002)(478600001)(6486002)(316002)(6666004)(52116002)(41300700001)(921005)(66946007)(66556008)(66476007)(36756003)(2616005)(86362001)(186003)(2906002)(83380400001)(6506007)(6512007)(1076003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q+HkumrnFXlk/b8ciXvAACCli/90rfZCtSajkmw79ZzeW14uYPFTMY5121dMum7BpOhML1ybK+6uUpkvXrUZq2IQ2ARVCTf3IMJd+dVEZmFNXDI6D1RyxTKAlqNhoeHD+F2KYNTau6PHr/slN2KM73LbKzalrTmwoHbJ0sIhfuvq0bMY59gwokt9S+qXVH/mg9ViyB4riYbeWigSCVgx/ic6Azvw81RAE1m2eFXpfqoSSI10WI6n+O3uQ24iBcr7GktruuYG5rNorxm8jUI2BNZg8Y8P/tTmoiZb5b08pwlq7TM2fW3gzpb2aD4fZIoTPs6m6Q6jbuyE4uuHFAMSIF2KN3Y+U64El/pV7S6I0i45qsoAgp3FRZ4EZ9+Fu/RJxU2uuD/p2oEZZhen79X9atuINqgWoCQfDtO4isnTTU36suyylLis76oKl+gZDP8ArAyjrHouD/QZlT+ePE4ZaFMzkzQFhRs4wt2sqAszpp1dPeRRNqSA/WSKd+tG14AGukQVEXZ8XcEJ89l1jZui6qGz1puqSHI+BUGL15UFEo5SFd/Wykpn0Bs+8WiXDXiCKtcaz002P54e6do1qP9vJz2LMeTl62S+/oa/S78DVeE4nC9kOPWTwt9gI4RQE3lG2J5PiCTiQV2ZBj/6UgMeNzBGyxIB6nxUMaJrm7thlj5srXw4h7R8DS5xrCx11Nzhkisy9/GDAgPST2qPTddtrgWLH45wlgDn7bKcPvpBqE7ef3sCO0nbW40/I1ShQxj70Ifi7QaRUS6Mlz1Z8nLkaaHN/Ciiv/Nq7fucMylTqV7wm9on8uzZMHdWLuf25zNhmM6UCM3HXnzxmgfmTdUblM8lKfPhbRM33ZFIspSX7FmVqyb8BFLZRsaFkHTA6z6GsczX3Yp9UcEp78TsqgwRW7NLANzFrLvcEiHESqRDriwINYqpIimCYjJpWX/lT/Z96FjjVWni6RAq7q3sXgFsNR+4T6L6+SxPGRcP1x6qfdvIoz74v/G/44nZwMH2iPBHbkZSbHLHgzOpxrJsPIskGhQYeylZOl26ZG3BJzuOBMXv/aTrPT+7hdYgC2B4MsGFPfqnwFJGrkDNgorL/bNsfLihuBvkiolGbbeZuNrJCBhWnwsotujAzQN9XH9kOiHYYQwSTfesXqxxNSKjTdmOJM8Pz2egvdJmS/nW6g3ALKWcGCLHRfIkDIru3kKoggAO625g4xrN1jw9xFgA3MUt9GaV6tSH4ZEF4dyRKnXj3e2RlrnHWmtK3qhPGqdHcqVJtycNgdCCQqOYhnEp4XNGoRslSZsUzSy5+ZvJgafWMFTdbiAvyGjop/8WUaa1BBq+TMdrJNhtzKZWJ9oMiu10SPklME5sYf8RepFTEJz0qDtyWKxSDGrHj52F2D7Bnail3LaOOKg6s7AIKspaaifI5dfe8+CW3mzA7D7+XLungzDgi3ckjrc1kF5k6OSRkfgrl8S37CpNdvjWMBq1CKauaSVEdvVOCy2flOfvW6ytPS+NkFMXlT6ePlQlWX1TLjofrrEvdPdmPX6Lbg80JRtyFrETFHBuaO4c5bxwkKO375zQsINrHZIBYI0zj+4IH6PG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8cbe387d-67fb-4c02-16f3-08db5df6b0db X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2023 14:37:11.5288 (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-CrossTenant-UserPrincipalName: wsfZ+Ds89PTNx6v6eETJUFoEZFeHn0leJeflf0ni5WDou9K3386hqZeicUFMPB7Kn+oW6vK/j1G8JCRXiCdiFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8070 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766968267200193526?= X-GMAIL-MSGID: =?utf-8?q?1766968267200193526?= Move the common part of IRQ handler from fsl-edma-main.c and mcf-edma-main.c to fsl-edma-common.c. This eliminates redundant code, as the both files contains mostly identical code. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 26 ++++++++++++++++++++++++++ drivers/dma/fsl-edma-common.h | 7 +++++++ drivers/dma/fsl-edma-main.c | 30 ++---------------------------- drivers/dma/mcf-edma-main.c | 30 ++---------------------------- 4 files changed, 37 insertions(+), 56 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index e5c7497c1ff3..839471c42758 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -42,6 +42,32 @@ #define EDMA_TCD 0x1000 +void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) +{ + spin_lock(&fsl_chan->vchan.lock); + + if (!fsl_chan->edesc) { + /* terminate_all called before */ + spin_unlock(&fsl_chan->vchan.lock); + return; + } + + if (!fsl_chan->edesc->iscyclic) { + list_del(&fsl_chan->edesc->vdesc.node); + vchan_cookie_complete(&fsl_chan->edesc->vdesc); + fsl_chan->edesc = NULL; + fsl_chan->status = DMA_COMPLETE; + fsl_chan->idle = true; + } else { + vchan_cyclic_callback(&fsl_chan->edesc->vdesc); + } + + if (!fsl_chan->edesc) + fsl_edma_xfer_desc(fsl_chan); + + spin_unlock(&fsl_chan->vchan.lock); +} + static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 2f13e687a721..71e19e20f1cb 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -223,6 +223,13 @@ static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) return container_of(vd, struct fsl_edma_desc, vdesc); } +static inline void fsl_edma_err_chan_handler(struct fsl_edma_chan *fsl_chan) +{ + fsl_chan->status = DMA_ERROR; + fsl_chan->idle = true; +} + +void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan); void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan); void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, unsigned int slot, bool enable); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 31531b8bde78..9c0b6fb4cb8f 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -33,7 +33,6 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) struct fsl_edma_engine *fsl_edma = dev_id; unsigned int intr, ch; struct edma_regs *regs = &fsl_edma->regs; - struct fsl_edma_chan *fsl_chan; intr = edma_readl(fsl_edma, regs->intl); if (!intr) @@ -42,31 +41,7 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) for (ch = 0; ch < fsl_edma->n_chans; ch++) { if (intr & (0x1 << ch)) { edma_writeb(fsl_edma, EDMA_CINT_CINT(ch), regs->cint); - - fsl_chan = &fsl_edma->chans[ch]; - - spin_lock(&fsl_chan->vchan.lock); - - if (!fsl_chan->edesc) { - /* terminate_all called before */ - spin_unlock(&fsl_chan->vchan.lock); - continue; - } - - if (!fsl_chan->edesc->iscyclic) { - list_del(&fsl_chan->edesc->vdesc.node); - vchan_cookie_complete(&fsl_chan->edesc->vdesc); - fsl_chan->edesc = NULL; - fsl_chan->status = DMA_COMPLETE; - fsl_chan->idle = true; - } else { - vchan_cyclic_callback(&fsl_chan->edesc->vdesc); - } - - if (!fsl_chan->edesc) - fsl_edma_xfer_desc(fsl_chan); - - spin_unlock(&fsl_chan->vchan.lock); + fsl_edma_tx_chan_handler(&fsl_edma->chans[ch]); } } return IRQ_HANDLED; @@ -86,8 +61,7 @@ static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id) if (err & (0x1 << ch)) { fsl_edma_disable_request(&fsl_edma->chans[ch]); edma_writeb(fsl_edma, EDMA_CERR_CERR(ch), regs->cerr); - fsl_edma->chans[ch].status = DMA_ERROR; - fsl_edma->chans[ch].idle = true; + fsl_edma_err_chan_handler(&fsl_edma->chans[ch]); } } return IRQ_HANDLED; diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index ebd8733f72ad..af1b0e8a3021 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -19,7 +19,6 @@ static irqreturn_t mcf_edma_tx_handler(int irq, void *dev_id) struct fsl_edma_engine *mcf_edma = dev_id; struct edma_regs *regs = &mcf_edma->regs; unsigned int ch; - struct fsl_edma_chan *mcf_chan; u64 intmap; intmap = ioread32(regs->inth); @@ -31,31 +30,7 @@ static irqreturn_t mcf_edma_tx_handler(int irq, void *dev_id) for (ch = 0; ch < mcf_edma->n_chans; ch++) { if (intmap & BIT(ch)) { iowrite8(EDMA_MASK_CH(ch), regs->cint); - - mcf_chan = &mcf_edma->chans[ch]; - - spin_lock(&mcf_chan->vchan.lock); - - if (!mcf_chan->edesc) { - /* terminate_all called before */ - spin_unlock(&mcf_chan->vchan.lock); - continue; - } - - if (!mcf_chan->edesc->iscyclic) { - list_del(&mcf_chan->edesc->vdesc.node); - vchan_cookie_complete(&mcf_chan->edesc->vdesc); - mcf_chan->edesc = NULL; - mcf_chan->status = DMA_COMPLETE; - mcf_chan->idle = true; - } else { - vchan_cyclic_callback(&mcf_chan->edesc->vdesc); - } - - if (!mcf_chan->edesc) - fsl_edma_xfer_desc(mcf_chan); - - spin_unlock(&mcf_chan->vchan.lock); + fsl_edma_tx_chan_handler(&mcf_edma->chans[ch]); } } @@ -76,8 +51,7 @@ static irqreturn_t mcf_edma_err_handler(int irq, void *dev_id) if (err & BIT(ch)) { fsl_edma_disable_request(&mcf_edma->chans[ch]); iowrite8(EDMA_CERR_CERR(ch), regs->cerr); - mcf_edma->chans[ch].status = DMA_ERROR; - mcf_edma->chans[ch].idle = true; + fsl_edma_err_chan_handler(&mcf_edma->chans[ch]); } }