From patchwork Mon Jul 29 04:36:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13744353 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4555DC3DA61 for ; Mon, 29 Jul 2024 04:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ViEuhhmsjkK2NMoFwMMgPUSSHd64nL6Vx+KrzJRf93U=; b=4S9pQfYLwmDfSn 0DkEm/fAxUIlImt3eHkr6fMkMlIXwNEXq6yHW6JjiGk3R3TlTgumAB2IIvSoBYSp9fw3d6zfuO+GP W6uD6G61fAqjgLyE6ZpAgADG0nb51cDB2th8eKRn7s3iHtwHTfODrFsJG+uwY9cNW7iw7ZXs+2VWX TGikkDlWrp0ef5B0tUiWhU1232z3wW/JpSSOp7aiEPQrGLyfVwLRFKITWl14SHeLeHYdj14fWr1c4 NP94A/Ng5UOlWLXGR4FbxMKVW03Vtf1dlpZ4UmF+QBnrTz9EoZErdG+qh4nq2nHc7oS2Y6GWUgijr 0ZPNg/UTAIPggh4xo3Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYI93-00000009yGy-3zoQ; Mon, 29 Jul 2024 04:38:01 +0000 Received: from mail-sn1nam02acsn2080b.outbound.protection.outlook.com ([2a01:111:f400:7ea9::80b] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYI8Z-00000009y3e-1Nlg for linux-riscv@lists.infradead.org; Mon, 29 Jul 2024 04:37:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QQOukr7Oof8Tkgf9dFx68qyEE/vFKxoevkfXUIKYMAhpa6Y9wl0Q8h6tySWFj2/1fR/iCDVBSKB1KOCm94QuHuL8cW9briESA99dhwjMeNBbbEGJJh2H7H4X2k/Spq36KSpB9vq/F1DBCE9LyTM/UJK8Lrr5HhYbamdHtsUJTScdxdz50zhXmImThNJ/XoEaVywCYAnr5jY5hfORjCftRQad54CqAbgy+GWHIUXwYZwldJ74Vudh9Og4FFoAGwQkM8KhOysa0h/Sg4GHnyDs/0YRnnKpFwsTXklb2VmW8CgvU9oPCe5tpBLCSR9P4LXIRAXhQpszp+wCQxaL8uQjJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Wr1EWI58vgY6CWzXaBMfjrS71hlZHq0bO3sBMwFJADg=; b=fNIQ7WhZsxIE92E2e+pAOnEY1VB0V5c3Mvpa4bFLmma3cOrgAGMaMh7M3ZGD+dwzasdlEKDoudsB5ZZNBJ3jr6c5TqaVdZ3vANqaFBUYEhKJyD4TfzWYSyBhfXycZy2/+CIY4Jjesvz+XSDMOh5T/6CisxTULueeCuSTYQRy+pGm94pCa0J1XTZATJlQwmMtj30Gu+mEK5GIegeFGGV6gdXk6noowblAbQkBQsSWEPlp5b9cTEm7/d1D+m1nnO1ZZxGHfWSG/+0Rx8UNt6BmUpyNVzZo24kKyxkFx2exrWYTS4WVBdUbfHNo9Oy/rwCjhtlfM6aWS6GfPsbGBSCUwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wr1EWI58vgY6CWzXaBMfjrS71hlZHq0bO3sBMwFJADg=; b=uWAviDDk+Ynb5wvd4phfem/HbYF193D++cXQy/UHgGxfwYW073tgE65OH8Eii6SJehBM0qRMJp5gIhBzS5bG0GAKZGnEYqVT/BHIaS2iDVxuMqQ8I9p4MM9PW+/jmUdTFFhWUTg8ingLtSUfVDVBHv8MVEVFD6XJaorRD3PLEH8urC7F0ouSm6p0EKr7q4hiSt/4bCoFu7P3M46LxZNaPVNiLxSQ+VSKehTbQ6TNY+sE2fsDdVQ3JQs+8N/i3KJGvyCgXSKMINqbKb0Hj3gTJUXY2jHSNMKMRwO8MZ9pu5XoeXjpJiOlDCNU1xdIw/SLtva/WofP9CSUYQhFv9aQOQ== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by SA1PR20MB4516.namprd20.prod.outlook.com (2603:10b6:806:23d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.29; Mon, 29 Jul 2024 04:37:17 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%5]) with mapi id 15.20.7807.026; Mon, 29 Jul 2024 04:37:16 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Liu Gui , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Krzysztof Kozlowski Subject: [PATCH v8 RESEND 1/3] dt-bindings: dmaengine: Add dma multiplexer for CV18XX/SG200X series SoC Date: Mon, 29 Jul 2024 12:36:51 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-TMN: [OxSrfHYK5Hgq2n3dm+S83MyCfc7Okiuz84L41aUuVCM=] X-ClientProxiedBy: TYCP286CA0361.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:79::17) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240729043653.899480-1-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|SA1PR20MB4516:EE_ X-MS-Office365-Filtering-Correlation-Id: d7d7d55c-7d28-4177-84aa-08dcaf881fcf X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|5072599006|19110799003|461199028|1602099012|440099028|3412199025|4302099013|1710799026; X-Microsoft-Antispam-Message-Info: vF3pM2UZ5y6BlHZFwT45bfsSI3ljTUB3ae9r8xHRpmza4irNB5wyDKxBASDOPas3S2PWgdLbzhOqM24SVY9KWXw9if6w3qkPr225dvdzfG475fZdOW1LCNjz+pjb3fm5Id2OnsFDhejkF6kodxBUC3JpvSTiy16RwfB0cyQ7sCvrkHfCi/4Mmi+zjgepfAV9ekzqUuqHfHopXnZZMSVdWPjvBAmu1X770c7ZJEmz5LT0EKA1TjvEmVtZHrwx0DGIeS/yqlKh+bGXOpniF5Y8qYqcHs9/FdHNfaMnS0HAEeG36bZHVGdzH0cRnP0fhmYt3Dl2wYKEvivNmdCem/TJZPHObu9mNwRQGAAPPZjlzlAzE0mEVHXVh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C6o5ygcaQ6msuWzmnvSc2SSI7VofBeX0tdEXlTMH00UGRvAeD8jwvF04yIsSElGcMCWaLjvWgqhrYQzfOw88i5SqKv7120ClmeAJWLsgLOQuj2Bw2Mo+XNVzvLRW8CjnkmLH0xH+ietJcglZ/9El3Xpb9Qe15QXuuKFOvUl9bePlnXl9pcizziYNPYaxvC9ekHWBfCRUvusSjmne61PUnnT1969Yk9ctALeq9ioBeFKyPKbHSkHk16RGhVjPSfsZToNloIEmWdyvSU5V4ubz2/j9aPkf0ruLD9mu0xArTjt8jH+Lhm7yeL43MVSFMYfPinsvhmSEllBns3yGJtDVwlqKqH/V5Frh3bXyZdViIfEy7ESky9+q7oFM7acD3Vn6/ZRDYaMChCd3Nw0nYDhro5e1UubTylzbAi9PwyoUSqcpLP6t9n6c8ZB+ITCjSBiDKsVfSUQhznqNLNm/5MzWl90hg2jB0o2JZPJ4t/WAS3IzTWCUQ+uq1iYCii5nBpIIKqU8eggREGRZLRsudSadMGXFZLeixd0VigkTfwyxiMRbi3PjyEXs3/uVUxR0lS+Q3F3FJbuTDzg6N5BljTe21duGIV36wHjp9qNk72+G842NgswZlYsuMYF6x3wA5Vcby39DeznSrawHQMlwKBudq+Nz8u8QyeexUdmXS4RRUvmZodGdip7/aoxPHktwhV3iDBM+zBh1CGxysPYcGqD X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7d7d55c-7d28-4177-84aa-08dcaf881fcf X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2024 04:37:16.5257 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR20MB4516 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240728_213731_383864_42EFB687 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The DMA IP of Sophgo CV18XX/SG200X is based on a DW AXI CORE, with an additional channel remap register located in the top system control area. The DMA channel is exclusive to each core. In addition, the DMA multiplexer is a subdevice of system controller, so this binding only contains necessary properties for the multiplexer itself. Add the dmamux binding for CV18XX/SG200X series SoC. Signed-off-by: Inochi Amaoto Reviewed-by: Krzysztof Kozlowski Reviewed-by: Rob Herring (Arm) --- .../bindings/dma/sophgo,cv1800-dmamux.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml -- 2.44.0 diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml new file mode 100644 index 000000000000..480cb117db9b --- /dev/null +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/sophgo,cv1800-dmamux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo CV1800/SG200 Series DMA multiplexer + +maintainers: + - Inochi Amaoto + +description: | + The DMA multiplexer of CV1800 is a subdevice of the system + controller. It support mapping 8 channels, but each channel + can be mapped only once. + +allOf: + - $ref: dma-router.yaml# + +properties: + compatible: + const: sophgo,cv1800-dmamux + + reg: + items: + - description: DMA channal remapping register + - description: DMA channel interrupt mapping register + + '#dma-cells': + const: 2 + description: + The first cells is device id. The second one is the cpu id. + + dma-masters: + maxItems: 1 + +required: + - reg + - '#dma-cells' + - dma-masters + +additionalProperties: false + +examples: + - | + dma-router@154 { + compatible = "sophgo,cv1800-dmamux"; + reg = <0x154 0x8>, <0x298 0x4>; + #dma-cells = <2>; + dma-masters = <&dmac>; + }; From patchwork Mon Jul 29 04:36:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13744354 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5FD0C3DA7E for ; Mon, 29 Jul 2024 04:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hrlfC9uFm11nz+V9fw983aHVE3FKpwFpfCglJUMO/rY=; b=Q+cl8KN1G2jV1c ZfuGCw3yJvpGhFoDB4NDYEn3RvuT2HS1JLp1xI16zuZQO/eWrEM2iOL8FewM9vAbpGKDs4o6g4tZW Vzvgnp8jemXsSpOok2UC6ghDXzFQmagU1U2wKwT/qp0JioTgpOWnTZmutcB976b63pMOt9WSqSQRd 8b0+dacbjj+US2/TIu5YqB3XlfYIQPnd+ongD2GgLo3WAW+Fn9qUBY8UO423ak7u4bd9BWTqWCs+a gd/c8FpH2/Lha8q1DpJhN04XpZdSB/6NHEf25xn3oOZP+4DYdZIzg2IjRrAR4RMgv1LngmmjHxXX1 NTX+FMWW1JXsneiFJrnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYI94-00000009yHR-3KQJ; Mon, 29 Jul 2024 04:38:02 +0000 Received: from mail-sn1nam02acsn2080b.outbound.protection.outlook.com ([2a01:111:f400:7ea9::80b] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYI8b-00000009y3e-1fQ8 for linux-riscv@lists.infradead.org; Mon, 29 Jul 2024 04:37:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ReFOjxyDCrZpjPFR0XXMg0E+GNeBO9QY8nSrgdYeroQOK7WsfReCdob8f3qNx4P3Afp1C2HVnfGdEfIhN2hr8oqhivhYkPNG+0Vu7qsnX7apiRtRz692hSISsnT1wviTUGNd5u6O3AEozxxQXHGm8kr8509YdXriEDkwtMDX/HYutaG0R8ZPDRC7/ZBjvghxUFDUoxp6B+ng5ngpWZNoVqmf3lRofG0WNIdMg5KYkm06CV2i07vZ3Ah65DvZYxyU7xiSLxoFisrWQ/uGztzhpBu0SyXgWCmQcHQj2mqkzII0VxKiFiNAe7zzaj4Vm1LwmtUgj8BU485MvwVKqRGZ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kS0KlR6sMzZ54c2Mbq9eCPI0GiPAwbDVfnXhdu/XLI8=; b=A5Lqqz1vfUaniiiHFBApbClhntoErSXR1xi6ZmA5Or3IYxYrJNY/dpREVQFNgAYQbigTxBzp+hPJy/jswHoBoCBz+OUdLkXbkFOHtUOAjUt2n9kPzmB8khUy10BkY9d0hk0VAArX/Dl6+iaf/KBOmdgi3TxFNgirY6w+5B9BtEhwUjyN1FvpFNew9HvUHEGud1/4FVYk7DxRENmqCaFtd/feX0kitJD6aFAwi4Y5tNt5HMZlsUMnZ/Geq8qoriYwOzffU6WIS/qlan7dv6vI24MO0ixDECyYhB3N4uaMv5tCrZd3FEWA9LsIivFjqL1u8xCGk2vtGSIm/CSP77e1jg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kS0KlR6sMzZ54c2Mbq9eCPI0GiPAwbDVfnXhdu/XLI8=; b=Cz6kOL1k/1XDH2PpIq7XZzIGXDKqZ3H5j0/7ofYzKXY7tOh2dchUDtmxcwF782FoCZ85Vb6R5IftgYu7U6InuMyvBgO20swqkPW/mF99khzKcO6Dp5r3FpYuu2QcC7G1vahA+YaTNoVcCfFNUMZZmC8Cv0i17knOZZh+EFjiSz9KjC+JbRQKOeuyR+tXTlpb2j4J9qZAqSf4t/eBBhdoSu3G3Poy8K3F1OnUrONcAH6cdAd0eDGrAD+TJ7+WdzyxLvmZQWeKPF2XbcrBO9/o4iHECjSAqtuV1bUIqc51qtp3RGR/fFTvdWKXYsHFjg9koiNeelJ7gAOIHsXWNHSi8Q== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by SA1PR20MB4516.namprd20.prod.outlook.com (2603:10b6:806:23d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.29; Mon, 29 Jul 2024 04:37:21 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%5]) with mapi id 15.20.7807.026; Mon, 29 Jul 2024 04:37:21 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Liu Gui , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v8 RESEND 2/3] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Mon, 29 Jul 2024 12:36:52 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-TMN: [SCg594rCqFiUdthjqEsQzSxrPO0NXXC2O9iOrWRJ4DI=] X-ClientProxiedBy: TYCP286CA0369.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:79::13) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240729043653.899480-2-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|SA1PR20MB4516:EE_ X-MS-Office365-Filtering-Correlation-Id: 392636cf-7f55-4af9-099b-08dcaf88228a X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|5072599006|19110799003|461199028|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: ijHi0uciQpYg1OrTTTc1BKaW5U6gO9gkWzoAi1XZOcn7ku2KhSxMSQRZDAUfg9ycoMf2JXWBnE6GjQeu5Px1pBX3OO36x2BhpLH5BJCPiS7IFh53BOJ/3B++DJGT4BVeABYx0tM76kUlo2iwYUGKbLo/6dqik1EuOzb5202pz7Us1AOU/e5mYOJjd0nwzXVK9TOzfgiEPZIZxDRCTCfIr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VlrjDjVY/by7F+oMj3XupeugXgJW2EiuCnXl9cangcW/W1zySilL7IaOAPGZczYGzloG8XNsJJWaLH1EHXFWnsIb/DXQiInoe9DJTZ3CIaliymHpmJ4w0NiFEZDOzvTU1tB5gbSkj3yxdeebLuNFNft/O4IOC0LamM09tXy3OrUQ7nfu4wwXy7F/M7zlBhIUGDNWp1oISBoVf2TZ4K5HqtGFfkw/S5ji13KG+2zvNbj05cJMEAkBk1wZJb0pGSzOZmSP3I2weKOj/2JHSzjsdVgKiBtrSOGoiQGPPDcxmKJFLA/Zx1hwt63tP6xAZrLvnc16ohR1uM8FVkdcFuxHAcyTpvPCdss5hf8CJurrA7ujKdeYF6Us/gpUES5tMbQ+bPHYtqQVRVliPjqsKtvyFvkFBZze/vpmRxuvDpZg6uR8Cl1FmlNm+Ihca+rR+mUcOEC3O/0rSDQgGUCfZSWaCF6nlD9t6cZsGr7jvO70H52rVsm5IH34scRIgzPYD+zJ8HL0HbtMmm8FrwTWxJAhYxJkLBWuqG2GjJCBwGaA7PguMQgjOcXXkhlORiShMKMWbtJnhRzjZGR02w9MuHUhkVE+lCGuICwgoYl+4kvdQKose1qssOQzACl3gOOv6e+0TWVTUqV8CGIirTB83XmeLsqB2DIGpKFchvQqYsxcU8zCXM+DwIxzaD3n+GBKODJRBMB2SRM1z8i6n+IQCK9f0LLelplcu3KFRxw2ziXQrnpMDoKuQpKrdQ1c+QdDQq+nrSwz X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 392636cf-7f55-4af9-099b-08dcaf88228a X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2024 04:37:21.0870 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR20MB4516 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240728_213733_483192_3C895F29 X-CRM114-Status: UNSURE ( 9.31 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The "top" system controller of CV18XX/SG200X exposes control register access for various devices. Add soc header file to describe it. Signed-off-by: Inochi Amaoto --- include/soc/sophgo/cv1800-sysctl.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/soc/sophgo/cv1800-sysctl.h -- 2.44.0 diff --git a/include/soc/sophgo/cv1800-sysctl.h b/include/soc/sophgo/cv1800-sysctl.h new file mode 100644 index 000000000000..b9396d33e240 --- /dev/null +++ b/include/soc/sophgo/cv1800-sysctl.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2023 Inochi Amaoto + */ + +#ifndef CV1800_SYSCTL_H +#define CV1800_SYSCTL_H + +/* + * SOPHGO CV1800/SG2000 SoC top system controller registers offsets. + */ + +#define CV1800_CONF_INFO 0x004 +#define CV1800_SYS_CTRL_REG 0x008 +#define CV1800_USB_PHY_CTRL_REG 0x048 +#define CV1800_SDMA_DMA_CHANNEL_REMAP0 0x154 +#define CV1800_SDMA_DMA_CHANNEL_REMAP1 0x158 +#define CV1800_TOP_TIMER_CLK_SEL 0x1a0 +#define CV1800_TOP_WDT_CTRL 0x1a8 +#define CV1800_DDR_AXI_URGENT_OW 0x1b8 +#define CV1800_DDR_AXI_URGENT 0x1bc +#define CV1800_DDR_AXI_QOS_0 0x1d8 +#define CV1800_DDR_AXI_QOS_1 0x1dc +#define CV1800_SD_PWRSW_CTRL 0x1f4 +#define CV1800_SD_PWRSW_TIME 0x1f8 +#define CV1800_DDR_AXI_QOS_OW 0x23c +#define CV1800_SD_CTRL_OPT 0x294 +#define CV1800_SDMA_DMA_INT_MUX 0x298 + +#endif // CV1800_SYSCTL_H From patchwork Mon Jul 29 04:36:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13744355 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57404C3DA4A for ; Mon, 29 Jul 2024 04:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SpdSJjXuwaKjYVfTVhVZk0Vo48BUlx2T+ZzXFvA2KbM=; b=ie38lWyZrqU1IH HiC/sOKhoZE9bJsdMrFBLgEbljdReq12QWRq2kEHKsDsho4g1ra0oUvBc4h3iyJTsj/DMQTX+U38d Audkaki75UT3lkIk8arYCBi054PJajsgyCtTLMBEdd2195OhvBAGu2NDkdxawAaxyw9UAz2IqGtvg fhCxy+zejkk73WWX762yk0qoCYcJdp4vv0n8SZnGnK3Yu3Iiq0hsLpIDy4p1VIFCk4B7l5Ose0R3Y fpkxIOlGSqPgZkm/nJFY1PYVOKoY59X9e1YpJzdci5PSAT5lEo3HObCwUOMrROa6p+R5Uhzsuw1Dy Z6QSqFLFbcrYAdEF3SSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYI95-00000009yI0-2mbp; Mon, 29 Jul 2024 04:38:03 +0000 Received: from mail-sn1nam02acsn2080b.outbound.protection.outlook.com ([2a01:111:f400:7ea9::80b] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYI8d-00000009y3e-0rs2 for linux-riscv@lists.infradead.org; Mon, 29 Jul 2024 04:37:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KbAYerldT7lO3u9edaaXtZsvqiREeMTXEw02j2/ucYR7Qzrrz3TH9r1YRAhSq3iETRN6cvU5KoBdy4kUaHHyTZBXGHUsfTS6cq0yD1QCI5+Twr3pm8XwAv7WyEHXm09byRaQQhD0hWCJKUYmu0drxSuk3sLOIeyTWBZkafXwyt/Z0uEcvBTOP62CiOA0OvP/swD+XPVthCbOFHOIXSY1u5F2TYWddOKMqWaq8pMTX9qisdSbwmYfaMJQVkz2QKLRaCvbIVP4K3ayJZ/kk2Txe53d02gC86zmzrrmFlv/ov9Ts+y6HFieD1vCF2hkzxZFOFfaVeMpgDTIGWMjfQ8NEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=sVvw0KcRO3YlrxiYZpzerGioQkzY8USL+mN5SJYl50c=; b=gscCQqkWSn6Y+jTqoohwldMn8pJaaYAHmoQkjYooKpNuatGVQnD06a4JvVt39CfyulCiFMmRtoeXOixJ8SaTmBzpKSeHgt3FbtlGq0R3aOZdgWbnNf60o+uJWO0TP5ITHUFzzwW7WbPpLpLa6Atn0CJCyILsyv3I/0KI9DRskvCPixCW5gTDcz/LPvJiROPiy5x+jHrK5DYgXtZH9iFVMeBMVF+1O/NnM+cP2SQNZSGdbWja55zIovW6Jc21s5unXB7I4XHHSaBy4p2LdFPHgVCbGkg5RTZ40XhAiohFnb6O5M2b9vfXFFm/zqXpJzVYvAus5rfZVMA0rtDxh90tYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sVvw0KcRO3YlrxiYZpzerGioQkzY8USL+mN5SJYl50c=; b=p5IUJq6PT5Wc/C/ytTBdAwWritH+O+o4F6mhciGR+HrWj3AsN3UhaCcEvyM9obHZEbpmKk4wHgCQeBxT3HsVzj6TZ3alYdT0qa4UdtY3uXEEMYkGYJP75uxJsWKRVubiwJA1ElEms5oLnu91WAz4YYxW9PB7eaSvyyAz+yqKBAKb73BZeatJbYcQGYp06hDipcC6pRKaPsQh8+KTNUv5V2t8lTaeK4YWyOY3dYlJANTzIRB/OmwnXfCHUx6KjhgEl9zUytfRAiUjVn0Ed8cMb0/QOOzEI+Gf6Usi3FHtX+N6wicNFsKxgQ3QcG9BvM0UqF+yXFssAV8IM3gXSRkQ+g== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by SA1PR20MB4516.namprd20.prod.outlook.com (2603:10b6:806:23d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.29; Mon, 29 Jul 2024 04:37:25 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%5]) with mapi id 15.20.7807.026; Mon, 29 Jul 2024 04:37:25 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Liu Gui , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v8 RESEND 3/3] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Mon, 29 Jul 2024 12:36:53 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-TMN: [2wGaVa5uJy+MaoEB50U5drkt5On76xTEXS5HnJtP3yA=] X-ClientProxiedBy: TYCP301CA0064.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::16) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240729043653.899480-3-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|SA1PR20MB4516:EE_ X-MS-Office365-Filtering-Correlation-Id: d2454099-eef8-4f58-56a7-08dcaf882518 X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|5072599006|19110799003|461199028|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: D77KAMEvGSjFDpWFEOCYWvuvR1PoCrC1J03Ov8waxw2dhupZrX7Us3Ga1fht6rYWrh3zRyVTPMRhOSwk5SAz2VW0Mb+f4SZs9sdJ+cS2Ec8ZPDGXRuK6L4PL09gfkEwizKzI9+Lwtm8b7jEr5iv3RvxFC6vhGOCsFqbtdM3PJDm4f6OrFA9gKCIpQaSqdSqFDuFI5XZ5Aza79i+o9aNdamB7GJOyRDiv+S3twvAHoZa02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XmFC6SKrxmoKvBp7n66psBCdya+FpFpMZnbhVUKTDcy5meeEsMhdEpSrK4oozgXLKj5LZzT2YEE9os08i5C/La6La46N0FngUtPeKf5bSZ+Vje9Bkt15G9X/wGjaRVNwqINvZvwV4oVDCTmlwUbF6QFaojIFYuCWP1DKMqKIEWdKfzlNjTmsdabNUJhSY49p+SobB24LT1MJ+pGKtDYyU1A7lr8Oi+qUbRN70p9IUEuS0HmODtd3Ok6Ju0G07XJmmd2ePVv3OlXHc1nZT2HHRhcCeq/KXKdoQ5WPlILGWJuob1yxFj8S3seu6bsN3J6eUoK6uwqMRpA/I/U4mD92rS1vADBaOjXU49j+i6KaDZmnGhRWXCT15MPHNfa3CBsayFQhLlznu2ts5kOn4SexM0inW0/3UNQmhuQavhkMy1nXzPBEgsixgI0kwJUd+V8iKXQcnmJAnpngaKMKQg1Glbgk2+59zEqKsd1FBwBYv1uKQKTOeWwkCSkikUYxNy89YoEOK2d4hbw/LoCe+5Pf8ssaBCmqjyXS94y1zI1VJ/4KPs9Pr2+CkNXWyiKxWo9JE/s8xz2CpSn+qduyRb6Wx6F+sDGTLTCSIv8pMT0j808bMLsjYW1VvqHTA96TREzQHSvjb7eWOoMp16TBJYoIFM/tYcVvXCqbbpAayr3wAWiAlZ7v/l8rsuxkUBxgmIKSG9gsleXNmG1qaFu5ztcyNKKpjdjKwitmOVb0oSx2 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2454099-eef8-4f58-56a7-08dcaf882518 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2024 04:37:25.5519 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR20MB4516 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240728_213735_319992_56B9BC2F X-CRM114-Status: GOOD ( 21.60 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Sophgo CV18XX/SG200X use DW AXI CORE with a multiplexer for remapping its request lines. The multiplexer supports at most 8 request lines. Add driver for Sophgo CV18XX/SG200X DMA multiplexer. Signed-off-by: Inochi Amaoto --- drivers/dma/Kconfig | 9 ++ drivers/dma/Makefile | 1 + drivers/dma/cv1800-dmamux.c | 259 ++++++++++++++++++++++++++++++++++++ 3 files changed, 269 insertions(+) create mode 100644 drivers/dma/cv1800-dmamux.c -- 2.44.0 diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 002a5ec80620..cb31520b9f86 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -546,6 +546,15 @@ config PLX_DMA These are exposed via extra functions on the switch's upstream port. Each function exposes one DMA channel. +config SOPHGO_CV1800_DMAMUX + tristate "Sophgo CV1800/SG2000 series SoC DMA multiplexer support" + depends on MFD_SYSCON + depends on ARCH_SOPHGO + help + Support for the DMA multiplexer on Sophgo CV1800/SG2000 + series SoCs. + Say Y here if your board have this soc. + config STE_DMA40 bool "ST-Ericsson DMA40 support" depends on ARCH_U8500 diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index dfd40d14e408..7465f249ee47 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -67,6 +67,7 @@ obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/ obj-$(CONFIG_PXA_DMA) += pxa_dma.o obj-$(CONFIG_RENESAS_DMA) += sh/ obj-$(CONFIG_SF_PDMA) += sf-pdma/ +obj-$(CONFIG_SOPHGO_CV1800_DMAMUX) += cv1800-dmamux.o obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o obj-$(CONFIG_STM32_DMA) += stm32-dma.o obj-$(CONFIG_STM32_DMAMUX) += stm32-dmamux.o diff --git a/drivers/dma/cv1800-dmamux.c b/drivers/dma/cv1800-dmamux.c new file mode 100644 index 000000000000..6ce3c292fe12 --- /dev/null +++ b/drivers/dma/cv1800-dmamux.c @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Inochi Amaoto + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define DMAMUX_NCELLS 2 +#define MAX_DMA_MAPPING_ID 42 +#define MAX_DMA_CPU_ID 2 +#define MAX_DMA_CH_ID 7 + +#define DMAMUX_INTMUX_REGISTER_LEN 4 +#define DMAMUX_NR_CH_PER_REGISTER 4 +#define DMAMUX_BIT_PER_CH 8 +#define DMAMUX_CH_MASk GENMASK(5, 0) +#define DMAMUX_INT_BIT_PER_CPU 10 +#define DMAMUX_CH_UPDATE_BIT BIT(31) + +#define DMAMUX_CH_REGPOS(chid) \ + ((chid) / DMAMUX_NR_CH_PER_REGISTER) +#define DMAMUX_CH_REGOFF(chid) \ + ((chid) % DMAMUX_NR_CH_PER_REGISTER) +#define DMAMUX_CH_REG(chid) \ + ((DMAMUX_CH_REGPOS(chid) * sizeof(u32)) + \ + CV1800_SDMA_DMA_CHANNEL_REMAP0) +#define DMAMUX_CH_SET(chid, val) \ + (((val) << (DMAMUX_CH_REGOFF(chid) * DMAMUX_BIT_PER_CH)) | \ + DMAMUX_CH_UPDATE_BIT) +#define DMAMUX_CH_MASK(chid) \ + DMAMUX_CH_SET(chid, DMAMUX_CH_MASk) + +#define DMAMUX_INT_BIT(chid, cpuid) \ + BIT((cpuid) * DMAMUX_INT_BIT_PER_CPU + (chid)) +#define DMAMUX_INTEN_BIT(cpuid) \ + DMAMUX_INT_BIT(8, cpuid) +#define DMAMUX_INT_CH_BIT(chid, cpuid) \ + (DMAMUX_INT_BIT(chid, cpuid) | DMAMUX_INTEN_BIT(cpuid)) +#define DMAMUX_INT_MASK(chid) \ + (DMAMUX_INT_BIT(chid, 0) | \ + DMAMUX_INT_BIT(chid, 1) | \ + DMAMUX_INT_BIT(chid, 2)) +#define DMAMUX_INT_CH_MASK(chid, cpuid) \ + (DMAMUX_INT_MASK(chid) | DMAMUX_INTEN_BIT(cpuid)) + +struct cv1800_dmamux_data { + struct dma_router dmarouter; + struct regmap *regmap; + spinlock_t lock; + struct llist_head free_maps; + struct llist_head reserve_maps; + DECLARE_BITMAP(mapped_peripherals, MAX_DMA_MAPPING_ID); +}; + +struct cv1800_dmamux_map { + struct llist_node node; + unsigned int channel; + unsigned int peripheral; + unsigned int cpu; +}; + +static void cv1800_dmamux_free(struct device *dev, void *route_data) +{ + struct cv1800_dmamux_data *dmamux = dev_get_drvdata(dev); + struct cv1800_dmamux_map *map = route_data; + unsigned long flags; + + spin_lock_irqsave(&dmamux->lock, flags); + + regmap_update_bits(dmamux->regmap, + DMAMUX_CH_REG(map->channel), + DMAMUX_CH_MASK(map->channel), + DMAMUX_CH_UPDATE_BIT); + + regmap_update_bits(dmamux->regmap, CV1800_SDMA_DMA_INT_MUX, + DMAMUX_INT_CH_MASK(map->channel, map->cpu), + DMAMUX_INTEN_BIT(map->cpu)); + + spin_unlock_irqrestore(&dmamux->lock, flags); + + dev_dbg(dev, "free channel %u for req %u (cpu %u)\n", + map->channel, map->peripheral, map->cpu); +} + +static void *cv1800_dmamux_route_allocate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) +{ + struct platform_device *pdev = of_find_device_by_node(ofdma->of_node); + struct cv1800_dmamux_data *dmamux = platform_get_drvdata(pdev); + struct cv1800_dmamux_map *map; + struct llist_node *node; + unsigned long flags; + unsigned int chid, devid, cpuid; + int ret; + + if (dma_spec->args_count != DMAMUX_NCELLS) { + dev_err(&pdev->dev, "invalid number of dma mux args\n"); + return ERR_PTR(-EINVAL); + } + + devid = dma_spec->args[0]; + cpuid = dma_spec->args[1]; + dma_spec->args_count = 1; + + if (devid > MAX_DMA_MAPPING_ID) { + dev_err(&pdev->dev, "invalid device id: %u\n", devid); + return ERR_PTR(-EINVAL); + } + + if (cpuid > MAX_DMA_CPU_ID) { + dev_err(&pdev->dev, "invalid cpu id: %u\n", cpuid); + return ERR_PTR(-EINVAL); + } + + dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); + if (!dma_spec->np) { + dev_err(&pdev->dev, "can't get dma master\n"); + return ERR_PTR(-EINVAL); + } + + spin_lock_irqsave(&dmamux->lock, flags); + + if (test_bit(devid, dmamux->mapped_peripherals)) { + llist_for_each_entry(map, dmamux->reserve_maps.first, node) { + if (map->peripheral == devid && map->cpu == cpuid) + goto found; + } + + ret = -EINVAL; + goto failed; + } else { + node = llist_del_first(&dmamux->free_maps); + if (!node) { + ret = -ENODEV; + goto failed; + } + + map = llist_entry(node, struct cv1800_dmamux_map, node); + llist_add(&map->node, &dmamux->reserve_maps); + set_bit(devid, dmamux->mapped_peripherals); + } + +found: + chid = map->channel; + map->peripheral = devid; + map->cpu = cpuid; + + regmap_set_bits(dmamux->regmap, + DMAMUX_CH_REG(chid), + DMAMUX_CH_SET(chid, devid)); + + regmap_update_bits(dmamux->regmap, CV1800_SDMA_DMA_INT_MUX, + DMAMUX_INT_CH_MASK(chid, cpuid), + DMAMUX_INT_CH_BIT(chid, cpuid)); + + spin_unlock_irqrestore(&dmamux->lock, flags); + + dma_spec->args[0] = chid; + + dev_dbg(&pdev->dev, "register channel %u for req %u (cpu %u)\n", + chid, devid, cpuid); + + return map; + +failed: + spin_unlock_irqrestore(&dmamux->lock, flags); + of_node_put(dma_spec->np); + dev_err(&pdev->dev, "errno %d\n", ret); + return ERR_PTR(ret); + +} + +static int cv1800_dmamux_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *mux_node = dev->of_node; + struct cv1800_dmamux_data *data; + struct cv1800_dmamux_map *tmp; + struct device *parent = dev->parent; + struct regmap *regmap = NULL; + unsigned int i; + + if (!parent) + return -ENODEV; + + regmap = device_node_to_regmap(parent->of_node); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + data = devm_kmalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + spin_lock_init(&data->lock); + init_llist_head(&data->free_maps); + + for (i = 0; i <= MAX_DMA_CH_ID; i++) { + tmp = devm_kmalloc(dev, sizeof(*tmp), GFP_KERNEL); + if (!tmp) { + /* It is OK for not allocating all channel */ + dev_warn(dev, "can not allocate channel %u\n", i); + continue; + } + + init_llist_node(&tmp->node); + tmp->channel = i; + llist_add(&tmp->node, &data->free_maps); + } + + /* if no channel is allocated, the probe must fail */ + if (llist_empty(&data->free_maps)) + return -ENOMEM; + + data->regmap = regmap; + data->dmarouter.dev = dev; + data->dmarouter.route_free = cv1800_dmamux_free; + + platform_set_drvdata(pdev, data); + + return of_dma_router_register(mux_node, + cv1800_dmamux_route_allocate, + &data->dmarouter); +} + +static void cv1800_dmamux_remove(struct platform_device *pdev) +{ + of_dma_controller_free(pdev->dev.of_node); +} + +static const struct of_device_id cv1800_dmamux_ids[] = { + { .compatible = "sophgo,cv1800-dmamux", }, + { } +}; +MODULE_DEVICE_TABLE(of, cv1800_dmamux_ids); + +static struct platform_driver cv1800_dmamux_driver = { + .driver = { + .name = "cv1800-dmamux", + .of_match_table = cv1800_dmamux_ids, + }, + .probe = cv1800_dmamux_probe, + .remove_new = cv1800_dmamux_remove, +}; +module_platform_driver(cv1800_dmamux_driver); + +MODULE_AUTHOR("Inochi Amaoto "); +MODULE_DESCRIPTION("Sophgo CV1800/SG2000 Series Soc DMAMUX driver"); +MODULE_LICENSE("GPL");