From patchwork Fri Mar 15 02:50:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13593015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9FB6C54E5D for ; Fri, 15 Mar 2024 02:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0pASrTlwtDo/OC5uwGrY2CsMCqUAp+sEXlkrXSkeShw=; b=QGJ/OjbyuhfJaF U199BeJGuO3+lrGYq9XHgYS58ov79Owct3OWOKCGQw3NhfTZIC+fEZtOcHd4+3l7cZhDoDuLBtNuk wc+u5f1oRLe/OXoNQpjdd8K3YSs+DAaP2qNn5IRaw7GVvi1nKs9WtBBvS8EfZgyIp1NX3Q3EIAZZQ xye6dgMnsAWjZ56JbhcQuqXYPaXm1ZR/2PySvbmdPgg34KcK99SyA2jS8hw1LNGvUzMYzi0fTXMWW n/CxziKhyWCYU/gAN420MAHYIcnnUQTNFeK0XHxvq7y4sFKBazJejC+j9lndQg3Ly22cS40goe8CF QlfbAbKEg++0gRyrxthg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxex-0000000GSlT-2tXe; Fri, 15 Mar 2024 02:51:03 +0000 Received: from mail-mw2nam12olkn20800.outbound.protection.outlook.com ([2a01:111:f403:2805::800] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxet-0000000GSjE-3FvA for linux-riscv@lists.infradead.org; Fri, 15 Mar 2024 02:51:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RnLkqy2OP0EI/fJoQzDlCS08QiK7yAFMoAlN0TNDsQtGWNL1T6cal2IlXztzxm95pK6yrNpll9h/ODy8DhPXkZGVbpQUT205pBtFH9WQ250f9lFqoHSx3u1CfE1dz5DXLMAqXHmmqWL9/+1I7srJHwS8aCxVTHuzEqMS8pcJRf1GH0ONSscBPFlyDLeqqeQEXROUqxDF7lvpnWU46WTeWsnn52L9JXhz3Bg2eVxLrPnDYEH/1RZN19JsBMmhulBW/r3ffHwthIFuCSxqklWQ6ZJTLPfTFltBRoNJQCN5txULL8L3yOkACngeLPMPQZfv3WW4aJ7FdAXaEbIWT8CTMQ== 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=6Y6biWoLFKWq0hm9lvtc9VvDK5jNTPCg1WF/TH/M2B4=; b=O/xKqembr3UdA7sNzQfuhomTxuUACRhRD95IfgeLP/S1zrlddueIDUeuJRwBH7lB6lvS65PfKf6+kg7wvm9gEyb4EzH61tJr/9Jtk0IE0CbUJ8CPC7lDnm7L8rpONaaSUT2qOm7AWsSeub5agSlgjGqXMfvKvWXRW6wQQXys2Dq8li3TGGyGYfzt/PNvtoO4pg0XXlvIttj5/+QXNK41OOz2I/ONhmjhAQ1xmtFMelgij48ECUWWkoKbtRCgjCXV9yza60jnrdF/4a3B2i+wnwsQvP9dNE3wpkl9fw/lReEPHeEmvqGiVa++YIpZen2gr6adPrqUNVkhaH+Do1woqA== 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=6Y6biWoLFKWq0hm9lvtc9VvDK5jNTPCg1WF/TH/M2B4=; b=OKqshR7+Q7gYNunNHYtKqPOsI+9m82Mv4jYlt1BGy/LVxyUVq0ygjWD2fuUEGd4pT0WNWnNfQn+nLmxdw+zsLnp3HQO47qpr1PYv91NvF3UXKpbIuoduKpZFNu2vMdFMD1lmDF8opfve/LTzxuN/DdUid++8d7xnUbrgOvkj7HtEN7cwBP4wfTjatoeIvNFpWtCmwZqrmiMuJnVuQ8hJ+0FcFpqdRv8mxyDw9p4nLe5r7rtQ/OkwG3hqO0Zqh/F/8lZItINvSnwVkGhhtVNlk4adpg8yLT+4PJ4g0RAy7X5QcqDeX5UGqre7hmiXJ9PG7iO52U1FyRkoR2G1p7SI+g== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DS7PR20MB6264.namprd20.prod.outlook.com (2603:10b6:8:ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.20; Fri, 15 Mar 2024 02:50:54 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041%3]) with mapi id 15.20.7386.021; Fri, 15 Mar 2024 02:50:54 +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, linux-riscv@lists.infradead.org, Rob Herring Subject: [PATCH v3 1/4] dt-bindings: dmaengine: Add dmamux for CV18XX/SG200X series SoC Date: Fri, 15 Mar 2024 10:50:32 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [P/3VFWK/Gi9d5MUPfvJr0NHkynog/V3mnx3Sk/kedRQ=] X-ClientProxiedBy: TYBP286CA0005.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:ce::17) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240315025036.554158-1-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DS7PR20MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: 3eac6f41-f7a0-4a06-34a4-08dc449abb73 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NfeI+o4/cFqe3PiCjV4PMVsNuiqDSPG7/HZSUMYECyeelurCXdSoP/1lpkOqgKp64ryr4IAWaC3jBbYjspKZYwSG/TLyZofsxYRWxYWzAvgN9kGZYaFk8o/5jYGKt7/UNxsxRutY3QbvzHHzUyfhzfKJHdc2qr5E2LwJBELSBNXgU8M8W/nc1qP/5eVukZUyDFNe5748Nn3eo9AKP/1BC4ce0QDxei5oVSdnQ8JciK0iUgWolQkGwTbxY3ZfRjLKbv1k2wTXrQCOdumqpPNxMeOZC3DRnXeTemPrfKoW0KZeVXaODvs4EPkYUyOoVgEFyhX9mevVnl5PozW6rnlKQXhBUdBGsb8B38LCXoCngJTmd0b6oBi9++QJ2t5gKErmtPTXiwNYAdTFpgFhRnXmtCBGK/L2NGWSZkrCum21Uzfa5XRxCSeOb9wGqKi3hZmO30HN0ncgmoXHp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rlqNrNN/QQ84+bxia2sLkYcNcseQVfhCJWBZAkA7e0mqSqONsuw4w+6ATO3yp76pewOAa5nGyzHpGJ8UW1DAcAW+FpUq7vPmWGOSPr5sIsx9e91m4GKVoElH7DaEE55RkAKG18efVNB9rpPXU5fz+AbNN9WKN3RDsceXQHGMQUjbU9hHUF1e4Dp4dumQNtS/x7eUEYilO5ZqEdP7cZNDSu8UggXxazNMtGbo1K8trvNS0ok0j5DdlP+WAULCW004/rGyz1aCoz3ySzMnDAYAxuMOaXve/tFesZodIShuLZIGGHnpYQEERug8v0KKjsHdB8g0yfpGHEAX1PqPewwnOfGHcO+SRQYWlnx8LAKicK4DZkX47jlJFrwiqeV7GGsY7mzNOZsssrm1lK6/ME2UgyPObOdiGVAeIzoIra30ga1p13zI0vnD3dEbkcriUZInAkasW4lm/j7qTXOFlW3znuUTKtFROYvKI1KZKpO8mCo9oA95bjk8AUjukSZUr+/zq6N8+jqEF2 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3eac6f41-f7a0-4a06-34a4-08dc449abb73 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2024 02:50:54.1578 (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: DS7PR20MB6264 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_195059_915022_93B50300 X-CRM114-Status: GOOD ( 11.58 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The DMA IP of Sophgo CV18XX/SG200X is based on a DW AXI CORE, with an additional channel remap register located in the top system control area. The DMA channel is exclusive to each core. 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.44.0 diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml new file mode 100644 index 000000000000..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 Fri Mar 15 02:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13593016 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12C31C54E60 for ; Fri, 15 Mar 2024 02:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z9DWhYa+E23iIuX+6SikJb0KjwZPsYjpp/v8gWtfVVE=; b=L58aUghk5b1/02 j/3Do/Z8VaNRsrFuEwnYDsRShf7kQbi+mD0HpJhCjQjy4HlFZUIUQMnHMAJqpZU6o7EHQEwcM1TVw RfFutqXlxTRyUuAEpeu+c0XniDrmQlNFVk5H6CgIzVTbHvowIHvyAIpT+rA3zN0zYMXFXom3z/Z2f xkdt/3ablmQ3cEjrQ2upJfLtTWLU9IcTB/65f2AtzUuKHkhM/otoIgtlt1V6qWRGkfJ9MF+xFQxDe j3VCndd+GMDO6pA3lvpImGhZroUs2/uJjbsaa763eRu1lynw2t8dyanLzuryBp1RB6P3XkCtUn7mk nQlur1budOp8qhCkjQKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxez-0000000GSm4-2BPw; Fri, 15 Mar 2024 02:51:07 +0000 Received: from mail-mw2nam12olkn20800.outbound.protection.outlook.com ([2a01:111:f403:2805::800] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxev-0000000GSjE-48G9 for linux-riscv@lists.infradead.org; Fri, 15 Mar 2024 02:51:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZFX6EveWp+QF8SlV189DlP5F6zQopD1byf/sTTOmcTbpl73ZmC7BNwED+gY5J6hv4Dje77tCCmv3JmH25Y2BXDlLrL9y/K5W77SKi20fpCN4gUBxVeM/DzlGqZLzItMwEbRSYSvlm0AAck6h6vg3QOXEGBmp1hkmpcBmz3Viz06t/F3FXB9SX+vGfXDl9dgw3D1loJp67apAbOr551U4F04bd5VeDw3Yfp/kSlilzbudTlWiHwnn2CiHXHGS3WoIHIqQxey6cBaVtZfTywUUfjr3jTMZc56FDzm3CnXChQg/pJT0P3H3aoOLdqKh23W8PQIh2lnUu5HMGrIgymP3g== 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=lQULpgMEwzJRKBmdrdqkQCcdIvdUj5m/Ron8MOI5Dec=; b=LfCTso1upJXiJLz5mIxJR5oBziH+JmQoDRJZnCmHCA280p7vJem6XQ6qmE8hXhnuxQbxD/mB/KSSRPWi6sLF8IgqHz5h5jiWPinKQIeplqshH+IWw+R70izkt18BuBMAkIy4QILIN5rjRMDv7X1PMtQ8+br5tmiD8XVNuMTkqzI0GwwPxqKseJD0c8gJ6B8uF8m/grvb5IGN1Gkzc4LIzLxBUnxUKrd4dter+ia1JlW3jyUO8WLcQ4EK2stRI7KnkwJ8bgdBRn/6Bxv2MH6oITJbso5gBl4lyRn7PX7vV8L6nIP0DvvD06cEx4Ydl3VixKGy2lIX5EZ8L08qTBx42A== 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=lQULpgMEwzJRKBmdrdqkQCcdIvdUj5m/Ron8MOI5Dec=; b=VfQMS+zqygfJl2jz5SmJddyMJU2sgvcqNXlNuBvkHFjybeh41oKhzTIT7Jd7SSSQgEIhIrE/4JQgm4jMZb4HgZjM3Fr0r8qHUVhVAvwMqL10iDtvy1bcNbs2s04Cpc3zxj7KMX4ExEtffcAmV00akOMOym4ggKgCvIfy3QLaLXWwcONIe3QA+m/fVekS1EVFwqxzRS92fq6hcX8OvsEEOoTpfyy3RNGO9a1xs7/x3BmNKFVowCDcZmLp57zjBSwVcdc8PMp1Y5l2QLISVYYTERO5ZPidVf5tiKS6CEAy3kvTpwaDVC2XGLKQwplk2i0JE99j12OaJeXZRUiJ4SAYqQ== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DS7PR20MB6264.namprd20.prod.outlook.com (2603:10b6:8:ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.20; Fri, 15 Mar 2024 02:50:58 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041%3]) with mapi id 15.20.7386.021; Fri, 15 Mar 2024 02:50:58 +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, linux-riscv@lists.infradead.org Subject: [PATCH v3 2/4] dt-bindings: soc: sophgo: Add top misc controller of CV18XX/SG200X series SoC Date: Fri, 15 Mar 2024 10:50:33 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [VNSnH8/L+DFnRInjFmPUEduzpznzPjqo/1JnUS7e/A8=] X-ClientProxiedBy: TYCP286CA0090.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b3::19) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240315025036.554158-2-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DS7PR20MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: b8deeb4f-cd9b-4e61-8afd-08dc449abe23 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fIKJIKgz6UZit/QnWfOuwDF6ex9Lkl9utBlxZD861FlwoQqQUGcItI5p0UnwboyOZpBd3CS50GPgOZwBnCmpwZ9nV1xShmsRgQ00bUsf2VTMy66Gdtzxc6h9YMoNKzO/IQGV+9kOPx2ezg20CR10YNUUFmLR3YA6fXCItnpeJgoO23HWbOqqhyBPKuCSsrFNGHGo86vuzIUeENg+rjs8ZWL2zaUkeo0N6D2yfKXGoG+8rfZm09AT3ynV1OAdMjNSa+vwG6drMBnCccbobTnfxLF+UVgcu5ya6fNyV1/6KMQP30PSxkHdyX8EwCHWliPDh/1SuLP2D2mv9UoPzVHs2ZtSEjEJDL6lubZbqsRpFcJX7giNcE8HcKjWjBQG2IQIBSHK/hxeFvcv866RJPT+7DnYn91JJBpMy6jqYp9YqzZuGov2Lqb6PxWLKWloOpYktfSZC2W4s8OoWOraDm+Zn06fMI4kM2zOGOQ1VqZBwNbu35YSdqQOR9Ut4+R4422hB2pB2ffhs1xu65PtR04sPMSbiNPCutmEzRdX6d8W4FByeH2qZ4DQlBJncI1yrXxLTIZAP8VV3Cf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OBq2K8VC0M1Eh9Z7XP6yIcUo86U+zKBoeitccfGcHik4K3z0aQH+P4tkpxZoFYVSH2hTYU+WagpGazKiFYYSlO39Dul4DCyY+vjZIOC727UR7LMEdiNdSGlWvyaNJIO6Nzdrur3EPuJ/qYmBq+2ErExJsxQuI24+bCrsj63oUz9VVelImtN0VXVADehkkgIk9i3YTrAay4CP7InzF0Y41WAM/7661v2I+3LQH4C286SWcdL+ZqWz45Pb6e4Q8uk9JtwmdN77qC1PLBafpBwSAsf2E91hozFE5xvHbLLTjKqD4SbCvFi3B7Y1poVp7ARw4riD6EWaiNG3iIhp3Qwq8L9+1C+gV/RTlk0NHIKneZcRHdSWRj00gbq7abM+pckhadahMmXVkvIufUVyeXPuQH5 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8deeb4f-cd9b-4e61-8afd-08dc449abe23 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2024 02:50:58.8275 (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: DS7PR20MB6264 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_195102_120182_C2402F57 X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800-top-syscon.yaml -- 2.44.0 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..a78cc8f5a84c --- /dev/null +++ b/Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800-top-syscon.yaml @@ -0,0 +1,49 @@ +# 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@154 { + compatible = "sophgo,cv1800-dmamux"; + reg = <0x154 0x8>, <0x298 0x4>; + #dma-cells = <3>; + dma-masters = <&dmac>; + dma-requests = <8>; + }; + }; + +... From patchwork Fri Mar 15 02:50:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13593017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C848C54E60 for ; Fri, 15 Mar 2024 02:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hrlfC9uFm11nz+V9fw983aHVE3FKpwFpfCglJUMO/rY=; b=Qri65CsZ0Dmf/B gSk9mJsXSUzUo79VtfXPwb2iUxRKbTnBk9YdmFj3UWaePUoEmxl8zvuhI6kKwWDsiKYuOxfm2YFGu UPfk4rw2i4Y3Eu5MYOUUF3nnOIU6rb54ID6O/h82KEO3Q+XZEMTqLjaOFUmNGveR9oe/sKBY+RQE0 XJH7iqBB7fEjjegYBUY5M1QMJWscJdmMsIlB+FvmHi522pUXxkS05770YverbBrXcK67tTQFP4F8S L09vA72WtpD0TULUJc9/PpSYOtsID20vEC+17kd25GbA6vv7zUQNbSyUY9ZQSkVncVtD+EntZ1JJX cTZNmXJsE88thf8QTErw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxf4-0000000GSom-14F1; Fri, 15 Mar 2024 02:51:10 +0000 Received: from mail-mw2nam12olkn20801.outbound.protection.outlook.com ([2a01:111:f403:2805::801] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxf0-0000000GSly-45A2 for linux-riscv@lists.infradead.org; Fri, 15 Mar 2024 02:51:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f1klhx/SSOz2MuY80l3I4YvSyCItrOLMD/X8bnEe1S1SlhosPkZ/Bts7kWdBYa5iKeP2yMTUyU4f4td0n5Y3ckMIsFCWBL1T3mOri3wD48U/aCseIv0Vpj+hEfNkiw96ei+9UJxrIoT0Y1zmpAvuBb2QqoCFdQeaN6o5KbOiss39jLnDuxfkf9BqwgO/wQdDUE0YHOCBHtsrkT+Z0HWU/FiVZ8x12+YKdPacGdTFmJrwCFK8fa1W2c2mj8lhafBO3Gvv3qaMSO5C5qF0Ug0CfwMUHFCpdskWOVLf2WOS1QqEa9jy2LPfTeNAtsFwM2z0o2m0osVE+EJP5jFmWey0Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kS0KlR6sMzZ54c2Mbq9eCPI0GiPAwbDVfnXhdu/XLI8=; b=N7ADzfejAjhxuQ+BPbG85DwtdZovxVwaXMAzF3pdy4ikyngIuzUHZsa8aMVUX2boAFOzlWd9Vik6K95J7nkwVqkn/XuP9Nb/FnzWkHirgEp5StbM+rNxyFN40ng7PRJE1G2rDadx3C4ShyEYGf+qCPyuGZGiOYUwNMXEiqC+r68UoVOXPRS0xz0pbk5k4iKbuGUUINW6k5xT+BhxOH6jxOA9J5NdT29Rp9E8ZgLNheWowHb+RPFSKjUINEh3+Y13BV6bOlYP2Rk3/66xxDPEfyIUgItPzjF08Qo9Zk7hUiQG7HSGzmnuAuEZbj5yXxPsNy1FMbDffKOGrYWlUsdRSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kS0KlR6sMzZ54c2Mbq9eCPI0GiPAwbDVfnXhdu/XLI8=; b=NzSto0ERLwJQdWFeFgFrg+QHPCmAsuCk+ktqPTaHyndD+4V+JHYBzi73Mnxl8BOk5KKi7bqUYIinf6RfzVKGLuuggjsAJDjhmsJiCEpPDrEUngx9Ogo48MOD5HbbL12UFcStDU7Uzbt2BgodN0+BypOlYBk7PuzzaBoUegenfH15Y5J+89uVDQTBQC6CLP/DMw2GLMflQeQRtPkxhXaSULur8FaIIdH4ZYcTYOitBuR89ZJIg4e+Byy7pYjzZO0DbDw1mtBi/Xh8fmWrRdbAnXgY6XwSNh6xVvea42tMGKHn+4zb4Y1y/Dh+RwFEbGdXB3wAf/Me5bYX+VEpXEnzSw== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DS7PR20MB6264.namprd20.prod.outlook.com (2603:10b6:8:ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.20; Fri, 15 Mar 2024 02:51:03 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041%3]) with mapi id 15.20.7386.021; Fri, 15 Mar 2024 02:51: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, linux-riscv@lists.infradead.org Subject: [PATCH v3 3/4] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Fri, 15 Mar 2024 10:50:34 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [tZRzF+14o1BP4nOiHH1IWg2XL7ZldA7VnTkbvSdDJnY=] X-ClientProxiedBy: TYCPR01CA0022.jpnprd01.prod.outlook.com (2603:1096:405::34) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240315025036.554158-3-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DS7PR20MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: 9332383c-7bfe-47e1-e999-08dc449ac0f8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eo5BMaIAwcj30EikZ7mfFvWkzikQaKQa/9yLe4GRvvyFkvd0tpCJAXA3RvZYKBLOEw8x+1jW/6ZGpx24UR92oRd0Lx+aZHTCTIPsMwOkbICf56tNwU+EgrsOzCn9h8IHZF8Y5BFPaRqG8rVsp50i/u522A/Fog6RG6+sdcNHC50xnzN9CaNz2plL484/tVpFjU5KcJtZWRqClSCT2S4g3JC3/m97CgGV7eM0KFHYlhFT7DotIBJg387A+6Jbvv9RaUrXaph7BndkNzFElmvMTUeDx5qW5feJHx7Rq2+zRRVLjYvOZyWs6irCQhiT66QgslkP/v/0QDSCAcO2OAPspTUJxlIPKkqcJVl0n4mrc+SXecSAGFDIS6r5SH9yCyT7eAslPx4fO3p1xHA41xbNxmlgdKVnNVHpRrCY5UFhAgytDBjWO60uZyFJkNMc//cDyc9gEEwaYw/I3WLhvRI2X+cuFvVb5ygt36ilNPzeY1jcHjXc2RI45qeW8LgEgi7EZUpa+NOF78MLys9xJnKE0FaCpQ/hbm7cVorx1XTZ9+lnsWhq2cKtCPErF0a6ICPB817rabBhfIWsTwEbPnOnIaQPBWDPztKaMhZq/JrwOX7bf+uJTtxagxYpRCCdAE/2 X-MS-Exchange-AntiSpam-MessageData-ChunkC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ibJiM/0s8Iv93tUbMeousLo9dlBEVlq+3aO59/2lzKC1wcXz2aV7nkfutKcYxvFRQoEjtN2JGFoC7fxKtVu8upcTTehnZi9hbKn4edOHkluq6dkedQs3vJAEfI+6CPCxkjG5F508ahThSUDAV1b1q9RVfzBLygLgpnrx20MHG95eKn/7OtvjYmlbye57nDLDOCPClgQ+XQcLNImEpyavOhrejUOk7Sw2SuOp9 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9332383c-7bfe-47e1-e999-08dc449ac0f8 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2024 02:51:03.4352 (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: DS7PR20MB6264 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_195107_193361_BBAAFCD7 X-CRM114-Status: UNSURE ( 8.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The "top" system controller of CV18XX/SG200X exposes control register access for various devices. Add soc header file to describe it. Signed-off-by: Inochi Amaoto --- include/soc/sophgo/cv1800-sysctl.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/soc/sophgo/cv1800-sysctl.h -- 2.44.0 diff --git a/include/soc/sophgo/cv1800-sysctl.h b/include/soc/sophgo/cv1800-sysctl.h new file mode 100644 index 000000000000..b9396d33e240 --- /dev/null +++ b/include/soc/sophgo/cv1800-sysctl.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2023 Inochi Amaoto + */ + +#ifndef CV1800_SYSCTL_H +#define CV1800_SYSCTL_H + +/* + * SOPHGO CV1800/SG2000 SoC top system controller registers offsets. + */ + +#define CV1800_CONF_INFO 0x004 +#define CV1800_SYS_CTRL_REG 0x008 +#define CV1800_USB_PHY_CTRL_REG 0x048 +#define CV1800_SDMA_DMA_CHANNEL_REMAP0 0x154 +#define CV1800_SDMA_DMA_CHANNEL_REMAP1 0x158 +#define CV1800_TOP_TIMER_CLK_SEL 0x1a0 +#define CV1800_TOP_WDT_CTRL 0x1a8 +#define CV1800_DDR_AXI_URGENT_OW 0x1b8 +#define CV1800_DDR_AXI_URGENT 0x1bc +#define CV1800_DDR_AXI_QOS_0 0x1d8 +#define CV1800_DDR_AXI_QOS_1 0x1dc +#define CV1800_SD_PWRSW_CTRL 0x1f4 +#define CV1800_SD_PWRSW_TIME 0x1f8 +#define CV1800_DDR_AXI_QOS_OW 0x23c +#define CV1800_SD_CTRL_OPT 0x294 +#define CV1800_SDMA_DMA_INT_MUX 0x298 + +#endif // CV1800_SYSCTL_H From patchwork Fri Mar 15 02:50:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13593018 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52C3AC54E5D for ; Fri, 15 Mar 2024 02:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8U63jX1S2aTy6miRNfYGdn5T34i02oo4hLTI+UYU0js=; b=lM1J1wAoX0qymz qV97T95V7PkszCazzs8xg5r7we56wOotQf2wnh46ZByzfKOZh6n35o6fN62eel34qQjxIX9wKeIbv 6g1EaynV4tHceCN6QHjRf+M6BEah2lewowCYM8yfhoOBYsDAYbjS8ZJwSIIoD/tEu9MKq3Wh9jaz5 OU+wt/WbEZfldtqQ/wQ9qlKx2VBaNu+ZYuMpyfRhqlzeHeSqqbEsJLNITFRiVA4sa+AsUpDmFVUiH JDfc/zc8gz/nD2qtwTY0sWzvkMyOBCaulRvUANiT67C3Wk4yRyjWUw0fmJSvtete99ChZq7VG+LkC d3tmhqXgxHZlkYWob91A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxfA-0000000GSsO-22II; Fri, 15 Mar 2024 02:51:16 +0000 Received: from mail-mw2nam12olkn20801.outbound.protection.outlook.com ([2a01:111:f403:2805::801] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkxf5-0000000GSpK-1ZhL for linux-riscv@lists.infradead.org; Fri, 15 Mar 2024 02:51:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BWwd6VMRe6ybFwm2mKhKvwX+4SKMZv2yfv1ebyG5RPccb2QcQrwcVtB+Um1KeIOoKnhMoC9AM5U/30/s3r+dN0ztDtVrAJKlAldm8VtJ9DLap3f8gfMoyjS1E/eiRt99JaAd9ukeefxPuz+eziKTyzP2UOkqNMy94nFqlbQS1SeUZVjBpPlJOA2OaQtyFUKREHYDkEidE4bFa9VEILVqCEyQHRwvXuHl9v9IuFUA9kGOngDcqQIZVe1XHCKKImn2AdGYOzyloX6rqqrI0y/IIOmzFc01IZQt0yieQsvXMqACeoB6kD4J0E3MK+bdwZtzOvSp+wHTEWQvCMiOC/yNdg== 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=VnWIaekvWfIQHaZcJpQ7RUb/6XvShLmgknIWz1YlPKE=; b=gmT10AQKYczhTMoh+oOHUr8JphHiYZ4by+G//CeBh/X6hK7zasTZ50cYVVcbK4Og7T4bg7Hjh/SFA2fdG63L3JjMxqPmvqjbWggarX83CWl86S0zsQLQgP48A/PcpL4w14/JVBkFJRwCNl7rA/kXVeYILA9vVQ5MjjABQTx+KETYNrfL/ytIMvl2tnfcEF73jCsFF63TrUH4OQXRMQPgg1HLbG1H+dLbDfBtCx4L0UfxE/1pQz0b6kwc5/tKvQF3KkKS1EyvwmInFa/Qfpj29n2Vok7KYxOMnqN+JjhFAMOV7lNZYeX0gDw8Gb8U7D7EPp/AcwxDo0DO5CVAR4rk+Q== 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=VnWIaekvWfIQHaZcJpQ7RUb/6XvShLmgknIWz1YlPKE=; b=o/lpHBiuYoE/q1rItdk3gzUOQ1NCqMtb7KaMzylfZkVWL661y9TW9Zes81RZOA2SjEYAnoorCABRnV4MFaFmK0AiR3bH7OtN1aLhGBKx0OvabztQVzvBhUI7wQTD8Y13Y8vA34EkGARgX67UxX1JlT3SZ7yQ17S0NHQxwb24eIc6KbyRucmAMaYQ2Gh2LtMX8wyeGaPW7po04rTPz2zlBITh/4m4M8kZ8EAJXf+El1tuMAfMqVPY0OZ5cmdWbncHviSyOon4vJJf84T7sF9fXjsv6pPIwPiJpTXwPNBPl/pRGsq7mf+Kk1KRzZO/Xc1Os+FtDJ6XA3va3Tfc6hikxA== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DS7PR20MB6264.namprd20.prod.outlook.com (2603:10b6:8:ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.20; Fri, 15 Mar 2024 02:51:08 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::8615:efe2:7c8e:2041%3]) with mapi id 15.20.7386.021; Fri, 15 Mar 2024 02:51:08 +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, linux-riscv@lists.infradead.org Subject: [PATCH v3 4/4] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Fri, 15 Mar 2024 10:50:35 +0800 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-TMN: [qB1A89wk1cXXIqOH9v26pP5/Sv3BKJazopYi3bwYNRI=] X-ClientProxiedBy: TYCP286CA0088.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b3::20) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240315025036.554158-4-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DS7PR20MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: aa1379ac-c81b-4e98-8a04-08dc449ac3bb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tr33UT7UwOVNZt2d82b5D6uX/COpEk5W4ykbF4lVD/G3elvB4M+Z7uP2mquR2p7gmvgbaY57ukqjWWfzsZ0qO6mmlhfsTe9In3G6+25HCV4wdlZpvCNVfsQA/QwPaAYAfpT2vT3SATIgxa8CbQ5Kzn/2IiPsncs98idikJVKhCuBCBFc3xavkGbMwsdXNCMrpTiSsjrFhAsknjfXYIuvWBtDk7bo989mCvDo3kB/SVuGxeXn/sGtwBfux3XgYJLo/OCJjDD2WH/eq2TXgwpWktUtOnu+MT6tU6WjluAGXF1dbStPdJ4g/5ATmt/vKzslRQ2rwZ4WHtKpnnoOhSfsJzI9ZLaTt/vxqc6lPF4TecQhvIThEwuln9rafwMjV+KBsamhBu/ISHbEtVaaja2qUvoL9C7HlXe85ekzl1vDIQbwvZljwByQICGEEA3LfFuEyHSe4qG+pIe+ViPITfgWIEmhvPeAfEPNYVVtyN1Te+yRNXpQa4bvW6rZoJtK8e8QsF9WfKNU4NhLthHQ8hIgt3FuT11WBVWkDdk0HZxF04gp8ejasjYBxEpf6cgrfiXhMPR26+eqqXKMzb/j/XAaebkoOcatHSVSCm+f24zBgqqsWh+tKQVBdC+jVgmzhfY3 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iJFaR+K8bXzoRptYjbdR7MY86DIrCl44zSZGh1mFBpkFDCBYQoPq8r66GTyyhYrTepQJDTkWU9C6zvivTUj5Eg4oAgYJPzkfQn3Kgx40h+c5/egYKV/kJnm8gB9yfYjLk1lYxlBXNYX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Eue0WD/uqL2PYfG8Gd8BslL8AOCduJ1Znv2n8GkqDbE8aElyhFmeLQU8 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa1379ac-c81b-4e98-8a04-08dc449ac3bb X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2024 02:51:08.1757 (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: DS7PR20MB6264 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_195111_743994_7B4165CD X-CRM114-Status: GOOD ( 19.39 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Sophgo CV18XX/SG200X use DW AXI CORE with a multiplexer for remapping its request lines. The multiplexer supports at most 8 request lines. Add driver for Sophgo CV18XX/SG200X DMA multiplexer. Signed-off-by: Inochi Amaoto --- drivers/dma/Kconfig | 9 ++ drivers/dma/Makefile | 1 + drivers/dma/cv1800-dmamux.c | 232 ++++++++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 drivers/dma/cv1800-dmamux.c -- 2.44.0 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");