From patchwork Tue Mar 26 01:47:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13603241 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10olkn2030.outbound.protection.outlook.com [40.92.41.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80C6C208C3; Tue, 26 Mar 2024 01:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.41.30 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711417630; cv=fail; b=FJ3ZuTGkG0QiW5MiWB7Uwq2b21x/ufpH1b4aBowciSJKDxFE970bctfN03Xl0TZq9+IlA911S6vLZIsQdc8o8M+y67dmm9LN2q4BP+MC+hZM6kiGVor7xKOWT1TFc9gHhq5860xAkE0lzF3wJI55kSEud4d38NVVz2worEpj3mI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711417630; c=relaxed/simple; bh=1OOsucIrRjpdfDLKsQ7i9+kFepqGo9S+LcJ3bptx/Yc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=unkP8vCKm7GUCVqc62jE7ogCjw063un8xQcHiAMaSpgzK4WMbIOb0FyqpG5C/lC0MahYAWrIKiMz2/G7MM6Ton6h1ZEXx8+MCtxGKvVdJrW1qpY3UqUD7Cxd1xkEnArnCEGJkIpgTDPqE3xeriz7khoxxR16DxD3/JBkwJy63Sk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=MHNGm17L; arc=fail smtp.client-ip=40.92.41.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="MHNGm17L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FeP1XG0TPAGui/YiWHZZjTFgOHr8AxXJctqXrccOhRRNiIaH3gn21qDbGICL9iFGE0fxG3g7Ov5KCT2UcLjk1JqVuPXNAMsa5JIUAgP0qvTpGAs768E3xAq6seAnxqnAeIu5oRzVS8C+tefOmWBpxHCSJprKUXq5jJ1vY+c6WWP2ObDErs0Relkrgc4mpHXxLux8z93Em1WAM//8ozuKRCWRX1v3/ZZF8jVThx2ZrH5lW4CLoCuFIIerU70VSbx0gI4Q/m+jcqI/oAcLs5WWqBp7MwdKybE0vketm5e0WnaY5qx5HmeE0gZUOavG+XVDGuoZNzXzd7VMn+0veeTtKw== 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=dtomVtg4mIqjy/DwUK3ruv+kxALMcxzSl3aOBQ6jDyo=; b=jcfSqqVRB7oWI0PL0EwdgGhHpU06f/sloVrYMKCwM51nSZfe1FfEk9hQ6et/51F5/66YVcBF81L2MJ5eCyj0YONd1+Cglv93tsSe4iJZ/B/4/NH60ZbWofb/BMwDNZ2BzW/B0oeimFa0yfX7BaxZVmq8nYt6DGKXTXUN13csYJ3rHExh8R7c25nRQPJcvf0m97Q0WWAZ6J/BcQb/t/fu1ai22YPKA8Cc1QZfkMt9/HBTJl6Lqwml3Yc9UOYHr7J4O7lBVzkHHsJ5zvEJKhUXoRtSUhGFR2uoj5sij2CJKSgOodiWB8VUWROtRW5d+6QnZki/MGKqmU3PW2JdQKbEmA== 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=dtomVtg4mIqjy/DwUK3ruv+kxALMcxzSl3aOBQ6jDyo=; b=MHNGm17LnLo0fLRvbVtBvbX0ph4rAVzVqXRyN56q2/ScwTgC6VyNqytBtwcTfh9S2WYyWp6Z3yTlIZz6y3vGr0CSvfXzQWMOHQs6BbInfccjQcIE5ForIH/FYcWq5nbPDiznO6HMOF7k6ZH5nDu/tBMfau23SDrK+gNUGdOItx7MX6PC5G94VohaikLqx20RispiP+ZdO5vn/HGBMnGEZRrweODa/pyuXFHE+eu1b8SE+b11KGUQh68uoeDkt+m5HJIAlQlbL4kFFntZZN4BW6cE3z23zDrzA0siGNwm5MGO/DuI91Js/IYX7lTdNhz+uwFpkn9B4JcpID4rjVvtcw== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by PH7PR20MB4964.namprd20.prod.outlook.com (2603:10b6:510:1f8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.30; Tue, 26 Mar 2024 01:47:05 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::182f:841b:6e76:b819]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::182f:841b:6e76:b819%2]) with mapi id 15.20.7409.026; Tue, 26 Mar 2024 01:47:05 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v5 1/3] dt-bindings: dmaengine: Add dmamux for CV18XX/SG200X series SoC Date: Tue, 26 Mar 2024 09:47:03 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [V0DYU5w8+/yTpuTFj220gal4Xaa1y1ld1mLiGlXsa1M=] X-ClientProxiedBy: TY2PR06CA0046.apcprd06.prod.outlook.com (2603:1096:404:2e::34) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240326014707.327110-1-inochiama@outlook.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|PH7PR20MB4964:EE_ X-MS-Office365-Filtering-Correlation-Id: c8ebcd0a-cec6-47f2-2a1e-08dc4d36a3ec X-MS-Exchange-SLBlob-MailProps: RlF2DIMZ1qXOkXGJ+Mozsa5bhT5ExeELuWzU9cKs0/9XTJjCpdX5xXQ/uIssNNpUIG7PA4X2wdaZrIcW0oKYSenUp+oYFz+Wj8E2cXZBEBFgva0Hcu5+l7qA70H18SJX+eh58pCvSkf+D18wJ9/WM3tlpcUyQAtCUTDUCR2buYkrCkRRMW5Vmh0eRlOHOnhTjWlS2yb4s60FuCx+pxYLKr0MZJAPalndQEOhk2mOz4qHEp/++QlRw5bNb+YsUG2GABE77aTzmVGxhAa7zS6CrStm8TjWw2O9H1hVIlk26Gnz2rA6wpMpx+Z5Q5fSe9Quz9Ww/IzdRIqW5bIOvxiurlFKxEs9lucsHdHS0LQZI5EqTb5WFN6WTj2mJUAxgAHYWFdAXF/eHsMwZc9uB63Ppz5KJsO51e7dqLiy7tZUpExngjRUdo45DrTILmobAQXmwphwNodK66SkBRzUo2YBkBjI+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qXR0KKqI2//s0S6xlRyLjfc56IJaaNnusPxBr22UIY9CH3DP23oWGS/uggcGE2bVBHgC7zQK6rblhL+j7BUu+uz+MwrezKwoh2VOjs3KzVrXA4TXUSHsIveV3qCwrJXTc45UB08opif6C6hD0pY1lrOmdVWXvhZB2VvkoPb2Q51EWyqlNGUsAyDuIh9GsGyLW38tgdnjyxUNmqxibxXBh7bobYfTDGfC0SAODs/kXK7aeuQt18NCpwQ4KUmJP+cM4W6aNZ0epIm/kRdsjtIVyG8O6cXPBMv9CuRUP0K2dpQdgiZlNBwN3keqbSETFnYTDzDZbzeXxVzixeOTJdo9 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8ebcd0a-cec6-47f2-2a1e-08dc4d36a3ec X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 01:47:05.5834 (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: PH7PR20MB4964 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. Add the dmamux binding for CV18XX/SG200X series SoC Signed-off-by: Inochi Amaoto --- .../bindings/dma/sophgo,cv1800-dmamux.yaml | 48 ++++++++++++++++ include/dt-bindings/dma/cv1800-dma.h | 55 +++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml create mode 100644 include/dt-bindings/dma/cv1800-dma.h -- 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..d7256646ea26 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml @@ -0,0 +1,48 @@ +# 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 mux + +maintainers: + - Inochi Amaoto + +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 + + dma-requests: + const: 8 + +required: + - '#dma-cells' + - dma-masters + +additionalProperties: false + +examples: + - | + dma-router { + compatible = "sophgo,cv1800-dmamux"; + #dma-cells = <2>; + dma-masters = <&dmac>; + dma-requests = <8>; + }; diff --git a/include/dt-bindings/dma/cv1800-dma.h b/include/dt-bindings/dma/cv1800-dma.h new file mode 100644 index 000000000000..3ce9dac25259 --- /dev/null +++ b/include/dt-bindings/dma/cv1800-dma.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef __DT_BINDINGS_DMA_CV1800_H__ +#define __DT_BINDINGS_DMA_CV1800_H__ + +#define DMA_I2S0_RX 0 +#define DMA_I2S0_TX 1 +#define DMA_I2S1_RX 2 +#define DMA_I2S1_TX 3 +#define DMA_I2S2_RX 4 +#define DMA_I2S2_TX 5 +#define DMA_I2S3_RX 6 +#define DMA_I2S3_TX 7 +#define DMA_UART0_RX 8 +#define DMA_UART0_TX 9 +#define DMA_UART1_RX 10 +#define DMA_UART1_TX 11 +#define DMA_UART2_RX 12 +#define DMA_UART2_TX 13 +#define DMA_UART3_RX 14 +#define DMA_UART3_TX 15 +#define DMA_SPI0_RX 16 +#define DMA_SPI0_TX 17 +#define DMA_SPI1_RX 18 +#define DMA_SPI1_TX 19 +#define DMA_SPI2_RX 20 +#define DMA_SPI2_TX 21 +#define DMA_SPI3_RX 22 +#define DMA_SPI3_TX 23 +#define DMA_I2C0_RX 24 +#define DMA_I2C0_TX 25 +#define DMA_I2C1_RX 26 +#define DMA_I2C1_TX 27 +#define DMA_I2C2_RX 28 +#define DMA_I2C2_TX 29 +#define DMA_I2C3_RX 30 +#define DMA_I2C3_TX 31 +#define DMA_I2C4_RX 32 +#define DMA_I2C4_TX 33 +#define DMA_TDM0_RX 34 +#define DMA_TDM0_TX 35 +#define DMA_TDM1_RX 36 +#define DMA_AUDSRC 37 +#define DMA_SPI_NAND 38 +#define DMA_SPI_NOR 39 +#define DMA_UART4_RX 40 +#define DMA_UART4_TX 41 +#define DMA_SPI_NOR1 42 + +#define DMA_CPU_A53 0 +#define DMA_CPU_C906_0 1 +#define DMA_CPU_C906_1 2 + + +#endif // __DT_BINDINGS_DMA_CV1800_H__ From patchwork Tue Mar 26 01:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13603242 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2067.outbound.protection.outlook.com [40.92.22.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 161524E1A2; Tue, 26 Mar 2024 01:47:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.22.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711417635; cv=fail; b=eaCLzUStYyfzaofrkZGIVAlvUxxcT07FTa95S0DerogpnrHdP3BVmEb1myip0kP5RfCmtH3lR0WbC1toLVolAoAS3OX5OXIXZ23G732eB5k1bpfHGPerwEAk78bZcQvg21b7m4z0iQTENlpbTeoMnXsNiBY+wbqltUyEsHLAHRo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711417635; c=relaxed/simple; bh=8JgoSjCMgT+4YWgPAd3BpnSD8PgiKGpOWzslfEu2zi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=TIttQrMLFNHwLMoBm/jKv81KvP8ePxESQSiA08N3zXATZ21ktEIQZePrBABs1PBt/MYgDBRJgxUQcozOW5b7WCDJUdEIwNcKtf54Y3UHCkcws8qa07ecbbjcCA0YHFTjkdM4GRMbXDnBr/mImHB4C4OZgLeM9AM8qZiv5g1yI1g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=UVv1UjJd; arc=fail smtp.client-ip=40.92.22.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="UVv1UjJd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RkuHgIOjxccjzqc7UxJgE1apUdlK6ghsq/9DKfSdFwx+SNV5OMrem0UP2OXaKO8L6CInwZa9InPWYRUWOe4vNf8lLDXqRpbrbQOhsknGDtTiWZ5bqp8LDttG/SpjqK8oZk6BT5r7B6t4pRbB6CctSmeCf/UBn2nvYr+wWTBcYZiFd4EfQLeKUFd6YTIXdpVm/1D23DYx0hZ51GohqH7DmzirOw5t2IcILphl+Vjrtr9KWpgo9SIiHjpejabgdQ3yeqBv5NXWjI4HHHeQXXqNyyfMWBpWH53kKAAKG0FD0MF8SU+6K4H1J1xDCii9PTDMxzn8wQUJr8b9/JwrDMn6Hg== 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=kS0KlR6sMzZ54c2Mbq9eCPI0GiPAwbDVfnXhdu/XLI8=; b=AU4mVFivZlqirISEwW1ipHXNeo6mTaUP7UwpNLdvR1Z485z/x+birbRL4ggAqfZJ0oJq6+p65A7NqW8Fv088bDcZ3hp4J7zqkdLuK9KS5k4E7WhhWpBwc8o+mIuORuc7zRUw9ZaAfD9E9aLmQdBxeZj4y4MfVioXk8+fH7xRdNnb1fs3SMcUZLw7ym9Kes6BAUgyWA1dv0nt/iqdE4cyJav59K5fa+SDIe9fOHm+kpXfCF1Y+lGU8AmOEmSiaDZyiNgXXLRcOJahCiCszXWWYa2sosvC1wlJS7aiQ/qKhNVZ1IlARGvKpScTiq+Sft9lZJb+wODJqMezvpSon2oA6A== 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=UVv1UjJdR5hs0/Y37N2OZfi/to9sqiCLwQCQgMIbNLfJrFSJL1KmRbhRslVzjgK4HfKM+xcoz62WlSETeT+Je7bPdLVuqQtagU8aqqfOKUzNUInBzVXASCYQRxezje8cDrN+rAP04T7+4gGEha8yTAhGYgOfrkRRoMCFUBOx4zk83cdkPff677dWilLW45sn1n0D4WJH+qKgPsBEm5h/xZmMuILf6Zcuj7Z6jRF3mzqNueUa/3BdW0//g1Jr9kz7rko2QEc0yIVHyDxPFUur8tV8oykQPfZ8m1H21isdatLOdGzuNv2JjxLt36AkG6STziQb69nNRt4utC6GuD+z6g== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by CH3PR20MB6537.namprd20.prod.outlook.com (2603:10b6:610:154::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 26 Mar 2024 01:47:12 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::182f:841b:6e76:b819]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::182f:841b:6e76:b819%2]) with mapi id 15.20.7409.026; Tue, 26 Mar 2024 01:47:12 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v5 2/3] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Tue, 26 Mar 2024 09:47:04 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [UCcD5Xwk2hFWlWc8GhsrZmJDltzohuY5XjqIF/iU4s4=] X-ClientProxiedBy: SI2PR01CA0033.apcprd01.prod.exchangelabs.com (2603:1096:4:192::23) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240326014707.327110-2-inochiama@outlook.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|CH3PR20MB6537:EE_ X-MS-Office365-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UEcZzC699TUzFHXbVXd0B7vB9SB6Tk9tT3AHpIfJuBZlcrI3k3JCLTYp6GPMsgXxOil14M1k+WnKmE25b7eHJsM6etdCGOl5qzpQZXIP/+zUSgexygtyTRsdnG4GmOOSzMSnHptk/3bs9k1i9YGi3rfENZJSCCH0+g8fFRCLvt4OKnB/7VWHlbsUTc4xZbkEdiDEf1AJoa6feDDdd0TSjyuvfEIv7YS8HGruuUvY25/3hiFBEGAjGPMfwiBsI09OH8RHmHYEHyD/6Xa2MU6/xMb3JjTz8kSGrZeV18WTOxrotFMcNzjRFbYHxzcBpxF5I8uUr3kxTtsK6W5InqnPXk7X6hjUq55uTmvWu1cmSSu0Ht1O3N4ixh+ykOA6dEuXfnsiArwiKbaej0/S9MauA1qDguFBV4X63s57MUtCpG4vKz9N9sD+q5IlFWZ12sW5YI4qyXIVAd96TTBnnFTwoIKdx0o5vKIq+fnCP8LrkaTQjmkZHca6EUZslZMcjzO5mgGRADqwUxLd+j6kF8ftyPfC4aBezdsDJrUiRqfWel2kl8OAKBux+Dotu4OJ5FkMYY+zN9P1hFX7RDLJqLGrAuQIRDWl7G3CoMOj2D4GLkjg+oPbB0E7UWyjp8l+ReJnFZ/LTZC25rb7SGJ5glCuzrC83cqlJUFZcq+tWt5rm7O0gFem/rzirQ+Ixi27QLADrspDtotuRRAdBJXqBJLMjTDr0g01imtQ3tlWoVCTtb X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bb21393-9719-4b30-2a2a-08dc4d36a7b3 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 01:47:12.1401 (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: CH3PR20MB6537 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 Tue Mar 26 01:47:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13603243 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2096.outbound.protection.outlook.com [40.92.22.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F14EC80C1F; Tue, 26 Mar 2024 01:47:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.22.96 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711417642; cv=fail; b=uYiUVZkIxw2ZGb5CGu1QuXN2j2raveXdHAhNSO2XzgRzqR4uCV3/6w1ksQcct4l63/N4E1g7rx/SGsGvMbJUfEPQhM4UdO8pXQNzT0/zp8T8OKE4//H4VObBSpkOp9MKpOFBBTEkeC5eaCjeMSkS/f3474vB6+AqOLMA5G+I0AY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711417642; c=relaxed/simple; bh=G402pF/C1xwkO3ddF4EGPf1HmaICEsd4RzlLSuDQAzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=JsgqFPFG/IR1lhuPXN8N2u+5+lFjQUl0u6wJguwOodzVwX0s1Rha+HVnvY5xxa1jomOMWF+OxTOOimq3k5dvsuIy3KUhFUh2GBaWg3wSzbueiVcn0jVsw9wWfhuUlqX7lZ79wpW8KZh4ksiqnHaeIP5EjoNycg8ziRasmRp8EtI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=MfLkbSEM; arc=fail smtp.client-ip=40.92.22.96 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="MfLkbSEM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qv5uCfF5kmbgWR3xddYYDeOmV3jX3PcODDhGW4WCwUJL/wUuUOrLEZv1+TRKa2P2wR9eEToch4teZzW+dxO1X+XNJ5YHtAWT1kachp3r/giBI2RylTcYTEwIJtF/Fe7g0ZK16Pc8LGbDsVYdtqVS5f3WsgN3UiPFQRxM7igo5Nq/gOEzfOA7ZKtk9j6zkBUIMuvwBp5helJi9DQEpmW8gi/LFBDTxMRXpxmC9E7D+LHHYBCpcvlO6M6A4GZclRJbzckvhteQHRC9buC2aH+rJ4x0i7BhBrbXX/LUrp5cJFQ+ytDl1eZN5H1r3JSJOJaIxi+NGRqQkg+Y5hIyMpjVRQ== 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=jLMOdrQygst76bvt6bKGJPcelvUQigBt2RtAuf8GQwA=; b=ZqMob0bqXzFCfatRJ0nHIzCozpAlSQ9P+Cji024c1dQa0iI0FI3PmOge83EZU2SG/sgyBtpN3c+8SUPHQa0i+geihq/Bt0/JjwTEwHeJLtOd9v7jzmehqjNTQhSU17zFywTS9twD+2/Rc9GRKFIn0t5EiTNK9aAKDRN3NgfzZ7723TjNdxwrzfRAL7R1tXbP7vVt4Fr0TMU1EPplbKoDUHV6ki8iCRmLJnWUADSUNNQXA9xWYn+JLB9Gpof7spUVmbUl/111uKbE7+gtyZ7KQd61H22ASQilJMv2uZ/7x8hS5gb+e4RAIGdIUN74WQGIWFxIKBrdkUovrzoKJqYkQg== 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=jLMOdrQygst76bvt6bKGJPcelvUQigBt2RtAuf8GQwA=; b=MfLkbSEM0yiaz8Hs9/CfvqZd+kE/6T0cJY0jGf53FcFNJKPIh0FaC85qaknzVitFWEsot2Q2CN0K6NqNZxN3LnbTFkLNi6pWOOVfobCKMq9xSvJrpMXRJM8Ka1pn9e1ryFg7ri8D+vANCWG9IrJ7B1xVbkmKneeJr/t2VZSbLs1RWTGItDGkc0NhNj65vaThAKECBRBkwF8D33YcNCFJ9TxodQHuHOtxZZdBoAnTeDknATNrABQjxM5PfIKYa79V/OFIhFLYNUYUeoRFbEvgPMzrCLYLA1D3t2CxCeRRC+mRxTs3GjBrKnbg0kW3YDKP9O+CWqQqFhf3Bvu3zsDn1g== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by CH3PR20MB6537.namprd20.prod.outlook.com (2603:10b6:610:154::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 26 Mar 2024 01:47:17 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::182f:841b:6e76:b819]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::182f:841b:6e76:b819%2]) with mapi id 15.20.7409.026; Tue, 26 Mar 2024 01:47:17 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v5 3/3] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Tue, 26 Mar 2024 09:47:05 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [RmjrvbuV6JDAmctJ7cGRxemzpheBgOQKG8AHgNpq6Ng=] X-ClientProxiedBy: SI2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:4:192::9) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240326014707.327110-3-inochiama@outlook.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|CH3PR20MB6537:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f5a4511-93b1-4382-48dd-08dc4d36ab3e X-MS-Exchange-SLBlob-MailProps: 7J/vb0KDx3ghsXKwRy/t5h7NdWkXmzB0T5mqelZfSxrF8iYJzzinjnwdw+qKFn1FtVvTbo7Mu1KGBXbm1di+NQPYimvy/8RVu8TpSt9CfR7H6Sp6KauTysJgYFiKSJiWtJh4MekW6HAi6ZuT5+nToJ1TVi4JKB4j1AKLpUbqQlsUzQr4wkABoBjtJxmdYZqrCKsU4Rk6EWqbohfYCbvhXQlrASFXSPUpEec8L0aoHFbdkt1KUOnjLDfpjH31RJ5AN+MHz4fcUEw+jAR97r5s4lAf8B1Z9xxTxWY1XyeuW46PXVT6DN+gPiEfb5wLdkIR+CKF7vhRPtImYm4d6MT998s/hYSpmCWt5Wym+wrhnYcbmLVxjZLqIOYOd6gjEwTTsFzfY+mr6EQAes6ED9Org0EJ5gHIxcNDxyfweZQk5bVW6j512FBERMRUIhQrIvyBH51l22srak3xEhfqqxT2L3zM8bcYnAcIPH5tlfigolT0HvaL4lknAtpV3TU+q5kzToBrTxr2S2ya6VJ+6WDarLxDwo3+NyOfoatCgzXoZNAo0mg6SQ3GWtKcBiq8R1IxpLbofzXl3CnqC64xcQ9y2R25eWFCc1UEYmPh8yKmm/BE9W7ND7Kn7FFXoY91cSMQ75BwdVpak3ydmM35eM3t+wPoourGcYr7OqgynlZRsazreYrptw9FN0qNNuoG37D4d+JcUMgEEQgY7+m4Xl+oLEO08JJ8qwjKKWvYLBic4cT2hOeFeSP5Ra2UhubjULBfiQsiFi0YZQUyaf5WM1BnhddjIK0C3kjPVGWGE1wgaZA= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j49TfSXAtpdRffossYF8OwA8JzAL8XaWpYTikigArRjPr59rXYAtwm4GrJblxOnOEVqx34pFYYoYwDtr1Hyubx7aUAIxs7nYT9ow0FCfNYcdahzWhYOasDEEy9PB4w+y3wBDtWDL+1IpBKrXQ7uHCBXEKtPt+4RLv91ICd+9Atd55Y9v7uhs5PRGq7lAj7xHPRqgYkm4Vo7yqTUpDwJoHexwIUtzT9O/sOihnw8YRq8tzYM3KJKt7tcb3i/C8eRXxckRLDkyd92DKFSxQFqDPpcQM0c6KqEBrw6xjl6Mnocdb0kRmb3qS3l7ncuGLsRrxH+1Y/rBebbc2AGA7SeJVvV+B3zPX7+sTpZrI8erSxVP9MAdppAjkwWTa8TE2p+JJVv8kBJUT4bqM2N9XD8v3S2JZ9eTZ2WJ7clL681JCx0JWYMmMBx81/ScSugNAi99hEUwUa6n1MWqaRITFMMsj8sb38TifGPIdATm9ZIAPWgimO2048tU8Zk7dcy106whmoRn65pxiSx36hhIbW3BYg1pZWMboJra7z/BFDanYlnbQxevqYN44RyjwiClNTFt57HMSALfGN+ZYk1RzuLFBf3BgJDmKd3ArsHZIewzuXBKlVDIYLKrSmkBBN0ObDg2 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bLzwx5Z3memmyawh5yOxVl7bI25oA51hjsdg30q3bqLa3fU6jED22HzNh5ZLjjektEYuixZtukaZB1f194LuDy3K+39UkFFNxCJj9t5Eohz4h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bUcFfVBiBleEyb8Hsc8ZtMWKnn+Y/HXa38LV2bInXZiqkeoOZ5n7a9t8Y/EGor/hd1FH4rQA5XlMFb7 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f5a4511-93b1-4382-48dd-08dc4d36ab3e X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 01:47:17.8738 (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: CH3PR20MB6537 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 | 268 ++++++++++++++++++++++++++++++++++++ 3 files changed, 278 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..9c01f157ab97 --- /dev/null +++ b/drivers/dma/cv1800-dmamux.c @@ -0,0 +1,268 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2023 Inochi Amaoto + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define DMAMUX_NCELLS 2 +#define MAX_DMA_MAPPING_ID DMA_SPI_NOR1 +#define MAX_DMA_CPU_ID DMA_CPU_C906_1 +#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, DMA_CPU_A53) | \ + DMAMUX_INT_BIT(chid, DMA_CPU_C906_0) | \ + DMAMUX_INT_BIT(chid, DMA_CPU_C906_1)) +#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_info(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_info(&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 device_node *dma_master; + 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); + + dma_master = of_parse_phandle(mux_node, "dma-masters", 0); + if (!dma_master) { + dev_err(dev, "invalid dma-requests property\n"); + return -ENODEV; + } + of_node_put(dma_master); + + 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");