From patchwork Tue Feb 20 10:20:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563846 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02olkn2069.outbound.protection.outlook.com [40.92.44.69]) (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 8C72660ED2; Tue, 20 Feb 2024 10:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.44.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424432; cv=fail; b=VdlnwsABSpNw9fO2KOKv9RcrOt6BkBFhPul+eHdV/2v+HKPyVnczeBgvzrT2vt5IWkYCLzTwt4sD6b6zcm6xxM3mI/GulQ9n5VI2iYRUfMX22Isd4dJZAZEiLNFJ3TM8+t0rQKh9mhqsRgScbXR3oxUTZtPAKxxYd9SFipEOa6Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424432; c=relaxed/simple; bh=gyy5jwaju35coA1NLIYiVhYlDzoZuCdbjcxOYEm3Dto=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=WlLpa3Wg3WvJSwY5dj9mYpEvQ9Z8RMDxaygXgWkQ30yzXmYWwEGsTQfonKax8q2MGeC8wsR9w/7KYIToUFRJmGXSh8Fyecbdpi7w9uN2vli9Elk4q0rNeDyUf4Ucdiz7PaoV9p3JrhPunw8xFSnWGURL1I4YgbTxXfxqnGs5OeI= 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=YTdeAf6j; arc=fail smtp.client-ip=40.92.44.69 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="YTdeAf6j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dR1nMqgsmc5otO8L02Li6A6ISF3+zoipWQs90HcblPZNXeShw4hq5AIb48gxkK/vS3RhWsi5izUj/L7ft2LI7Xh+rrObuTmXFuZEzNy6zG+iBkdDUs/pH+O7JpmlSwzsAaQQAMq1VGxQs36UlqSP5tGrSLVsyjvxW/zJjJkwfERUWzo64yjOtanEyF5XC+cLrUXiGgeF8PU8N0YSN8WMnVlE5sRjFCEmU0pTYpaAsrCQGuTCH+o6McY27NTjKhK2v4gSzyXTBeS+6a/PlljQGmRMtabAi2Ext8O0WkwBddilW+JwfWP66GQqnu3HOLHj5b0oe3tYin+PsMblBmn3Xw== 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=A02tJGwt5VI62ljCpigJGEiGn9yrCWwrjxyI5/aiJMlwBLz1cYO8WJ48trliu8W3Q9gpM6bNWMJkdruEgO0YuKEaKSBaG7Edsivhl0ZiW0Q//8XZkMmJaZ/mBmJV2VQDorwJoGeTJAh11khVsayHX4MZOK48p2c8xPLK5JeKPgugz7gvUdx8Q1rxRRFaXSwlbZtwLRuzbkekSL3fueisWmGstsgERLs77/1mPX6XzShBBckSkn0W3YsijO6LxDejoHuYzM9Zye0+CaY5PXPP5T13v6FpHoPxXH3Rg8VOAF/+l7TJELv3buGGpQHN1wultpz2OH9Sn7Bczmog/XY0cA== 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=YTdeAf6jNTpQEzT9ViHoeB0E55Y9z64hrVm33x10uOvwL7GZoVQLDuQBvHxM0y8K68Ki6tUAsP0U5p3Xt0TlT74wYPVy6PQi5nddHGgttQNzAgxNup2E/LSA1HdMXHaDNmk1AYnSfaOXYDIkMWTSTuD3Efw2+I79vgaAUaemoCw+MzHvKwlnRCwHIpwJ/KMmGc8RlPKcxyTCFDfbBbT64MKZjgj+PStVlOSGj8nW+gUX08cmWHl0oyJ2KJNjVXjBt7A+O3iyytemt9lWBfWdx/v1wHnhmuPK+UZU00bJK0VDy3FadtOJSIMFUS2vU6Kdho1eJAV+Ad/ry6XwM2iGyw== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by MW4PR20MB5156.namprd20.prod.outlook.com (2603:10b6:303:1ea::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 10:20:27 +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:20:27 +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 1/4] dt-bindings: dmaengine: Add dmamux for CV18XX/SG200X series SoC Date: Tue, 20 Feb 2024 18:20:28 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [RsOGHVyKM6KT5nBM/G4YCPma1OebsM13A9hGmRSxFbo=] X-ClientProxiedBy: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) To PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) X-Microsoft-Original-Message-ID: <20240220102032.870200-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_|MW4PR20MB5156:EE_ X-MS-Office365-Filtering-Correlation-Id: c746c2e6-54d0-41ee-251a-08dc31fd8ecc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6W0yA4qhXh/8Pc6vJZReiMgUYFDttPXGRbKJ6NcBenIpbbGox8Ii2i4AKa2JqitHidNe6swnFC2EsP+XM3wprtTuZtCOEFxlRIn1E+/qu6O/m8/ZQysqB81XMP84Ieh/aFvskF+9YfrX5AztmbIDoqW5UNMEbEVkneCnNkDNMlebLv9bujK2uRHQxAGEaphkIpTMi7zzbz7PujJfgI6tH+uHjH9PeaDeWIDqTXxoD6Qll6F5/0uYbWJSMESDnYaP14T3bfnP5ul2xYQR1R+S9TPQs/nMN8b4CX4siq/FyulCM3VId9li+F/P6+3mogy9hcBf62TNOuXKK5VVlqwDTmFkJ8Gp5jpwzT+Bw4i5oub8eWZ6vf9G6dWNu04eiQXKNQrGz0YoyTtswfA2OZVotMKj6rLYRqP4MTmld8W1Mb7Ea/yzu9vGRxF89neMK/byZ2uiv2lS0cmNYTdLsP2EJ9E+hkeLGwh4i5UAhiHO6ScRph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Do1PrJIijT35UEH6dC3EXgMWgaMIfn/5VQ/MWAnEiMGYnPyu35AdR5g5WMEedei9hTRUgGh9Vd9nMgi23/HkzFbK5T/yUX/W+QW2u6QVjjQUTKvOYN3GGFrjjGXKQmAjBYeoJ7XaL2N+pSxGyB2rNOO09acOyLe4AQwADf3+3UuurqDeLg29nekMr8ylM7A7xmOpinjIfQgrb0V/z9jHsZfVAdunewBU67Oefjo0us3wgRK9vrQ5QfBk4541YsaOawclLbP+L7JjyNwMu8k6G0ZyD5DYpSQ4IdjNu4I1Yi3lnlS6JNbW7OvoNDFm71IWrAjN3vX7wv16Gd2NGWdTCHVBUp4uULYUx/xK1xfeUh3O33f/Rl+Vxn4Fdduoud4ZwffPVeLTdbrw8p9XPMnCF5/DMRUWK X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c746c2e6-54d0-41ee-251a-08dc31fd8ecc 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:20:27.3730 (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: MW4PR20MB5156 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 | 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:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563847 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02olkn2026.outbound.protection.outlook.com [40.92.44.26]) (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 59DC2612CD; Tue, 20 Feb 2024 10:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.44.26 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424435; cv=fail; b=KwxD+QUhleAVk/KAuQIs+YULxbg09Os3CaspiA1FmPEmLSCOP+zAyTzjvdB0R8i6Kp5DBV291HtjVJrXPyAeKPo7RRybJmDIDSj+cZUIbYgmKkDO0uGYWSeHMn1/jK5pygLoCqqyGIjSS4gwM/X+tnl0jmN1zumKG8LrEbiJvQQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424435; c=relaxed/simple; bh=4Y+lZczuBSWd4c+fmfkrznNnCx063pkkQ6axcowgtJI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=hTHCjozeSlfXm/sS5j4wLMtjtVNT4sjkF3WT/6b+yDGHvLr8Lwv5QmK0zdtR3ohIcqF1d7wlP6y7Wno2kEJgW6hOXT3GQ+dTJcWt1OfEqoX+GfRFSk/3zjSw66as7mwlM6HipuHcg9I3uNZIdQxK1q7oCTJnXvpDdkuVHusz6mk= 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=cQRE+MwA; arc=fail smtp.client-ip=40.92.44.26 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="cQRE+MwA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTlsFq5ENqziyPDKfgD9zieKO+wQMLRjTreAidP2t9AFjHgy9PuCSgCZVYOeU75/u2CMC6yYkdU5fgTpMBNkG39nbuXVBJnmnWF8uzQZzdKe6fZLiLj4fumyNr3a9x2eaZqp+b6TQTmR4dS+kipXewEBIYsg9OIpg9dNusNv97m4511xqAdkiL0r7m8D6+1ZdAmq6COeH2X4a/gtqOM5RNlEt0IaEGnLrqfUEoDA04umX4u4ioicP6FEfURWQ1Xjc/s+I1h8hq9QMoPagSpAldS160YMUAabx00v/LH36OFXHNgFnSjez5T4nA1DjOvfD2PwGuCXrt6NZk//owcnjg== 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=U6d15aNxd/pTwB4XOrtXvWAxot+QUF3otkbV/1WccWUukvuNimezeF7yMIfnUOCASEAKIcSN5bAlt2GXKKr1SSkhE0Z7QgO+YJ14ZZmMZyLtOZRaXwt70VZIwTX0dIp4oSjso6dYvMC/dqYES6EtNQJSw514qlwLBkVo5Q4LQJuPahZ38JbXDwr6m/6wtnWR1xBDdztkWISMyZ5zouyEEi+bnWyXoWrt8PTzWc/hsj81YIDOGzB9v7wqiwW7zYG1saZljBDypcOxBFglfFGutH0wrRjrCw+h/djVDqLXEPzPSvPrNgk6w/+rw5eaAsWS4T4P86i9ASduDrUhHhmDCg== 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=cQRE+MwAraYZns7Q/et0WTkUvtAW3hP/rXXpbtdJY++EnycYnB6KUVW1VCSnPvePdOkHtUAyz6S67mqY3h/9w6hkn7Uim3PqgwMUpwePb/g5oAPB9ow9MAHONYj0YxJGNOZ9gZ8rdQoInHs8f3Lz3XRU5px9n7U0ISL6+1iVyuGgdyqxYder+SfNvPFHHIQbsYUlCwz06aiMF6ce5kde9olPIARwNqMmLJFOiD6esCqz/GVhzCd9fHJ24rHm9YaL70TP7ED7QivzBOeFpym3Ja6x3ZYbpXjLsG5antXXZFTsC62N9hVKeWsGv+zv1ZiMWmbv6cFDH/53ixST5njv+w== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by MW4PR20MB5156.namprd20.prod.outlook.com (2603:10b6:303:1ea::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 10:20:31 +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:20:31 +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 2/4] dt-bindings: clock: sophgo: Add top misc controller of CV18XX/SG200X series SoC Date: Tue, 20 Feb 2024 18:20:29 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [aNiP0EAz0lB28HdS8r17bHZ6hs+QXw3PZOhsV59Gp4E=] X-ClientProxiedBy: TY2PR02CA0015.apcprd02.prod.outlook.com (2603:1096:404:56::27) To PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) X-Microsoft-Original-Message-ID: <20240220102032.870200-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_|MW4PR20MB5156:EE_ X-MS-Office365-Filtering-Correlation-Id: ad236ca9-b7b2-479b-7f3d-08dc31fd9100 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vVIX4O1AQbUhAkozBbTsgGu1VUub6I+13sV/3e2Nao0S9BNWsB8ManZfeTOVo7p60kHP/qUcWOmyWegMI6++Ic4rURrl260Q1xUld8IQ2NMNY1tcsk8S5BWUh7dSOdR0nXtExk4DEcjSgcPZkX58324Mn4l9E2vQVJM6YSj+0lI4LaKIU49rr5ysKDSwaR7+gcYu0ibghzd42N5SqDuPMdDyf5egN5J12r51P2GdozWFhZ17BNdFhHmBwXr+etFzYUZ5Mt6ASmp+So2zp3QLI/Eqhu6JEAoLxrok9sNBZne4Z7TBptu7fyYOS3K7mBrBmU81PA+uwN7/qjIrMYimbR5BkVJo/oZFmx6Uf5qmP8ZdQJNfvkHYSvuGUvGZi/6IX4gr/X+bOXva5zvkTR0eeerfOf4tvGOXOQb+f0+CMH6p+nkNsdSq7PuIaTdkaAzJ/t71gXgGVHfzzVgjxVAAwGHpHKgFbOqt5wVmKOsnYTn8Ei6Zd2JlsqR3r1cT8oVpcfB/Hg2munl5CiJlAnxG8bJP1gdtev88qDhaPGqGrDTHpHc+R/Xk0pQwED4EPu4vKFtLEfXkhqIBsIUUjo8ehNLzJYazBeinZioiiYbcSZrkIj8h7ifs1PQwvCDKU4SP X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8gvopGn2ptUsdoYpOTzbJnVcsu0U1nHlT4a7DfoIS1i1iNw0MHljCB7XOkCMNGn5qi4+sim3FzjSlFM9MW9qBb9uAiy8DWWQkTk0ALQ9PpYTXJcg7ICWai5/fmzQ/f/o/tkdBszr9d60lTgOpGFrRT4VzG9OGHRhU6y6BBmVuzFR/mX+OzywdOWcqpKZPZ27tFohcIuiPrYWVQ8k0Lj3EFLDoFP1a4DqHHbp5Us/gJR36UME6xp7eEVw7dB1cSKLEtbz3X0CsPa5qSVV8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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:20:31.0634 (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: MW4PR20MB5156 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:20:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563848 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02olkn2081.outbound.protection.outlook.com [40.92.44.81]) (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 7198160EC1; Tue, 20 Feb 2024 10:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.44.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424460; cv=fail; b=SItjhFtczwxlkxbzJxDzAcUKtp5O1BpHEoMgCenXw2F079T5NNp6p6QpDEIi4165qE5ZTbF2wxX+cv3lEQ/8zaKTLDHbYUgEd2XhhXECi9HOE3fjq9Eaj8GFugUMdQ+resnXrcJyPddOFkd6QziRulP7qB10+n8lR9Ix8OFB/po= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424460; c=relaxed/simple; bh=KFjDzG+7y8lC9tvfGHbYkI88rh4Bwc6aVu5oAP3VAmw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=SPMZbG2g37N0iRkwAC/xDSnUq0HqIQLeY6++PgvSEa332mDaARuz4YW1ToAphEu3uqyuOs/nUSP6V8JXxUjinZ+uSZcOoVYStkhyMrq1YHeOtFtbtFiqUlXeQj5QAR/YLFILzumn9xcGeghIN7IeUBvAfTlFdthFEp7DpJNvHe4= 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=poOyfE2h; arc=fail smtp.client-ip=40.92.44.81 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="poOyfE2h" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fT6LcGl5e7x3n2yyA5ksfnQy1d1GzgU6dQCYaZZqx+eXGNR9vJkXTiAk/s/nzXxbfPl+z4jY7gTlyC106sw7wj0qmpagzaXMhjm7LhKeLNrd8+LmlrHnujKV1yH17S6WhtskIlJZgEVrs2kacfe9Gue60jaTnuVhnZnrLh1Mml1ABhOPLeYeemXBBFtLlxM+6LHYyxwC1+oMXf0AMI0Uh31dJZIr6LYfyy/K4SdgnRvPHRSre3LwWY8yjSYDvQYqoCLE5DYywIpk3cS6Fn6MIhbFtSKiXC9/k0lMTNwr3f0uFjOicW/vTpri9ayEYSYpVl6IN30RxR7XxgviBIf5mw== 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=SOePw4NJoUiEGdqcnAT2iFv4V6l/4ndIeFJ3thmIioOYtFk0JGxQ3WZfjHvXt5SMmOs80/1F7Oqml4wh6svDkemZAYD3I/425FFUV6D+4S/uiUTGPUAycnMhmXT9XXx6Ys7jltU/Pry8I3tzRMQzUEkv+3QwQbI8C6gz4sDTLbcA47tjYnMJ4m/p+UEgo/eY56MoA3EdwzYsTTWnbKOiMAgFufWJi0Ij3yUisHL1lDvY9YJS3u50roVRyxQ5MN1S+MAvI1N5/vQQW21sKCVFhzyNAZ92iRZ5LMf12r/Ft1bsRr77aIAqiFUDefs/e6F4fLCu1QzhoR+iCt7fpICWgA== 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=poOyfE2hVxjmGS04+o7XzD7QrV5fa8Zs1WGW/U1rdNm/g3OszSlLM2NgCaWDjFI+0Qrgj8huAwz2KxfnFQPjN5tuIMNK0PupfSBuw/oOmkOu9QN8LkphBxytJIcG9LwZOkItuXLcad9i9NMnx1osRp/g/faip7AnJqpac1Cm2H0MeLvvVELkt1QeuZgFKbClyBLJE2xxApViVUKEiv6OxABrCz6LImLXQXbbBsYnLD3S/8EcLnoFQAkyj83Du+0rOa0v/sb6x2Btl4NGEaN7/6u6qbK7MlEHnZX6I0gvdortL8RfyXMRlJr10pgB815WHtT/hprUh15m5+akdasrFA== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by MW4PR20MB5156.namprd20.prod.outlook.com (2603:10b6:303:1ea::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 10:20: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:20: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 3/4] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Tue, 20 Feb 2024 18:20:30 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [QGHKI2NMpLVbJ17sOrY9CTP2FjxrYgo0JCsdxpWM2xU=] X-ClientProxiedBy: TY2PR01CA0012.jpnprd01.prod.outlook.com (2603:1096:404:a::24) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240220102032.870200-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_|MW4PR20MB5156:EE_ X-MS-Office365-Filtering-Correlation-Id: d74b1317-2624-4809-9435-08dc31fd96f9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZS7QeZPCnCqX24HoYHKr/FuyY6oT/3VzxCMKXc6FZfHcd9zapiCKlZ8qAwgF0dWyfE73a4j0zkJt65ofyiaGhOaRULbIMHgxknLN8z4QIQXWfW/Qxt7x2tBuFZ/aFvWWIPNG4AEf9QhCnSux22BQUfs+dfdQBQw/SfhlBchtU5MXcJm2+d1vFB8PXNqNb73ln5JENj0PuPvToJb2KrjuY8AbPUqWQKiF3G1CX2cDuDFyMcW8SB9uBLUyYQKTGuvF2BpqfzRqZRTug2oSTIhYYOCyp1/lTdC2yNMInPzwMMR5a5jzAvvpGaGAqLazdu1x7Q6YQ5ZUc1WJ8SDH5wRwENOl7hysToVpAH3bDC+p76dDPtpe38yif5Q5IZcJ9t4Q5g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OxZ5V83Jy8Ej3EOBLOW3jB+AxXuP/ZMuz1Dx7H+JOFVecNI9iq7eEj06Mtrpq66yPtPSHnZs+dHf+47x9bLRA4hKFEOlLaROJe+Cb1LBbFKolqcENGNA+s+IhLLi8XPlrr2bG8oKLTet354SsaRm6gRofBX/H+3wMXZlAXlHvVCPg1Yh5ihX0bCRczuYdnDHvTk4k++J+PiHJyxvi7b1bWU5ugW9Q5dpSYkxB0e+5L/WqKwDONduEUpwhzsUy78XWGTUt/KtriwXPPPi802TIMQtPM3j41iFikPUeELe28lQj+oVkKIMd+ojZVtaj3gGn0Ef9cHwmkzR9gwi2ewnJ0DjZsONFxnJcovyZWCDs28b3v6TTbVikQBFWlN/uJ+OIXxbZ7wdNbuhMxCfowJBJtv0FPr/gF3VloH7CgmiX4aWvrhKBF/fgrdCqMOZyNItn/RTXmFPXVIWKVrPJm1sfQb1j+aGyxxqZ4miSUg1VeStawthco55kHhBdXr7 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d74b1317-2624-4809-9435-08dc31fd96f9 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:20:56.1354 (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: MW4PR20MB5156 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:20:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13563849 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02olkn2085.outbound.protection.outlook.com [40.92.44.85]) (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 F0916612C6; Tue, 20 Feb 2024 10:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.44.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424467; cv=fail; b=j+xqW2lmgIP0zYbcg3jKRw4JoVwZEcThXtfhqgP68HLskcuwbKVDCjBkcJCJQ8uCua7Xal8K7NvcCatrFRHSgP2yoNCh5AZmimDCbph37XUxIKtbyrlRWcfUTnkXhpBE2Ie5TkDlH+PQRl3XiZNDBUUSKVK+XDUtLGzpQKSNxMk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708424467; c=relaxed/simple; bh=XXV6nMc8o7eCFYU7MSxbIzJnKa2S0VdxWQTsb2i7PhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=SwJHEDVZt+XXm4f0MHSHWRkdVEg01mk1s7/4FEy7GhWGnSw4IsinzUGbxzKWt4Ew52EQNhd7Oa1wgWDbHs8jBXHOEvQOOMvG6bWQO/y5UIwwLHxPv6Je86f+J3fZehnQdkDFHT0wTfOO4PrPwIJ9WPkEQzZMryrZE/kU49ORKd4= 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=WA7+WW0N; arc=fail smtp.client-ip=40.92.44.85 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="WA7+WW0N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QB+8+d+kT7xWxPIjF0D2OFwEa+oJkyrQU9kwLqP5G6Mf1rNElg5kCtY/2KV0dYfIWwU4/8Kdmz6TewPlLLVhL2ra2FrX/L1NLuXPWKoaZ2SeyWxKp1Fgs3EXM9jLlh2LqPuWzl0C+8HqFbPZk0ji2dqsMeVohvLz/o0gJSBOKDjCRF+apX6UeUets52xmwrMD085p4wmR0CJARP9rg3ERhMyLKPnvzvopY/Dq5QE/zDjcvcXbB+e9ay7Zwg0iHyD4p8pZWVl9eBqkt2mM80+sUnMSwaZawrvpSxbLuOB9Kbb5oCHAZx13AXX2tlzeRQDPga9VXIRAeh4a4Ucwmyd0Q== 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=mKaOyXkwNuB8Y78Oo3yoO1oeQKB2shyRXyHsA4WRCKx5p87RFUBR0Ye5IR6j1VPzWbqjhT8gZ+PQOgjRxbadkyNDFJsOnbQZBwa98ChhwmOAB3UGa1ykHtCZRCoPjn7NaRiKRBglpULAiRqbgj3rbKgqkPMDSpQG4CccOAJidwHRXR0vn7AHU5QVIt5f11ac89G43XE0m75jOqe8DbBAD1h43cIzk8wPO7mRw5zipYAifAVSV4AJnmlHHv2vwJyzMgdyJDQu1peXe3NnLI8Ax1SerB8eKfu8QTuPzP5O+C8ASinb0l1MaQIyZTmASE9EuGZ0CuPTCaFI/NqTRtJaiA== 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=WA7+WW0NtYSeDj8lJ5SbesEPVkSgde25XMRjzMVTSwhEWICD9ctdYQwV3GyfmIwpmJBkwzCaOR7Lf4UfhMN0GWPiEpaAYtrV3hSFkx/VkXKOGriObiC3tuF+aBPvEPNjctbLrtfr7cx5jyN1lq1BTocxfHRae02pMRx9lnLid1Fp2jfg+Opn6ESsrSL3i63isg2MDPyZzGuE59pX8XmDYhjqjtwwQ+9Hf6sLjvLpnrgJrNpEdZ0qPKzkmQ9roiLauPaiQShmCaFghzlN+PAhmeHzJYhjnI8EKd9R/+gV0xyzcRGrXrytfpzwZ1qSts84SDYw14g9Zz/6f4ybQ/C0ww== Received: from PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) by MW4PR20MB5156.namprd20.prod.outlook.com (2603:10b6:303:1ea::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 10:21:03 +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:21:03 +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 4/4] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Tue, 20 Feb 2024 18:20:31 +0800 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: X-TMN: [xhYwH5W1ZUv8tffS6PV8774XUKoe9YY/wEnaoy6V9cw=] X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PH7PR20MB4962.namprd20.prod.outlook.com (2603:10b6:510:1fa::6) X-Microsoft-Original-Message-ID: <20240220102032.870200-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_|MW4PR20MB5156:EE_ X-MS-Office365-Filtering-Correlation-Id: add84bab-e65a-4496-31a3-08dc31fda414 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fU/RaIwDfJ8FLtVmdK+b2a088Lkya5BX2LGajqcZz+QyIomnofXEunCRFBye0dlQeas1LA1TQhbwLRTKINm4OHj0gF/DQo8UamAMVe7yKl93/p/LQ3eX5Tnm4v8+reRK7TMb5uv235qCAbGpRijIxpNDo+Eess3bNc+6YAY1VIkC/Df3jYd6wKerQeoISAhBOhDcwClt4gWOFKVmph3RxZ5ZmKqi1uhJXRcmhD82MKxQv6mWVMmWKA+v6oClXc3Hg81nx7fxJ/jYo71F44H+0ZAZu5Zg0MwOpVk3oHtFo45vQFo+z5ZbPlR5M3nXu+MO/KMedXllnMFCiPdCYAMG90y4hWbzoq/+Gk79VuqUJs7C05sWCkmk8JI7LdtU0kBGPdY8l2fDcJrCDYLopwaP42Zpno+sbKQYprJIUrDaeNX0UV8QqhMu8MpSat1zNeBppzbSqNcfkcRrjNlay0j+XZN4hImY4z/BAFdct6AU7oWxWSImSaM/yiiGQUnKihe4SLIfydr1Ae5KA6ewc0rrtMVYTQA5nFfNizDss3mE9prowHZxD1wjgde8GRSU7eNQkt5HGt1nhhr0DrLiKBGu/Ms4qPYc+cBgWqsWi3q77RsD8/xY++b9wLfZVZ7rB1wH X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EnCOtqR8gM3cF6xLXjTku5zZAfJa4qVO3zP3waaexAYHjS7+5PvY0GJuwC+qVkZhsKbQhGfTIMLqaRj5CdGW1whhMWAIUNwGk6F4fBl59103VsBab6IL3dzM9LyCnGKhWxWBL8HAe4d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83YYasvXKTeSG7cgxmigkOKdjJ+3IOCHJkGau1f8NecRSC6aMH0I3rldQlyNAO X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: add84bab-e65a-4496-31a3-08dc31fda414 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:21:03.2379 (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: MW4PR20MB5156 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");