From patchwork Fri Jul 7 19:00:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73D2BC001B0 for ; Fri, 7 Jul 2023 19:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbjGGTA4 (ORCPT ); Fri, 7 Jul 2023 15:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbjGGTAz (ORCPT ); Fri, 7 Jul 2023 15:00:55 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33C9210C; Fri, 7 Jul 2023 12:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZjFuMq4MvSVxs3chFgd7uRLQgH//imWaoq5x4S4X6/yU3KaKKsCva0HEgVAC2g3HYTGDiIiNecHGRht9IDHpBbObvg9ph2qSzO+cD4Xu84HPSpTqF1TDuJ+87NpnZCeNNy3pdK5Ks5ni1DMrFNhgfGE0zbHtWu6AiLjjaEvtG5KUlnmg/kiBZh0KXHIfUPjB5xUDUmjaN2jYKgGrpqNmrzBETbJJq8AxUy1L6zuAIekDg1HC8QfIZKioD4XJ99qeLQjojx280SnCGleDaVOwY6ke8/6/7ETbXqM6we5AXh/50o71eEYQF+y4J/9hTmiTHbdXIjaRosvPQYKWLwk4gA== 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=5ZOgPE2Dl4YD1w4FCyI7Ni+HFXQQPkwbBweq93zVzcw=; b=c59uVkVSRbwDHR5mSi22Tdrs75XOtRc3D5S/0U10KzRoM6J+JsL3qvDjDl1SoPRiZPGdxA7jeyCcPJWqonIXnANKojHResTJi7zIaRE0nNLyT2RYjrcFcSkKhvTtdha8jGdOKzjtf0D3GlxQXPG28eH8d3r0mqLhNlH0BeDjaMMcmAOQ1qGMU7yEv0EGBo3fAuV3Q/p01AoQObymFKwG2W+GfUxOikMF36ytstAWnnJCq1s2bBDJRmQ+PSRw0ODaarZEnlhg4R9MFoxyGBLhTWC+4E2a/T3H9IiA8X9ontsWhluXv4tKGfYu0bRLV5g0eSQNoiOLv8rR9kRyZbYnPw== 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=5ZOgPE2Dl4YD1w4FCyI7Ni+HFXQQPkwbBweq93zVzcw=; b=XqSRHnUMI1Bg74IFrcalpIlH8OhfRHbGgNczzzkK5qsarQDBHgYrcQJ0eKZfFlnYhjlLPAgBwJqMweOi9iT5wiNijusUQp3urahQbLjVSbAifamgtAauscHHBgcb26l6uWMHpOelOeTT0GiZq0i01kwy6KIlwvyNsC0w5lg1xYc= 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 AS8PR04MB8103.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Fri, 7 Jul 2023 19:00:51 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:00:50 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 01/12] dmaengine: fsl-edma: fix build error when arch is s390 Date: Fri, 7 Jul 2023 15:00:18 -0400 Message-Id: <20230707190029.476005-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 40b614a0-fafc-42cc-1509-08db7f1c7b30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DCRcqOBmxeVC6c3zzI3/uGapveYxcWyhNOZihSQDHnKMACnskVG5v63BA9hH3ULo7zO0dGD775buGTpuMXPLGYIFO0fN1Xpbops0as5bSC/DLg/v1uXwjpb3T2ZkAONLtwFNyYRjsHi6t868ePMEvmh/6b4ibI7GsCAYqvaP7uDRcgpOgWSrjAR6F0WiF9Riuma0pP9/KVeafKTF6vKZa7b0pMu5DBI+IhwKV3FNkUYFgDKkuLwBwnh/CuJTsqsoSKo6N1hWpYspKNQT6dpbnK8rIIkbuUe17ZzXzFAzbmrqRLYa0rgOm/tHC+QW+llQYrPh8pFEcxTBh9VWvcTdeLm0b8ACJBR6M2JZXgLc4Mc+5BboyRKnbO/s40DA4ZKBUmsqy6FYPMdoQS1alNnVe8PkMBp43fZV2Qy8WrPpUe/JMgGEwRQxVP9cZWAb8yW55LkR4NyzPwZIp2NIgPyWou8dLHdzuboFEaleREb1W02HN3rJiKYdSFKrwawQZI11zaUTSwDx1XdR4DAVKVo+jsyYtacLS7MicgWYgjn3Z1VqxNXD8dIS7AwUnhKtEpYGC7GHQYKsrPb6zDfH3ZeyLH1Y/eF+b5dVk2RVRzG2HO0= 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)(346002)(396003)(366004)(39860400002)(376002)(136003)(451199021)(478600001)(52116002)(6486002)(6666004)(6506007)(1076003)(26005)(6512007)(966005)(4744005)(2906002)(186003)(41300700001)(316002)(4326008)(66946007)(8936002)(8676002)(5660300002)(38100700002)(38350700002)(66556008)(66476007)(86362001)(36756003)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1ieNa3hD0vigCy4rf3QZbSC38DQmG3YhYMwUw8uL6qiU9A5imvQUcV1LjrKdq2kl8T8V5KcmV2b3KxIfhJrgyUevbyvPXzWXAF9hj9XqCAEz/FOlxhzoiNpqBWxuQu+e/I4Iuh1kjDU2nupTvlHdAIedAXF9UhztB69aTJIKKrNGuspB11HvFQoHkTYGDRpFVaGKBlsB6uKjRIYEV02JAzVf2VWU4A5oO+g0h/NBaCgypM5TCb7VYaKMhexEAO21S72uro10RKD6ETUVQuhrvSirxLUK9uGYxJ8kdn11t9jGcADklIfCuSlFqlrZgtcGsoBwGJu8G6trEpOjcAY32brSOlUx6q+PzX9i1n7YDAUYnX2ObbgUqydUsopsEOgyPB/KlpVsoKoWQddoRY7z3mIgTDwt+qYlJmkakIy9fL6BtioEskQiFtbt/6w3ZfraPMJxSRNHCKEsFGtOXTA5LRxPSHebWnBpdu3jfgZiVBHpN6s3vN33Hfjh4pozOTy6zkH03JCBGv3GzexGTCCgxrbFWNNEBQp23aL+MJgNl666f5+7DkQrHF3hbZ5NZyggPgb7BGOuChFQ2i2ZGjoBT5r9jidXfoSwhj+83nA0dGBou074w9Wx0VRCMDZZlDWqwM6hQx0tWfbnkXvsPNeu3LJvw/KZ+PvZnICDnjH8LeLs3ZQHd54nJqVHmnykS91e2k6WywVr3EfGcouxcbWLHCiQpfI6mxKGP4lzw0gLyOOiJkAFcs7+Ke2H/gzAF9wuaiWkFfGZM7aDHEdZnm12P6sl0RBtBXrEkvrQr8BUOnxjJ26GkxVNlPNGTUZ71o9u8vgEUsiTjCcrozA5jd9k4DQEk4+JBiJ6EYB4iEEJuDlq3bMk5Jq4C8qPjp7vegj3AbjFzpUg2MWkWoQjbfV9cl1OrM+yrRY+xNu7N1x7747J0Jkf0ewgYyE5k/xHf5COvqkWAFaUB6pQtOV21C4qJ67idNVK2sBzu/nbqtEQo9toMOwKw/kMOnmRuEUK3zVqdGJQMB0++gJ7G+4BKU8mGXou1K7h9oW/Ays+SXjNDgebuhYH0hiwb/lCDpcljQxsVOF3hxWciEppPRDfEKhA4ypUWN6+PSAlbO+k9gzMcyh6PswuK25R98LKPt0VGa0USK1SqnXwq5vCgCk8ZNdR9Txtis5PDqYyMJBJu9qhf6XEHmkXD1rzS4NGXjwl2k/FVQ4rPj154lRSDDvUJmlBF6EyN9BRFWwJvKTzeze18FzwY5sQK/GCDWeA815VgTHIOO610d7Wowfl+NLDcpgcR1kKM4Cfs+V9S1idr5XWBjFPMhi46B2XBcIrL1W+f7gNjSAtVciFRDEKB5gEuVaKyIsUoik3TXxee+ZxuTIIC6sMRiJNzLb+E1b0UzYzBd6ep+sgtUZXPfu8hAW0aEnP6T83Xrv+kLgUkoJJOpf/rRztANBWyXJj8KAoydl4ntrGbe4iU3xIRC3N6TvHMBu901au+UYY8rbyQ4Xd9y5RHyyCsDlRYD0TjiSWhZK7l4TJ4cq79QFi8szfZWwP85ckZAQx2n5dUmCU5pC8RCjull4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40b614a0-fafc-42cc-1509-08db7f1c7b30 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:00:50.8774 (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: N/0WFBK0j7+2c/mG81Fhzr5Rz0sxvRZ7C/LegCjuNsEZvmAjxL7uWL+eeC2XumxrNE825oQ/KMoMb4Ajx/sioQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8103 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org fixed build error reported by kernel test robot. >> s390-linux-ld: fsl-edma-main.c:(.text+0xf4c): undefined reference to `devm_platform_ioremap_resource' s390-linux-ld: drivers/dma/idma64.o: in function `idma64_platform_probe': Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202306210131.zaHVasxz-lkp@intel.com/ Signed-off-by: Frank Li --- drivers/dma/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 644c188d6a11..ac4a3fa94c3d 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -211,6 +211,7 @@ config FSL_DMA config FSL_EDMA tristate "Freescale eDMA engine support" depends on OF + depends on HAS_IOMEM select DMA_ENGINE select DMA_VIRTUAL_CHANNELS help From patchwork Fri Jul 7 19:00:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42925EB64D9 for ; Fri, 7 Jul 2023 19:01:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232808AbjGGTBC (ORCPT ); Fri, 7 Jul 2023 15:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232782AbjGGTA4 (ORCPT ); Fri, 7 Jul 2023 15:00:56 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27F8A124; Fri, 7 Jul 2023 12:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=On8AGiHRlx6GIqzTMzO7Ld/iZuPt7VCwt26m3gLIQFmCfAnV3tSI7MJZR9MyRta7a4xFFcnIfh2Kh1GHiA1ZAF2hrthVGXQ/ofEj23q7u2IAZpBWejn5v2dENimpUFipd4QYpfwggebkfhKyjnX2J9HBdiNom/PNc/4J/akahzCVpSQTkhIJQDKP0Lx8etXhwUdDNU+e1ztPSVqxhF0qZG1IramlnbiyENhNl5H+SzWGLcCauLv8BUf8b6mwDYcgrBqYoXpkSL5hPReJx8Yie5o0hYMwZQipC17c84CnFVQ5xeo68889Mzx6KlE6WgecRZ2NtwVcgVIapLbJ7/DYRw== 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=hZk1c8k1FJIoPWbylqW5yBsHWcRGzoOxvUatOi3Yo/Y=; b=mnQn4x7uBFcJ0ujq4YLF6a5lHdvbvEa8/TIE8WzYd4kOE9iecjjCVIxvBrAvBxPJeHnCeeY8lhUotpUq97lf/pbXWNxDao7ZQIZMJWXiFeWBOEyUHZdj2ueWwmUj6qf/SLIx0yTqgkFWUp4Sc0EDaqNPYlvNp2UgUN/zeA9UNjYeyr10ixHb3+ATRm3560QHHaLF9Xd2d/Tbc2bCArGY0Ii4aG4FPY8rjKRb15ZAtJPlNcJT40Lt1qcr8y01bcJMi/GLHOcn0aTfWPR8aXRw/XwgHM4rUQRmRxbFNb3p4xtQ2UINMBf6VdS4eua26lAnhtq7Xid9sYUoZcYz3+Nneg== 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=hZk1c8k1FJIoPWbylqW5yBsHWcRGzoOxvUatOi3Yo/Y=; b=bPQcZyJa9/DWVRpZNsBPR+1Ycmi8vljql3d+xQdxcRcrFndJWlDM9voEzCvzYnc2o7tFB0rP4CmeJ7KOrlUgMcQ8meRNBLziEYheYnBx3WdyCCUPV/1nJYPYs7Js3i3wle0qyNFuWxDWeK2J8xM3xwpywP+X1Sr/ruqjY0gF1dE= 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 AS8PR04MB8103.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Fri, 7 Jul 2023 19:00:53 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:00:53 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 02/12] dmaengine: fsl-edma: clean up EXPORT_SYMBOL_GPL in fsl-edma-common.c Date: Fri, 7 Jul 2023 15:00:19 -0400 Message-Id: <20230707190029.476005-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 632fa99b-6bb2-4c8c-f736-08db7f1c7d00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mv5gw1/rBT9/o65nud/H1eOfIa5C2fo9D4QYXcwybLVPvcgGcuMEQQRRZ0XgvtRYqRmAmExcbJrCyhjxN22TrW54JBZUampVc1iaVNztyjLzmU1CTdGyJSxqp0lNPCXviSqDwkxcXxG/LG0nBTqB+otu+MBaPCCH2y4gNupPds2PgjfQXpeIkXZYTp8PczjYZBknUwwWyavzIPjB7bBAChwatrqALtFRs1rUANOWLCe9+hLa/c7149Ajg/rB2lAcD3CdHYG8Bp53SlMXfwre0rLq4ARWCF9IuU8uFRXMYrejDU5PLuuXu0iV3eLYs/Gi/VCc/4NtYFtwLvJs3LgcWVPjoLt7XF6oy2eRc4VsgtaSWjQVvr713qGDnawsWLK6t375TF5fy4piu2dNLEvnolvytNl1kSE5fmhAT51K8HsNvspPTYdBg67HJeM0zG0igwes0SyTdueAp9dJd77FPbuutWHEOkdhOEjOG5NbMD65NJkxi2MqGo0ORzV7ma21sj2GlY5r+9k0VuyUPNndbkxJBW7IZrwSx6AxiY7vOoNcRJppObFn5uPLeLxI6FRkCIhWqN9mfkPfLkLzjOrhVeF084Axh6dlYXVcrpq2S0dwCllUA2iD/vx+QRy0KIpc 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)(346002)(396003)(366004)(39860400002)(376002)(136003)(451199021)(478600001)(52116002)(6486002)(6666004)(6506007)(1076003)(26005)(6512007)(2906002)(186003)(41300700001)(316002)(4326008)(66946007)(8936002)(8676002)(5660300002)(38100700002)(38350700002)(66556008)(66476007)(86362001)(36756003)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JgwZS4+7gfZrROWaTSv1U7v1J3qU2yRQHHILYdcbpXR7lCRsjQIR1W/ncy75BH2zcUI0l0uGZc120ISfdvrydm/CVR1BOmgPAI/jRQBntiCL9xSoK43mRU1l8kO3S2rYNBIDMgN5iZRHOVTtTOCKNcw8IMbYbWnl3HCNYDFKE1jIL2tRPg1LYWCoMiEgpudBQmKf/itgf9AB7BOCNpvjM55PNPNkoe/sBjvF0eV+GtPm2KvuktvUWq5/42gVWstscI0SnImyeYKx6QIiyXF3PjDcQctCUkle+5a92UIbRFRr0I5YmGYzUWKL9WICLPo/+QJmokKi4wyQsi9upg9VcVQ2CQMp9pF3tp1c9QHfs7kj6rwb3tMtBUgC/AcHk/+97j4LFKBO4NvHpuqyXi5CsUDNF58qgXSJmAp7w9Pt2tkILvYTLwr4Hw3dcRsMMCFJRz/7NQ2yi3bc46pvejS4jpTC23mV8yPrsWb3fnXJ94sm34L2KXBhOFVEThtE/rg6223VJ/pcgSSXJtMwecxXmxngp56VW5CSTTFvNdIzpCvbEJUKXhilkBE+wIJHvMgdq/GcYdCJh9qcsd03jS5GxU5FH4Dq8Q0KMhlNDMqeVAf4oW3C2UYiEbqLzr8rJ+KMlEQ36V3dmeuz69SdZoByVUc1Ed11FbdKRXZe9GgS6ioaxNKYfd8jlAeSeNTwGyrINMUjDDhkjS3GpC6+znYCymFYdu215TX2D7lnsd4n8CS2VE6IUNy8eLUOCgf6qAbiLOcRWA1nbYYsr4DHOymOX+4VTrOMx1F7CUK5Ni40l7RylRahz+393vH/++292Cm53bMrl0P04yRw4eYRQadNMlQj+PzliXQ2F77VwKPdaLrpmlpToMkqoJLcxuvvmLut/aDa+yJHGCkNe5OUnnLsQsQpJjZs1Gc8/lLGQxDipMKUI6FvnEznqgyaJH4Ps2QiCeBQsGCrKCsZbh0a8AiXCQ6Ut+BJ3tfxWoOq4C/09JNJ5CGMcxddAD2UoB4iQ8Jz8k3WfajgoOzFPDacUEoOYzSpnWFFToAZsWi4NOm943w+ic6uKJUqWmKGQhH9wZAeJ9Udi0SvAMYy4lDlTAARdOK+zcwmZipDqdnWUpmGN/l1fXeOcJ2WWzkNZFRz7b0hz7hnFZAZPYqbQNju/02LUu3IRZxrXt9LoN4ACdYuyhj5i/x/00VPP2UJnJsF/b4kAyXKPoqnL+dU/zONDcZ7bTmU10E+C3c7dFbbhH9ahS57qIpjK1ASud3G5xv3Jb5TRskmzcW/3eEwiYvHpPx6313exe6TLK0F6bcFHIiwq8nhcsJqWUV7wkDLXjDKet17V5UeNjXoCKIerccol8rAJeyjOUi3LyW4CoUX56qIaWjZnaCXLbhacRhhAI1IUNGeCuMA73nzjvpOIEHyIVgf9jpW6OEGkalCGH7ZdgwK/ru2D8ZeeFrrLegn/TzFuvG6+4DfL9YwMev9rS6hzBlMSElbNTvlwt+R14D7PBsGQODIqRhgrNf/HO/KH3bEFl/XvAAXQlNSWBb76EVGBPYMLhuWxUL+KyqbXJZsAWhoq8A= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 632fa99b-6bb2-4c8c-f736-08db7f1c7d00 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:00:53.7702 (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: yLCLfItIB0tYfzd27w//asmqF0pA4+A/4AcxVyBCRWQyhs0On7oFd/HVNXF3wlHwxlZ6XNslvtOxoedPlv3opw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8103 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Exported functions in fsl-edma-common.c are only used within fsl-edma.c and mcf-edma.c. Global export is unnecessary. This commit removes all EXPORT_SYMBOL_GPL in fsl-edma-common.c, and renames fsl-edma.c and mcf-edma.c to maintain the same final module names as before, thereby simplifying the codebase. Signed-off-by: Frank Li Reviewed-by: Peng Fan --- drivers/dma/Makefile | 6 ++++-- drivers/dma/fsl-edma-common.c | 17 ----------------- drivers/dma/{fsl-edma.c => fsl-edma-main.c} | 0 drivers/dma/{mcf-edma.c => mcf-edma-main.c} | 0 4 files changed, 4 insertions(+), 19 deletions(-) rename drivers/dma/{fsl-edma.c => fsl-edma-main.c} (100%) rename drivers/dma/{mcf-edma.c => mcf-edma-main.c} (100%) diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index a4fd1ce29510..7f3d62c9dee2 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -32,8 +32,10 @@ obj-$(CONFIG_DW_DMAC_CORE) += dw/ obj-$(CONFIG_DW_EDMA) += dw-edma/ obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o obj-$(CONFIG_FSL_DMA) += fsldma.o -obj-$(CONFIG_FSL_EDMA) += fsl-edma.o fsl-edma-common.o -obj-$(CONFIG_MCF_EDMA) += mcf-edma.o fsl-edma-common.o +fsl-edma-objs := fsl-edma-main.o fsl-edma-common.o +obj-$(CONFIG_FSL_EDMA) += fsl-edma.o +mcf-edma-objs := mcf-edma-main.o fsl-edma-common.o +obj-$(CONFIG_MCF_EDMA) += mcf-edma.o obj-$(CONFIG_FSL_QDMA) += fsl-qdma.o obj-$(CONFIG_FSL_RAID) += fsl_raid.o obj-$(CONFIG_HISI_DMA) += hisi_dma.o diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index a06a1575a2a5..89b0d09c13ff 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -75,7 +75,6 @@ void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) iowrite8(EDMA_CEEI_CEEI(ch), regs->ceei); } } -EXPORT_SYMBOL_GPL(fsl_edma_disable_request); static void mux_configure8(struct fsl_edma_chan *fsl_chan, void __iomem *addr, u32 off, u32 slot, bool enable) @@ -126,7 +125,6 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, else mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable); } -EXPORT_SYMBOL_GPL(fsl_edma_chan_mux); static unsigned int fsl_edma_get_tcd_attr(enum dma_slave_buswidth addr_width) { @@ -155,7 +153,6 @@ void fsl_edma_free_desc(struct virt_dma_desc *vdesc) fsl_desc->tcd[i].ptcd); kfree(fsl_desc); } -EXPORT_SYMBOL_GPL(fsl_edma_free_desc); int fsl_edma_terminate_all(struct dma_chan *chan) { @@ -172,7 +169,6 @@ int fsl_edma_terminate_all(struct dma_chan *chan) vchan_dma_desc_free_list(&fsl_chan->vchan, &head); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_terminate_all); int fsl_edma_pause(struct dma_chan *chan) { @@ -188,7 +184,6 @@ int fsl_edma_pause(struct dma_chan *chan) spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_pause); int fsl_edma_resume(struct dma_chan *chan) { @@ -204,7 +199,6 @@ int fsl_edma_resume(struct dma_chan *chan) spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_resume); static void fsl_edma_unprep_slave_dma(struct fsl_edma_chan *fsl_chan) { @@ -265,7 +259,6 @@ int fsl_edma_slave_config(struct dma_chan *chan, return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_slave_config); static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, struct virt_dma_desc *vdesc, bool in_progress) @@ -340,7 +333,6 @@ enum dma_status fsl_edma_tx_status(struct dma_chan *chan, return fsl_chan->status; } -EXPORT_SYMBOL_GPL(fsl_edma_tx_status); static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, struct fsl_edma_hw_tcd *tcd) @@ -520,7 +512,6 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_prep_dma_cyclic); struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( struct dma_chan *chan, struct scatterlist *sgl, @@ -589,7 +580,6 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_prep_slave_sg); struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, dma_addr_t dma_dst, dma_addr_t dma_src, @@ -612,7 +602,6 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_prep_memcpy); void fsl_edma_xfer_desc(struct fsl_edma_chan *fsl_chan) { @@ -629,7 +618,6 @@ void fsl_edma_xfer_desc(struct fsl_edma_chan *fsl_chan) fsl_chan->status = DMA_IN_PROGRESS; fsl_chan->idle = false; } -EXPORT_SYMBOL_GPL(fsl_edma_xfer_desc); void fsl_edma_issue_pending(struct dma_chan *chan) { @@ -649,7 +637,6 @@ void fsl_edma_issue_pending(struct dma_chan *chan) spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_issue_pending); int fsl_edma_alloc_chan_resources(struct dma_chan *chan) { @@ -660,7 +647,6 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) 32, 0); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_alloc_chan_resources); void fsl_edma_free_chan_resources(struct dma_chan *chan) { @@ -683,7 +669,6 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) fsl_chan->tcd_pool = NULL; fsl_chan->is_sw = false; } -EXPORT_SYMBOL_GPL(fsl_edma_free_chan_resources); void fsl_edma_cleanup_vchan(struct dma_device *dmadev) { @@ -695,7 +680,6 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) tasklet_kill(&chan->vchan.task); } } -EXPORT_SYMBOL_GPL(fsl_edma_cleanup_vchan); /* * On the 32 channels Vybrid/mpc577x edma version (here called "v1"), @@ -743,6 +727,5 @@ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) edma->regs.tcd = edma->membase + EDMA_TCD; } -EXPORT_SYMBOL_GPL(fsl_edma_setup_regs); MODULE_LICENSE("GPL v2"); diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma-main.c similarity index 100% rename from drivers/dma/fsl-edma.c rename to drivers/dma/fsl-edma-main.c diff --git a/drivers/dma/mcf-edma.c b/drivers/dma/mcf-edma-main.c similarity index 100% rename from drivers/dma/mcf-edma.c rename to drivers/dma/mcf-edma-main.c From patchwork Fri Jul 7 19:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9747DC001DD for ; Fri, 7 Jul 2023 19:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232838AbjGGTBD (ORCPT ); Fri, 7 Jul 2023 15:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232798AbjGGTBC (ORCPT ); Fri, 7 Jul 2023 15:01:02 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2089.outbound.protection.outlook.com [40.107.8.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1CCE213F; Fri, 7 Jul 2023 12:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GN5Ea46BN/AzGm11d1ztdKK2EyaVZDXlvZB6ud8eNREq02AXjETPyKb5PznE4AEZttuLq3or0h4PiQzJ/nbvUEUNrLQ1Mkn8q8xWOp3hZOB7U1YA56RCQyuP5DnSOxzwB4AgMyC7RGi8AxTFgRyMYS+qLO6Kb2zxhcMS64njdzlD4/xjObXw+np1gco/cxaJ37hUAtVpS14108LcnCm2Xf4RnPdoiomTuuy1foXNJIkGxkAgX9ZzWPFB/y/ZrrFgMUQSvCA9cpTyCCUSMKRzFjlC45Y9fg7D0Bg6Ykl2sPhmDw8yKYt7zfKDECcBrofuErYatyYYjvG4Thr7g1YPOA== 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=kTlCOs+gUC7/ksEKNx8JBDZsHq+yWhWE+Hzn/rKVrxw=; b=HPsHtUen/vEkZLkClESbTGnXGHPHiWmLIuoF3vdLyn+umKQK5tL2FTaPbMc7PUM7qCj3tJRaQvJIE5+b1stM1QnDR3hsicyNfdm9Chkgw6EQENj3DqEic5O6qnnl3dF/OZjxInBTWq0nIyDA9HraCjn1eqLjTzIlD271xo2QpiAtgWuxJ3HMxCIn6GtNM5fW36J5kr9pFwT9CfLm9dfNuMdpKYarL/dDKe10twB4lFh5Kq36jxNEQOn6fK1xZeMVgYpgHcj0LDzPtvd9/pQQq+lYOO4WDZs2riJBVj8iJZ66zhkj3NlVUit0/WwVEoZQsUMjpwu05I/HjNAOacWjkQ== 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=kTlCOs+gUC7/ksEKNx8JBDZsHq+yWhWE+Hzn/rKVrxw=; b=QPTyx6ebE+OVsbIl19E3K57935g/FNikju2sNo5FKYyNnDkf2YB6d5fit7iIgDUFUI6uqAH7hTCFfs67bAlAAok6UiFu7c88OUPILGqBjAyR4DwkOLgGLL90HjobJju8rz3BJEo8MdKBeVnZljr8lZcQ1tAsXiSH9MPu63NM6ho= 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 AS8PR04MB8103.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Fri, 7 Jul 2023 19:00:56 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:00:56 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Date: Fri, 7 Jul 2023 15:00:20 -0400 Message-Id: <20230707190029.476005-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b8ac228-3fee-4664-025f-08db7f1c7eba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cBNQVtuRAtIHPJ6zDBSMNrsTmCWXbOFHArZelDPmmt+BrAgnEsIwDR7BlNP8WAL6TWXCFqa/Svuav1E4QlKvhWRlpcQw6++NqdmLE+Pvb0K2Edn9+hl6HqwoaBNngG7B58ZtGMU1kj1qDWMRCq5aVe0LQKFZltXfWy+bexHVrhOl/sKv/hpTOmwUuRTOxVkQcqMr6GJ9H2Q2ecnUypBn65Dipe05Ks9XJBnAFilY8KOvxUuJaKdCxPRjcuEu0kMCaEPEgIddBijWPN26Ci4OK9O4vweByPzYSaCmOZgVNt0OVq8YqXLSRA39J7a2H1AIGtTv940UZOYIIxWb3iEXsgJiQ7FWA1pS9locmeZrzMPgLqPsP15++m280RAg4Guo+m/dfln6dULqWsPptd8DhdIXBCtHJ5ZQVzYf4cV7p2FXwi17+dQww9AUtrEybevmaS/qkj52gmys6u3bkoo1qT/Lisuy5FjjyswCR44si1VtYCJTduOy+q6Ru35IDuTFRm6/g7dW2mHk76EG2UnZ/Pmf4Zk5F3EdEYYKTlXKYWzcIc0TH3b959KIDzNdHmxERA9fHtWkgR0B4SMwhX8R2reZF3Nwb3YJvUdAVBLkZRUOGIxEKsmvQLr0Se/rrss8 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)(346002)(396003)(366004)(39860400002)(376002)(136003)(451199021)(478600001)(52116002)(6486002)(6666004)(6506007)(1076003)(26005)(6512007)(2906002)(186003)(41300700001)(316002)(4326008)(66946007)(8936002)(8676002)(5660300002)(38100700002)(38350700002)(66556008)(66476007)(86362001)(36756003)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c8ZWstpz3pp1kLPGtFP0BZxBXkqgy5ed4U29QWhw6D/qUUuKGuogmlnsW7GOHjlKjXEtUeHh50hqZ4RT+RtciVyxOKgFOTP+UndouPKm7mJjGbw7jikW8vdDWyhxabMPUxE9BDow7wIrl863tT82rXwAIAeahpuk4HnfWaC8yRCjBPqeW7b44l7u10YbF7Et+zGr3dciXqQV6D/S9A4V8r/2beV9ESpvFd+Wj2ttnxg1SrdyzHaYuE0xklsB0rBz+Ut75G4hU4krN+7hqMaTlVidGHBJTTOB0hkQjBhdaHeUqwFdVQT26vudSHDaC8TFYkkacEvg2fuwpN4QW5QS4YlESC2yUroa28lBvsiE6mPGFglUY9lhASzVqlrv3QW0qRxIbBmHSiYaEu17a37WtYDOU0hIgl1NTwAipbtwFenCAEmWZRm744UXioHQ3y4oLozxzRsPRVUONWc9ChOK4j24/Uu+pqCcA+Td7wCJH429RG/1tnOhKi1XPcJIO+BfgvzKekUwLV8FNKPR0MO2XGowp9VsbBHD/KqaXKLqbUlyBJrQP4WM5M9dFmasIiuQ768ISQVPOeLg8+Zq0OQ6Zgl0lEUpAC5QpvgbhID+HSqqH/dNZmrUTWRDVPAGGKDFIq8Q5BR/hnO6Ves3zATnkvT8OfeWG2AAYwfmIQc/3reSz7spgWJWI8sAbbamXkNvmqnxGDZ6B0unGw268oL85harhsdsvGXNtM51pHg0Fe98fqAQHjyYI2ljDfnOFKB2vMW8X8E6Q+zFZzkM41fd5/je6vhuPg7S5u1noDP5e84+Uh270alZD5LdlODJtCEBoYOv6ehAYtqkMvs7vPxPVUNl8mmQA7HAhO0bnTy+85rBfsJX+i6eJ1TH9RPWkxnsynhukitbw7vLL2zTpgOA2MvQOcLr3WBA8f0RU++dLAcN8IWhSBLu4pZ7q/UcRmY6UbxjkxOqUfNuBo9FxQWw0ZEd9+w8KaAs+xdxFsbv7tOdJuU5Bfyoj/bcK19N9B9niJkxP3iUvxTpkymFCz4/mFY17JgXwErfESK6GSfmqdFXA2P/WPGY5ac2F49O1j2kvFZuzOj5PRh/cmY3u1ygs1WSTUFAotfbDu0PYjjvqi/ge/4OTH7Fx9/SKYBdnRfzKEbvjs4zGE42r2Wh6eUkZdbaspKUrwzrtP8IkLs8BqWj4WNLX/eONUkyvNJOjeYiJEJF8hSjV9Om7OCaAWNs8jbxaTI4P6yVyi6juJJEJ348w5Yl3qZXyVHSKmJ6FVaCBuDOJEi4XXo3F0H8bsKVw34oht7L6JAS93o/rcV6b5zFpaihZX+9pzLDguYJHB7WDzveMalLGkdBvIZfqKFdQetD5mlaExJumvA+dPHkg8URP8ALjDEwwdr1tIZdgdQ4QVpnJx1ppqkZa6xnxhIDlqWxWj5Wo3rddbn4VOyouVEs/gW3ziIp/RLwzFpBHh8k8BI+52OrqeixSvPcqg/O7eAQL3e/S6s/8JMbvHK0stpqvaBBGZ9HKnPwM5Ia0WuW4zkFXE69Vb6HGPbEj3RQXrFlw76EHja5Hrii7SbBoIQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b8ac228-3fee-4664-025f-08db7f1c7eba X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:00:56.6457 (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: 3aisnvu2Y2tfuTryzueSXpSo4wDiWrOU7ZBlL7bnluWYjRvY6Hw9rd0RvhCCqtAZRxhsleuXJWLesaKPpPUHuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8103 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Replace individual bool fields with bitmask flags within drvdata. This will facilitate future extensions, making it easier to add more flags to accommodate new versions of the edma IP. Signed-off-by: Frank Li Reviewed-by: Peng Fan --- drivers/dma/fsl-edma-common.c | 2 +- drivers/dma/fsl-edma-common.h | 5 +++-- drivers/dma/fsl-edma-main.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 89b0d09c13ff..2549a727913f 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -114,7 +114,7 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr; ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux; - if (fsl_chan->edma->drvdata->mux_swap) + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_MUX_SWAP) ch_off += endian_diff[ch_off % 4]; muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 004ec4a6bc86..db137a8c558d 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -144,11 +144,12 @@ enum edma_version { v3, /* 32ch, i.mx7ulp */ }; +#define FSL_EDMA_DRV_HAS_DMACLK BIT(0) +#define FSL_EDMA_DRV_MUX_SWAP BIT(1) struct fsl_edma_drvdata { enum edma_version version; u32 dmamuxs; - bool has_dmaclk; - bool mux_swap; + u32 flags; int (*setup_irq)(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma); }; diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index e40769666e39..1e1cf0548ac7 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -244,14 +244,14 @@ static struct fsl_edma_drvdata vf610_data = { static struct fsl_edma_drvdata ls1028a_data = { .version = v1, .dmamuxs = DMAMUX_NR, - .mux_swap = true, + .flags = FSL_EDMA_DRV_MUX_SWAP, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { .version = v3, .dmamuxs = 1, - .has_dmaclk = true, + .flags = FSL_EDMA_DRV_HAS_DMACLK, .setup_irq = fsl_edma2_irq_init, }; @@ -304,7 +304,7 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma_setup_regs(fsl_edma); regs = &fsl_edma->regs; - if (drvdata->has_dmaclk) { + if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma"); if (IS_ERR(fsl_edma->dmaclk)) { dev_err(&pdev->dev, "Missing DMA block clock.\n"); From patchwork Fri Jul 7 19:00:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6474C001B0 for ; Fri, 7 Jul 2023 19:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232879AbjGGTBL (ORCPT ); Fri, 7 Jul 2023 15:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232805AbjGGTBF (ORCPT ); Fri, 7 Jul 2023 15:01:05 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 072FD10C; Fri, 7 Jul 2023 12:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GkU8jZ6Kxz/pfmL6HjIG0ZXVmXbA8UZwUYRIQUHARP+XfoXTC5ZW50aSblReHbbuLfwwXBCNm5pz5ToG9X1S/9u/s2za0/cTMZi/fOEmpnlYlkUYtnidO58V/17XP+rbf8tL0AUrefDSQOFuDwAJdCemCEB5NsFh1YsyocN8iR+KLQJ980hmxB1GL3H7fv9I/29puyQ+YOxDQm4XKVL2UCFM8Iol2SrDDJNz08cNIiRfzlJ0hcB781BPdLKAqCQ5Nzp2mYLxpuPl2JR0Z0qTKQEm/yyGu22UDvoPDv2KFj+OiDQy6mw+rp7K6aMkzAOqwLf1aIPl3JAjct3/u23mog== 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=qYDV9MILkKaLR+IR6/b8VsBFnagiKkTiFeSxiAj4udI=; b=OhaHPwMNt4ckVjv5tpcsHu+htMaUE71/bjXF448l8/2MjzG5jkS68LqKUoCXDw0oCEBzTWH2ccFinT8wAddBql7cbViKVY2msBNwYJS9VLLeKg3wyb/ga2DPAFbckYrHisN/vWduIuWfZUksNci0p1bSbppoTQWeHNu9TKKBFIYfu6fjh5/14NMhByKonpC2JZOq7e3iQAibENTVRUau8TpVzhZnCK5MolFNqJS6OR/XuLbPk1wWVDxL2kqs55NgDPE7hObSzxzfOlYFK/6+8TfZ19jIFXP03r+NYuwOJZ/Q761fXx5anKIDFQPoNxXPFBYeXMHDttgIyy0dI8WnlQ== 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=qYDV9MILkKaLR+IR6/b8VsBFnagiKkTiFeSxiAj4udI=; b=bHQ9C1SZUQjiFHelFmbZnQvYjQGWdgRTlyjcxvIj5PrC0h1DDcXlIEOWAsafbQtwCpVv5JGlPfEHDtpVAlmWuQvf98RKYe4Qsi0v0QglK4lr/vGm0AscJidRqDINP4YF2MKoY7SWSI372sCyW4qlG/psF2C028vQd/NK1oEDPw4= 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 AS8PR04MB8103.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Fri, 7 Jul 2023 19:00:59 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:00:59 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 04/12] dmaengine: fsl-edma: Remove enum edma_version Date: Fri, 7 Jul 2023 15:00:21 -0400 Message-Id: <20230707190029.476005-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 4aef0e11-8e2e-48f5-6fbd-08db7f1c8075 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EJn12ebjjhLk/B6MXMT9XPjhRisp7Zh1jHrpJFUY0Jxnty6i7/xXrSBclqEzY7sTgFanMn18JJYj3yHyS/HLmWds/sCr0CBF7P8ax04FJyv5ccx3IK8J2Ap1PRwzd0eu3UH3KrBYj3KpaqMiqIhYSuOpuDq6Eg1R47u6STPZIipAJmQ1v47QwJaQi2+P4tVttIRPG4zzESm5iiqA8fthN/AfJTX3Tm69IxMBw++RwnESz7xmZp+Km9MXbU5d4CDzDFLlY6QY3qz4rwTiavgDGNn3sj2PyUsN35dD2/gpFNaFp0iPcAsWTbgKwpNzuUuXZ7vUI1w2QfoVnTEZ4gBMI9eIM6Ezw2CUBRI1GpjBIVugNwSHhemiljuWF3iX+rJtHAKY8f7F6av3Rv/LD5VLWrcrHZaYC7krqXjOB3q2sixum8/prFTflCLGDE4m/VFRFSdqiUeGBQ1W7VMEK8ZbzAi8+bP5x1yH0bsioCRhVx6V+GFfP4kIGgiCGxp8KTwsrZIRxXEA4CH3B+y/HSTbAIG4IOfbeXiVNqt05QUL/wn8krhCP4bnoB1kxt68cKV55YCLc9IZeWue5jfnfANNalj1a2QGPhyzITziEEne9bjFatAdTHXkT9kMSZsRdOEbnHQmq10sxakDmUn10IiE0g== 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)(346002)(396003)(366004)(39860400002)(376002)(136003)(451199021)(478600001)(52116002)(6486002)(6666004)(6506007)(1076003)(26005)(6512007)(2906002)(186003)(41300700001)(316002)(4326008)(66946007)(8936002)(8676002)(5660300002)(38100700002)(38350700002)(66556008)(66476007)(86362001)(36756003)(2616005)(83380400001)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qu39vxHcLGKByQEaELBIeilzZDwGrm2tOKazNPE8DWrYDGcJfur6RNq6lFQCjNapvtpCot8T2FP/csapOwruSgmlzTx0HdyuE+ArTFb8zENpbR3nhvnxJPAY7G7aTZjg205LQ50fhC3w+dErABQRE9CS6j0yujn+yPmFbm47EtlnPZwLoyCrni5irNBBCB9I7+LoEHHtWyQ2H/t1j/TMoUjakLaOD0ZYD5fzzWMJ/x4gaIpBFVy7USLOJqdS4hchSGyU/1sj+Py/JzdJywpOcULJfjtEeTzyP/3xA3mucP6HFGvIq0tQFCrOOeG2z3NlQ8WB+yl73sz9sIC53mAJHePQUcR9P9tPRygds1pjNoaqSyxtcslAroe8mhu53uT6SZ6kktl4p6nblN1F7KpG10I00Gjz9EqFoWkmIxufs/LTAvNnQwdOh/QdTDov16ztEcfDHiGcnt1pKnfO9gwFltjNsgu7gcGO2Pk5k5jVtK0Yodjl1hfJSFYfH+X2Uhmvy+1uxpBdAqMkKqapNSnE5ENj4LiNGC7lBp20+ahJKNGA02iMlCQMFTYChYWIWVlQ6Iln8CVPROrsMMn9o+SsYV1KJERxbeUJ2pDCdgd5F6VXWlbro+Ec6ubNVOQmLa2gXHvcsHumqfGwHXFCh8iTjBt5oWDSCXN6V3MsH1HMOahHvCyYfZn0CgBQNF7KfhYgOJso915F/yw9pyWB5TbrT35bBANjEmD/CckUHXliEbjx8+0qIr67pJ2JzEWSx0nj+QzvxeYQL0bPvoscRRvnsBUJfowJNxbCbkD4E0s/fkbSnUzIgP2CF3f7UC/z241sY+tvapbJTMaQp2GDcGHP8No/K53p5gNZFaeN+l1Wo6j/qSlzdwAQzfIQFEOnIkvTQ0di86CcRfwTFxuAP3l42406pUuW54JuTvz49jsp6HI/qMHUXC0SvSdWR67hvWBpHcJXO9fKFqjs2AjujssocIF2axbrzscM7VjVm0JggZRsfAMSjaqiPG+eGKIhlCZy2gcbmj+t7zMGGkbH58125uSaS3CoZembS4D7gmEdGX2Bl9uvoo9L4jytilOO4u85QdJ8rjHts4Hy9tEE9fXPU0FtdHJ+UyFvxo1hAfa59lUdrgv3t7N4XTSLVCnTaZOK/DLdE2ampMdSDYpIiVA2fuby6M1ocyuO1D8FPfmVETermwuIbKbtxJDDjuQr+BpbHDbGgkMKr3kpTcOc3PSez/MBV/eIC+NYwYl3FYdliIdZRW6S/kenICqlcy3fuSjIymb8EaJamkja09Cn3FIOW4all4bHPrI+T5FnWD+xHFc2DQ+m4riXS9/7fwyFYMfGnnlCZrpwzx+ZclE4Rc+Am4ICMn5miE68vH3uAa+QWiQTjpuaV9T/rSkkjhGO/n8giAWLO5fqz+U8U4LDWZToANeTXhAPovoyzXh3MQHDfNv4ESpzk6OKLkuK21+Yctrx6HGrrVgmw9mr6FJY0vVN6gZNtCO944XPPMl29j2EkPm5YZ16ZC38WY02XG9sZ08eeHtfwnxD3NnoIOr95iUwbbB6vyUQPwY2Qp8P8VJHL/I= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4aef0e11-8e2e-48f5-6fbd-08db7f1c8075 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:00:59.5785 (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: ebGG7MB6QB5/kgyYd/ou61hKXd9K7O4l1nB6IEX0asRrA1rTRyAa82YQgPk6GeI2IORR4ZVNplwkmUnLcUtofw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8103 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The enum edma_version, which defines v1, v2, and v3, is a software concept used to distinguish IP differences. However, it is not aligned with the chip reference manual. According to the 7ulp reference manual, it should be edma2. In the future, there will be edma3, edma4, and edma5, which could cause confusion. To avoid this confusion, remove the edma_version and instead use drvdata->flags to distinguish the IP difference. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 47 ++++++++++++++--------------------- drivers/dma/fsl-edma-common.h | 10 +++----- drivers/dma/fsl-edma-main.c | 8 +++--- drivers/dma/mcf-edma-main.c | 2 +- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 2549a727913f..5800747b8fb3 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -47,7 +47,7 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - if (fsl_chan->edma->drvdata->version == v1) { + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, EDMA_SEEI_SEEI(ch), regs->seei); edma_writeb(fsl_chan->edma, ch, regs->serq); } else { @@ -64,7 +64,7 @@ void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - if (fsl_chan->edma->drvdata->version == v1) { + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, ch, regs->cerq); edma_writeb(fsl_chan->edma, EDMA_CEEI_CEEI(ch), regs->ceei); } else { @@ -120,7 +120,7 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; slot = EDMAMUX_CHCFG_SOURCE(slot); - if (fsl_chan->edma->drvdata->version == v3) + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_CONFIG32) mux_configure32(fsl_chan, muxaddr, ch_off, slot, enable); else mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable); @@ -682,9 +682,8 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) } /* - * On the 32 channels Vybrid/mpc577x edma version (here called "v1"), - * register offsets are different compared to ColdFire mcf5441x 64 channels - * edma (here called "v2"). + * On the 32 channels Vybrid/mpc577x edma version, register offsets are + * different compared to ColdFire mcf5441x 64 channels edma. * * This function sets up register offsets as per proper declared version * so must be called in xxx_edma_probe() just after setting the @@ -692,33 +691,25 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) */ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) { + bool is64 = !!(edma->drvdata->flags & FSL_EDMA_DRV_EDMA64); + edma->regs.cr = edma->membase + EDMA_CR; edma->regs.es = edma->membase + EDMA_ES; edma->regs.erql = edma->membase + EDMA_ERQ; edma->regs.eeil = edma->membase + EDMA_EEI; - edma->regs.serq = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SERQ : EDMA_SERQ); - edma->regs.cerq = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CERQ : EDMA_CERQ); - edma->regs.seei = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SEEI : EDMA_SEEI); - edma->regs.ceei = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CEEI : EDMA_CEEI); - edma->regs.cint = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CINT : EDMA_CINT); - edma->regs.cerr = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CERR : EDMA_CERR); - edma->regs.ssrt = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SSRT : EDMA_SSRT); - edma->regs.cdne = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CDNE : EDMA_CDNE); - edma->regs.intl = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_INTL : EDMA_INTR); - edma->regs.errl = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_ERRL : EDMA_ERR); - - if (edma->drvdata->version == v2) { + edma->regs.serq = edma->membase + (is64 ? EDMA64_SERQ : EDMA_SERQ); + edma->regs.cerq = edma->membase + (is64 ? EDMA64_CERQ : EDMA_CERQ); + edma->regs.seei = edma->membase + (is64 ? EDMA64_SEEI : EDMA_SEEI); + edma->regs.ceei = edma->membase + (is64 ? EDMA64_CEEI : EDMA_CEEI); + edma->regs.cint = edma->membase + (is64 ? EDMA64_CINT : EDMA_CINT); + edma->regs.cerr = edma->membase + (is64 ? EDMA64_CERR : EDMA_CERR); + edma->regs.ssrt = edma->membase + (is64 ? EDMA64_SSRT : EDMA_SSRT); + edma->regs.cdne = edma->membase + (is64 ? EDMA64_CDNE : EDMA_CDNE); + edma->regs.intl = edma->membase + (is64 ? EDMA64_INTL : EDMA_INTR); + edma->regs.errl = edma->membase + (is64 ? EDMA64_ERRL : EDMA_ERR); + + if (is64) { edma->regs.erqh = edma->membase + EDMA64_ERQH; edma->regs.eeih = edma->membase + EDMA64_EEIH; edma->regs.errh = edma->membase + EDMA64_ERRH; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index db137a8c558d..5f3fcb991b5e 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -138,16 +138,12 @@ struct fsl_edma_desc { struct fsl_edma_sw_tcd tcd[]; }; -enum edma_version { - v1, /* 32ch, Vybrid, mpc57x, etc */ - v2, /* 64ch Coldfire */ - v3, /* 32ch, i.mx7ulp */ -}; - #define FSL_EDMA_DRV_HAS_DMACLK BIT(0) #define FSL_EDMA_DRV_MUX_SWAP BIT(1) +#define FSL_EDMA_DRV_CONFIG32 BIT(2) +#define FSL_EDMA_DRV_WRAP_IO BIT(3) +#define FSL_EDMA_DRV_EDMA64 BIT(4) struct fsl_edma_drvdata { - enum edma_version version; u32 dmamuxs; u32 flags; int (*setup_irq)(struct platform_device *pdev, diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 1e1cf0548ac7..be79a06fd6e3 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -236,22 +236,20 @@ static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) } static struct fsl_edma_drvdata vf610_data = { - .version = v1, .dmamuxs = DMAMUX_NR, + .flags = FSL_EDMA_DRV_WRAP_IO, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata ls1028a_data = { - .version = v1, .dmamuxs = DMAMUX_NR, - .flags = FSL_EDMA_DRV_MUX_SWAP, + .flags = FSL_EDMA_DRV_MUX_SWAP | FSL_EDMA_DRV_WRAP_IO, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { - .version = v3, .dmamuxs = 1, - .flags = FSL_EDMA_DRV_HAS_DMACLK, + .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32, .setup_irq = fsl_edma2_irq_init, }; diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index ebd8733f72ad..7b05e303ba51 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -172,7 +172,7 @@ static void mcf_edma_irq_free(struct platform_device *pdev, } static struct fsl_edma_drvdata mcf_data = { - .version = v2, + .flags = FSL_EDMA_DRV_EDMA64, .setup_irq = mcf_edma_irq_init, }; From patchwork Fri Jul 7 19:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55A9EEB64D9 for ; Fri, 7 Jul 2023 19:01:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232782AbjGGTBY (ORCPT ); Fri, 7 Jul 2023 15:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232798AbjGGTBU (ORCPT ); Fri, 7 Jul 2023 15:01:20 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA7F26AB; Fri, 7 Jul 2023 12:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OzroLu34yGTipTA+y4Ffgd7vqAKAHVA84aMR7i1UlEj5bNZx93n8jsKyHbj7rxtIT0RqJTnEBKCLudPBhqv3qyL8yTjTFnipSG8q6RFUR7IZnLppt2BpopeuR1hiVWpbu4DZ44QpaQx68d8TkU8quBj7UhsYW2GDlttuScyHrtdkSpU0ZHA0GCKKbIP10NYF1IkceSjjptxqc/CD1W43Q7MQOBiA2vd+xWT97BvgVYsyI+esMLoJwJs4aRGnAeTUNyJdrLuEjejqjPTrJfUTRjcVSO2T3e16urQ6UrJQDtozMY5nJXXefN6aIk9hGyMsKNzeUsbleRFo3155yCzhFg== 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=HdeS/JJlSBGhfLIYay0YGd5Yd/T/EkmHvXJdldS/U5U=; b=g3vhBhU3HjdFBBuiItSkufqKHXHinbJuWMfzmD10axHgZkSc4pIYa+JHSAJNl2CGFSuiz9WQUXH66ryBsGcq3aHJ1OBEuA5UBDWOqRdZstWCxurB0CHaw4H2PFbzrQy+NBuv7+oNWcELGzYDAHNMPomulXXNAO98wPvdxfz3RxPpoaeT6hITMhm/H0dhExzSNODmxIgROfradRikBX7RmyjI+xZjLBmCq18dvXRe40WLiaBw813RRwutJE6/irkRkjNu2CsuNulHlpkSarrFoSelbcinN+tgoZ2u2hMJv55mZ3gzNqa9Hjw1MngqALF29cWmrR6ft1QtfWUaFQjJ+A== 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=HdeS/JJlSBGhfLIYay0YGd5Yd/T/EkmHvXJdldS/U5U=; b=h5G6q28fKFwUml7HMFg8ZRnvGiq4cS4p9a5hqDQxvJsjzn5UNuxpqG/MNgul8otkbe8v0b3yK2e3RvzLyAxkB2v90seA5oiT/k2VAuY87nmaoP8VLUsLxNV4bon3o+lFTyzto5Jje6DOiq3oRe8+TuSo83DUUYZ3ubTeZyrrWcA= 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 AS8PR04MB8103.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Fri, 7 Jul 2023 19:01:02 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:02 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 05/12] dmaengine: fsl-edma: move common IRQ handler to common.c Date: Fri, 7 Jul 2023 15:00:22 -0400 Message-Id: <20230707190029.476005-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 447e8c4b-552a-43e2-7aca-08db7f1c822e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uwd2e7uowHbWVrfTu6Jg0So6KygzOqo1k1i87HsTcnMIbAIpJR+Bv02UcmsT9tJkC5LHApDyYX+hXZnHsNPRloNEAENHgO73L8EcnaiEhdxPSH5l9CL1kfBZTcddohUL52cZX/JZh/q3Ka76++qsUBAqvENCWUoME8FRpk2GG0OWn9OKlxhyjyFK9WAW1A7wm25O9WVldYgywUDFy8KAVQdQa2eYMkdKhSOfAcKvqrlG50qTlNrRFBaHlUE9QSPqvjTT2GJAyAoNKPr+5YgvXb5n9u7w67SbJorQ6KE9PdYuULqpfS/YmHy/5yQtkQ/+wuA9NE+VtGtCSPNdNpliA0UmJ3oOrFaBKj6WS/g0GRoDfSBFeFxr955yEAoU+fEqsW3NIsCR89YWnXyqMpl/L1B+3i4orwQ8HOOO+u1rbHdoZ/7BdLUjY6P29cE+xSQ6Jvu0LuVP+T0Y4ZrRTuPytPsYoIHct4INs7MMTYcYO4UZ0n74fC45O9C3VjNwb80A4/ZgSM1UKW0gC5sVgTBRIMA5zz0A1lW17iuVKABR2WTkiHDDoe+bxx3JO5wugQoyEds2ICFUfoBAptZsk7ByOLQWB1Qel1gtWsptyVFiiKAuswHs74dbD6HWdziGTrDh 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)(346002)(396003)(366004)(39860400002)(376002)(136003)(451199021)(478600001)(52116002)(6486002)(6666004)(6506007)(1076003)(26005)(6512007)(2906002)(186003)(41300700001)(316002)(4326008)(66946007)(8936002)(8676002)(5660300002)(38100700002)(38350700002)(66556008)(66476007)(86362001)(36756003)(2616005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +S5ZoldpLO9hucY8WSVKq2BsTtoqjfsvn4LqhLXNbB0/Cl+leS3UC/kQfBAY6kBdxNjcaNlNUfLHXAnJLml7lEtQRbrTe2CE7/mGbnerjSIOCyw3L7EYGPjGbJgwnl699sct8DEX2MOQ5JGAgux6iHFfCVjx9RzDWqh6l8vclp/olnCtBP8OVgargyGXbe+r5zyl6tjOLnfmMB5WAdSEsZFiUg+zO8yw5O761ZvPx2ia4/Y5ONzZj6T4A9ezXPgGiLYBYWltAO7Gync7xSbh3XZ6Vz8dUTs1AfZXVtw6UADcjRLcPAQDbAJD/G+Pv+/rPa1Ao0mXYX+4YA1fW+0TDhT+Z7qqiYbf/BnC3Ci7FeycKXy2TxSyq5Mi5N3/DelZIZVqlAxICQ+ll/XTY3rOhCxBr+O9S1eBGdvy1lifZHFa6WKYG8Apo6ZQHLNxnZDPZlxfTfVCViK4mh9n68FE7dH5UdzEx2w0UsE6oXvEw+RGeqv3s9i0MLcEP6JFiZCRQVA+U6Qio4Z3vACrnAFYfU5X39SUat3WAjyG2xnCra2LSMxTc4KcWiBXzlGICnsaRqARuH/5qNtbenRMAJlHwL+rAOj0Ah5AfJjTx/6V2sZIHrW7y+qrzF3XzYN0CapjJ3+McR2q78GVxk/fo7T9LpSJ9C74SLYkB5lJqc9qqSnsxE3Z/LPuhdsKnV8+79GDg/0+qv8BOivofnML27IW717lafusqRY2aSJvsmKjPWQCAdNCO/j6oDtgyV3Db7FGVsnVQjwVsskLNnpNO8CXQU0CAqHipstrK2hWA/eq3eeExfuvp/7Qc1FJl5PxcuPNhVhaCMkULA51dIa96vPc6ML32THJs0dCtqiu373y5vaKFa9A9wNTDVJd9B1jnMc7r4i2aYUsGB1SzBIxlKI005I53wnIIhcPARY9tedtaGJ/87JsuGMdKNX8H05AyawsggqDS5CKY1RL3oGmiV+AtxJxDGwlkGBSRLSphywCInajY1n4zgWJqfY2CjMPYEGMEhODT6GOrW4mEu6e7LMBsVXD63yHZXRaBP2Ybla9RBlGaumT7lJ+ktxMQ8xx8AihDXDY0jogB5pZZJ2woNiXZ77zLPMusPuahCX/0wyNz9gUkPxhHwPXIdlq78ME3Id+AjuI8Gx6UWj1X9gTYJK9p5kNViO1k4tPVLcxC0hwZvZnyfPJqCxj/2ipIQvNYNWF26e1W+J/u0uzgA2BuRFAXVgAIRy6ThcNhLuPW73lQhUE3NfQCckrTNpB17g9axltp1H90JLZcFfisUhdwSRH8Rq4t/1m8x9mLZ+m0Ab2AwjXKO7ur+cldo0GdrbXTyH3Nb6co8EoWiNKQl4fMJZnCj9rPB78Fm/7IkEgi9eitRoqB1RnmWKJLCgNVE/cGIKVWrZqnuvB8UZSUlq/LN5/6waxuk/FA56a8WUJ6QQFiCFpeqrSgjjzDvX2hO0+5wIJn3Fgdndg7k9AD15ua4Aivn7GJvkKUZfQyfRP/Hf0RjjCEGTDCIodEnAIN/THgD5lVdpB0ZJWBPksur1WYk81fSf28pqIcXCVf88npM/D6Hs= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 447e8c4b-552a-43e2-7aca-08db7f1c822e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:02.4706 (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: 5mZTuYz/Rrgo5YwANBiAZJG42VeDOqYDFNMRyMRsWIWLBwOORl7C5p49866/7rJUa7x2VogO5jpwbiCt/AiFiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8103 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 5800747b8fb3..2b91863502d4 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 5f3fcb991b5e..242ab7df8993 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -219,6 +219,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 be79a06fd6e3..d974db8c1776 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 7b05e303ba51..316e637b00c4 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]); } } From patchwork Fri Jul 7 19:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AD85EB64DA for ; Fri, 7 Jul 2023 19:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbjGGTBd (ORCPT ); Fri, 7 Jul 2023 15:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232577AbjGGTB3 (ORCPT ); Fri, 7 Jul 2023 15:01:29 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2049.outbound.protection.outlook.com [40.107.104.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E841E2709; Fri, 7 Jul 2023 12:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nlAIhfWmaeb9mLTRsXjM9swH8IBi/s5m8pHahT67Diynzt+VRLtI6lDmUuk2d5UgQEcqIUp1Ft+XI9uH8OlurYyGXNUssA7AUUAwz6n3eRCk13YAykotd+IT17em0HL0B5EA0BmbDv2IIas+VCRNRvkq2cWahSIFnCeM7ORJF8a0FzMKAG/hxR3sZxivHgx2+c2JWGmS8sOZaomoNWa+OkkrUKTJMWpjf5drBizUTP/3Aj1DzIRY1kkWYxpynSRIpPCJlHBH0K5KCF9Js5HRdV/qIPYNIxv2ZIF5JmwBEz3k2wz5EoXPalrjumbWeEBS7CgZbIrxhvlVzPOuHiushA== 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=IRLdjM1Tp42zPEUNnoAANp7r+uXPEoASlSMhumKXYtc=; b=Qvn6arQaMW3mCL2tCr7th8H3Dun7jHqAXMWMtCzC99Bg5hLnwCLhddK168XXSwNHobyFR1HMs6c6NIABR4LJv4/hRSt7cXj1XZoF18dSNYht7pukjAoAKv9Saev4KgxszV5/KXdiKbGSbaBd/xmcYutdduPLCmgXumm/UJx9jvV9S/xCjLI0mvp28CRKjM4uhwQNHm/Gswc/qW49+lSGXi9LzznqXC1TBScKmRO3mjsAw9FkcFLX79WMRyeP5HVL5QTkaCDh4Ixea9/ngTv4u85Aoh5XZqyMicJ6+mD/thluuqYKLB/HSKSso7E1oa/j11EVmd1qFrHyqdHryH6EiA== 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=IRLdjM1Tp42zPEUNnoAANp7r+uXPEoASlSMhumKXYtc=; b=ClYDRqFsDqklSd7aG8blf2svL0HuUSgtP7YvmzQTsrGmNbItxFCWT9k+OlAbDO4FSoTKX63FsWpyo1WqZSfaeTyI2ZsIdJvMnxcfIlhQD1ma0KMF6abewG/5gpLzaqjUz8U5A9sFRigQ87flo8fTfQgZDnKFSH8HP77Vg4yEDS0= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:05 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:05 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Date: Fri, 7 Jul 2023 15:00:23 -0400 Message-Id: <20230707190029.476005-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: f79c4080-b55c-43b9-0f27-08db7f1c83f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: an/tM294jri15ajAlVNTvV2D+D9nWU9km5rzpTgEUOCmKB9N7uDbRtkmWMpfIe2g1VPP6ewodDthfTms7m+VPog1jqxV/iLpGm3UcXiS1lJ02QyGR75u5XpMxM3Ly43RWMsJrhR5UogOwqgsFxmAj51CLh3M1rMZSyxSY7UZYT2rOLJ34xJwdQDAPk3C5PQClnTWR/S3HHW/qfRQnBt4bgAxZXM98N5xNQR4+PXp1IRbtmOb+Yu+GHRW7C8mfFaueXycBIqQuSCDwW+T1AyqHcR4lQlEHD4CKdArl8r3AjZsAMTdSCU9S1JR4fLiTX1OoywrsC1ryK4IrpgAcp6tKr6/Pous3gYw9vCam6zGOSCY7UkPvMRDF0/pRu594ZnDdeUcYcOW7xXWs8CmD7bjdEI1oPtWJxtfGrnUt0Jr+vPTbVYBS98fhh2ZatKhbgmpySiD5qqZL9FUVbrTYx3c0j/bdXnb+41wh86vR9L0/odJV730AYvGpwMb0dlIoPBJozd9N59P3fKmPeSmngk9SS5+Ywy+D0dFd64gWS2EaYKx8a8nXgr61m1xvF/7CtDbfUuL/5nC0UVDiiS+0yJbt6xA7y+NFUr4W9DNxw/7RzsHWH4YyH13DXtciAy3RbW9 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(6666004)(26005)(1076003)(478600001)(52116002)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ga/XsqM02IG/dhKuryVd4tbKTagvTint63vVNji+mWEt15EPvDsdGGEgarP1w0OeLGY1nMCm7eo+iCctsvSEio77/HBTD/5xX/GMtUUVAckQxfOv5lgyHKR6jwvqIKrvZe3fA6bzu7AMSgXDCcHcO345aVXfQ9vQZmE24POO3EG2lVxITOwrUAGuuwOhcYGuDPuBHMPFMlVblxLsgbQTiyE0aH9L8n1P5ZpYP4rciCqmLU7fzZs4ZY+K0z9n81m0jLgCAqKVHg70erbproyESVsBQ63wmwEEJ2qwWtpQufPMAVaAgaabdnH45KRoAPmrQ73AHfN2lnCfejWJOpH82/gWkLDmzIVkbftfHElctCiOKHG1/oYw6i77aZ19HbVfAleVRqv/+dNTnrpWK939MhSr1gZ5SfKdDMI3rsXVGvil0yqfM7yi1s6UPWBOIL/MLlhCSF4uB6dbzF2PbUelLV50uUOYj3Dk6o1Vj/FWth58iqCL5qJzw0Jf3mavb/BdyBPyakpxnv6ktXbUmrChdim6JmCQqFzpOT2R8gchpgv2wcDZZpgcfH9wr0rOqKBJ9zNVENaZdxWBcm5sq6RrUwaVrmmbuY3q2+gt/3nqhvAJc0MziHDIS2A8j/3+Ts+/Ubi0qVk0ijoRefbKAMDZaCKZF/AXYwOAEqOoSCqXelzwkMSAbHK/SfXWngOgR9URTbrCaea35H5KGESn5VgtrE+S4xAAxqu6GPfnBtOmA+9oBMFYrdqesWQArVw14qaNWFDTTycbb8+MdwuNxX6dJablEvGyRUYNR3Mn3mRn2c8kHySGg5l9Yb2Cfs2NQh5A16pWGRquv0ieA6HFz6cXsapPEJwAOPjmgSugsjJF1hsPz8xqwoRHwM0nYfALuIuwqgHdL/11M7wp7S2ui8VeItUWX4CnpVNdxqGuVMBMefYin8nfL2hXnHkD6OQuUI+4LF0jLFKLY+0OFihB5zN03j02bnAql2TiOV0xc0zT2WUW584g1k5D+0SzRFDQtLXt9z6ue6iNf0nn2kyJctIHZRPcVK5GR/0CEhMuV5JzJLAJ+dR50HkC9NPTfFZK2Q7KB4eWXtuZXiEeqENKtpHCdq0ZGs3nU9etuN8gHnchwaojsy1AC8bu2RKo7pWhKsr+K1kVzh3thI2mzh7gNQeM01+QtRdKxKsyBc3BqjNsDUaW7Ora/ThmtwtSjwdQjU/Po+LRmKE4l71a/JCaN2BOiVxTCTYWTmvFSbMidb/MO6JLIcYaDr5h+lolr3F2/KWRoOi5C66HB8LNl5Ur5C8M2lhsBxFGC4o6/+E2ILatlsbfGZwPyHyX37jXFCLmCyBkzo9mNwSNFBcNJMMVHJcqfA938Ct0Z2wNyQmIsuc7Ypf6kvO6dr2Ub860khgqLOlCPW22Ag4r5Bhrc8XODFgoZTnk0mvDp1q4ufZnz277XSqSPohG8FqBi5xK/UP+0SmVICxXdqd/3l+VlL9iS8kCd12M1hSaIkmj6DBlndo63o19O7soaAc45BnIJyd7vCfLyHln40vbAbFDiBVmfa6wWADtn+TIAEgyfrf4FaF/0UE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f79c4080-b55c-43b9-0f27-08db7f1c83f1 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:05.4397 (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: DYTC1E3AVcU2f0RNkSl43y1Iy9L9GbgPIgtrSuQyxeTjslDTXLpcVxEvtkiRfj/pUdbwYD5q3V6MUx+pO7nOKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Removes all ATTR_DSIZE_*BIT(BYTE) and ATTR_SSIZE_*BIT(BYTE) definitions in edma. Uses ffs() instead, as it gives identical results. This simplifies the code and avoids adding more similar definitions in future V3 version. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 21 ++++++++------------- drivers/dma/fsl-edma-common.h | 10 ---------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 2b91863502d4..e0f914616c5f 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -154,18 +154,13 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, static unsigned int fsl_edma_get_tcd_attr(enum dma_slave_buswidth addr_width) { - switch (addr_width) { - case 1: - return EDMA_TCD_ATTR_SSIZE_8BIT | EDMA_TCD_ATTR_DSIZE_8BIT; - case 2: - return EDMA_TCD_ATTR_SSIZE_16BIT | EDMA_TCD_ATTR_DSIZE_16BIT; - case 4: - return EDMA_TCD_ATTR_SSIZE_32BIT | EDMA_TCD_ATTR_DSIZE_32BIT; - case 8: - return EDMA_TCD_ATTR_SSIZE_64BIT | EDMA_TCD_ATTR_DSIZE_64BIT; - default: - return EDMA_TCD_ATTR_SSIZE_32BIT | EDMA_TCD_ATTR_DSIZE_32BIT; - } + u32 val; + + if (addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) + addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + + val = ffs(addr_width) - 1; + return val | (val << 8); } void fsl_edma_free_desc(struct virt_dma_desc *vdesc) @@ -623,7 +618,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, /* To match with copy_align and max_seg_size so 1 tcd is enough */ fsl_edma_fill_tcd(fsl_desc->tcd[0].vtcd, dma_src, dma_dst, - EDMA_TCD_ATTR_SSIZE_32BYTE | EDMA_TCD_ATTR_DSIZE_32BYTE, + fsl_edma_get_tcd_attr(DMA_SLAVE_BUSWIDTH_32_BYTES), 32, len, 0, 1, 1, 32, 0, true, true, false); return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 242ab7df8993..521b79fc3828 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -29,16 +29,6 @@ #define EDMA_TCD_ATTR_DMOD(x) (((x) & GENMASK(4, 0)) << 3) #define EDMA_TCD_ATTR_SSIZE(x) (((x) & GENMASK(2, 0)) << 8) #define EDMA_TCD_ATTR_SMOD(x) (((x) & GENMASK(4, 0)) << 11) -#define EDMA_TCD_ATTR_DSIZE_8BIT 0 -#define EDMA_TCD_ATTR_DSIZE_16BIT BIT(0) -#define EDMA_TCD_ATTR_DSIZE_32BIT BIT(1) -#define EDMA_TCD_ATTR_DSIZE_64BIT (BIT(0) | BIT(1)) -#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(2) | BIT(0)) -#define EDMA_TCD_ATTR_SSIZE_8BIT 0 -#define EDMA_TCD_ATTR_SSIZE_16BIT (EDMA_TCD_ATTR_DSIZE_16BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_32BIT (EDMA_TCD_ATTR_DSIZE_32BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_64BIT (EDMA_TCD_ATTR_DSIZE_64BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_32BYTE (EDMA_TCD_ATTR_DSIZE_32BYTE << 8) #define EDMA_TCD_CITER_CITER(x) ((x) & GENMASK(14, 0)) #define EDMA_TCD_BITER_BITER(x) ((x) & GENMASK(14, 0)) From patchwork Fri Jul 7 19:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93FA6C001B0 for ; Fri, 7 Jul 2023 19:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjGGTCV (ORCPT ); Fri, 7 Jul 2023 15:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjGGTCU (ORCPT ); Fri, 7 Jul 2023 15:02:20 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 133862703; Fri, 7 Jul 2023 12:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CT4dfCtgOlF6DjeLJZdMvaYzhVwko4m3pEJCZyA6dscWJ57oLoYX9WEq2CmeUpFrnOFSR1n/OIrkbMFUAHTvtdt8FH4TksUexEP6PR1ThN49lecms4XEfvOoESpxvAIXmJJucnrUrd2+EpEFQO+NVql1d3+Js5CAMMdJenNhJbJZ81Km5Tz0vloSVJWk68cz5j8eHuUltF4JzHK8bTCEE/Xro4LsjKFFVKGe5acxiBdQXnjE9fc9hs9x3E+EieruglZG4Z2viHQLH1XIwn0wL8M1BzyJAbs4GkFnnLsJmJPK2IoA98gTiEp/zAedqV/9FmTgYQkVuIqdxKWDaUidNQ== 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=QJmS0fv87A2m8ioygrPmKl4m0cZ6ysbwH8gW689zRcI=; b=XJmqzsihht4/aY6wJ2N8yDiySJo/6x9B6oSfgBEb4uNtpb3ygFybWnYNYeVGplV1mQSwlyppjGuNVldi8fwASf4O8//IIzcunv9qTXx+FjWmOIjiBt2Y/4+HbARtlZKNSYA0jBdzw0Y66vkgDb2lC+JVviRbzkTp889iYVWS2FSuoXnXYgjt2/3+W6zIT720SOzzkxCQLonSUhZZv5WKgtJKKkR//eDsOKJvy/16+a39kRe2M9nfVvgGZccdm3W78ZWXJ1SGgov74pafJeZNlSkIb+RyC9qbRo+aF0msTctjPjIDqpdsPsW9oYBz5+Qvz/UHFBvDWXERlOMg4rD0Iw== 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=QJmS0fv87A2m8ioygrPmKl4m0cZ6ysbwH8gW689zRcI=; b=b3y6BD6+v3IEDK9H1ZovuVVs9lqrZGn27yuccjEzrVReQ8qAzJRotMEjHAf/8C2oLrZILhnzTiqhj0z9IyR8ia/CKVXFvao67mZ7lSIGt3wYY78NYUYVMPFO0a+fTs0eB8xkRg3C/Lpk3q5zUi11rTCFmBmkYVYKzoMxFZMLVyM= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:08 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:08 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled Date: Fri, 7 Jul 2023 15:00:24 -0400 Message-Id: <20230707190029.476005-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fb60481-d08a-4368-7c83-08db7f1c85ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nUl2cdn2aGFo+0eJNaDBOe9AYU+fTGC35uh50lUkcs+q48BZ6CvvmpKbjeQXIFLmQOG3cu1mTaNPPNL8bsVyv5CW+w5UVeuogWM/IxWAMl0xh9aZT1CMgxXa6VNk6/uVqbJM5D2iUmxwqjITOjgAKWAFZpMDgZpU/yxeyl67qwUwcHVb8hTLEH5AW2r0SJdmsjgPZYl8JcRe5H3b0QqNmXmzdmQcuuoFgl5KDsm3icHn6baymvrgGvJD/JZ3i9TaI8a5AgnRK1rty9CDL2ff/yjRMXixz3aWzuBajFp5J9sKlCh6gWV4FVHTh8HHSVMpslwyFMPv7zecdZam5tq2l7SEJMz1jUfv30eSCEQ2UgZOK/EiKnCluwbVYCpZesPN+Ga6xnfrXtdmGLN8vgZtjil2IHiEWwVfi0wqxFeGDqLFVmxFFubXfF8V99RfjzJXvFXWi5BSXCvWbY5FiA9lEj4oUxZF+px0rZ8rCBFJf9tnzUOIB279W7OhlAT2JmV/ZteJikxv36p93QN7Wm2PCgyE4zX//8irAs48S2LClNBp3vcCh+vtv4CP09DABwbk9R00DN/wXhmJGEzJ/5ZmXIGSCEoc1Isf5QlxPDUOXr8jsTDPW9cTGKW45+Sku9QX 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(6666004)(26005)(1076003)(478600001)(52116002)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KX8IDShrTUyDpKgEWcw/8mK5xgaAsmOyuToknhoo8cnugx9K7hQmmVZQFVuckF4hU3LYkloNxJsnPIfdMA45Zf0akBwJ/PRdL1USEnYVop44XkgynautCvSWa34kTH9dUABe2EfMliLP1I84k+Dz2CA3fwZ+wHn0xi11s8ck+CopOdynCwCN71Mo1p+saX4cC0122DP+QmKmHmeqeb8r9/WVpm0zzYRme6A90T6idHzrA2EpWgFz1Ub6tzyYlXy+Rqy2pvooC7H4kgHxDn+jrR6Vcy3qHX/TfnRofbmw3KaLEtAt2atP0xuIY2dvAThVAAHO8DwIqGDl9Kij62Jyqs8BKUHsjYm+BlhI5W9UbNxqb5j96c+eEhI0zICaRnTURy35mZXo+QElNyqtl5Soi6dQePNm3EKjxbOMLfXX9dWW5lPEkx8Kw9OzsJvSUOHc/dfbu2JLZ2ai+49+TPb2yEQKWyygcLth7DZqoZfSmyWaFZJKu1MUTHcxX8kGrQ2TE3GB52r9qc9R372/z73RV1IAyToddMu3Yr5Z9kQi+hSFIbjEHfTZItkadTXb3yogHnEW6dOb3F0fHaH5eD3SkzVdnO0O790pYkH1oBxFVFo4YyGNR74SWEwRtjfPVmq6NU6nqq1XJyPdkBiEfd854zYbI+9A396nRFRkRnRbHl8n2cqMd+CyTqugaZg/e0pQ3tDhIOMsqUTPPa4JOX8lAWUdnUixKHofmQGyqnorW+bdlpIHZcnAoUKbUiXFRtTPU093Lw3MTK3lCzUeHPZLrsnPqtuYZ4kZSCAL5WDvjM70fxbf8uywgIaCNhVIMVldWJ+L+QqDth3jzzMUBziwnkqyub3Zja5/IJb86L3T6Z4HQ+hyvlZaM42vDMRrXUAG0gzesX4jCgG4hhRB1BGA/X+BV7gCMbauSb3ByqD8JaC1ndfryDQyuiUGCZSW2af9sq4D+Jhta19VJay9VuHWe95oq+XnVH8R3+PVmh36bbNDuOzC4yiqLo5yyt50Yw/kxj/OdFbZ4jU85OIQ7yEwehpJRoHod0bM7HM+KLgQ78pTyWCP0OKi4qR5YnHaFxDzojqx8LiImxhogI6/Kh+8q9Lk7caEOGF29VkcqYHMAzax7Otwp1jTqip9QK22yqi7IKS9ucMDosHNM/HQwStjAljgX+TBE93/fX1kimdwcYVqNbo2qMxOPaIuhZYU4yCwhSsw+ik9MumxPgsqnzdE4nZ9jv1bIEC+5WGVii+noFn/CWznaYW8FdwAuE8ktVWVehAbeJZ02mgOTJC+DY1hYZMNcjXQe2vWDsqMEcsq3rjoD050aZ8sv98OR6OJW9h0HrS0gp4UpoaOcgh/RHf9PGT7M6A3mdeE1HC7g51JffIEXS4bf4AXIAVy3+bB8CD4hZkVI/z4j+Dztvc9mAZloU/6axc19qUYQkYG+rBQA6vcG01qIVUPNrVQm02VGevtw6uUSxo9xqMcj30exSyY1UdKYKly3/oWN5PAtME2BVjMsyEDVNDM57AXpwcsRRQpI+xCADkI7L21xOa0PkJFuI+0zN5hDcmPGK0oiAuZPqc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fb60481-d08a-4368-7c83-08db7f1c85ac X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:08.3022 (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: gvGg40tkR7LT7IkE0TOApwHHNefAnFSmKg9JEy5EL2vYMf0v19cqRHXkQeOOWq3PTO+pmI9jJw54yPbpmBF/tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use devm_clk_get_enabled in probe code to reduce error checks, thereby enhancing readability Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index d974db8c1776..e70cd39bf45e 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -277,17 +277,11 @@ static int fsl_edma_probe(struct platform_device *pdev) regs = &fsl_edma->regs; if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { - fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma"); + fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma"); if (IS_ERR(fsl_edma->dmaclk)) { dev_err(&pdev->dev, "Missing DMA block clock.\n"); return PTR_ERR(fsl_edma->dmaclk); } - - ret = clk_prepare_enable(fsl_edma->dmaclk); - if (ret) { - dev_err(&pdev->dev, "DMA clk block failed.\n"); - return ret; - } } for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) { @@ -302,19 +296,12 @@ static int fsl_edma_probe(struct platform_device *pdev) } sprintf(clkname, "dmamux%d", i); - fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname); + fsl_edma->muxclk[i] = devm_clk_get_enabled(&pdev->dev, clkname); if (IS_ERR(fsl_edma->muxclk[i])) { dev_err(&pdev->dev, "Missing DMAMUX block clock.\n"); /* on error: disable all previously enabled clks */ - fsl_disable_clocks(fsl_edma, i); return PTR_ERR(fsl_edma->muxclk[i]); } - - ret = clk_prepare_enable(fsl_edma->muxclk[i]); - if (ret) - /* on error: disable all previously enabled clks */ - fsl_disable_clocks(fsl_edma, i); - } fsl_edma->big_endian = of_property_read_bool(np, "big-endian"); @@ -375,7 +362,6 @@ static int fsl_edma_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA engine. (%d)\n", ret); - fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); return ret; } @@ -384,7 +370,6 @@ static int fsl_edma_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); dma_async_device_unregister(&fsl_edma->dma_dev); - fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); return ret; } From patchwork Fri Jul 7 19:00:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B0F4C001DD for ; Fri, 7 Jul 2023 19:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232662AbjGGTCJ (ORCPT ); Fri, 7 Jul 2023 15:02:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjGGTCG (ORCPT ); Fri, 7 Jul 2023 15:02:06 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2049.outbound.protection.outlook.com [40.107.104.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E1F32696; Fri, 7 Jul 2023 12:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j8kRQPBcG/PQ6zMVNfhGFOEXZSj8LoMAzIiSM4j4TfQ7LORavvgBDu1PCxICIoqcW4Il3Y6Tl/gZJao/HhY6VENAb8tAMHTtmTfv80IfZ3N+j0RfKaw0F2TlXtJiydp575ZxgwFWv7IMAst4N8t7l5dpk0+WSq8H0FHIjjbd2KFz2L+6IS3tCrmwK5KxHYJmhnw88+jYnmmoL3T/VI2pWZp0CGKGk6/D4m7SlKwuXZE/Mdcy/2W594EsuwjQ5TV7kP2pajmc5o/UscVAmfcnsI1UXkNU6YMVwDKPK19gzGIdAVdpIbkpDWVSbUXJ6j48qh26X/JONDx1UmrJjWZCpw== 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=iYBoFoTV/QstaSfXbdLrZSLgnkkozEypR7b08wPTWj4=; b=A0ZfZ8z2nMLEexOxe4M3ktuLsmIpytYSknoDEZQoSetcbeGBgZELs5bdnYCnnIk15kgrFbeRS+PhbYfuYwsfYWSebF5n+2qjhhqvGXNKEk6LmPMkaqhcp3yS7SgpBAYtLVt5AZMAedd3mZlZY7EH1/uHwljWqsRfLhiIdFobvZFnGiRfgbYhtJeHPmS/weRncZ4Fj4lQ7bBy03/a1EzFrqItjOuUTiKCUuR+g21128/IAnTHJ6s9r8X8tQRT+SvPIHbN0yLzUa4OuObQxTHgpQBfS9rymSRWl3lMgcRrxfSmsWoqziHWWjR9xuvMI1NZziCugXQuWBCTryK4GfTFlg== 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=iYBoFoTV/QstaSfXbdLrZSLgnkkozEypR7b08wPTWj4=; b=kyI8noSBQZx/6q7GKXFslqwLrMxFh6tEHq+IuOpqv4/pi1acU2JgLZL+2yTmT6PMUd7ovf9dpNmFdIoCaBbPVTkuDL3wRbkyy4z34sQxc8sycIEpl0l1YOlGEsykawqBNVLQBNAHMoG0QGRzqp9r/zsbSbioFOuMVzl9c0IwJRw= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:11 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:11 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 08/12] dmaengine: fsl-edma: move clearing of register interrupt into setup_irq function Date: Fri, 7 Jul 2023 15:00:25 -0400 Message-Id: <20230707190029.476005-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: b2042b6b-dce9-4fff-254d-08db7f1c8763 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qcq7wVuhd8n7f8pXJFOckW5s5kOvdmpVsz9HAbmiwoYVcU9uF9RXp8KRG97dDDzJ5iluNhFDu4nvC2YCCJXzjFYGxa1ob44swGNF+Lua1gquLkBSh5Zs4jeX/3a0Y58CJ37BoWxdZfooxn7rE8sb26kkLl0bZmQ3mOzwLhUNl0T6JEdS4jMV9nVo8AnvsY1YET0iOPYKQdoK/kbeXHJd1HDFpyyci8M7o49BRc2jdXVh7eOMbcEhH9GfAroPYB5+2zy6bnNUh50pUqFQYKSwGyE6+hg75pLTuWrupuk29OMErdwTa3HmVAXlvHeh9fW3qXhk3Okl8BH0RSqJWFMZtLL+wmHbb/7U+YvapE3XyIotX2wxIeNvLUIO/wZ0eK55OtYKB9kpr9xE5eT2N5gOTFlBRLdhhjvIlNWzPFQ5JmPKfsvMm94GM/cmI1uXqsU+fJVdphK8qRqRPMcEP51T1i+2ghUviaXOkyp4zfLJRXtEkvo1NkjLGq2pdOWVQU+cqpiXUY/qse/WFrAfZFheokrXjYibxVviG4+RDWBv2kSFoXBGJaCgXP+jpFQzKzl7oZbHFAft1tzTc5ubSD+WtZ1e+g+PMDrtOUExPcXoh1Vn9C7SDPNdMjVLPiHDPYVC 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(6666004)(26005)(1076003)(478600001)(52116002)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OBmle4fdfKhLoHj3o4a29v4t/B12mIT+0e0jyoXc++YA17ZDU50SnIzR0ZPnxaSTb4Lk2Usd7FL6d/oHKIWnD6K4okQAbRJ03YECnKXoi3UxZGdaFNyLPlTtfjf9zhtqzwM7PhqLDuNXd7w1DHOY11ZPOuNf2pgC2VNuLHjO95NhUAu3vB0oysx+2HSg1Ruod6sbLs157ebTrol7oA8Ne+QFCG7knTcuL87sMDA+XnazXR7YUjm0BHHiItgVUGmcEfZmHoCTtFwf0Gb/eU+GBzgaXx6AUKUzYKd41eqN3757F+zdvZfvQjcCkXWYdjPJLUA7eVqfVwpk3W4B5LRl1e8HrDYQVNczIOwdckqV9dQlrJzgSA4zhBpDRb31D6hWRad9Ary2WO0h+m0oTYlHDc3mFm168joNrUKOGiaxRKlcU6R2BvSVkB3qHA9gbMHk2k9HfJT8g2Pokhi6aPt7oGhY3VZnMEDzLpJTL5R3IIWI49PfJAkI1HqYXQ5BlhPWCl3q2GfDFnlkS5sG5sPIO9dA0C6jQkd4vG5wScdUU7JLE0CjzGCUgOpv5YkEAfy0/vmMTI+6zhcrCUBYKd1hhD6He275ZCHJSL5UnOGtXMVDfd3+b0Ad17ErgcwYuCviYzxYF4AIGCFFkFn9C0jIVtAYDGpRt5uz+J412SjwTJD5ILWb3YO7bNAeS8i/sYcFFe1PkxyKWNQ9MTicQjcd7E13BD3kMO+sD+jF6qR6qaYOmGLHSdfBWkERNTvHXYhjg3b/yArfkxfJyx7Dqe9F89dSATSXIhU8qByAmGB/zZ9rNz6d+Cti0fJhDcFlPC4ZqO07Q6fVfalunRD6eAW7qUKSEFV08I784LIjhM2+LWWC462h8WSTtly3jE+tSTSCBIdjgzl7coj/KinmuBYwk68EtNyhbGnaB3V+dQgYmO4n4HrRXJHu1mKc6B7LY/xUFirY0TnPF1ur0E792xDWoSyHroMRxtbh0L0zmFEwiPlUN4BJobvBS/+0/i7WOB7jH4yWGOV8rfQY63Aa+fEE8iKKcOebyc7ftXBtKuKY8v13hze0LAIls223CN33owKWH4i2UpY7cmDSCFhnKRoUlWEPrwZ14EPS/eO3TY2Qr+gdsKVwNkfyOcCMCNBjonMVUh02QGBhTvO/SPVHXmjO9j7+y8Jyu/ehm54jaS+g/P7y5Os9PKk6adiFZyyYeFPPDARmgIVGUzxRIFZo/7eii4YYuHfw4Np64W20WMTRk5JY60NvO/QLPvqCLWuG9rR122GGfPFe5N3zqw3atADx+2ySJJRRL0sekQ4RQ0WdL6EqdP77GT9Vb7VDfkOB/Vm79be66P3mllj6Y3zCob6SpjwXK1PJcgZyn7VLNSJRw5dkT21vE7EIGosctoggtgFFBUtFft8R3XDEf571ApFVV3mb8GagX5E3j/opa9+SZrS+EgqGVKKdF/PqENdVWXzls0P2bXmCA+fK4lxjrLS2mwZJ0flOHowuLiM4zuP/pYcxFbAsEhXQlcIH/cjZajkc8CcjS5fIqd3No+lxo8JyZ9CU1XgZ4pJPLgKWAsxYT7w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2042b6b-dce9-4fff-254d-08db7f1c8763 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:11.3076 (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: lT5uiU+ABWTME1GXdv3tLWNNH4VxuDiLMWMmmhCTgHAKSSqHUct8VxgeqQ53gOWzEKOOgoodnJ/PD/fepOYryQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This accommodates differences in the register layout of EDMA v3 by moving the clearing of register interrupts into the platform-specific set_irq function. This should ensure better compatibility with EDMA v3. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index e70cd39bf45e..04c07e9f45ca 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -113,6 +113,8 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma { int ret; + edma_writel(fsl_edma, ~0, fsl_edma->regs.intl); + fsl_edma->txirq = platform_get_irq_byname(pdev, "edma-tx"); if (fsl_edma->txirq < 0) return fsl_edma->txirq; @@ -154,6 +156,8 @@ fsl_edma2_irq_init(struct platform_device *pdev, int i, ret, irq; int count; + edma_writel(fsl_edma, ~0, fsl_edma->regs.intl); + count = platform_irq_count(pdev); dev_dbg(&pdev->dev, "%s Found %d interrupts\r\n", __func__, count); if (count <= 2) { @@ -322,7 +326,6 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma_chan_mux(fsl_chan, 0, false); } - edma_writel(fsl_edma, ~0, regs->intl); ret = fsl_edma->drvdata->setup_irq(pdev, fsl_edma); if (ret) return ret; From patchwork Fri Jul 7 19:00:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B36F2EB64DA for ; Fri, 7 Jul 2023 19:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232897AbjGGTDt (ORCPT ); Fri, 7 Jul 2023 15:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231249AbjGGTDr (ORCPT ); Fri, 7 Jul 2023 15:03:47 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2053.outbound.protection.outlook.com [40.107.104.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69842700; Fri, 7 Jul 2023 12:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oCi8IyIa9m2PnQ0/InWK/1JVCtUCsxl/XINBzlwOEUP0hiuel+LLy5T4mDPgA6LBsNemIKqgKHiGpRRYkfHQym8m7V70abhOCOTP9KbkdsPVKPoFODbgA96jrFxo4/ZdpTFYjGEbp56wb3wafQ/P/CrBHtWPZjJK2v/IVAU99FvCT7T2Sb2as/QiP4C59kVrJ7USqdCyq56f3bbeD3HPZINidCB9+vNa5+EtR/sdOK8owRbjIalYRz+NyBwboP2XUvonN9ayCM5dwg0uA62taULRHgF6oP5RwJkvZV0eJlrQApR/JcATioC01tBIboQyjD+KGCZpc4nPzNWHuEWDLg== 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=jCLhli8qcAeGElZvjPy3NGr1NAlNJ0LntWyYiGQJbsE=; b=bXpRrilLs3+gc4df7Jp3MDjqY3Z9iX9MvjTxEv9iVXqNBEM5rfRJ+oAw/ntWGfTY2M6JvyBc/Ka9QxDY7EPMwdmdbi/tZJE/39Vwr3Gp+8Y+huEs5G/TPbPiBOYazpWrdGAqlJJeZ+QOvBABPMPv9Bm50H9sMlbCNxjDzn5pUowkHKnSjUKMa9B+Ch3H3JfUX9XKF8zGBo93B8XHAsDs41bdb3+CJsbx4n8RrntgNY4/Omg68vWlvuxUgVf3e4agEvfpQ2EbrvQvzbHHz138qIS99AtO4VYoic8Nhx97L/sNpRXZdSdlve1+a46hbS1UiPqk/OgfSNfgDCImwy8u6g== 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=jCLhli8qcAeGElZvjPy3NGr1NAlNJ0LntWyYiGQJbsE=; b=SY6nBPBlJhgSULEexRdYFbV/7h/UN1jo5rG8o4K0kAa+8dCCOJIXcdyRr3dqYRSzh1+f/l8ICMIXYKXrtFKxgw5oXHQanKle6vYr/Mj1PubSs9BKxzZMvGasQ4ExQMToPPHF4k+O53oUs2YYiK+R2JI6hW5TlQgUWppZXrsGclA= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:14 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:14 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 09/12] dmaengine: fsl-edma: refactor chan_name setup and safety Date: Fri, 7 Jul 2023 15:00:26 -0400 Message-Id: <20230707190029.476005-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: 43d8f2b8-95b7-4e5c-e092-08db7f1c892c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HXamXaiN4YCATpoaDYnT87SQTOw6FrXEzAfN+FNs1tHRS0r10nnk9fIspNVpeubDEWR04hBscWzyxoMkRcNasekUDc4AJ2F8YQM6+LbdejtzDHHN1h63QHJAgaqT4YXx4wR0Ot5sbuX79yj64OowyYf3sk29gjXi0fseivqPWKDdIu2tuNwi+/JN2Ao4Bce/L23vmJ3SC4CkGS3ZIg81mkAIJfTcgbksExi6GjSDZrEv6WIY5cpTyvsn1FenYNJHGOOyHjc4U0b+sG9I2L94rIE6/ErVG9LFFAh+7SlKrd4Scv4Oo8656vDd2vn+Y6Ig8ljqW8okVywhUMD2wxPzoqLNxAjbjp0hlW82+BLpB8ftG3BXoy28LPZhFOFVtbeMq1Z8zcQFguQDqHZN8Xx2VCC9sMVzBMUv+eZDFe7WTVnRUKKTxYkNzFjN8xz1yAXZ4Jj9n6wHVwC2CnMyhf3KQ5z7EhyyL2Jxsjsqvam2N9BvgU2BgCJIj58khmultTUNMJ5VZWgJhE6mmI8nhnZPvES7AC6KrF9NtL9l3l+vaopvd0jYEC8D0I60zmYCcMPEVONd4SVjFBvT5QgC2vbMu4xb6nYP+IilcjNWsKN+3VpwrDHS/hOKGOYk9yOYEUcQ 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(6666004)(26005)(1076003)(478600001)(52116002)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fpapAFCiIBGWNIUUhrqNc0jfk7YJSKZcgsng0BQWiKN+wZAous6Dp8+FGoIFzE04dSTqaJ+r9XfznHCFp2N8rUPmdPuvM8rUU61Zezhca4MPSkpjp03kOoVegq26P9dEDbHxo1POAp5LOd2F2Wfyvd71gFjRij2dx+P3Q5kc2mefoAn86p4lBSmhGz1ms0309d3QV4hmpEwM5a6ZgOR301aRJcjgVRG2PFfDvWi2cCzsE1THpNsdc00mRM+wFC9ebqXF+Ug/eOFaaP/olOut6cOMXR9UL7HhY2T7U5BLMA/V0xiYz7f5DoaBr/C+yzu814m+CAqLC6Ipe6SAEHMZeBfubSCZpBY7T02ahJS9YFS1bykjhyyLe8G3FsefJ9De7Wl8nRgg9qEN1Q4ACoV8jog+tiE4aY4AeOiPVNwe7X7QNiGDRRN8ED9N/3zyfkGyd4KXIZvFIMkV3u8TvTltEnE6p9mcVVhN530bVEuykoBaP+xoZxURK98qO8oST9h8KCwPHEIZVIH5Z2yKbMtAx+mZgllQqtXvx4QlQsAx2f5Fa0pUkejg01b5AMcCNNiRfErY787FtBOHxliSME2t/St0C3cVASU5F81RACTT39FMk8loeEhKhmN3OzXk5++Feswpiq+wokn3cgTxh/XNjzkX0LPTBhbFEdiOwN2cZv/Xu3/3QWT0KovnrInsFOGtUZrUsVg8IoXJinii8bhQOGVMs5kQR9B6/3EqJHjhUTjsBtBZ2LDYCLCaHWXUUvXIHskKInNdWs3IFo8oG1KefRWWSDYg5NW8sRDtJ5Wq83lCHv0361UeZDH3nmFQsm+GDDjuq99Olg3+mVzBE+8cuzoFZfleX7AEg/HnY1D4as0mGDn5BN9fM2pkttXZmNfGqmftSJE8mpIarheMZEeYjdIOWTes8SETHqa+ZQAEDaYVZZ7XpuNCYPEf2Q8WIS66AeK2xBAIceZASovSLrUYl8nkNAfeoG5rCxLYF/bmk3YS3p3M6IccJVDSPoX4Rq2652vSLxOZC6fjImBpRnaPe+gHHuu1QSXsEY1QF630GXBIaDLcDvygQu3iuCymjie8o9kcxP9qG6EKEDRz0wyc4pbaVg+MWFVapnS/tptorCqQQrBBxUyFoUJX1GpTikOp0O3bcOQdkLsCGPluecf5NlL3OQyOTVm7VSmjRRTp5Jb1q9HRV4jaKG14suNxxHk3oZtPKBGXF3IK9Z7iStXzG//GOihHm6pnjTkrO8bNYu/3GzFTK/RqDeLT+t0qeiF8JsJpQimsR8+HBnA+LfzIoCrSNBz0Hhjv7K9w/R7z0VjypckOodpSPNdAdw4fFXe8SGNA0rYLAFNEIbTwB6LNeWvLipD+YbCeZHd3b2MUFG6Nt8VKr0zQkWoTvl3a6+7c6PHUxrFC9TPhqZ7sXTzAqtMP3ys5Kqw6qNWwP2thl88OB4vp6BZLB0Vxn2vOVOfXPKm4sbfgG+QITu77nz2nLktcqH9kTdXdZ6M+ANCMFEv0s6XDfpAb4qk7bDjV66n8ZTgFiZFA3FnRTuAEUMxeqE9aFvDBKlbz1nPjP72Hh8Q= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43d8f2b8-95b7-4e5c-e092-08db7f1c892c X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:14.1669 (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: LdSjKDKDVDJg6AknfHGC76t/29o+ASib6PuxGW8ep6UFalbehzBTes2a6w4QmLAkuAieyTBI+qxzW5LVJipQXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Relocated the setup of chan_name from setup_irq() to fsl_chan init. This change anticipates its future use in various locations. For increased safety, sprintf has been replaced with snprintf. In addition, The size of the fsl_chan->name[] array was expanded from 16 to 32. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.h | 2 +- drivers/dma/fsl-edma-main.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 521b79fc3828..316df42ae5cb 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -116,7 +116,7 @@ struct fsl_edma_chan { dma_addr_t dma_dev_addr; u32 dma_dev_size; enum dma_data_direction dma_dir; - char chan_name[16]; + char chan_name[32]; }; struct fsl_edma_desc { diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 04c07e9f45ca..d39bda95600e 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -175,8 +175,6 @@ fsl_edma2_irq_init(struct platform_device *pdev, if (irq < 0) return -ENXIO; - sprintf(fsl_edma->chans[i].chan_name, "eDMA2-CH%02d", i); - /* The last IRQ is for eDMA err */ if (i == count - 1) ret = devm_request_irq(&pdev->dev, irq, @@ -314,6 +312,9 @@ static int fsl_edma_probe(struct platform_device *pdev) for (i = 0; i < fsl_edma->n_chans; i++) { struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + snprintf(fsl_chan->chan_name, sizeof(fsl_chan->chan_name), "%s-CH%02d", + dev_name(&pdev->dev), i); + fsl_chan->edma = fsl_edma; fsl_chan->pm_state = RUNNING; fsl_chan->slave_id = 0; From patchwork Fri Jul 7 19:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6973EB64DA for ; Fri, 7 Jul 2023 19:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbjGGTCz (ORCPT ); Fri, 7 Jul 2023 15:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjGGTCt (ORCPT ); Fri, 7 Jul 2023 15:02:49 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2049.outbound.protection.outlook.com [40.107.104.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B57213D; Fri, 7 Jul 2023 12:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xb+xiCiTv3aEAaQYTyE3m9lO1kV7iiYqvi+2DRKcRgG0en4OlKjYBwTGkrZ2VAr6vqmdQjjq7mk7ym3tTdF/ceTKd47sGO4OgKMwFwZ9eltlCIN7mSH6FfN3E4qy+QYbTkAA6XgvslQfm2YpiwJ2E6DYeOQ8tO1M7nlQzWyu+uLtj3cIaB2FRQAi4KB88uD+doTag37jlSYJdifv/0IeQYbM69hdOJ1OGSDwgBqsjJjl71RzkmQqqfyh24rkRFuibaqpuTZeq5007tq/qYs4V7QmkErKAZG5gALuYYgLt/s03x1marksu+93APEj4Pu2KYPAUAOI/B5e9muicwNgtA== 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=nrNz5ylXQ5OWYrkUzvCBAPmoqz/ZD+kybMybpY/+CII=; b=Ckano1gMYbENP/d+oNmSE+uCtHBB2c9i/M+yzLgQ31I1aIRLDVWtbUU8vKoZMvOuyuJRSLzBTSlQDiVNaqIq+rhGBZIcrs5zKi3D+DLtQHYo6YYK/oOvrKh4XfyWD70DeVIMofzvMj3uM7irs9Z9fqytcefIhNYJErDjmHoD2JxFpJ7Cyv/6pW0iWulbnoLcp5f7Zo3CwSFMNO53FUag6dnV+yUN3nLi4i6ukhz5b1ALzb8rrn/r7f0n+87tT+Uu+jKB945spRjl+ItQbF5WQXDuZjSmV0xK793cBfUHYdJzp0UVRz70FLHMcXkOLcgfrm9J3nO0X2WAWFSTv6+E2Q== 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=nrNz5ylXQ5OWYrkUzvCBAPmoqz/ZD+kybMybpY/+CII=; b=qNDrjZvShklaS8+tgnyFjIwRsTOv27KYlI7dOKezCqy1Id3DtRIemEVJJalra/hA76yFwx3NHxyA9GChthAnKl5hdMylKO65JelZHFayH/Wu0Ev7qG7fPmZpVDxu0Lws6bSVBqW+aiTW0rNYjGBqsH8UaBN76TzXTi2h/yvviQY= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:17 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:17 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 10/12] dmaengine: fsl-edma: move tcd into struct fsl_dma_chan Date: Fri, 7 Jul 2023 15:00:27 -0400 Message-Id: <20230707190029.476005-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: 7547b70e-0d70-47b4-2707-08db7f1c8ae1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 85i3SeE1fgCr89HASTBVOdbNmCIAwUzfaaIIaVPh/L77V7pjgxaGnATc8KqJd6P6RZP0fuFefUwQoa/VSIFq/gLQYbTzIu/fEJ5ItiupIpZoVmgT0iUxxFqanquDvMeyqqmO8sPtp4CYrFbUB+8gn8/dQUA2jygtSRF6/sucvxwHlVQ3NApKCXMq78OdJhgVNaTe5SMdvv9ImQUIJUfSmIjr6ulzFPTML7yNeqfECnRXs7Lq8drLbyjOPJuB3+V/Cc0QbYi9vb4BxOppRpXc+rcTZjX0OuQg4MWoan+ufQfdqgmPYXwZmmaqsQODJHwRXjk/YzMoxjr4mTCMJRHnf1b8oVmCHj549zymGk15kdJTYsnUOj/lpFBZhw0O0w3YCWSHBpY5cJGnRdWwZ53tyl7lJjUOJDd/ki7yol3pxZOc9qk9HDROrTfh+YJeUmqnoI4CKwzoUrmyHtRT7ZPNLibCARaTwDzCfnRq/blifZINeARdmYkuPc54tkd/6LJoZpuUUXILtRML8+kFudRCEz1I408aEvk80XQkLNVNskA3K94MeGPA5V2FNaHlVu5an9CMIsGlGutd2Gs69OYd8I94DVjwJqs03A4uL0NpHns= 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(6666004)(26005)(1076003)(478600001)(52116002)(966005)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EKN/ArwFd/3aqAFknq09Bkomj092jdNuQBD/8bgSMJoXe8LjDwQMD0stGUvgm9NlK3hZtJuv9LSZ5bcHrURCZkdO0wQNnr6bqnE6St/q5tdzUwttkPNGWHIeZfNCFEhW479KiqalQLzdx3OU1wKb+XOc4nrS4ziyqTM5KcDpQ83UWErR0EiR+zT6+WkbOyLkltxFDZ6ul/ucfDpiRp1vl6gF8XVVJ/TWMccsy0/Re/MwPY7Pld9pawTAXQT7rLW4QAjt5n5YmTeEfaxgYZ/tle7sF8QEWfcFf59+V3kZqAgBJafgi0TfsB0W/8mkOFTUqb79iaTw9poh7e+Nrp39UiRP/BBqJwndf+KhXfG6H+nZlkfGzlL+DxO8SMF+r0yPv7SOVmXKVB6O4lGTK/OaegEfvysJyVUhpmygtpu69xEFRqiqgeykGkYSfngMjXJXELoaObyUrxMUjh6aKzsoR9Uj8+bYKexeopeQaYE0dBcvZwADdY4rafyPY8TmCSpMUdYsh+3TO+f3a2be+J2D6/jQTqqXeJr09Q1pJWunaA+GL6BOOzjnyO+Zbhxql3uJe5d2eLLym0Cl2esGh9aSg3twyZvdf+EHHUOpUjRg/TRpWFptZSiYLdGyLuJ71nsWGsivGssQlR1cQAEpg1RuWoJXxXLYeupDz0NOc13/NTjFOW0M7K+Q8jQzIBhaaYzMMgNWXlZPxK/YkMARUtujQM5pCjyIipZKrOs0MFg0Mh43A5KNA/zZ8W+jdBHHGKcl55v9vD0tK3/aHsgq71uJaEeTyBmu4ej/V/t97xTVLzD56qu7s0EXOWhIVbsUr1ATHl6qyt6F9wUtwOshcP/1pDQ70j22P4J/ZoiB0JcQpg5IIv5ogFzi/WIaEcLXBL2LcTmvO8X8JcAyD83tzzwnVa17Lg+8QPrx8wLzNxOa92k0C1cZbkv4NmJ66fLv0dFxF1l/p47oiP14MZ723S2sRBxbRzrUhsJ9WPhWLZsYvkAhrAelBFnyVK4q2tGBESy0usFg483z/Iw9TLP2T/TZmqWInEXWI8/eHpiI+wNXSaxi8fLKp7UeL8QxJaryXBSsp+yYPYRGtTCndD4ytKtU/icli58xSIgHPgR/NjetrkM5oeAeFSrKVNGyhjFUYQktJhAgNXA37ss0eE5wOpno3YCtAAnInrKcIv48bDmQ2+bdcNKzxGM/aV1o7nfcac1zRrDjfuwkFOtn0ZHli3FnQbT4XUahejWSnsTdavAw8Tmzuv3tOPMX8Ld/E5EAL2BEt9SXij7TGOGSlclLXrccyfsofG7uJs6bifZKk7cDZbtwYW7/8D+Iz3uZ+ylZ5auhs42vmSXxXM7kbiR3SFrnTOl3cIhxUCNKhJO9MkXi4523X9oe2xQf/NyrbIEk7CTG0LPYwuDnCqDLAdLymoWmmIXl1wjELbNh8T6npk/7Tfgt7mTMiDdybperv3+oNJZeMBHlZIuR+VIJmnOb1ET1mgGfTYsDEgdgIabCe6FC0+J5EImTQb5Iv1B/nIwfgDys3qt5JO33dZoQ85pE2yuFIBFHAwU+rhLf97efJNCAzcI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7547b70e-0d70-47b4-2707-08db7f1c8ae1 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:17.0675 (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: iuhw9BF73K2SCVBKgc/OZfuEI08hmomoCs4GqTOjSwOJQS1Nd7H3o0s4Ahql+A5xN9lGj2HQY1x5LYAT8oZ5uQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Relocates the tcd into the fsl_dma_chan structure. This adjustment reduces the need to reference back to fsl_edma_engine, paving the way for EDMA V3 support. Unified the edma_writel and edma_writew functions for accessing TCD (Transfer Control Descriptor) registers. A new macro is added that can automatically detect whether a 32-bit or 16-bit access should be used based on the structure field definition. This provide better support 64-bit TCD with future v5 version. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202305271951.gmRobs3a-lkp@intel.com/ Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 38 +++++++++++++---------------------- drivers/dma/fsl-edma-common.h | 22 +++++++++++++++++++- drivers/dma/fsl-edma-main.c | 6 ++++-- drivers/dma/mcf-edma-main.c | 4 +++- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index e0f914616c5f..13c328728025 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -40,8 +40,6 @@ #define EDMA64_ERRH 0x28 #define EDMA64_ERRL 0x2c -#define EDMA_TCD 0x1000 - void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) { spin_lock(&fsl_chan->vchan.lock); @@ -285,8 +283,6 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, struct virt_dma_desc *vdesc, bool in_progress) { struct fsl_edma_desc *edesc = fsl_chan->edesc; - struct edma_regs *regs = &fsl_chan->edma->regs; - u32 ch = fsl_chan->vchan.chan.chan_id; enum dma_transfer_direction dir = edesc->dirn; dma_addr_t cur_addr, dma_addr; size_t len, size; @@ -301,9 +297,9 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, return len; if (dir == DMA_MEM_TO_DEV) - cur_addr = edma_readl(fsl_chan->edma, ®s->tcd[ch].saddr); + cur_addr = edma_read_tcdreg(fsl_chan, saddr); else - cur_addr = edma_readl(fsl_chan->edma, ®s->tcd[ch].daddr); + cur_addr = edma_read_tcdreg(fsl_chan, daddr); /* figure out the finished and calculate the residue */ for (i = 0; i < fsl_chan->edesc->n_tcds; i++) { @@ -358,9 +354,6 @@ enum dma_status fsl_edma_tx_status(struct dma_chan *chan, static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, struct fsl_edma_hw_tcd *tcd) { - struct fsl_edma_engine *edma = fsl_chan->edma; - struct edma_regs *regs = &fsl_chan->edma->regs; - u32 ch = fsl_chan->vchan.chan.chan_id; u16 csr = 0; /* @@ -369,23 +362,22 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, * big- or little-endian obeying the eDMA engine model endian, * and this is performed from specific edma_write functions */ - edma_writew(edma, 0, ®s->tcd[ch].csr); + edma_write_tcdreg(fsl_chan, 0, csr); - edma_writel(edma, (s32)tcd->saddr, ®s->tcd[ch].saddr); - edma_writel(edma, (s32)tcd->daddr, ®s->tcd[ch].daddr); + edma_write_tcdreg(fsl_chan, tcd->saddr, saddr); + edma_write_tcdreg(fsl_chan, tcd->daddr, daddr); - edma_writew(edma, (s16)tcd->attr, ®s->tcd[ch].attr); - edma_writew(edma, tcd->soff, ®s->tcd[ch].soff); + edma_write_tcdreg(fsl_chan, tcd->attr, attr); + edma_write_tcdreg(fsl_chan, tcd->soff, soff); - edma_writel(edma, (s32)tcd->nbytes, ®s->tcd[ch].nbytes); - edma_writel(edma, (s32)tcd->slast, ®s->tcd[ch].slast); + edma_write_tcdreg(fsl_chan, tcd->nbytes, nbytes); + edma_write_tcdreg(fsl_chan, tcd->slast, slast); - edma_writew(edma, (s16)tcd->citer, ®s->tcd[ch].citer); - edma_writew(edma, (s16)tcd->biter, ®s->tcd[ch].biter); - edma_writew(edma, (s16)tcd->doff, ®s->tcd[ch].doff); + edma_write_tcdreg(fsl_chan, tcd->citer, citer); + edma_write_tcdreg(fsl_chan, tcd->biter, biter); + edma_write_tcdreg(fsl_chan, tcd->doff, doff); - edma_writel(edma, (s32)tcd->dlast_sga, - ®s->tcd[ch].dlast_sga); + edma_write_tcdreg(fsl_chan, tcd->dlast_sga, dlast_sga); if (fsl_chan->is_sw) { csr = le16_to_cpu(tcd->csr); @@ -393,7 +385,7 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, tcd->csr = cpu_to_le16(csr); } - edma_writew(edma, (s16)tcd->csr, ®s->tcd[ch].csr); + edma_write_tcdreg(fsl_chan, tcd->csr, csr); } static inline @@ -736,8 +728,6 @@ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) edma->regs.errh = edma->membase + EDMA64_ERRH; edma->regs.inth = edma->membase + EDMA64_INTH; } - - edma->regs.tcd = edma->membase + EDMA_TCD; } MODULE_LICENSE("GPL v2"); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 316df42ae5cb..cfc41915eaa1 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -48,6 +48,8 @@ #define DMAMUX_NR 2 +#define EDMA_TCD 0x1000 + #define FSL_EDMA_BUSWIDTHS (BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \ @@ -93,7 +95,6 @@ struct edma_regs { void __iomem *intl; void __iomem *errh; void __iomem *errl; - struct fsl_edma_hw_tcd __iomem *tcd; }; struct fsl_edma_sw_tcd { @@ -117,6 +118,7 @@ struct fsl_edma_chan { u32 dma_dev_size; enum dma_data_direction dma_dir; char chan_name[32]; + struct fsl_edma_hw_tcd __iomem *tcd; }; struct fsl_edma_desc { @@ -156,6 +158,16 @@ struct fsl_edma_engine { struct fsl_edma_chan chans[]; }; +#define edma_read_tcdreg(chan, __name) \ +(sizeof(chan->tcd->__name) == sizeof(u32) ? \ + edma_readl(chan->edma, &chan->tcd->__name) : \ + edma_readw(chan->edma, &chan->tcd->__name)) + +#define edma_write_tcdreg(chan, val, __name) \ +(sizeof(chan->tcd->__name) == sizeof(u32) ? \ + edma_writel(chan->edma, (u32 __force)val, &chan->tcd->__name) : \ + edma_writew(chan->edma, (u16 __force)val, &chan->tcd->__name)) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. @@ -170,6 +182,14 @@ static inline u32 edma_readl(struct fsl_edma_engine *edma, void __iomem *addr) return ioread32(addr); } +static inline u16 edma_readw(struct fsl_edma_engine *edma, void __iomem *addr) +{ + if (edma->big_endian) + return ioread16be(addr); + else + return ioread16(addr); +} + static inline void edma_writeb(struct fsl_edma_engine *edma, u8 val, void __iomem *addr) { diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index d39bda95600e..7b15f3c1838c 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -321,9 +321,11 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_chan->idle = true; fsl_chan->dma_dir = DMA_NONE; fsl_chan->vchan.desc_free = fsl_edma_free_desc; + fsl_chan->tcd = fsl_edma->membase + EDMA_TCD + + i * sizeof(struct fsl_edma_hw_tcd); vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); - edma_writew(fsl_edma, 0x0, ®s->tcd[i].csr); + edma_write_tcdreg(fsl_chan, 0, csr); fsl_edma_chan_mux(fsl_chan, 0, false); } @@ -431,7 +433,7 @@ static int fsl_edma_resume_early(struct device *dev) for (i = 0; i < fsl_edma->n_chans; i++) { fsl_chan = &fsl_edma->chans[i]; fsl_chan->pm_state = RUNNING; - edma_writew(fsl_edma, 0x0, ®s->tcd[i].csr); + edma_write_tcdreg(fsl_chan, 0, csr); if (fsl_chan->slave_id != 0) fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true); } diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index 316e637b00c4..bccb5448e492 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -200,7 +200,9 @@ static int mcf_edma_probe(struct platform_device *pdev) mcf_chan->dma_dir = DMA_NONE; mcf_chan->vchan.desc_free = fsl_edma_free_desc; vchan_init(&mcf_chan->vchan, &mcf_edma->dma_dev); - iowrite32(0x0, ®s->tcd[i].csr); + mcf_chan->tcd = mcf_edma->membase + EDMA_TCD + + i * sizeof(struct fsl_edma_hw_tcd); + iowrite32(0x0, &mcf_chan->tcd->csr); } iowrite32(~0, regs->inth); From patchwork Fri Jul 7 19:00:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 017EBC001DF for ; Fri, 7 Jul 2023 19:02:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232908AbjGGTC6 (ORCPT ); Fri, 7 Jul 2023 15:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbjGGTCw (ORCPT ); Fri, 7 Jul 2023 15:02:52 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35A5626B0; Fri, 7 Jul 2023 12:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=meB2FAmtv8MtEU1cparmmkR5Je2b9PInQSJ2jDEZKvJ9iXYZViJ8qedk66DszrJ6BH2C+VOQ7iBdNX+XPfVI9Fr77FcOQWuauM2MBAYO1bxuv+3yzr0hucd4kdEGu1iHbRylp05oroDK2teBCNymp8BjWBd06xRc0bGsqWriJ7fKgr/2uL/hjEoKkWgMwEoEr76isIqQuULsoAaX3PItdpzsK3b7qFwiRVSqx9SLJ8uJ005LR0aVgDGwf3xCJlpJA37awXzeyRRhLNiYY6IMMNinigMRHkZc0+9Y3t5OR58SJA0R5yrQCgpk4zWjpkNpuUvYvMHuI6KpmkA/ZqgcZw== 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=xq4Iw/E/mh3cyEFC2hAms1m6XpyOfkMliNlCzrEMfG8=; b=YYt6l4kzZqTAFDR8hOFs0J9PncKRSOm1jFBcBqcsrvffII9WtspuIyHHV9zH8woGWoz4euohlcCTtbkk4+PMGH8/qCJ4MDCJC66Gdebcs2ZerSvmSrnzqXODwHbtCDaOfaiE7HuLwtjerAQBN7lPC+8kvsXRgDNNUt+3tde/g+d9mds4NBZMKhxFRSbWxYp4ti6GHSlfdsJfXuV+8qlRpZ46fZFj6jd0jNBixBFbfAm8qSvsTqwGLYSLzizhMc3qTS17UauskrFoMEIFXcP9XmLDAulmQotSQdyjtboCyO8AvmfAE58H0BSF/MKkWBtNeGgdgWdlAxpH3sMpI3tnYA== 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=xq4Iw/E/mh3cyEFC2hAms1m6XpyOfkMliNlCzrEMfG8=; b=s/cHcFfFElE9BFMZjIZVQxFp5p4lGc6PXS0VQ5vb8ArDzj+VWLC/xde8H4y7J7PfrBrN1g1I0YfhmGmKEG3UyQzyu0MX48RectJkkbb/iOv50TTTLc6+mIl13yN9anB4HjwKp02gDA5RDi8CKm1mj33NhvraH9dGwMi/T2V+dVQ= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:20 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:20 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 11/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Date: Fri, 7 Jul 2023 15:00:28 -0400 Message-Id: <20230707190029.476005-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: 376fc933-a014-40d8-f6bd-08db7f1c8c9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l12cK/8IlIYplfZtpPFZ4lkPaIOaTuB/Bf9W/7NJV6VmlHBN2gteSxZeYlrjHYoGFyzN9u+hMQKFaMAPzlnSNz5R7wGyOGo5OeLZ66GeW8B4Mnv/TuuhGfGfXluiD4QbxxJsbsTXzp+MczNyyut4h248EsssGar0k7ePgGhD5jlaS8uELYJF59sq/cThsC34eK1FGapCThJzshPGONcEG1nE6lKoo23bPmN6jMMYFQpsj2BpcQdaMfwoauPfx+HUHAUJgYE8Fq7OAbE/cxjEkrptHjTxOHJzItZpU/Bw44ZL3DOAyqViW7ptghgNJtGknsWYW9Pc6C86Ocun+YzC/WQM8jXnCSnCuIt2QMwH+BBn7ri5kjFegY/JICZQWK7sncN7luDNVd9nN3AkT363v7Lyba3klxCPeAQ6fWm+hKnwoPSIH1jr72nGXqSAjOLrPkzqzflH76a2ZqG3l/lbTyWpDx6TxBb6e+2l5eZilwnO/HKeuyLQ42cQPBZaTInEUbLlgv6xRkegWD97tfu7Ac9m1Yr1EDtsrGIWjFbur6Z7BOBgclg2Ik95x8dTwBT/5JMf54S6gqD0re3vuDfqaZ/16vDSnpbQXbIClIahppXyhuyDxwisyucWAj5HBz7G 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(26005)(1076003)(478600001)(52116002)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sh5/dOQqIh9KPF7AxzrhwwwoOj3U6qvg/sQvQkwWLb0iseff+N4JrTznL9th5GuBB8P0ooYRBy4Pd5+hCoVSinZf0a/kVGigsTQWMgOyVNCIdFCT8RRWpth4bh1KrDL+6N7v06Eh98atR1/vvj5BEI7fCZGicFgLcYbUwBb+G6S/nuri/E1ynzHKdOxiNouKBtCLFK8DR+Sx+zlrQE1DfdLdo+/0Adg3+QrnjN+U5+yjeVR2HTrO+Jczl+hnu5uYoP0BsPADvOoeO7E8vKqtiQsW9g0iKNY+2ETk5al8NDpgkYS9oXixdNGM0/eEXz8HNpPE/XqpW8u0U6DgaEWqyvjIP18R4iqfa3TXNPVlHuoHf/hFo7qPBWECxFdy75pdPMVbW4YI6PWZZZcUQOB2GvrhTAB+EDp/wepRR0DLVkiq65e53hmFm+da5jNYas7dq362IiHJNfjb88ATt4jSEGRhdLsRk/Y06Uvj78jxDD8NvBOfJHwp8kFDyfnTdYzPgUisU+Pn4r3FfxbE60I5No65NqyM6LyH5yLK9/jSskOaNjsHrAsa/i8K0f9x3UNNJE7q6bAKBePF9OUqWGpok/vnLOC/mhiPpY2ywPBwt5lH8tlc7qkxty83J/EGZfm4lsUh0kLERAugeCDAem4CFik/EvhXz6YQonMC4Sl5mIxM2E0HeW8PAn2X9cuicC7IjF8NgTsdbOQZWckymjoqntw1VqdR76AHfN5VpKuAD5BqQVGzmdWlwa86Z45vdlmwpluv33aNozflXnwCfJie0nzzz1aGc3GYITX3bdkX22IZJoRP9FHBE92/iz0aRRZilBi1xPeRrdyxSB9Wi26tU7LShp899gLAL9go8gjub2rD8q8CTBmOJQAhtly1vVY/BQE9GcGcdaUhlkdVYfmfoQSM4CgYoe9AUBnPbndHaaS4kG1LCsdHlghgBiSdLbWS/g+8GOCPt1We76mwhvWDqov6Oy2M4RAiZ1QTxRbzH8jGdNjDgMYM61cz0l0tqhGexKaONIN8a18Buso22YNsTufBWPygCajQI09+GYFjckX3cq0lWw69MJsLRhxb2Gkq4haKHSaPR5sZ4VnetdvNLmi6do/z4EsGtsVWugV6/NWmsNuCntv4Po1CZWD+y8wILp0THq9ranTPkn4zJlc4NxFPrLUY2u5117M6Mr9WSzP0tjLjHNZp6oV0CdDq6t7y7mxUugUJ0WVVyRC5t+43rVtixdg7Aga9ChYcDlVFvUx1AQgnoDHyaLkhGsli4VF1HicEmXkhlmqqAccsX/HZ9OyrhQrYKaYfMFq4buVZvGIHDH2My4la9t50N/90hZDvdmiOwD7C8D2hfe0SWTnxpyLYV38GQzDyEd4hktr9nmgaswz5lCj4Kb8phYnDur6rjkaOb1ie+h3qOAWqgjTu1kAsISziP5eOCtTSkVr4rhmUmEr21gjW9m+vxbUaWos4sKyEekh/70aWGgD0HwqxE0+kDE5wSyx1iRjbByPVkZtMoFuxdMzuzGYh1Phc0zRTmFy+ByJ0QBTksz9TJNs90Io8bdyHuA2No2xvkwdmaOg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 376fc933-a014-40d8-f6bd-08db7f1c8c9e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:20.0446 (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: RlDcpPy68gSmVzu7EKUe/d97ijsRjpkc2Ywx7d1MSWIndPKLlALfIyfAhO0Uv8FTvHxRe5c+w/p95bAiZlP4gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Extend Freescale eDMA driver bindings to support eDMA3 IP blocks in i.MX8QM and i.MX8QXP SoCs. In i.MX93, both eDMA3 and eDMA4 are now. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Frank Li --- .../devicetree/bindings/dma/fsl,edma.yaml | 106 ++++++++++++++++-- 1 file changed, 99 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 5fd8fc604261..437db0c62339 100644 --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml @@ -21,32 +21,41 @@ properties: - enum: - fsl,vf610-edma - fsl,imx7ulp-edma + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 - items: - const: fsl,ls1028a-edma - const: fsl,vf610-edma reg: - minItems: 2 + minItems: 1 maxItems: 3 interrupts: - minItems: 2 - maxItems: 17 + minItems: 1 + maxItems: 64 interrupt-names: - minItems: 2 - maxItems: 17 + minItems: 1 + maxItems: 64 "#dma-cells": - const: 2 + enum: + - 2 + - 3 dma-channels: - const: 32 + minItems: 1 + maxItems: 64 clocks: + minItems: 1 maxItems: 2 clock-names: + minItems: 1 maxItems: 2 big-endian: @@ -65,6 +74,29 @@ required: allOf: - $ref: dma-controller.yaml# + - if: + properties: + compatible: + contains: + enum: + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 + then: + properties: + "#dma-cells": + const: 3 + # It is not necessary to write the interrupt name for each channel. + # instead, you can simply maintain the sequential IRQ numbers as + # defined for the DMA channels. + interrupt-names: false + clock-names: + items: + - const: dma + clocks: + maxItems: 1 + - if: properties: compatible: @@ -72,18 +104,26 @@ allOf: const: fsl,vf610-edma then: properties: + clocks: + minItems: 2 clock-names: items: - const: dmamux0 - const: dmamux1 interrupts: + minItems: 2 maxItems: 2 interrupt-names: items: - const: edma-tx - const: edma-err reg: + minItems: 2 maxItems: 3 + "#dma-cells": + const: 2 + dma-channels: + const: 32 - if: properties: @@ -92,14 +132,22 @@ allOf: const: fsl,imx7ulp-edma then: properties: + clock: + minItems: 2 clock-names: items: - const: dma - const: dmamux0 interrupts: + minItems: 2 maxItems: 17 reg: + minItems: 2 maxItems: 2 + "#dma-cells": + const: 2 + dma-channels: + const: 32 unevaluatedProperties: false @@ -153,3 +201,47 @@ examples: clock-names = "dma", "dmamux0"; clocks = <&pcc2 IMX7ULP_CLK_DMA1>, <&pcc2 IMX7ULP_CLK_DMA_MUX1>; }; + + - | + #include + #include + + dma-controller@44000000 { + compatible = "fsl,imx93-edma3"; + reg = <0x44000000 0x200000>; + #dma-cells = <3>; + dma-channels = <31>; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + clocks = <&clk IMX93_CLK_EDMA1_GATE>; + clock-names = "dma"; + }; From patchwork Fri Jul 7 19:00:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 700177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D561EB64D9 for ; Fri, 7 Jul 2023 19:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229557AbjGGTDO (ORCPT ); Fri, 7 Jul 2023 15:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjGGTDN (ORCPT ); Fri, 7 Jul 2023 15:03:13 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2049.outbound.protection.outlook.com [40.107.104.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2E262D52; Fri, 7 Jul 2023 12:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aGmE7BXcqryHmnPUnphv9UI8iI2RDf08cGQwjBS/up+tAsHe7KpxdMmvypnwyADoyrvWC0FBsu8yv9GISg26j0jSIc3MTiwE+KHUYfTY2N4pOqLMVod+pJ4W7ND8O52h7LLA0gE9EiUkR4VNQLjJBtueYf3Lh5LdOcpsjbldPUmfoeXaJESXDu8o3C6XMWBS9GcU2Gmt5513FNSN1pzoilcfJDuIYcg/GORDsEVexXqQfq+qnoM6UEwAJ8c8XZQW1vsyR9BhCDNo3Lo3imi3VZjZ6RlFL+UWC4H9Uq+MBnMV7/ASM7YhNfgodKe5R4QDG34O6bhoAxA2/eg9XY3pgA== 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=6L1hdvPzumTPHCYMnOb1rjupe75kBGPAmF1rTSO305Q=; b=Kr+o1XE4uHJgEU9TE+zWZMTWTDG8Rh+qRxoVyQesK5IkbVRqfUo7N5b1mmCi0gqpLyeT0TnNgyO1ycXiKbjt5INULCcgh38r7BtiWGunY7gV0KPJ1n6BlSwDWietKU4+OAEWkh/Oy7r4fs9vQZizsgjtSm4Yrd5EXL6qMkUgD13TfWw45GgSw6y5/teXQeVc3Zcxa+J9Vi9HRZpg7fiRlWGnbPYSwd63U3i6yzWeBA2B30sECkH/FI1+3fax0ewBQAAPOLiN17pOGeyldgrpUo0RPllhLpdt8WZHtJnxLsJrvIhbvSMNiv3mYroO+0k3vqI2ZRwkylfv/I8TQht1wQ== 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=6L1hdvPzumTPHCYMnOb1rjupe75kBGPAmF1rTSO305Q=; b=kWz0hu6B+0jKCaGcAn5SJkYT3sDzSGGdI17aS9c9+egOv6+xItqGq16RuyDzJ0P8cof6n9ZeFXRb0FH/09oAVqvhz5Vfv9j+uL1pu7sEYw7Y3/G/PuHSLG/NiuLOiUCEBGjsWndSK4Z2eemTRvPbkcSs7AqYGXI2qwE84gDW3zw= 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 AS8PR04MB8612.eurprd04.prod.outlook.com (2603:10a6:20b:427::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 19:01:23 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 19:01:23 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v10 12/12] dmaengine: fsl-edma: integrate v3 support Date: Fri, 7 Jul 2023 15:00:29 -0400 Message-Id: <20230707190029.476005-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707190029.476005-1-Frank.Li@nxp.com> References: <20230707190029.476005-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR11CA0067.namprd11.prod.outlook.com (2603:10b6:a03:80::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8612:EE_ X-MS-Office365-Filtering-Correlation-Id: e24ed444-d91d-44d3-3b36-08db7f1c8e72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C5rOwgnjdDQTOjj8/xWH6lG1GW3eHZBepJbMQ8XVNuPemHfNEJ/uDGgACKBdjf5ez2+qLZnu0B6Qv0bAeP/s4+EdPpRirhTWrUrFtZ9NFT51KyueplBoRCHdAH8TRB6muOxB3GzJlQJM6wIrhVKzyL7iiSfHEBcpfxwKXtKZ/tYHbB6Zn04XHEZYRspzapwsyy6rzTQ1G3lL4hq8kYehI0aCdDrkqjrioIEKx9wJ/Oa5FkKECWThu2ex9affaGXGEVlXusbqMqDO/PL3UMKQIibUaozJnY8WCFjpeR3ssjim+LV03TZi/+bD9XoxSxlykVQsK+942xGDsFhnoT9TtzBKs2Wo/rm/dFl9FDT8AZEgEkFB+TCpnl4FrhnDYu7RtiLYRKuHKL+AWHmmnVggGGACgvzlT11meE8R95WYDgo49PARNCGqtuIuIXVA5RZ/SKbRdqbZAKVdXJyEzk2ivIQgeMg80bjcxVMgTeY6hNK/3sXWzls4STR1+Gc7KEP8gh68Mxjc9uFyaXIi6KW0zrIMImDwWSCxcHsfK9H0DNgak9yrsR45ye/KI5jXY0yQDMLdcAR/F5aHak3ODhH5KsajBVe2fmcV+due6mvGJ679r074sNz8cx6AOe3siNuD 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)(376002)(346002)(396003)(366004)(136003)(451199021)(2906002)(5660300002)(2616005)(86362001)(66946007)(8676002)(8936002)(66556008)(26005)(1076003)(478600001)(30864003)(52116002)(186003)(6512007)(38100700002)(38350700002)(83380400001)(4326008)(316002)(66476007)(6506007)(36756003)(6486002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 43zEXSz/ZXDQNtHPBseOWqmS7smWOJxF2do2nduGg3eHPWLfRfx4WUXFti9dhH56Cbee8jTBQxKKSHxllPVrT4n7sq4qWnZwjw5cD4SJxSFkd0G6NZro69VUKlNw9Um4LSAi3Zqul4Cd5dRASEuaK/VJTlFcbPgPm2NIMDKsorljRNehoYqPR7zDW3KmDOARQRCvTmz7c4F/FNDkV0HMYU9XqqsFqwVXBUGBLYOvU8WAEAjVjoIz5xa3hTdHp3KoH83ZaaDRg+2QeI0GEQiTwb68DhDEcYeChpfyW9QPADcJ14xFEHCmwNbkdiHk8UgrlkY0yOUeARRrwAoNnH7T4cu3L5TXTgl3J4uOyRDV++hUhLG+nphIF03bnJ6R+MUGLt/aM1sWv5Pm91WVxqWmE8BbJcg/UXNy6l/jbl21UHVj5f61SfaZvwtX+uq/JfDKNrAREcsouaxtcGDzkndkouhUi8KVhBqzYGNKoR+sFrAiYi7YG2R0nV/UYR1l37iL2QUrAn7UUyd/qwAXHk8mq1xUhhoVxTDoAev1unA7iqbVhjQPh0Uh7lDML9AAbklKV70XOaYtFsKE+kEwI72ZCLRPuQxMNaIPiPGxQehCWESGzCced1E+gzh7917CUaDYi2CNE5tfQ7rYLsxEm+PV67rGBkmRjb3gpd/f2MyiKuc5ieLbM7K0IuY/CBz5F9gy4iRPD24n8HNFgAAV7Inc8wouGWfITnkW6WhlnB/eNCpqvpfSRcv3WPpBRiNkqE6PyoQBstz4yVpWTswP7MLhpReywD1SDr7rBzhmxO66WrdwRNdx15jLURWXg5Xc402XOQYzAqfCkILITAcj3R77QlzNT0EbR0vT3ryNX46oOdqqu5AJY9IHZpIlf62qj9c2vKMH4yZFZiLfprhjxIC+pGh2Ovb6v69bPB+y/p1KRXtFm9BaAUv/F9iOEU8AQscJQPLQ8MD8CS1dcueUswbpHgUJ1NP/62Mged6TRyh3vxbToGafl6/EuNk/dJkRS2PKqOTnPFIQ4lauBwda2N7bBKnuXbb+c9QXnMLg7INtezvasNzdbcKB35fmLs3JctD46PQZreY2AzKoDtBuK9vyG9aUTh1p1ja37+Dj2f/QIEF+0ennfAoMiwct0Igjh87LLFW7MrnPHsrpRahOn3x5e78OLuCffq5EaVGwl4ass45kJ8P3pzkYI/rLooK89oYsF0XxxXLwv9EbkbuShsikcrX5XNRiqxWwN46lrtFGiebTd9G/fhQA44802/7QInQteXa293TCPV9DA/I10c1stxc0PWSvtZ+l640AoG5Ew+abnzbsLvSvMyTQcWkBgfSceYnwTjmJl/gWcUY6usbE/szMYnjC+TExefuWGhucIOUuPwMRpUiP7ML1Q1rRBGJ/ib9aFBi4yAhPmKyuDAOX+/a9e7QFBjhFlzM3W6FHMss2oFqdFsMVgCGirYUzorXlN6xmoOipv+C6dPmheJPjK6YyOZGJWG5/NcWltFDGGPEbmQXSAE/Wf0k1P7vJu32tQ2y9pT6lZiZyFpPVmhTnK4gLyfGZSH6lKEsg6E/Np2w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e24ed444-d91d-44d3-3b36-08db7f1c8e72 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 19:01:23.1648 (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: xzVlMIAtOPn6IsfBju0oLW+xLJnbe2fOJ/q6ujcjZNTg8fjvwEVt46CgrWrZI0l/XOS4H9Q4gsze8T+1kLzLRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8612 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Significant alterations have been made to the EDMA v3's register layout. Now, each channel possesses a separate address space, encapsulating all channel-related controls and statuses, including IRQs. There are changes in bit position definitions as well. However, the fundamental control flow remains analogous to the previous versions. EDMA v3 was utilized in imx8qm, imx93, and will be in forthcoming chips. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 158 +++++++++++++++++++--- drivers/dma/fsl-edma-common.h | 73 +++++++++- drivers/dma/fsl-edma-main.c | 246 ++++++++++++++++++++++++++++++++-- 3 files changed, 453 insertions(+), 24 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 13c328728025..a0f5741abcc4 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "fsl-edma-common.h" @@ -66,11 +68,46 @@ void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) spin_unlock(&fsl_chan->vchan.lock); } +static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) +{ + u32 val, flags; + + flags = fsl_edma_drvflags(fsl_chan); + val = edma_readl_chreg(fsl_chan, ch_sbr); + /* Remote/local swapped wrongly on iMX8 QM Audio edma */ + if (flags & FSL_EDMA_DRV_QUIRK_SWAPPED) { + if (!fsl_chan->is_rxchan) + val |= EDMA_V3_CH_SBR_RD; + else + val |= EDMA_V3_CH_SBR_WR; + } else { + if (fsl_chan->is_rxchan) + val |= EDMA_V3_CH_SBR_RD; + else + val |= EDMA_V3_CH_SBR_WR; + } + + if (fsl_chan->is_remote) + val &= ~(EDMA_V3_CH_SBR_RD | EDMA_V3_CH_SBR_WR); + + edma_writel_chreg(fsl_chan, val, ch_sbr); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) + edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux); + + val = edma_readl_chreg(fsl_chan, ch_csr); + val |= EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +} + static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_SPLIT_REG) + return fsl_edma3_enable_request(fsl_chan); + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, EDMA_SEEI_SEEI(ch), regs->seei); edma_writeb(fsl_chan->edma, ch, regs->serq); @@ -83,11 +120,28 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) } } +static void fsl_edma3_disable_request(struct fsl_edma_chan *fsl_chan) +{ + u32 val = edma_readl_chreg(fsl_chan, ch_csr); + u32 flags; + + flags = fsl_edma_drvflags(fsl_chan); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) + edma_writel_chreg(fsl_chan, 0, ch_mux); + + val &= ~EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +} + void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_SPLIT_REG) + return fsl_edma3_disable_request(fsl_chan); + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, ch, regs->cerq); edma_writeb(fsl_chan->edma, EDMA_CEEI_CEEI(ch), regs->ceei); @@ -135,6 +189,9 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, int endian_diff[4] = {3, 1, -1, -3}; u32 dmamux_nr = fsl_chan->edma->drvdata->dmamuxs; + if (!dmamux_nr) + return; + chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr; ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux; @@ -186,6 +243,10 @@ int fsl_edma_terminate_all(struct dma_chan *chan) vchan_get_all_descriptors(&fsl_chan->vchan, &head); spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); vchan_dma_desc_free_list(&fsl_chan->vchan, &head); + + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_PD) + pm_runtime_allow(fsl_chan->pd_dev); + return 0; } @@ -286,12 +347,16 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, enum dma_transfer_direction dir = edesc->dirn; dma_addr_t cur_addr, dma_addr; size_t len, size; + u32 nbytes = 0; int i; /* calculate the total size in this desc */ - for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) - len += le32_to_cpu(edesc->tcd[i].vtcd->nbytes) - * le16_to_cpu(edesc->tcd[i].vtcd->biter); + for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) { + nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) + nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); + len += nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + } if (!in_progress) return len; @@ -303,8 +368,12 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, /* figure out the finished and calculate the residue */ for (i = 0; i < fsl_chan->edesc->n_tcds; i++) { - size = le32_to_cpu(edesc->tcd[i].vtcd->nbytes) - * le16_to_cpu(edesc->tcd[i].vtcd->biter); + nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) + nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); + + size = nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + if (dir == DMA_MEM_TO_DEV) dma_addr = le32_to_cpu(edesc->tcd[i].vtcd->saddr); else @@ -389,12 +458,15 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, } static inline -void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, +void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, + struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, u16 attr, u16 soff, u32 nbytes, u32 slast, u16 citer, u16 biter, u16 doff, u32 dlast_sga, bool major_int, bool disable_req, bool enable_sg) { + struct dma_slave_config *cfg = &fsl_chan->cfg; u16 csr = 0; + u32 burst; /* * eDMA hardware SGs require the TCDs to be stored in little @@ -409,6 +481,21 @@ void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, tcd->soff = cpu_to_le16(soff); + if (fsl_chan->is_multi_fifo) { + /* set mloff to support multiple fifo */ + burst = cfg->direction == DMA_DEV_TO_MEM ? + cfg->src_addr_width : cfg->dst_addr_width; + nbytes |= EDMA_V3_TCD_NBYTES_MLOFF(-(burst * 4)); + /* enable DMLOE/SMLOE */ + if (cfg->direction == DMA_MEM_TO_DEV) { + nbytes |= EDMA_V3_TCD_NBYTES_DMLOE; + nbytes &= ~EDMA_V3_TCD_NBYTES_SMLOE; + } else { + nbytes |= EDMA_V3_TCD_NBYTES_SMLOE; + nbytes &= ~EDMA_V3_TCD_NBYTES_DMLOE; + } + } + tcd->nbytes = cpu_to_le32(nbytes); tcd->slast = cpu_to_le32(slast); @@ -427,6 +514,12 @@ void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, if (enable_sg) csr |= EDMA_TCD_CSR_E_SG; + if (fsl_chan->is_rxchan) + csr |= EDMA_TCD_CSR_ACTIVE; + + if (fsl_chan->is_sw) + csr |= EDMA_TCD_CSR_START; + tcd->csr = cpu_to_le16(csr); } @@ -466,6 +559,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); struct fsl_edma_desc *fsl_desc; dma_addr_t dma_buf_next; + bool major_int = true; int sg_len, i; u32 src_addr, dst_addr, last_sg, nbytes; u16 soff, doff, iter; @@ -509,17 +603,23 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( src_addr = dma_buf_next; dst_addr = fsl_chan->dma_dev_addr; soff = fsl_chan->cfg.dst_addr_width; - doff = 0; - } else { + doff = fsl_chan->is_multi_fifo ? 4 : 0; + } else if (direction == DMA_DEV_TO_MEM) { src_addr = fsl_chan->dma_dev_addr; dst_addr = dma_buf_next; - soff = 0; + soff = fsl_chan->is_multi_fifo ? 4 : 0; doff = fsl_chan->cfg.src_addr_width; + } else { + /* DMA_DEV_TO_DEV */ + src_addr = fsl_chan->cfg.src_addr; + dst_addr = fsl_chan->cfg.dst_addr; + soff = doff = 0; + major_int = false; } - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, dst_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, - iter, doff, last_sg, true, false, true); + iter, doff, last_sg, major_int, false, true); dma_buf_next += period_len; } @@ -568,23 +668,51 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( dst_addr = fsl_chan->dma_dev_addr; soff = fsl_chan->cfg.dst_addr_width; doff = 0; - } else { + } else if (direction == DMA_DEV_TO_MEM) { src_addr = fsl_chan->dma_dev_addr; dst_addr = sg_dma_address(sg); soff = 0; doff = fsl_chan->cfg.src_addr_width; + } else { + /* DMA_DEV_TO_DEV */ + src_addr = fsl_chan->cfg.src_addr; + dst_addr = fsl_chan->cfg.dst_addr; + soff = 0; + doff = 0; } + /* + * Choose the suitable burst length if sg_dma_len is not + * multiple of burst length so that the whole transfer length is + * multiple of minor loop(burst length). + */ + if (sg_dma_len(sg) % nbytes) { + u32 width = (direction == DMA_DEV_TO_MEM) ? doff : soff; + u32 burst = (direction == DMA_DEV_TO_MEM) ? + fsl_chan->cfg.src_maxburst : + fsl_chan->cfg.dst_maxburst; + int j; + + for (j = burst; j > 1; j--) { + if (!(sg_dma_len(sg) % (j * width))) { + nbytes = j * width; + break; + } + } + /* Set burst size as 1 if there's no suitable one */ + if (j == 1) + nbytes = width; + } iter = sg_dma_len(sg) / nbytes; if (i < sg_len - 1) { last_sg = fsl_desc->tcd[(i + 1)].ptcd; - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, false, false, true); } else { last_sg = 0; - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, true, true, false); @@ -609,7 +737,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, fsl_chan->is_sw = true; /* To match with copy_align and max_seg_size so 1 tcd is enough */ - fsl_edma_fill_tcd(fsl_desc->tcd[0].vtcd, dma_src, dma_dst, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[0].vtcd, dma_src, dma_dst, fsl_edma_get_tcd_attr(DMA_SLAVE_BUSWIDTH_32_BYTES), 32, len, 0, 1, 1, 32, 0, true, true, false); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index cfc41915eaa1..3cc0cc8fc2d0 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -42,6 +42,11 @@ #define EDMA_TCD_CSR_ACTIVE BIT(6) #define EDMA_TCD_CSR_DONE BIT(7) +#define EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(x) ((x) & GENMASK(9, 0)) +#define EDMA_V3_TCD_NBYTES_MLOFF(x) (x << 10) +#define EDMA_V3_TCD_NBYTES_DMLOE (1 << 30) +#define EDMA_V3_TCD_NBYTES_SMLOE (1 << 31) + #define EDMAMUX_CHCFG_DIS 0x0 #define EDMAMUX_CHCFG_ENBL 0x80 #define EDMAMUX_CHCFG_SOURCE(n) ((n) & 0x3F) @@ -54,6 +59,15 @@ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_8_BYTES)) + +#define EDMA_V3_CH_SBR_RD BIT(22) +#define EDMA_V3_CH_SBR_WR BIT(21) +#define EDMA_V3_CH_CSR_ERQ BIT(0) +#define EDMA_V3_CH_CSR_EARQ BIT(1) +#define EDMA_V3_CH_CSR_EEI BIT(2) +#define EDMA_V3_CH_CSR_DONE BIT(30) +#define EDMA_V3_CH_CSR_ACTIVE BIT(31) + enum fsl_edma_pm_state { RUNNING = 0, SUSPENDED, @@ -73,6 +87,18 @@ struct fsl_edma_hw_tcd { __le16 biter; }; +struct fsl_edma3_ch_reg { + __le32 ch_csr; + __le32 ch_es; + __le32 ch_int; + __le32 ch_sbr; + __le32 ch_pri; + __le32 ch_mux; + __le32 ch_mattr; /* edma4, reserved for edma3 */ + __le32 ch_reserved; + struct fsl_edma_hw_tcd tcd; +} __packed; + /* * These are iomem pointers, for both v32 and v64. */ @@ -119,6 +145,18 @@ struct fsl_edma_chan { enum dma_data_direction dma_dir; char chan_name[32]; struct fsl_edma_hw_tcd __iomem *tcd; + u32 real_count; + struct work_struct issue_worker; + struct platform_device *pdev; + struct device *pd_dev; + u32 srcid; + struct clk *clk; + int priority; + int hw_chanid; + int txirq; + bool is_rxchan; + bool is_remote; + bool is_multi_fifo; }; struct fsl_edma_desc { @@ -135,8 +173,26 @@ struct fsl_edma_desc { #define FSL_EDMA_DRV_CONFIG32 BIT(2) #define FSL_EDMA_DRV_WRAP_IO BIT(3) #define FSL_EDMA_DRV_EDMA64 BIT(4) +#define FSL_EDMA_DRV_HAS_PD BIT(5) +#define FSL_EDMA_DRV_HAS_CHCLK BIT(6) +#define FSL_EDMA_DRV_HAS_CHMUX BIT(7) +/* imx8 QM audio edma remote local swapped */ +#define FSL_EDMA_DRV_QUIRK_SWAPPED BIT(8) +/* control and status register is in tcd address space, edma3 reg layout */ +#define FSL_EDMA_DRV_SPLIT_REG BIT(9) +#define FSL_EDMA_DRV_BUS_8BYTE BIT(10) +#define FSL_EDMA_DRV_DEV_TO_DEV BIT(11) +#define FSL_EDMA_DRV_ALIGN_64BYTE BIT(12) + +#define FSL_EDMA_DRV_EDMA3 (FSL_EDMA_DRV_SPLIT_REG | \ + FSL_EDMA_DRV_BUS_8BYTE | \ + FSL_EDMA_DRV_DEV_TO_DEV | \ + FSL_EDMA_DRV_ALIGN_64BYTE) + struct fsl_edma_drvdata { - u32 dmamuxs; + u32 dmamuxs; /* only used before v3 */ + u32 chreg_off; + u32 chreg_space_sz; u32 flags; int (*setup_irq)(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma); @@ -148,6 +204,7 @@ struct fsl_edma_engine { void __iomem *muxbase[DMAMUX_NR]; struct clk *muxclk[DMAMUX_NR]; struct clk *dmaclk; + struct clk *chclk; struct mutex fsl_edma_mutex; const struct fsl_edma_drvdata *drvdata; u32 n_chans; @@ -155,6 +212,7 @@ struct fsl_edma_engine { int errirq; bool big_endian; struct edma_regs regs; + u64 chan_masked; struct fsl_edma_chan chans[]; }; @@ -168,6 +226,14 @@ struct fsl_edma_engine { edma_writel(chan->edma, (u32 __force)val, &chan->tcd->__name) : \ edma_writew(chan->edma, (u16 __force)val, &chan->tcd->__name)) +#define edma_readl_chreg(chan, __name) \ + edma_readl(chan->edma, \ + (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) + +#define edma_writel_chreg(chan, val, __name) \ + edma_writel(chan->edma, val, \ + (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. @@ -224,6 +290,11 @@ static inline struct fsl_edma_chan *to_fsl_edma_chan(struct dma_chan *chan) return container_of(chan, struct fsl_edma_chan, vchan.chan); } +static inline u32 fsl_edma_drvflags(struct fsl_edma_chan *fsl_chan) +{ + return fsl_chan->edma->drvdata->flags; +} + static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) { return container_of(vd, struct fsl_edma_desc, vdesc); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 7b15f3c1838c..6d2a96883dcd 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -18,9 +18,15 @@ #include #include #include +#include +#include #include "fsl-edma-common.h" +#define ARGS_RX BIT(0) +#define ARGS_REMOTE BIT(1) +#define ARGS_MULTI_FIFO BIT(2) + static void fsl_edma_synchronize(struct dma_chan *chan) { struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); @@ -47,6 +53,22 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t fsl_edma3_tx_handler(int irq, void *dev_id) +{ + struct fsl_edma_chan *fsl_chan = dev_id; + unsigned int intr; + + intr = edma_readl_chreg(fsl_chan, ch_int); + if (!intr) + return IRQ_HANDLED; + + edma_writel_chreg(fsl_chan, 1, ch_int); + + fsl_edma_tx_chan_handler(fsl_chan); + + return IRQ_HANDLED; +} + static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id) { struct fsl_edma_engine *fsl_edma = dev_id; @@ -108,6 +130,51 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec, return NULL; } +static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) +{ + struct fsl_edma_engine *fsl_edma = ofdma->of_dma_data; + struct dma_chan *chan, *_chan; + struct fsl_edma_chan *fsl_chan; + bool b_chmux; + int i; + + if (dma_spec->args_count != 3) + return NULL; + + b_chmux = !!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_HAS_CHMUX); + + mutex_lock(&fsl_edma->fsl_edma_mutex); + list_for_each_entry_safe(chan, _chan, &fsl_edma->dma_dev.channels, + device_node) { + + if (chan->client_count) + continue; + + fsl_chan = to_fsl_edma_chan(chan); + i = fsl_chan - fsl_edma->chans; + + chan = dma_get_slave_channel(chan); + chan->device->privatecnt++; + fsl_chan->priority = dma_spec->args[1]; + fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX; + fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE; + fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO; + + if (!b_chmux && i == dma_spec->args[0]) { + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return chan; + } else if (b_chmux && !fsl_chan->srcid) { + /* if controller support channel mux, choose a free channel */ + fsl_chan->srcid = dma_spec->args[0]; + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return chan; + } + } + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return NULL; +} + static int fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) { @@ -149,6 +216,37 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma return 0; } +static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) +{ + int ret; + int i; + + for (i = 0; i < fsl_edma->n_chans; i++) { + + struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + + if (fsl_edma->chan_masked & BIT(i)) + continue; + + /* request channel irq */ + fsl_chan->txirq = platform_get_irq(pdev, i); + if (fsl_chan->txirq < 0) { + dev_err(&pdev->dev, "Can't get chan %d's irq.\n", i); + return -EINVAL; + } + + ret = devm_request_irq(&pdev->dev, fsl_chan->txirq, + fsl_edma3_tx_handler, IRQF_SHARED, + fsl_chan->chan_name, fsl_chan); + if (ret) { + dev_err(&pdev->dev, "Can't register chan%d's IRQ.\n", i); + return -EINVAL; + } + } + + return 0; +} + static int fsl_edma2_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) @@ -214,29 +312,108 @@ static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) static struct fsl_edma_drvdata vf610_data = { .dmamuxs = DMAMUX_NR, .flags = FSL_EDMA_DRV_WRAP_IO, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata ls1028a_data = { .dmamuxs = DMAMUX_NR, .flags = FSL_EDMA_DRV_MUX_SWAP | FSL_EDMA_DRV_WRAP_IO, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { .dmamuxs = 1, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32, .setup_irq = fsl_edma2_irq_init, }; +static struct fsl_edma_drvdata imx8qm_data = { + .flags = FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx8qm_audio_data = { + .flags = FSL_EDMA_DRV_QUIRK_SWAPPED | FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx93_data3 = { + .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx93_data4 = { + .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x8000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + static const struct of_device_id fsl_edma_dt_ids[] = { { .compatible = "fsl,vf610-edma", .data = &vf610_data}, { .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data}, { .compatible = "fsl,imx7ulp-edma", .data = &imx7ulp_data}, + { .compatible = "fsl,imx8qm-edma", .data = &imx8qm_data}, + { .compatible = "fsl,imx8qm-adma", .data = &imx8qm_audio_data}, + { .compatible = "fsl,imx93-edma3", .data = &imx93_data3}, + { .compatible = "fsl,imx93-edma4", .data = &imx93_data4}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids); +static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) +{ + struct fsl_edma_chan *fsl_chan; + struct device_link *link; + struct device *pd_chan; + struct device *dev; + int i; + + dev = &pdev->dev; + + for (i = 0; i < fsl_edma->n_chans; i++) { + if (fsl_edma->chan_masked & BIT(i)) + continue; + + fsl_chan = &fsl_edma->chans[i]; + + pd_chan = dev_pm_domain_attach_by_id(dev, i); + if (IS_ERR_OR_NULL(pd_chan)) { + dev_err(dev, "Failed attach pd %d\n", i); + return -EINVAL; + } + + link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | + DL_FLAG_RPM_ACTIVE); + if (IS_ERR(link)) { + dev_err(dev, "Failed to add device_link to %d: %ld\n", i, + PTR_ERR(link)); + return -EINVAL; + } + + fsl_chan->pd_dev = pd_chan; + + pm_runtime_use_autosuspend(fsl_chan->pd_dev); + pm_runtime_set_autosuspend_delay(fsl_chan->pd_dev, 200); + pm_runtime_set_active(fsl_chan->pd_dev); + } + + return 0; +} + static int fsl_edma_probe(struct platform_device *pdev) { const struct of_device_id *of_id = @@ -245,6 +422,7 @@ static int fsl_edma_probe(struct platform_device *pdev) struct fsl_edma_engine *fsl_edma; const struct fsl_edma_drvdata *drvdata = NULL; struct fsl_edma_chan *fsl_chan; + u32 chan_mask[2] = {0, 0}; struct edma_regs *regs; int len, chans; int ret, i; @@ -275,8 +453,10 @@ static int fsl_edma_probe(struct platform_device *pdev) if (IS_ERR(fsl_edma->membase)) return PTR_ERR(fsl_edma->membase); - fsl_edma_setup_regs(fsl_edma); - regs = &fsl_edma->regs; + if (!(drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) { + fsl_edma_setup_regs(fsl_edma); + regs = &fsl_edma->regs; + } if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma"); @@ -286,9 +466,29 @@ static int fsl_edma_probe(struct platform_device *pdev) } } + if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) { + fsl_edma->chclk = devm_clk_get_enabled(&pdev->dev, "mp"); + if (IS_ERR(fsl_edma->chclk)) { + dev_err(&pdev->dev, "Missing MP block clock.\n"); + return PTR_ERR(fsl_edma->chclk); + } + } + + ret = of_property_read_variable_u32_array(np, "dma-channel-mask", chan_mask, 1, 2); + + if (ret > 0) { + fsl_edma->chan_masked = chan_mask[1]; + fsl_edma->chan_masked <<= 32; + fsl_edma->chan_masked |= chan_mask[0]; + } + for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) { char clkname[32]; + /* eDMAv3 mux register move to TCD area if ch_mux exist */ + if (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG) + break; + fsl_edma->muxbase[i] = devm_platform_ioremap_resource(pdev, 1 + i); if (IS_ERR(fsl_edma->muxbase[i])) { @@ -308,9 +508,18 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma->big_endian = of_property_read_bool(np, "big-endian"); + if (drvdata->flags & FSL_EDMA_DRV_HAS_PD) { + ret = fsl_edma3_attach_pd(pdev, fsl_edma); + if (ret) + return ret; + } + INIT_LIST_HEAD(&fsl_edma->dma_dev.channels); for (i = 0; i < fsl_edma->n_chans; i++) { - struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + fsl_chan = &fsl_edma->chans[i]; + + if (fsl_edma->chan_masked & BIT(i)) + continue; snprintf(fsl_chan->chan_name, sizeof(fsl_chan->chan_name), "%s-CH%02d", dev_name(&pdev->dev), i); @@ -321,8 +530,13 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_chan->idle = true; fsl_chan->dma_dir = DMA_NONE; fsl_chan->vchan.desc_free = fsl_edma_free_desc; - fsl_chan->tcd = fsl_edma->membase + EDMA_TCD - + i * sizeof(struct fsl_edma_hw_tcd); + + len = (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG) ? + offsetof(struct fsl_edma3_ch_reg, tcd) : 0; + fsl_chan->tcd = fsl_edma->membase + + i * drvdata->chreg_space_sz + drvdata->chreg_off + len; + + fsl_chan->pdev = pdev; vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); edma_write_tcdreg(fsl_chan, 0, csr); @@ -356,12 +570,25 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma->dma_dev.src_addr_widths = FSL_EDMA_BUSWIDTHS; fsl_edma->dma_dev.dst_addr_widths = FSL_EDMA_BUSWIDTHS; + + if (drvdata->flags & FSL_EDMA_DRV_BUS_8BYTE) { + fsl_edma->dma_dev.src_addr_widths |= BIT(DMA_SLAVE_BUSWIDTH_8_BYTES); + fsl_edma->dma_dev.dst_addr_widths |= BIT(DMA_SLAVE_BUSWIDTH_8_BYTES); + } + fsl_edma->dma_dev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); + if (drvdata->flags & FSL_EDMA_DRV_DEV_TO_DEV) + fsl_edma->dma_dev.directions |= BIT(DMA_DEV_TO_DEV); + + fsl_edma->dma_dev.copy_align = drvdata->flags & FSL_EDMA_DRV_ALIGN_64BYTE ? + DMAENGINE_ALIGN_64_BYTES : + DMAENGINE_ALIGN_32_BYTES; - fsl_edma->dma_dev.copy_align = DMAENGINE_ALIGN_32_BYTES; /* Per worst case 'nbytes = 1' take CITER as the max_seg_size */ dma_set_max_seg_size(fsl_edma->dma_dev.dev, 0x3fff); + fsl_edma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; + platform_set_drvdata(pdev, fsl_edma); ret = dma_async_device_register(&fsl_edma->dma_dev); @@ -371,7 +598,9 @@ static int fsl_edma_probe(struct platform_device *pdev) return ret; } - ret = of_dma_controller_register(np, fsl_edma_xlate, fsl_edma); + ret = of_dma_controller_register(np, + drvdata->flags & FSL_EDMA_DRV_SPLIT_REG ? fsl_edma3_xlate : fsl_edma_xlate, + fsl_edma); if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); @@ -380,7 +609,8 @@ static int fsl_edma_probe(struct platform_device *pdev) } /* enable round robin arbitration */ - edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); + if (!(drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) + edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); return 0; }