From patchwork Tue Feb 20 10:28:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563852 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2027.outbound.protection.outlook.com [40.92.18.27]) (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 BDD44612C3; Tue, 20 Feb 2024 10:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.18.27 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424941; cv=fail; b=ac79J4tYKJHtMIjmqDAyClXaQ3umbEoneLa+R4KneKH2ExraU3H2N6P9bcGULKBR5BpYU5W59XaKkch0pvslkfLYcD3JTZKiPsDL/RIMXOdMrK9myXxyXyNXIhzZP5wHorq7Dr5YSuS7GAiRRDr5uuKYpygSt31I78pv4eurzDI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424941; c=relaxed/simple; bh=gyy5jwaju35coA1NLIYiVhYlDzoZuCdbjcxOYEm3Dto=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=iL02E+2Gv7RpjgCkYaLA9AemZPIs6yiGfRlUO3Z+n6a7puDprrJkhTeHifw3ahFhNjpu16G1q5bPuwFAaddlDKsg36HYz8CZVSN4I6+fViJCEGn810Z7bInyWYT4WYQJ3CVJ4ZUkShdjQ9oNCuHRymlYaPt05cqSQ3oxNMXiUpQ= 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=l6v9k1+B; arc=fail smtp.client-ip=40.92.18.27 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="l6v9k1+B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kk8pMHsLf9FCMcuMdVEqQwGnu5SZ/HwuVgdAGzueuNMnACi4R6+fNLI4dKatPMuW0EQYicHuS61sBAm2bZJNb+J9L+jFtWfeHseoiAxEQEk2jR2zwJE5FppvGaGhi0ra+mBbBKvqVPc3TFfXT2cA+g+B2H85AwKC0Arj+5RbrMsdH2ECubqXf2jjX8WsGB3/cNY6qSOmbHGMtLDgSzPxj6rBIbJZG/JF287Y6YCIP1XnC3OQSQ3VSdTBPivaH+7x0dbqWd9voOOByQnPwysFXg7SY0ZDjX/SXoisawUQ0oit/VrisDNNxA1DT0aeNYI8KBq8rk+dvFNR6xNLend/yw== 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=q9y4GfvmMSRdx2AyYLR7SV3ok2Wz8X/1DcRtxIB0cug=; b=DLJ5Pm4iO3aGq+OlheF5zjhkghxLke4zrD5eTvYggO+ySgiGa+Gw3g2nzPZc7OMib76C8xVMhPFifcjqU+mfLlpY3zt6AX0HQ93Wo6ikDYkDR2mS2hXcEsxkXaZi/IxRdOx7P+WMG8lyJYOkZCwZoaGt/KQ1Ti35cCzaS0JZnYxIj5vcq5LFL10RNpDJBdntIjAqWHba0y/XnF8/AIPAT89p4EqY3heD8qQYgPHQmiupULNL3yEU95ZejAN8UnnJ8WDGKRUi6nuA/fdhpiJddTH6wmqnkE+NuUju3M0HUh3/lW/3ulqSiCj7fvYi0xLubk9dWl7ljZEFiav5v2RrjQ== 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=q9y4GfvmMSRdx2AyYLR7SV3ok2Wz8X/1DcRtxIB0cug=; b=l6v9k1+B8kXPHNIrX/FYMdfAIh44LFs324zM0MftxyaHqIny4NvASxrij/O8uUHU0ssLCnlbIohM4wEg2Y5LOBk58Z1fc8+OuqovGMe5BVufzHotxn9Gp/A7LpnIOIzyev8ATM479wZSFT1FwOl9iVH+S6bdI4qp/0cf2xc0jMYuZ5xWZvVGPjpv/uR+3KjoTvxVoNs0y+1IO+jd2XFNfFveayzAA9Y5wB7Dl6g6scg9+1CUt8qfojMe82EwsASnvUcfCCSmmdvsorB3GYb6+HQEdikXoIuviqZ0zL7w/D5/d4OB6khsQIeYsjfU1du71Ii+BEW9Ft1peULjZ575vQ== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by IA0PR20MB6813.namprd20.prod.outlook.com (2603:10b6:208:405::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 10:28:56 +0000 Received: from PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff]) by PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff%6]) with mapi id 15.20.7292.033; Tue, 20 Feb 2024 10:28:56 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto Cc: Chen Wang , Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] dt-bindings: dmaengine: Add dmamux for CV18XX/SG200X series SoC Date: Tue, 20 Feb 2024 18:28:58 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [RFWU7OVraIUpj4XNFKtF8C9rBic/JPVJyA7oD2DE2gQ=] X-ClientProxiedBy: TYCP301CA0032.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:380::15) To PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) X-Microsoft-Original-Message-ID: <20240220102901.874602-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: PH7PR20MB4962:EE_|IA0PR20MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: 973d6829-ddc2-4cad-879f-08dc31febe27 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KFPXQSaQT1nA64E51kl4QrQ7BwANSdrOMDUgrGbsyOnYRrujLaV4IgQ5TBzyfznA5FE2Tz1ug/oZley19NgN6PhA5IdWVwOEKk34GlOr/ERrPXaUt07Q7bfoYMEXOktieLj6nvLwY/n7FbyMFjx84oeB0PCDdvdU3yo7aS/F1bEKb1R5ymxW7E9OijlifEJgONWNlFZeaERXKm6zdO/scY4jstCIyIVNcmMhEQ+sVZq4Eha/iCAil24ct0VnOpcpTY0R3lEmUWfOJ+qH//tJrGo6dAECL2vMGkM0PVWcE3fSsbSHLwg1BoBMuIEj20OOX2PORtLmA4POTPn9LfwP4/yQ6MAAGwpdYWWKw+5aG1zv9UtIczwUcJAqA6WuAjkavU+EvdTowWpZ5Uk/4tWmPelwjZjNbyQ0q6WtIYsgbLlY8CrF+90Xxh14OP/FAfjf0AUWiDML7IXl2isiPx13FQ+549Hf7T6gjXT3iBU0he67vWhCRcERgzlZZoS515WcX/mcPFU+6IpzjXS+5DJ78DbMvqTlKA4Ypyzr92LFvvHVJZrE5IdLAdXurgB86bl7eYKP0LmBVbERR6Q4nG3VosgJp3wz1oVE+WHPhdCvN0toqhAC99px3hYfz+Wmua3m X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lor94uOkPYVZCfx2I69bMLES3rklxsNe8OIl7eaCMxNsIvz2pf/o8bvH7sA9lRV0+1/vePFGOr5AaxxViAfiyjU5DuVnJL4pceSModAKbm29TwucuzxYEXvbTjOKCPJ6mwpEdCdgGMGj/Na45dHuw5bQYH2JE/Zo9ci9IM7p3voU/HvzKwqVbbYvVxcVfIdso9HbDrK3Y+0u8VerHaKnvnuAkNwliQKttd4zpbvtNzXHQZrj7vRdGJ5+E2pqJUMFRHOGSEjIXyYvUz2Q0FPZ5garS0p1nOfxMpQ0cNuCmCGe9HNxt7I+bVxBWSNiaxP5VZvhit/yTwlWgz4K7ujBCYIN26WvsKd70yHsFykTDwJgojzWYQ1T3HCpv51rcKjlxKDwJE3KUvZFtuH+4TNGi2yfUrpZMteNeoppp2yu/cDvz3lszmdr41Br1RIb22BfskfxiMuORKDLxGLDZdzdW5kfcWENmUEWRqJDz7yDJ4J3ymki6R7jDDorqp1SUow5jYi8Bc1auoVeghUkhouULq7hiO9EvEcHIPpOiJ7DoPbcAANTSiQoGPjQmy2PMKiCsTDRhnwidKW1tUunF8TEx5Y+OTBR3DIqwibL4P463ZYXqg/+9fonr1oV/ZY9AFAvLxDl36iu06Ug+wtdQu07iK5LDQW4376PHfR2iKhFR7Bj+2SC/1CTe3FaT9ZA3LUTWNJBq6piR9bpQbNtSqLA3vagMZUDHWlTsJVIET2/57MtRV0jYM5mNCeq+RLaBn5UOyE+/dmRq695SxZbBkPmPRWqG0mR4irniGSASgjKACTETh0SqprxXDhQSNRivfgKMQqMs/TjzI7EhmGvOyuZrh8199Dx9FBTsS5OpIaB9fObLntOZpN6h4fFH2cj2CNwMLVeAUWCTa2rOsZuw9Q8XyZd6jssL2fYFNuD/Qvf0OAdWN728rmYukXAv5aGr5cwRu52PTjnOJogPZjm4BermzJNV00FhSVxMNJlV0JNgAgionPhAdKWIEcsi4qbjTri2tO01T/l+722yi1f8aU0JXwh3XmQzh6qHzL4txeac7CxbG39XjvDsNJVVSCMq7YURXXUAWYIcgq4HV3sDHg/hmCaGnL4V4oUnP1NGs9yUU/GaJG4tKHgoyZhqwdGWzcOE+3Ya5tZ6iCl8m6LWotZdxrAvyhQSugmwZjbLm4A2CLc3mxgDibVN941BasytOB3OeDxB+kVmPYsryV2nYI+ZuoqXNoL02BhxYztLkun4+FGvG3OuBTBHgSGpjrQ7uVg X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 973d6829-ddc2-4cad-879f-08dc31febe27 X-MS-Exchange-CrossTenant-AuthSource: PH7PR20MB4962.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 10:28:56.3486 (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: IA0PR20MB6813 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 Reviewed-by: Rob Herring --- .../bindings/dma/sophgo,cv1800-dmamux.yaml | 44 +++++++++++++++ include/dt-bindings/dma/cv1800-dma.h | 55 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml create mode 100644 include/dt-bindings/dma/cv1800-dma.h -- 2.43.2 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..8bcbf7beb432 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml @@ -0,0 +1,44 @@ +# 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 + + '#dma-cells': + const: 3 + description: + The first cells is DMA channel. The second one is device id. + The third 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 = <3>; + 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 Feb 20 10:28:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563853 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2063.outbound.protection.outlook.com [40.92.22.63]) (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 8BD5B61663; Tue, 20 Feb 2024 10:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.22.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424945; cv=fail; b=UWvGm3B6Rb/tV5nevQSeJMNongehtTgPKf+xtzYjc+PcqMouwpO/P1K45xQg3niceLpGLGE/vo0Xa5mitv8AQvpnbdXVi4df6yJV/NzIv4D0bVeuCxl4n/MvqM58p5ITjfH3iGn+NMAgtGrAZIdEdGkksakgTNTrteRub69IZQ0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424945; c=relaxed/simple; bh=4Y+lZczuBSWd4c+fmfkrznNnCx063pkkQ6axcowgtJI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=UZcCh7zfj7tU81py0s43mHN1TZwBwNPkDav0I2KQ/eizqs4yjVUTmPYich1DtALx02oZ5/WEXuXdK7INDfXrVYFZ30xXDNYbX96GoC8eSehvdSvAAUEMGD0INpQMFOztRDpy9od0IQCQGIanPYMIjlswY/bRhdyYIqwTa6Gfc9s= 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=Bk6KHPH8; arc=fail smtp.client-ip=40.92.22.63 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="Bk6KHPH8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fLOuQG+7oPtTAOKQHEhZIdD9/R2Zn7Hw7MxD64xOCiVWELHj+bJclAs7M68z22vU1LdBplO8rUf4hOuRnsmXOEKHMKvc3y8Rfn0bu6rHh95/KPX8OKHe43naFC9/fbxHruj+Wdnnd/Gmixrkq/gLlU7R+HgCRhzRekPTzcrWor8FH/HaoBmZcbEDZvcL9ZtJCs7kVsSdt+bNJ9NJItoM9+fVz/q3mDTOhPoAKEBMCpPyigvXplFZZORDiGXKOxwfLZsGat5ZtTgcycvoanSI2Y2qZ0hBtMpGE4p3Tj0SkgQcuPHvdD8sBC+yiPMJl3U2FWajJywWGeXGjKkmHnyIdA== 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=9blte/oYIVjIztCnVuSc3Zi1abw05pc89Kc6LVCHUlk=; b=kgodHTVPWTe4KV93EYiaa3QNhaR5LzTa3AVmLTMVd21Tec5z4JVy6EeVZCTyCdnBYZ/2eGsakXyi2NMn2NjLzBApMAlL8DmaXgstJKXCt9zJDM9Os7NfJLIn/B6BT1+aY9oTqELb5uVD144aXfdOVK6G/0yJkRQuli3F0AZZLXAbORtpQKy0YKfSOYDjbmgmYIdghGQyLQsp63TMPXAARqeXWE8epwc4uD27NfBiHLml2yOenBRrRWi15Kmvk/+5wIZ5FF1aBmELoql96aRwtvCJzZzKF8acHkNNLmt1iBP8hQjmY+KCzAcIKHIz8eaR8LcEgaJbjdvcx3WP6aXCng== 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=9blte/oYIVjIztCnVuSc3Zi1abw05pc89Kc6LVCHUlk=; b=Bk6KHPH8rE9WxI0Yo/8PwvouU8N65N9GeDrliiv8q5F2t8zjkX3DasAqhKAjLTf/ANF5sOOYElIz2lp2L9gNN2bjhZ1SqvBindvs+G25sdMEO7zA3smk9nwxoFbtd0L/rYPoRkfA+n5F7On09hTNBT8GKB1Y35KMGmxsHFksE5W99kCJxI36qkrqtpiTpiWMUAcAw53Cc0HC2ZKVxf8/PaViaFzJ/5pg8BWBqsVVh4QBE51yMPSPJFSAh5b82DLnCxmTDCrZ4ZDD57BZsbx60V5tw4hljQR+NAogif1PPc0TO39qQ7JTeQpx3ojcd7SSR9pAlMjUblamuv+Jp83KwQ== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by IA0PR20MB6813.namprd20.prod.outlook.com (2603:10b6:208:405::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 10:29:01 +0000 Received: from PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff]) by PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff%6]) with mapi id 15.20.7292.033; Tue, 20 Feb 2024 10:29:01 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto Cc: Chen Wang , Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] dt-bindings: soc: sophgo: Add top misc controller of CV18XX/SG200X series SoC Date: Tue, 20 Feb 2024 18:28:59 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [xw5cnSw+Sr9IA9HuTo2hICCnhKkC8dVex/ANf22Z0dI=] X-ClientProxiedBy: KL1PR0401CA0035.apcprd04.prod.outlook.com (2603:1096:820:e::22) To PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) X-Microsoft-Original-Message-ID: <20240220102901.874602-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: PH7PR20MB4962:EE_|IA0PR20MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: bd689b2e-a2e8-406d-4de0-08dc31fec112 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3PRifu/rzX4vKb4qXv6zyQTEbu5uJBLjRlflbiefyfPcVO+skYyaEBUrlsaKim8mqaqRx9qlAQ2jwUwVsWrkTHWUgwh45+wBVlRFQQSAT422gMPqKYE6cNcvXDV+0Khgbb5i4QWwQLzMixI16I7vJFkrQYEbpg1B7PI9YRi4hNW+AnLj9bZtEuvm5wlZZWdcXprInIMNHhG1WYV23Inx87SFdaPoEVAG6m53zpUKasf5bkMBBG152xTVl0TtUHrxLvMqJ6vG9b+gUIulFfYG2wIGuf5E19aG1Z5QuHs+B6ffUkREmWxbHx2mMguun+J7hALiLptq07GQGTDHoRkLxcuRGYnwqT1oP49ZN5jLyMWexNynEvzOUqFtU98RzuZTj+xAhJS+Hr1oJjU0oJhazCPDTu2dmXq0xw+8RnRzdiLwARivLJIJYdnc59cCJid8fBJB1WZatIIEs6xJo7SAnGEKUsxbnFfn0fv4XkDFnCSa9myViJZjHxA6OU4izWaQf/uS3qVEWQTstiT1QKms38HEuPXUkYPBl8OsY0vfiH9jADyNEQgpz1KD96qNYCWuMCQHo8l5GZY0I6DNcGbzlpmWL7XRucc4xVO+z+YrIgYwA0GctB8M6cbwNfLU4wUS X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aVRizulA2l+O+/dLNOaNSL/CmLDGC2F+8Vq3oSz+Hff+OmgFVUzmhZ4zae/9cLiIZDi+HT24cCpqgT1s7k32Qcvukms4snkUVYVgPWOnbo2FqA29uD261lAU3Cx4SL09d8vVB6Rb4jQJkj+GYMl3HJoOy5nMXQ2kNl4mW34hFOqpuVByADn3Jh57Du5tIpDfSawGS5Jjad0wqVY0jhnOa2blh2x5OoC3QLg61To6AIcM83DydNso+YKvwJApZTrFSv3YOzcwl0CJNz9vN8WuVG6mBXxLJWII3w6tMythqx5NUJktzNzTlnntNHRmUVaibYCk0I9xIM7wQUMvC11hhH//Yi/PpW7bWzvoJfvuRBNuNQS3i0nP7PI/7/lOLn1SJoimtaF+TeaeQuIP685ONtBa0rD8G2R9CB1pIk6lXiswFVxkmAq+GO7B4PZwoRs6XZdFJOQ9Gf0T15UNRxtFmhL4KNhSIEg8bsFcy8cNF0ZX64DhS67w1qNfl7kg4UvOqzk7PuGz/cKNqvg7Io0/5FL/floFwm8ihRYO+BDfUnDWmQQXfGWwxMYVxFQHNgXIxgjYQSziv1vs79vI0ofcXp2L3RP7bRqJwFE2kTv9aFFlbkHQ4m5wZGveqlQTk4vzl0vat6qB22JSD8i3HwllTQqe2cyMCf/f1NQOmxE/r6LvUDU1Bny7nz50JM9ZuYb3eEygRQ4lcmz0ozuVSl3DKfZO4iPYU+N2qldwfg3UDdVdw2Q32j0m1MJSG85VxepJX3l2qXQu0/ZZONlwfVsQUz34/xrKX0Hm3L1ZvTCFYBrYoywSuzjhjLFV/S/iplxxJrsScroeIwH1bnqYo64UWK76aBldEL8HvzZ5Qr/wO24vgsenZg0FrT5MDdnwRtnDLkQx42YW0NQbue6/FNffcASisqXEB8Ty6GapRseGZdapCRJDWJPgwv8WXacgcrScj7OiABrQbSEcojHRLut1IjT261Pk3kb+SK1fWfIz+PxT/1Kl0VlZofr3IwTvPJ6vzSO5ITNNV0da63fQG0mOzFxhdrV/ioeV4/V6DpqEoC7WHe8+U1w29wwMs00x5ZboazvAgTZPLfPgpHtBf1zzaYyKqID3ZeSRBXCWCly4276Eiw5TrVUm+OJL8HO9awYOqlLyJnAbHEtpkmYy+qOaRZHlKb0NjXyc0MNd14trJbLGWDFOQxm1A3O5uAoci1oonoMOFm+x6YTu+YX4gvL/QUsEpt10k0I8CDoMuEbzbZ+l8MiZMOnzZEpAAYuv+UGX X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd689b2e-a2e8-406d-4de0-08dc31fec112 X-MS-Exchange-CrossTenant-AuthSource: PH7PR20MB4962.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 10:29:01.3343 (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: IA0PR20MB6813 CV18XX/SG200X series SoCs have a special top misc system controller, which provides register access for several devices. In addition to register access, this system controller also contains some subdevices (such as dmamux). Add bindings for top misc controller of CV18XX/SG200X series SoC. Signed-off-by: Inochi Amaoto --- .../soc/sophgo/sophgo,cv1800-top-syscon.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800-top-syscon.yaml -- 2.43.2 diff --git a/Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800-top-syscon.yaml b/Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800-top-syscon.yaml new file mode 100644 index 000000000000..29825fee66d5 --- /dev/null +++ b/Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800-top-syscon.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800-top-syscon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo CV1800/SG2000 SoC top system controller + +maintainers: + - Inochi Amaoto + +description: + The Sophgo CV1800/SG2000 SoC top misc system controller provides + register access to configure related modules. + +properties: + compatible: + items: + - const: sophgo,cv1800-top-syscon + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: + type: object + +examples: + - | + syscon@3000000 { + compatible = "sophgo,cv1800-top-syscon", + "syscon", "simple-mfd"; + reg = <0x03000000 0x1000>; + + dma-router { + compatible = "sophgo,cv1800-dmamux"; + #dma-cells = <3>; + dma-masters = <&dmac>; + dma-requests = <8>; + }; + }; + +... From patchwork Tue Feb 20 10:29:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563854 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2084.outbound.protection.outlook.com [40.92.18.84]) (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 D43CF64AB0; Tue, 20 Feb 2024 10:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.18.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424950; cv=fail; b=mdvyJb5kABrfhacXrNqAlM0uf5zo/URZoaqrjH+iCai1A++1f4wt7BTHYGU2W+mZsnh8x+vFf0Hfh8Ds8L50L5rGCBOxiJ/trJ7mNnKR+3qi3e3nURuLGO/IpZSXyDODNw1P8sIGdv51NjCMCnVrT3VSNGtCUgrcQJmMeDSZiME= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424950; c=relaxed/simple; bh=KFjDzG+7y8lC9tvfGHbYkI88rh4Bwc6aVu5oAP3VAmw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mqXIIWUQ69Ksw34i/cO3LA/lF3WPxi+3yuZoS8tqBLXtptnSOGUXluUdL0hBwKlXztC7Msx5gh9ZHgcldhGyhZAVcBmgr4ATd6Lpe7l5ksbgMrQ00Nt43BIoGUilRkVQE/9cpkdI8frvPKNgij+bcqQfCWnGbssWBsXbk0j3AHg= 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=Msg/YHe7; arc=fail smtp.client-ip=40.92.18.84 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="Msg/YHe7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Srx8JGVmbcU/xi48hLj5EPiJgA8diVR93qqCfHRBevnPYJuUcTf+PB8PpBFLCeDfKaZUs8n0ZPlbsxhRvfVa6D++Bkn2bZW1CrUOrsJAeCbeOsIvIx3/zpWRSotTHRxI/tH86w4+5n1f5vjLZk7sD1/TplWjN235THRF4sw+NiczqF5fUBdVYguyKJej9+9C79lsGWXduxTWJHr0r4Ugffvcx80IbcA8YdaSXUt2E7+4HNzZ3eC0bCQzchmroFlRWPC1tOCKbzilsJMzRNHyGn329AYiMT6uCW5M4SQAjLtIHxUNHJG+HiiVnmTvdq3OxgiZ5YnDk7NL1HWHnJuX0g== 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=3I4Jl06eg62S7kOQvj3HvGIzNzzrrdbNmYBf6ba374M=; b=WnFqon0xL8YX+Y54SJqDHTh+Ct282C8ZeCR40nrHal5s4rO4OcFmIO0F5pC5gGzVN727DPB+O/KOGK0co7iAKdo8FXxSDmeSfgDnzIrOm9hTNDDWvf9LiVvuoy/xTEiGJxsL3HhxS4vHmNVSpX/XqopVC7VpU348YRW4yb9IEKQuOtwJ3Pz3A11PAh8kQO/sK+HQD1Ttm5qtqFgpwCezEHQz/Klrn7OGgilYNZZbZpzZlThMAsXBPQ2aBlVPSyNO/TbMTXK40qgvgUYsXkxAapMeSMhDNuhA/lTvTqTbofL1zeQOX+B/q/Ph+TFXy9afeLfHx3ZBEwPVe26ij3TxxQ== 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=3I4Jl06eg62S7kOQvj3HvGIzNzzrrdbNmYBf6ba374M=; b=Msg/YHe7BcqkdJPVtEYehQabg2xyyIg2Nd9uv96IUoRK8q35Wt9EQ5kdpIjlY69xweKQnSAx1BtLlcYz6OE7rU2At28vJ7b9S1Gsx+3e5Uf5zdU46KC1QJ252X85XQ7Of4tSnHdkba5O92/CL5+u+qrKl3s4Uw34lCEJHnOOa3HVsp1PQ7d+Y47TcQ+szqbvMN/YfxAzBU7ChZTHQZESfjZT0hyVLeudJD1RCpULQkhiSeLHsIvYxvJHWw2W4MKtRgpQL0wy1IMlxBtfJD1VghVgVL+O1DJE9QT2U6+Rnv3FDA7shRgas/9wu+jbbVKm7fUC0ZCJmI3is59nj2gL1Q== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by IA0PR20MB6813.namprd20.prod.outlook.com (2603:10b6:208:405::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 10:29:06 +0000 Received: from PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff]) by PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff%6]) with mapi id 15.20.7292.033; Tue, 20 Feb 2024 10:29:06 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto Cc: Chen Wang , Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Tue, 20 Feb 2024 18:29:00 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [7lfz9GNWhSgmepKfThLNLsD6w2f0v2/Gow84f7sZHLg=] X-ClientProxiedBy: KL1PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:820:1::23) To PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) X-Microsoft-Original-Message-ID: <20240220102901.874602-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: PH7PR20MB4962:EE_|IA0PR20MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: fbbe15e6-9f95-40aa-fc66-08dc31fec418 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lybyhqvjgY0zS00wJ7jJ0KMSoxgDO+5hFud4WrkfHm4xEgW6n1lT6QjF4DHDsDfijy3sLWh/dz6Y73cbNUBcRomsATNNFFQncLs2MVc0Y7z2uDk5UELxNGazeWEnY3KvFXVcKL3Ny8JLlJCR9J59SL2DNLzyrIji2A69eX1gVP1c7D2NyyVrzk+UGnZcqcaY/6XWmwbyEBHmOzBnfQ3UHXtwX6EFJwkt06V8OlGK5JvBqJzMndGXhKWhKGwtRs4uACxQIobqm8yMMXgYxJBXO9H7vNquPmtYxqXHh6fcTJzPNX7xjboLY2oACq7iIyt3zpxiFbJMUN/12blxfVEuCW9M+bWFpFoSaBxni3z9sIuLIBF85xYubHwyM0JpJYDURLz11ybGEV4cfYX+EeZS8HSxzTrxXLohBG6LjKbd3bXiULu5yoDRpJxDgskJYEiReA3HoKOEfDT2rb9L0eLEnqpr0IX7FVRs+m0TmOc+cLt+CqdeTctPr0HQJ8bn8PpxzAYAJgBfjIbgcMeASgzPPw0d51i487b+YgtkTfu1OV1EK+FO0OUpQM2aq0oEuFQl/tg2Qg2+/UT8cUmZx9+FkIXFdrl3pMfAZgSZ0JEYWe2Iq5RAUspuuVdy6JQpIxK0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bgs1fSMqh+xEE4U4sTr8KsC/wAxh354dKsKGSMLhBAACBmNWGYDwV8d/C5NtQmHIw6UjAN8DxKqDgIYyf1/zEV8qGBEGPDIyCwR2Pp/Jk9Axpxv4vDAR1hyELWvYfoPMuJ0uROJTd1K0hzUfsZdweL9wfS1QOvsmRDEREdhRWcjEK6YbeA7+cwt00pYIHQjuxcMv8xX88zC8N9jh1/6yOp25Gq/R+mpgObM/sJHh+0CCGTpPrJxQiAWW8cnL6s1ud7mB1OAPeO3NlOnl7rM+IZAjlr2ZHQxsC3TXWklhCi+H4YDcEHwoYIeoUFXVemiVpLTFsadXJjaXWY6Gi+DQAqFOy9pnDnMm6vOcPZq+qMd3Y87j3A+l0JsuQMN8KFtXBOxcZ6XzNyOxRAMlqgcCdz8TegeNdGM1oGH4chjq1LyHAk+F+auDxWBzrxl8qPx1YYR9NfzkUbu7W0tK3ssBeQXiRhJPVZ1w+oBm0OMw7nqDUmoupZTo8laYYs0nKy7bruS0M/5D9ynXaa4o3h6in4PEOLYsux6VfnP95rso5s2y3nqvfVgttQrqsvfz9OmH7QIgL7f/yot36236ndGlRtY6lJfvAowAPgJ/MN69AcCdrSTIM0/9NlszvcBat8r4CgQTQ7qEK7C8v//iDPYWqRTvD4USThrQR6QTxCsZ5XcYsntCfarCd4sZmDLqWj1rofKZcSqLWI5OPc6heJRFSQeSn6Ham46TzY9En9H+22mvQ16AE5oHRRpDi8qgiPr7DKqiCW4Wisq8BmxKWsIWb9xBoGpWDo5feJ0TQgZ1EjjKVyOBXbgouw+wYEKkwcaXNFJJO97zfXBL5l8bWPK2Xku/xnFWWpTDu0yoOCMFJ2aMJT91dYw632t6eGpYGsyem/9PMxW8MQQ0oy5DDAS4HzuJZg8WvsvgZcuhMs7zY/WwAcXwc6zjsUsyEwoZe+2tZI3mOgRGpv+ocR178ExJLuvIrlyD5x4L1kvqOkhNDw1FZcUhhrhkK++cLaXz3TZaOkjQZDNNSsGG9aGfm7EGW3aBYdGd7La+KNXEAErbW+67JUKVLkA6H/7mvl/51imMdjD3bEPQhKamVQRnq47H+cF5gbHl5vyASVvR9TkId7YOrd7JsM3PPu1LaRVD7x4tO4Am9NG7OuB2YRhp0c9zHJMUluzbh3rwEVfxh9PkdXhtPsTkaTuBERyiH8tEzX1O8uKDAupzI9WPr6/yryi+fEm8/la/JnQJUvoKprAsBC1Ex/6rBnksWlyWmhXl1Zt7 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fbbe15e6-9f95-40aa-fc66-08dc31fec418 X-MS-Exchange-CrossTenant-AuthSource: PH7PR20MB4962.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 10:29:06.3326 (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: IA0PR20MB6813 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.43.2 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 Feb 20 10:29:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563855 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2091.outbound.protection.outlook.com [40.92.18.91]) (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 600D25F470; Tue, 20 Feb 2024 10:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.18.91 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424974; cv=fail; b=mGT7dUM3yMFsEJGJcdNAaqCVnJXzwKor2YjD0I4OdudLZmAOnsgdo6X7GOyEy88HT+bfjWpaEbP3yJngWWj8M+vplP4rBXIycbFu9mcWORQv+zbiLgdrob9do9Jn3uZovTN04yllra8KFEUdwDZX3v0KULLgrVGKhn9mh5lBCyU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424974; c=relaxed/simple; bh=XXV6nMc8o7eCFYU7MSxbIzJnKa2S0VdxWQTsb2i7PhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=uNJVVjC5SEjEDX1XgR/i0tC4w5TIltXcKbKlf9n7u7yJVVD8YtkoNuKYZI4STEQ9EIRxZ9cLi4BRnTNMaVs9y2gJCSl71k46+M5GvnZGUxxlkeBkAgeq+80xyUF0JZCwlB+A8P63rYt2i8nMGha4wgSPRun5LhYx+ONuieCoOT8= 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=pUKuacQ0; arc=fail smtp.client-ip=40.92.18.91 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="pUKuacQ0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CtsayK6sxhF47/qZM8u3g9EJ19npQEglkyMJAHrHDRpx7LquQnUDQ92yMC760lJ5WDoT0qwHFhPZfC8Nc7sJJF53wtNbseuD/ylASaeAlfUMnVPHW4noyWTbr7IdCCqj/CMDOiYSvJWNckyUuDMTyOx7nsAkXrPWb14D06vp/XU5jbZumxxfJ60HzvXQ3+YXpteQV45yYrPJLzqqoUcoUrrC4GImLvW+csHQyQ8TWvAFYxiDbV+ERPLO/DqnuCecExE4PeGNubW8O45dEN0cyI7wpy75+LoGgpOhZ7bA9AJyE4PABQhgcH3ftevMG9JZvZ3KlqUV9zJLShIn2ORU0w== 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=zn82jgskJdQbI2YTFjPDsz/iYp5K+2/rTbV3KNO0tHs=; b=fzCGen8u9zpd+6UlBmBVialhoWKCCeUGDFUPuBpYXOwZr7w48UoifWX8rmz+XPPGj+i00ZTzRbG3GHCeZ0lt/wcE9sPyoDVU8EY9p7Dk5Kk8ieKoyEiVaYkdNBlZotrDuCZ2fYLEnABDa4JV7anIpuEi7yIZf6Qzpfbrp/z1tcJ6iIFHpnZ9KexbOvEbQ66+1gP+HC75lZB+XKOBJL52k4XLfwr7p5sGNLW80Gk90XrFfZTkbl85RU+AUe2HydxS8ns0YFgzbEXTQEH4Dv6mKgCGqFl7F7Qtffi2egSusP5zUmCT1HcIZHsNMFv1ws3BaGUWvfzqOxURjyVUmsxcrw== 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=zn82jgskJdQbI2YTFjPDsz/iYp5K+2/rTbV3KNO0tHs=; b=pUKuacQ00Be6x1tkUPanJNFZMXDqC+McJZWQYttgTi2xtqchQgOwQyJjwKWBb7NplTAi13Er0GJSx5KC8ZZVLC1VbVEpWNuMoAxn+8EN5O8D2Ubrlt69UNFvbnxdBBwJsOVAzWkZACPsNHYIU9AZ62Vl577sno3MJsyGxsgS+ytEwUAqHWP1e1cQPaXimSafCOGkDJK4qVpiocuqS0O5ClToULMNdl+PfojpBcOhq1Slc/+tJGeJ3/nOlwy6skP+TvRQ0yeutRQdq1sFyRYoE1KswRWv0m94DXuaHhrrqUlNXAsdvaOiPN76cbGygAcqnSVuV+u0USMwhKKp00VuOw== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by IA0PR20MB6813.namprd20.prod.outlook.com (2603:10b6:208:405::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 10:29:30 +0000 Received: from PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff]) by PH7PR20MB4962.namprd20.prod.outlook.com ([fe80::4719:8c68:6f:34ff%6]) with mapi id 15.20.7292.033; Tue, 20 Feb 2024 10:29:30 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto Cc: Chen Wang , Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Tue, 20 Feb 2024 18:29:01 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [6TBxqLxCPsW85B8tYi4fwxmgBUMa8fdCNcudmz+EGEk=] X-ClientProxiedBy: KU1PR03CA0011.apcprd03.prod.outlook.com (2603:1096:802:18::23) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240220102901.874602-4-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: PH7PR20MB4962:EE_|IA0PR20MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: d09be249-9f8d-498e-7e53-08dc31fec830 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LufN23+q/h7bkojuWVFhbAsf15D+yxn5u/taUFqElaQi+YnzuLYCH9e5oY7Eck1ydKNlihJKTCHJhqio+ZjRovRV9IG6nFS392FHTQlbVS/ikpeQO7G2RHi5jlDUk5xYw8in7IB/B9XdkKnI2kTWCublSajNoxD4CabOO92Kvy7rZhI/E7bq7DnnSR/kMrvonl+r+RfCpqWGb76+tMd+k7vdrZJDYtHGPD/ZhwHeC3xy46ap/iw06KH4nDgMSrqt3EVeOPSJXWwA+EmV9T3DgX7pc8P/MPrNYwP5a/ri/o6qx25P/euJDsmtbmwnd4Gsuej4xGb+VmSYQgU6TsbTA1SFKGVxJy0MNfWYcVc61WlKgDLpIzwswLsVeGOYsUG2coPt18lMG/fs6SoGGe1tTYkZxfgTPKruaxvwplZy08rm3xcP55ay4O5Mq0pg4T//DE0gn3SX1HvkvoZDpba6HwTj0XW1ri74we6IZY4wmbGjKukpNJW2OQMnswy+Pnyn9S3aaZHz1l06rleMCX9TVMMAQyU/GyfB5CzhvouBEr9glFbmaKbAZfkZXzintdLsuWIS7ZZ/FUDitK5N2PfnH1o2bTabMUhbz2hR038nbYmphG8sZmEgbZVvDfRnYuNo X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hbsD2Gp+DdgbFarZun42uzlHJ0zKNW97p0luFGBjW+cBzoXfPrpjK21V+MhQ4YMfOz1hA0SySgWbFhfGnz9WRsa1c/wPI++08H9J5wTYEWg6w8PBzNRKudVffvZWl9IcbAaYqlJL1PrvB7ZbgtI+r2cUtH4fmKLEmncCrBEH2WmEv+1VWlZxuNfsT3lfiGrel7I2APFoZ/hwGPStAvN+czB5vhEoCwu6riJ8PihN1m7rLK5ihNJ1RPDTGk3fJuCJ0yXUJUJARq/bW18aRxMq3I8akK5Y0Lvr31NNng5pXtkDrqz02AW3rOLYEkFu6OMdMpjhPwBJUDxQflMSe6iRoy617CEq6ltqBK0RxQTinFCAbZ4a+MKr5UG20k4YE7R4MpxMLOXIqoqd6Wwzvz80gzo4+bXojOiFzIPOm6q2oCfr902g4JSh2ZmoaWZXvMvVu8QxsBIlaAEfB16mijX8xQWFTj5/xv6czSuuzd+h0nVaL4liTqqJFIL/etCpMv88uzggpJu696Jn0q+NJXkAKjfz+FVMyB+TkkGWnA8xIsCIqhHaXYzm14C//y9Y/x/bkBp0U/CBI90WrwpLFEiDR61Jb0ZEzla0k0iKbu09CcOwpeYyAYD4CRoUWNsXwWfg6F5YnC03dMa3/6fPbk00a/nvQW4IysmKG46hSn0tr2qlLcfCFENI34SdHZR2QTG8KrNfrvB721GJ1XS8BveVDKbkbJp1W2QDqNEm2DcOaHg0DSX7udB8HpAiRb4IjTRrAq47zZdXv02mFnr6HvdpIzqabCAcZ38N11Et0E8Fesk7ovkPWSvdDjp0LubUqfHTbuorFTIbL6r60sXo75JNKV4RcPWFXfdTxftfqJejTBFNcr2p96fmlu+kKbKTvYXv0GyUXZVd/9JnMqvDvBFOZ3814ZqRUek3elXRrAGBsIyyJke+kVwZb7PvpeXkWk6QwyauNUQwCTVqoj9uOnsMgvkK2uNcUQb9aC1gDJ3GdLE+1LZblvnU+7uvSf0I41ckbS+gOgtsJdqP1zKHir/MtWPQhGbzyNvJV6/uOIFKto9T3k0ToLPrvT0amiJJGvJFzRjZArmIUurAE8+YhjV9aTmS5YEcOv3qS6Sbct3WgBBtz6P93HewQSHhlRgSBNJ5SufZz4HwWh3/y5YwEMeDlZdfzhUDvVYuNpbZP9hW6+1hRJ8Nz5f4+47cawOO9tqW5lyNgAhK82YiIdmUUIBW2V9SM6EG3FHoiMCWMDvK8ik3Cket9EI7OrZa+yJcj7pu X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d09be249-9f8d-498e-7e53-08dc31fec830 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 10:29:30.0585 (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: IA0PR20MB6813 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 | 232 ++++++++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 drivers/dma/cv1800-dmamux.c -- 2.43.2 diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index e928f2ca0f1e..5220b4eba3a4 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..b41c39f2e338 --- /dev/null +++ b/drivers/dma/cv1800-dmamux.c @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2023 Inochi Amaoto + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define DMAMUX_NCELLS 3 +#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_SET(chid, val) \ + (((val) << ((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; + DECLARE_BITMAP(used_chans, MAX_DMA_CH_ID); + DECLARE_BITMAP(mapped_peripherals, MAX_DMA_MAPPING_ID); +}; + +struct cv1800_dmamux_map { + 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; + u32 regoff = map->channel % DMAMUX_NR_CH_PER_REGISTER; + u32 regpos = map->channel / DMAMUX_NR_CH_PER_REGISTER; + unsigned long flags; + + spin_lock_irqsave(&dmamux->lock, flags); + + regmap_update_bits(dmamux->regmap, + regpos + CV1800_SDMA_DMA_CHANNEL_REMAP0, + DMAMUX_CH_MASK(regoff), + 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)); + + clear_bit(map->channel, dmamux->used_chans); + clear_bit(map->peripheral, dmamux->mapped_peripherals); + + spin_unlock_irqrestore(&dmamux->lock, flags); + + kfree(map); +} + +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; + unsigned long flags; + unsigned int chid, devid, cpuid; + u32 regoff, regpos; + + if (dma_spec->args_count != DMAMUX_NCELLS) { + dev_err(&pdev->dev, "invalid number of dma mux args\n"); + return ERR_PTR(-EINVAL); + } + + chid = dma_spec->args[0]; + devid = dma_spec->args[1]; + cpuid = dma_spec->args[2]; + dma_spec->args_count -= 2; + + if (chid > MAX_DMA_CH_ID) { + dev_err(&pdev->dev, "invalid channel id: %u\n", chid); + return ERR_PTR(-EINVAL); + } + + 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); + } + + map = kzalloc(sizeof(*map), GFP_KERNEL); + if (!map) + return ERR_PTR(-ENOMEM); + + map->channel = chid; + map->peripheral = devid; + map->cpu = cpuid; + + regoff = chid % DMAMUX_NR_CH_PER_REGISTER; + regpos = chid / DMAMUX_NR_CH_PER_REGISTER; + + spin_lock_irqsave(&dmamux->lock, flags); + + if (test_and_set_bit(devid, dmamux->mapped_peripherals)) { + dev_err(&pdev->dev, "already used device mapping: %u\n", devid); + goto failed; + } + + if (test_and_set_bit(chid, dmamux->used_chans)) { + clear_bit(devid, dmamux->mapped_peripherals); + dev_err(&pdev->dev, "already used channel id: %u\n", chid); + goto failed; + } + + regmap_set_bits(dmamux->regmap, + regpos + CV1800_SDMA_DMA_CHANNEL_REMAP0, + DMAMUX_CH_SET(regoff, 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); + + 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); + dev_err(&pdev->dev, "already used channel id: %u\n", chid); + return ERR_PTR(-EBUSY); +} + +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 device *parent = dev->parent; + struct device_node *dma_master; + struct regmap *map = NULL; + + if (!parent) + return -ENODEV; + + map = device_node_to_regmap(parent->of_node); + if (IS_ERR(map)) + return PTR_ERR(map); + + 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); + data->regmap = map; + 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 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 = "fsl-raideng", + .of_match_table = cv1800_dmamux_ids, + }, + .probe = cv1800_dmamux_probe, +}; +module_platform_driver(cv1800_dmamux_driver); + +MODULE_AUTHOR("Inochi Amaoto "); +MODULE_DESCRIPTION("Sophgo CV1800/SG2000 Series Soc DMAMUX driver"); +MODULE_LICENSE("GPL");