From patchwork Sat Aug 10 08:38: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: 13759456 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11olkn2032.outbound.protection.outlook.com [40.92.20.32]) (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 3AD0E24B2F; Sat, 10 Aug 2024 08:39:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.20.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279181; cv=fail; b=gdhDdyTKe3tA8kzIF1WjTHVEsfob5w1OkiSNlyQo5s/DH6QyjjWcAZDGzkXPd/xGSqCcmCYUBKbqvdKR22IChM4Yf+FCADn3B6hp64ovZWf9KgJQ6Hj6rFDBrZuQ9CPLyDkwRrllBRSKtlocRMb5zFsYfDfxx3pjdSNMWV1WP2Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279181; c=relaxed/simple; bh=i9vNv66HDHDll+vbxgK4SnsmzW4uDRQPtQFjqs3T87o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mD0Mf+u3JxqvjpEy5lXjoMhfrrNLmTHUNddPjcp2PBaYXElE6bGneXyTnCcFGZ8wbTEZVeVi3/a96K6aX2iuofRgdsWXDh9zBPl4fEA4tUXM9EL6Xv1W3j4Cgj1PUC/RcNDR9JgLnD3WI8B8OMYuwBMt8AS0T+ZRMdjngcaN3kA= 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=lnLUFme0; arc=fail smtp.client-ip=40.92.20.32 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="lnLUFme0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hp2DXPEye17C5KJMB7W71QHjX3vfjMeHa9Z1sL/Wp8y+LUlegPAdjpwbK3JKt+wCJjWuvF9dpbh0k0ZyDJkOxjllDRWA85Km2wRIVR+MKXskScdmDgOaQaKI78oALQhiBxWQkrtcoro9NboYQeGGXNtaP59zKZqDS5cLBWn8tcZHi6yjEr1zQfK0fzggDuEU0nwpcVom/5IqkWl1QspXKCWOgkpvanS4UR+gRKIA/oH8OYtTTE8Cj7W5zXQ5QYbvcr+cxRAn0erRW+o5s5MmJmwMzuSR7+5KC5gRzek5bq/t9vTE0Pau9nCAnTyRFN52fXV/qfkf2iHFeZHIs26HcA== 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=bWgQNS5HAX8Lns7csOKsQ0dL79ppzSttQCfsAesf1FE=; b=EnXkKlWztjvc5khKsz5JZeB10hVum2Cu68LvkFxcUAnGlYTkk2Z+Z3xLZba16fVBpA4S6j8pJb4MiFqF0OwpJOlF64KCuisvVJ+AQ2tXXcQMzcZTQ8ITbpS10b0AM/ZRYQQYw3IvO+P4PyOnjMHzgKsthRQurh0+nloYYX1wpillbmSWZ3YrB9n5YALpCK7wvOW/xUfZzio8TkVn3+Mxn8M3mTERbjrpzduc6Y1zhMsxhWQ4MPO00n6oniCwV+prdkmqCzVVFQnfbmHyC09AikEK1Hf5Cxs55k58CzN4c5kDmlVuRTZ+NXBsRXpwlN80wsCh1UURjSuNKQ71RVetjQ== 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=bWgQNS5HAX8Lns7csOKsQ0dL79ppzSttQCfsAesf1FE=; b=lnLUFme0S0pFfNbqILta1i5HBrev9sGqAnl71h3onKnQfPO0afMqIeX95vin6wAznz0oPDIHunGo4c6Tpxxhz4k7MvBsNAtD/4XkCkk5TsUUPb+Nz0ozdQKAJ00+gxU0NLTEZWI2HFsZaXQEttDwU0ezQtySU+PwyQ5/mBz8mrmSoFFYjXcdIBw3eFXdJBp04xlaTujbKN59+5Y2p4X/fjAhsT6nGwPTQnoaxAUCgr0ZMtOHywsGQfnotKRSTtjkA6b+N0EERzlD+B7xYgW+OP9dEa/uvBU66dsuatEWd4mK4gFswhq22N33azf51L44N3D4qGr6koer6Nq7Ic5QEg== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by PH7PR20MB6115.namprd20.prod.outlook.com (2603:10b6:510:2bb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.23; Sat, 10 Aug 2024 08:39:35 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%4]) with mapi id 15.20.7849.015; Sat, 10 Aug 2024 08:39:35 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v10 1/3] dt-bindings: dmaengine: Add dma multiplexer for CV18XX/SG200X series SoC Date: Sat, 10 Aug 2024 16:38:53 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-TMN: [8ifUDYPhYk4+XHypRhGydgyYWUTFlQkDG2eCDq+F8n0=] X-ClientProxiedBy: SI2PR01CA0044.apcprd01.prod.exchangelabs.com (2603:1096:4:193::8) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240810083857.487764-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_|PH7PR20MB6115:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ce476a4-cead-4b46-3c53-08dcb917f6d3 X-Microsoft-Antispam: BCL:0;ARA:14566002|5072599009|461199028|19110799003|8060799006|15080799003|4302099013|440099028|3412199025|1602099012|1710799026; X-Microsoft-Antispam-Message-Info: qoKyJ6qu0KH1+rCl1e6QGvezIdBTNzrhfQwkw9dtvVPuYc+PpI5iJKvOYcLwjnW4gCUpCFm9xc3dkYm4O1PSbo6bzB3FU1Zr6Qk9DUGHp5Dt3u2xdAPtfsiw7Sfqs+x5xfY+e/tjhMb9cNog8+VRAlsILE1bsSGSnKA3VY28krtLM67eMh7v0MxrK9AAQTj7LteJ97dq2QCxlVErPvjmRFGgZJJd1/eqNLrWeFuCXTmU6DRnzt3dtgkfTE8JHMmJ5FFBF3ivPqT/i/z6bodp/F9gS3Qw9robTIn7QKe/6CM4Cmb9IJ80XtcG/32opSouMK9m+l+91XNXXuroJXjS6OIJukOMth9XYGqMka8D7FLZYKuribdTJiDqTV97t89oTj3fykub9LI0Es4rKIw8apipcIVMerS2DLWWGUEn/pDcBaaFn8hCOcom8F827iGC4wFt+WoLbtryfVHyD+tvIymYFaANH52071wIEcNTl62wGNMyQnXSPzDhpuBDrlFx3ubmGN/6C9gnLsHcerVLSmYch4bHsMiadtZPUfI23X8pBPaGDPLWNeqo4JQKfg60hHAvusC/zRji/1/O9/e/6Xgh2ZFbFGBOhB6VgUUr23hGgdyDKWujAW/d9zVqIgwqojO6GoU+7HQxkkvYTDhLmdQKigTOYHQHyWpwxLbPf/41y9RwmLwmC2h8FHaeIXuN4OWotBCZFLfAVB+u4UCtzp7EEricu3z9tOZylEmed5k6tNh8tLuF63LErD6+IPkFuPxH+aNJyrdZom4eKPJRxG1XlR8eNWmk6TbqnOIDFsgN1HlKAaYlYix8jypBNi0Yab/WJ4yhUBi6EVlJSJbD+mBIANekmCCnKwDMN8PR/8U= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0L2JaX9e4nzn2OpN5UuQwc+cd34sGYo9VZUncTOVZH8/GCOoc/RgSYRm5FMKHHniubw0q7xetJkGAmOhc+y9PF9c96NZgv7eaRQ/haWsqsv4wEgo17tuaQaawjjoYavnytuBxTT5CdiCB7Q/4q21BBBkmqg95IVnjl/jn7s5RzmPuII2KpOuXamOd0RTdxxc9t5+CmqZMj4srlhYnmvAq1awSpOPAzTT/9+RqdiV7SQyc/nnR6upc/Smp/sSeVNEJFkE2B6lZ2FESv13c3RE5KXucNsAokrFt6RNMOrJXZxdytcWiLJqVQPLT4yRiNZDdcSKsbcv1h61VSR8Mkf8vXKjDe+bliGqSn93VYiHJmOEHnm+eAJQahVHFyiMi+qKoRvcuqCQOKd093oY0dvi/f7moWTNRhqeTdqfFhPNhNpcowmdh+2zfutqw7Sg0dWfcKt50YuvFuCoJYYmc8MXM58ugGaJt8pTcM0L+Y6Df6+ND8FXJEnBUMHiEsBnhSMDFhZxpMfUguqvaskQ9x9WOQLGkIIe8kUQl9oRnOES9/H3hcWtxQS/lLQ8g429SqINAPfJ3hm+3LWLIQd9qIGvc1Th+Cx6UAb+y3yXwp/1O3JF8/bw5rmBz14UKQT13ULLJ7p97PFy+lOhsICiY7z0aMEnXa9WmTrdPTRSXigz28B/hZFuPF6Vv+TnJgg01eXtd3xRQ5NhB/JlCsyxiVb1uDFxn0eFocT9Nq54aP93VjC9zYFp/Qh/cX649MV4kD5rnAP289rexOMFen7/xOXsL52JJ93WdLsaoijcq1DOBv4HxrslzCVJ620VeTnbY/DLdyzTKBD+j+CjAe0Ti7nI2Q7l2ZlaNFnISfeNbefLBsOFqY98dL88+VrPyFv1NroZDGBSUy4P0d7o4Tc2x8qEteRI7M0tOVOtIzAxuaOGYF3BULkJf8M94P6yiBpf3K292rfvcQwYA4E/+wwzknMxh8SlE1lZdE3XBJbkUOOYSIUZAsKZeRE8Gdrvvzko+NasXE1C1A5vVUcnjpaBhnTDgdmU8+hNKVj2S8uxjhUDPc2zyVGf7zAUyTOjM1H/EurX8u6+rqkoML2TV+y/vQDuE2yLb9Cj9bkIQaSujkUC0meWdwCd9H80ghC6SL+moJ95LpX5dndj4TtbsXl3+OqeOj7jLlw19z1IJnGCx7Mz523ATJG3fyg/iHCWt3QslyiTakvr8pZI+ASoRL30dyaPfsUq4Qhgj/ynloux6YxvphoH/2fo5kCs88zTPP2BbYCu X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ce476a4-cead-4b46-3c53-08dcb917f6d3 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2024 08:39:35.7541 (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: PH7PR20MB6115 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 --- .../bindings/dma/sophgo,cv1800b-dmamux.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800b-dmamux.yaml diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800b-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800b-dmamux.yaml new file mode 100644 index 000000000000..457fdad308df --- /dev/null +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800b-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,cv1800b-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,cv1800b-dmamux"; + reg = <0x154 0x8>, <0x298 0x4>; + #dma-cells = <2>; + dma-masters = <&dmac>; + }; From patchwork Sat Aug 10 08:38:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13759457 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2080.outbound.protection.outlook.com [40.92.19.80]) (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 1889E24B2F; Sat, 10 Aug 2024 08:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.19.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279190; cv=fail; b=Mr3yw2P7mSm+KCHhlvTDlbZ0vRo7xqBcB9GES6EaIcyplq43krvcrMEoi+mkNFasMgeFlNzrk0GB8ec6oL/fv9MYTJ5rMG32S6/GAXcj273VYdi4SWSz3SRcuQ7XinAhS0ISSvMMugtBhpyyHprylCX6acIjuJ+KeJV4+xQ0Aqg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279190; c=relaxed/simple; bh=PZS5cigwSxB5fhIh52/T4cSyL5plU4LFypOxWBus7h0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=gVWV1Ak9GEeto4n0bVsqqhWmjN6sybGgMJUaKoRrNw5gRYDqbJTGv8ConIfFDV7FnCdOtwcPGA4DBiUcVBw/ubNO/6Z3EBHfrqrcz6TLPYMU65hVLRrAtLK6ZtGW1mRvJnAhM5eXRT3fNu8J1+BRq6Qn0UzCjsyufyeiPhc7FD4= 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=lmkcFgg+; arc=fail smtp.client-ip=40.92.19.80 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="lmkcFgg+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tE54Ci8AwFz5Fl/ws6ijU0buoI9t8gGoNY7VYLZXmOV6fr1USzG/chFqIWc11Id+8I79aSguwjTWaX2F5lrX3/11o61L7YGp1sLxG2kRm9oQUfQ66vlNwEdpHL6CgX/IRYwId7JBX8fGzz3CO/pHcLxh4wN8BzVZs4ugKNB34R7ZIWHggSQZHOhsyCi3eK3jz7cB/QYDMZgdJHR3qxvNdHvUK4QvK9LAsISy8GEMn9OyZa8/x3/hWmMZXtrlk7rMByElxv/gx5kgzIJW8szqZbNOTnxNP50Kdcs9CfMInwmnN3dFrCzOUaj80wpC/N+7/ulk9zL24KSqQRXJ1hdnpg== 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=V8BiqYB/pmIIGwtoQCg80Q4LlvGH2VU5I5bg6jVgwmY=; b=tRsYlQ66qYZLnIDQMNHBIX3XSgMlo9tKmgHLKQz4wkl8zaakdcYohcZMHzIpgM6SpMlG36Qzs9DGbekndu1i0twI7ND/XsLfTRUMFaNSiC+JLqj3W4llt5ibSFkGs9zbq84lOE2iyS23pkPGhpmzfKqMkte4npbWRWDYEtpwmg+VtqgSL604tN1YU3HD1LfS7ORXnLZB7SqpRWsaXOd18IhX8af7uIM7A3WmZWfYQqeblUym67t6mES1ZNOPKKxRKHZjZodz73VuQ4P7NhDpsywyIxgqqxp2VkGPMz/1EvAgGemjy5lRa3fJWArZOi9yqU1oyR4M+4LKTeRDo6mnDA== 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=V8BiqYB/pmIIGwtoQCg80Q4LlvGH2VU5I5bg6jVgwmY=; b=lmkcFgg+abbs4ruRiEIcI3lta6NFS/bhPPJKvDV/LgPz35sgDAeYafDIAiby6R8GUmn93aTZ9+PHD1RHeo5MexIOBXAU6+VG2J5Yi72SSHbbOS19ivdOpbubF4VQ40l7juPCqmy6vO3gGG5jVuhLL0QMQIAAIBVAr9s7R+yP6kKKWFeMmM14V4zyHYPK3ngdBu+IsjL7PaIFLmvdoLEAQhKygGL9Zr6iUsgf2NZS+FuP0E1KJBHHpwpJeRbr2t+05ejAbwG5fBWJADzXavkKeghqM9O3A1fBU7d1NvzkCrS9ZoEg0psZQeT7sN6qw1bpem+Ez5CrOGITpWbd9WEDsA== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by PH7PR20MB6115.namprd20.prod.outlook.com (2603:10b6:510:2bb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.23; Sat, 10 Aug 2024 08:39:46 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%4]) with mapi id 15.20.7849.015; Sat, 10 Aug 2024 08:39:46 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Inochi Amaoto , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v10 2/3] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Sat, 10 Aug 2024 16:38:54 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-TMN: [vTzII9Ryr2xku6pJZ3FW+BXnw8dEftRN6aTt7PB2u9g=] X-ClientProxiedBy: SG2PR06CA0250.apcprd06.prod.outlook.com (2603:1096:4:ac::34) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240810083857.487764-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_|PH7PR20MB6115:EE_ X-MS-Office365-Filtering-Correlation-Id: 428e69d7-48de-45cb-4ca1-08dcb917fd0f X-Microsoft-Antispam: BCL:0;ARA:14566002|5072599009|461199028|19110799003|8060799006|15080799003|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: LfMVBW9spFz83ei3/yGCd9AWswWHDbK1IfX/kAK7lltUtxaX66+pfIoaU81bfFdnWqnPyEpwySAxjhPROjVdUij+nRNgKCCBpZq6uHzZ9SEmlTzcl062s4Mteg8nk8f1TYNtL23P109DZ9HaYNwAIx+yDrkAZdoGVOrfQML48eGnMfrv/9Ip6nhZNd0mbzZsrqtPIW06sGqaOmtdZVUubgdz9facx+AJPaci3o38tUGh3MbSZY4U6vEXCLinhFtr0ywYHY2HmJbwz3WgNqDSInhbHKdqGMltaLtaaGQOeFeNGP9r2n8vb0PYWDy2ZknT0fy7oA1K0zwXfbrIciFgt5htitoQu0X2F5G2fyW8lsuu+/nor7AuBQE1deR2VOm5uASzv7nUxSNHbFd7rhoOZpdWT9t2stvTq1gSXtLPrjvuvSxURA8TpJenes6dqiR4gJXEREAsm82YxSsug3RCNbxFW9vjZ7QPIDMlQrUcpfHnPosWBgreKtbDRvwp9i2BGp4brOEM4gEs+Lg8uT6O9zphHqSSMoGrW618bvfcl8qC5I5O0Ve4ta3hyErxIIb32gI/jkX1VE1OvHAChQ4rNQ/9ZD+hHMiN+I/MF24CZL6G1OogNqk1FU71pwmNBW68yYLqTXkq4maNscExxA2xeeK3afZLaTpnrvXXZ7thfgh++/x1eGCpItwooAWFF3iLt/tDXL5rPmAjlN8iol8UOgOgSCJ3N6fykCHAtIDULjc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4pJ5ybowcuA04ZLLgzW0IV37AxS679XJggGdAiqY1z+QjtYOfn8QDtuotJNx+eYAOE4kbyyjRM+ysZTqySiMeiNrJpw7I85BQJjrk4TYbCjn9XiGAUW10VkAh7IwiRIsXMmNsCOtvKvPMOTnET2BgZdITqjDd8At0IrXDmFpzV9wfnz92heukEnwtzNaRVyhGhOYLe+QjU0HhueBSkBSh6ZH74IlMJ1rrph+ral9yafVFYi1UoaLhOlqpwkjKiZWgLkajhtmGwkuJjCC6s0B03dN/qFdvuPg933i8LSA/M4uJA25dVbEeW21AcqhJwxqX2TE+PJDKwbDiqPw+v0sX4c4DLRwwAvYu7TDB4TuK7csXlDfMqrgElMs9Jf0y6//aEIUyOoCrHRY+M4OGqp6YWwcttydgpzxQeJfqYDxWsDpGBjNzvUvfRffsg8txnx+B2V4/S5R41VtCyKcaHBzSHD1fBiIr6yH8RUS0j1ABrYXd91StMORNpl+sTjI2CvxYQ3R4gZHfK9mVnOGkMcHT2lBZkP7M4NuwvImexyaffH0rGMhHqALwk97soIkduYI+ABcvcJWFdicPyHUcCX920bzPtgn+7Yh9zkpG6T413awGdit0P1qskQ8zUYTfUZns8RXJUqmR+eD5KHFiBROfejeTtTxZBjXn4JIbg6V6hUAzZUzGi6Q8NhzKSRyA0083Oio3JLz/AOXju0JtfmReOFw+Gq1/B+VkcGd6laUJyFesC+cY7zBhPT1sxbnqAKK+kxhPP/TUBK6344SZuKY03TlY52JVyBRA1zMy2LwLQb2BRTDxvYU62sps8sEded3PrMdVb7AI8LnWkZhHbyHzJkzIL3b2ylKmy5GAG0Ay/J4GBlRW89HzNG3E6Cl+vJbu1uAHkfpDqCIyEosv5hgnYzJMuwfA1TWmm872R0wCXIYxXBAjuGEdo0F8u5fHcC0bfpsQ0kdqGYYD6ZOXj0V+VlNOuIL/+2v7RlA654GwDGXzZLOoSBFryFQOZtc9Ozh0HpN5IjzSJTvyeYDMlimgAnEDJK8LElZXH8dkuvbUuL/FyCwCjLGAE3AwjUWW0KFEpJCXeJWTyTogmmoNzoxUP1Pas5eySgx8twXIxYrv06VYfQ0RetKZi6YDNDccB62uPCCPyk3LEd+8glh6dR4I/Qc3P76zA0I1mVf+Sh2pAFMPb+rATDuZYI/nviTyeD+QkMN1622XEOzi4CqTdkhPvj+j6+3Sx5vHXPVm+wTSeDww5YJnCmtf7FjZRkVF0tX X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 428e69d7-48de-45cb-4ca1-08dcb917fd0f X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2024 08:39:46.2019 (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: PH7PR20MB6115 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 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 Sat Aug 10 08:38:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13759458 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11olkn2073.outbound.protection.outlook.com [40.92.20.73]) (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 0550F14D430; Sat, 10 Aug 2024 08:39:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.20.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279197; cv=fail; b=bDOdXsgSVgnXjvjm92OdMvdd8EsHxcfLedSP6UF9l7yNrP0cIvbgrM4LeIK9K2kxBZUdvaoqpzkGk0lSzKTXiVjW6KTcz1+TsEfSXb/jygJRCmx0LjZCmF0b0BLA5QTWAAZQKvZwafBEMKM67l+5LX0AplITmmQwe3smEeMvcr8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279197; c=relaxed/simple; bh=pxAO91XUNNbvZQAdUlbHtEX2Uh5KvVKfJp97fMSWDTw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=a6rgggFNV+i7UoxpqeOECbtjDm5pDqQ5nLX/H37dUF0e5VN8kaWS6Yoq6TW/zGh/H7AMs/lfk/X2E63DfMScGhbnOqHTyuQ2ZtRrH+8fXpAK2hEPOoKS/ongEMBbiF9aIbZ3d6SgFQ9j30aNsrTWyGQv2M+1mbpmTYqtCDyRySo= 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=fi5vR7hk; arc=fail smtp.client-ip=40.92.20.73 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="fi5vR7hk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=utYJ94P5RGsxlI/Z027mQNqZl/00Cp0Zj+Fnj4AuQPuxv+5y7gL72RLrxgvI+jkbuDn2Dpv8bPsDQI7hxC6haq/1/imZA8rF+oOQZ/YzztB9TNnhyoI7GOTrnIlS01W7GAujP5CXEbiL0e3rLNqxWMgQBokW5DAhJpzihZxREAa47Y1i/YLjLxj/d6jKL4KhQlovO6ggTEYHXqe6dNmr7birHUFGXj5hME7XL4+tEi8l3sKIaDRkrHan/rmLSPFXDEIn33K47/D1kdMvonNlI5QxrLjKJWT7fK1nIrjC1nzBAp9OonQI/A5Bj5kMFwWNQb3V3NaZ47mg1WdHghlXhA== 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=Xs2ROf6X1JN3z9bP2TAgfx/DOx2m5ZoymWkgTW82OW8=; b=H6NQjtNSRxma8lM58hZ8G9hCIIxRwmkXdObg/Ll1p60JtjoRM/SrBAiKR+lZLJ/WnVJEey54O2R8Mp85EwKvLOAEIYT8I99k6Wju+sQRTCLv8Age7KgBZZlxWxLED2h0O8E+Ey0rFZFV0dhowr32xvd4pUgI9aWIog67MUx5CcQGGnHOVZdf19jVxiZiNLZy6vlQQlANAfGk3GjFsboZtWddD9c8RMlKmArloJvt08BO+cr5i+Sq6qkcJaARS7igdiolafNAJSVXIEiRSyXebbjfnnLXHHc+vtAXYHuoZMcrKRe/DkAEhvtsHHsxvr6ENQ3DiR+jm9U9jGCyPjZzSw== 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=Xs2ROf6X1JN3z9bP2TAgfx/DOx2m5ZoymWkgTW82OW8=; b=fi5vR7hkOyuVBzKiTtHB5I/q2vP8xDkjWg9oi4U0yeGjvapiENdsZipOvtO3AqEItxkp+sljx79+OdIdp9YzT25UW26M+hkLd3pw6tGDDTIu9pD0mb/qv4sGtBNc58+cNLxnEmKisCIplRuCtotoKulnY5OZtRREyVdnH/Ghwt2mwv9Lz69Dm9k7iCAHPUOXRGctQenrbbY7Oqn1RjzVzFbCoCv7SYS1jhQ/qjuepKvWaAGp+U/68HptBFL1erX/ncubZ8fero9aUb1TWRDGnX++VMKAKg5g516opo1IDoittvoJo+UNt/VvalSLnUVr3hTBujAhNhgOl0uYbDrS/w== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by PH7PR20MB6115.namprd20.prod.outlook.com (2603:10b6:510:2bb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.23; Sat, 10 Aug 2024 08:39:51 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%4]) with mapi id 15.20.7849.015; Sat, 10 Aug 2024 08:39:51 +0000 From: Inochi Amaoto To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v10 3/3] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Sat, 10 Aug 2024 16:38:55 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-TMN: [YKMlMLhW0UVOg5xfZ/TBYdw52enhBndqGuH9cIok6mE=] X-ClientProxiedBy: SG2PR02CA0035.apcprd02.prod.outlook.com (2603:1096:3:18::23) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240810083857.487764-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_|PH7PR20MB6115:EE_ X-MS-Office365-Filtering-Correlation-Id: fa47f9f7-dcc5-4871-7e75-08dcb9180032 X-Microsoft-Antispam: BCL:0;ARA:14566002|5072599009|461199028|19110799003|8060799006|15080799003|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: 5txIuTA56WFPY0PiVN95QiOq/e35093Wjt6FtS7p6199vj9zpu9KnD16NIDGfiWJO0TeVXYSc3wLxV/EpUoxCBTBYmyJH8yNVqBWqtIqO/z5n0JVX0hIrbELawCG+M1dDiXy/EMNWY61BoeDa4qTdpiBEYlLGnbHQv/gdAa1f/RNzjXzDglXusAR2MtyFbzfzwuLKmvlFAtIZIWiC04shq8BQIjvDMPJjBmj4dT6I+n2tSzLV9aMfacpSiGPgMOqJYZU2nl2HPPNs8e9bCEbBx1Pmmw55wsmUtA2oDW/qcXh2XGgPqPZdUftmKvC/KV2X9QamlMGEgP+sIIt7ViWcF11Ink5KzC+sBoH6hJNTp9RfpMwOmHzHX0vSZQoZ6fxPHGdUVE1U43JHJT0Q3k3kNTPniLLH6TUcYw5P3iKBDgL1LEvi4cu79X/kCTrxe9s4QHnZB8gqoa63fmM6CnS1cKKD6j9aMbmpSdHy9sSiuL/mhT5Ml0grnoMXcl5LdvbMKhvfoH9WaYbN+95bfQSPhjsdsWS85+BCBbBCHE4IEcOE3Oylvfi1PDt6eGyzfCU8mX9B6fVJr2oKQvTEZRLbyuQ7XHJzpWVzu/DOASYVUv94OmkcCvvXDXJMVZoRuuzy8Q9WWfqRrrujEl8bo0Qhvt8f3npx+DSjkn/MJSbCSxHZO7WrD3+FKW9JQIvSUww06P0oiqZjgk331tYiE46T+oHsEG4RF6n6+E9yZrgGJ4= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fJSKqY2x7/bYwuVNpQ98IcBF3p3fbbVQaoLogVdvM3+QFrq90YTvxW1dHJonGnabL0gq6X7PwE/Vayj0rS4U0MoDsVrQoWrWEpd0JtL95zofNcelUsXrDwNR5U5VePxyH+iree3aSVKonikB7SdRRg7QMwpAMtyEY65/S5S23v9AeMZNoDvS9HVsKdnlzTdGXJX9FUmgTe88esixaeYxo0gkFdOvbGp+RtTenaIdUndw11kBFg46Qvm9X2hfkq1uqnxG1aqOc+5vwfVgLl3XVA3B07JK8ZnTG4SnmZQAqC3vqam6JfHagljzvTb4DCwaNYUtF/vdJXxH1tohJznp2J03iAZMUe9dOo02R2XwTZMm8lvVFUtN0ObI/cmanTTmtqrO13E0i9xjSeEUfHsLPyVaulrWTSRlALkvJejIQ8BUnLIVgF6DSOCn+tx7cs/TJBdiXQJA3cPK49yebIc8qFcheoh4oTD6kvH5V251cF72feTOA/BzrvUNcn96Xs/GYTf5h/xjmjJtfsquiCHo3FEjMqkfg+Ihve35Mj+H5ZmQYiMVRIExqA0+ah0Y5gzmSMCmUBZQbkmLLZ+muxVM6iYo4JgulZQ/3PeegoqO+ABf7qqYk30DySeA80EkxNcG+zhddV0DYUioQd0DtguoJqkXQfh/3ex6ALFixakTIorCiJyjLaJVtfsN2BGA7wdi2VebXjSI2mSGIa/9OeTQjlMnFHh4VB09pUAyEd/9NABL2SlVSl9CWcbo4HJGI68rZLX5pXRIGnqBpj5cPCFdAozsmggmyJcAzghKp8dC+zvoFv2MBuBVzky0jSooktAFcVuoeR+oe9yfb18S75a2N+7P9K2rPfvoewpZKuTBrwyy/4lQypDYbDBLCZH/I+1BR8ppklJQNkMYJ7ZUrNZMs9QFvh0IahlpfTg5e66va8jB1oVAl3UlUqK43TpY3MU8JRsSV4kBYCAhKsCGYksECKZVRm39JuQCc790L4/J3xHivo2H0byuAIS7iO4K0KWuXcPA53+PVI0r0GpdVBSt8Vr1vyKiQV5mmRrTgnbMy0iKtFASVv6YkV8o0bcd+iIbVGhATK83n9HoDvTw3Lfi4YFNUGg5+KuIRDOg9ypzGzgQxmN3m0xXUZeyS146N5e5xUdMsVBj5fs2kDqK+orGHUBcgkCzEWA5coF/mlWFJism3wyKky2yrrFxs2D7A/KVtBlYmVLycCV3juy9W2fxH3l+dWZC9RxLcoYqREJGFJ/l0zB8cFxWxuw+6F9Q1UmX X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa47f9f7-dcc5-4871-7e75-08dcb9180032 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2024 08:39:51.7109 (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: PH7PR20MB6115 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 | 257 ++++++++++++++++++++++++++++++++++++ 3 files changed, 267 insertions(+) create mode 100644 drivers/dma/cv1800-dmamux.c diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index cc0a62c34861..df010ee1de46 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 374ea98faf43..60d05b305082 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -69,6 +69,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_SPRD_DMA) += sprd-dma.o obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o diff --git a/drivers/dma/cv1800-dmamux.c b/drivers/dma/cv1800-dmamux.c new file mode 100644 index 000000000000..483cf3ff5feb --- /dev/null +++ b/drivers/dma/cv1800-dmamux.c @@ -0,0 +1,257 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Inochi Amaoto + */ + +#include +#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; + + guard(spinlock_irqsave)(&dmamux->lock); + + 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)); + + 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,cv1800b-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");