From patchwork Tue Aug 27 06:49:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13778986 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 9D943C5320E for ; Tue, 27 Aug 2024 06:50:58 +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=i6Wn1HnqtnyrN4vHFF5mDB3gHz6LyT7HXJ6eMi/Vj04=; b=V0Q2FL4m6Jjr9z HqqT/sgchJBGwA96n91VX5ung0mWgT1jE7mAaYUw8xuXNLGCDHzbHFYpDnlduAgJunbDp2RDoPQm2 tqW1biwW0EIlarZqdES2xUVQkEQcn/0OCXacUMROK2+Oayfo3EV5psW6t+kXg35ZAFa9MZenmyWGQ 8Df9VEzXmwDURgBhJfm83EavMLKHlJ14uHWBlP5NjH7FgE3RBI0qU+odttEfdvvx71A6E2XjU37cm 4Pas3aLR3BzQ/coczR6Cvb+grU9EyqehWKgQ4swZzO6uj7ut0gXhIOVYgtmFsycvL65bf5RTjrHIz g3KCgrEL2uvIEdO2pUyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siq2Y-0000000A5pt-3WlW; Tue, 27 Aug 2024 06:50:54 +0000 Received: from mail-dm6nam12olkn2081a.outbound.protection.outlook.com ([2a01:111:f403:2c17::81a] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siq2V-0000000A5mx-2LfO for linux-riscv@lists.infradead.org; Tue, 27 Aug 2024 06:50:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wspq1yI1ekDRhP+bXWMUIY5Z1aR4xs0mLOnUBtVvauch7rLGiNehg/xRQ06cxYxOSp5pSXDHJLrlakXKDDcQBahDkiue3Uf+TveRvfBEBO5Txly2yzbH0pMFnD8VHtkp+CWDCkuuGFMH82TH0Ze3/gRxGbUYI/leGjKyICHtpm2NVxQj2oR2SE9sA+e3fdLljF5HS4JtsHpF++RUcSteD3MFLtF9NLQMCZsXkpmRFZZj2es0QAqBi/v4kFiEmjMLBroJDhY9OvMmlxOl8BNDwyLGnoPe9tkL1CHBhkYAe7kGMpeJXPY3lRlc7fJUXLPPlHbx9lEScNp2zzUJF/Rpyw== 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=odGUw6TQxCZH1ppD8faEmD9SkHZWFu7bl0uSM+oAuE8=; b=dFmsFwtgwolQhMGlSQvaS0ygSGq5c4ybjB53YJGB8sRMNDMlXJfz2wcLU51y/G06biX5bxTkPsyPRqqnI3IVcTvbb9sf7BWHsj1tC+WRrCBdS8dGffcRJAImFi2rO2oRmeJEOdvGpJGbTae8m6orh4sjdlvwcsYxk/gy81Er6nblqxpnMeP4o2kxMxPtON64PGSNf9C0TOdup1F6iuC9kv0vSg1qkQl6ZcH7ERPYlPG28j7iulvRsxMrTXcuJBKXCCC0JBo2UBJJqjeE26auBOYysjHpSZ1hnV0HGddbHXZuiotHYTzA2b4fAw5/2VJXubsQzs+60dgjPml2Vp+Wug== 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=odGUw6TQxCZH1ppD8faEmD9SkHZWFu7bl0uSM+oAuE8=; b=JR4v7PLCrIYNebCP9qRq9QJp10PdGLuVjtImhphTWLxIkSJgEktD79PicqrdHS2ayXgnJSJ7cTu5Mo0qLtuJomWdNaRWlu6OUg8gvV1ix/VVnJf37513u53l3kFhDlnNUteeUkRR4IQZN4vmFQfyHk8bHsuMqqF6wMJQn+BwwS/o+2LoJgAraPwbsOWuNym8sl22WcAP16lncx+Vu8z4v+4mu+tNjdvT92dwpCBCPHKF5uEctymkOkbBdiWuzRXsT5yjgPWI034I0p+PwoSpDnGtcu9ue+BkFxCQXZjZXxImERLbapD0gD9w4C+BuOmkS6wDD1STixd+mMmGTE80HA== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DM3PR20MB6939.namprd20.prod.outlook.com (2603:10b6:0:42::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 06:50:45 +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.7897.021; Tue, 27 Aug 2024 06:50:45 +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, Conor Dooley Subject: [PATCH v12 1/3] dt-bindings: dmaengine: Add dma multiplexer for CV18XX/SG200X series SoC Date: Tue, 27 Aug 2024 14:49:41 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-TMN: [fe+b2hhLiKur94uz0G+heUNWBeii8B+T8Qgr3sxU6cw=] X-ClientProxiedBy: TYCP301CA0086.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::12) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240827064944.740024-1-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DM3PR20MB6939:EE_ X-MS-Office365-Filtering-Correlation-Id: f3bcb4e3-8685-4a50-4b20-08dcc664933d X-Microsoft-Antispam: BCL:0;ARA:14566002|15080799006|5072599009|19110799003|8060799006|461199028|1602099012|3412199025|440099028|4302099013|1710799026; X-Microsoft-Antispam-Message-Info: oVJGS+EWGlb2tRGfGtE4PyY0Y/v43LYOYWQU1IZXlJQfVVOCwNgRSeK5b0ssQJNpHtJWQw7IPGWU69s0N55m/Hq76G2MC9YsFmXQTFT0qgW51aw6mp59EwW5xHILbNcW9N8VJG5rpQNUk0BkqxL8NP2b9ruaJXoBOy8o6mg6U5QkHToX0vrWAG31Huj1z3uYXncWZ3llePMC1jZjZVXAD1Bmw2gGn2q7ITRgMDTdvONa1EKxoMdmPmX6x7nr6QVwvcuPuXUUuMUrdoR8j7w4ie8CPJ3BOpfj7IO6Z2FK/CJYgx8U2oYJ3LhkrZpbNRRYwvpgm/WRBx56aWQ/l7OrVdmoD89qg8laMWVNQiMYwH3lBnD2ZsHhNoQVv7vMeCRJmZknJBvtmB8nt1N9oHZ8S9ZF2iGkaf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FzijZdhHowkLU6Kb3ZMCxkYLh0OPNpyQ7usMH6XATaoYeh7ArJRjDPNxN5szLvm0hdZI1envTPB6JvIx3QkKSrTzjvWkvG8s6Go/uAojz01ueFy8oyxl4kIyEe4Og9TGj8ttf6PyWpsXjIDwRT302sM0VITC0q1AQg4O6D44LRfZzHHYUgXp2zvWDWRbhiqqzwwPqcAkPhrT0vBrhFDxJLjKLN8GQGCRKgMatR/QZ0a1KkA4wrTQ47LbEkPzMxbwmuVECYB/hkQJG8y2a41VEeeopWU+ymNEjzi2EoYHc9umX434JJL5k16V1IHVgBXwj3wL5wV0X0N54jwHuZFj2yqngRWziFln6q9rGHGXlUbL6JqgABs4S+ijuZVOqVGMnZ4xQXMR0+hu/CZmOmQBWNBbbT2rwWJ245++diZz69DZnK2+/6SQP30YX20f6RV627pEZ7wGBzMaTFP3hO5Gh0hO5N4hBx0mmzcymUMbSq9JNYdxkxy8NuGuh8Uh9XOyTYQ3nW0E7SMn9WiJbycn35IbGmm0H7FryeCijDzg41d/lujvgqu8Q3oP+6bZ6i+lZ/sgyVfHliFlPyKKbKanHTEcKKnc5SBrXiGGwPu+J2z4t7lAROMHXufIw6kEm/3En/zjYXwNp/eDTMbQrvB2OQpfARZljiOt/ecv7D37tsEfaMINGi2vZ85R12/pO8J7A3MqZre X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3bcb4e3-8685-4a50-4b20-08dcc664933d X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 06:50:45.1363 (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: DM3PR20MB6939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_235051_630522_007EA8DF X-CRM114-Status: GOOD ( 11.90 ) 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. 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 Reviewed-by: Conor Dooley --- .../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..e444ac2cc9a2 --- /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,cv1800b-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 Tue Aug 27 06:49:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13778987 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 2A46CC52D6F for ; Tue, 27 Aug 2024 06:51:00 +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=nPJsdqN2rjPdnhep7a666R2OCsC/aJUOTunwXI3u1RQ=; b=Rcr+Tbm25meImJ XXFMmlgngHyYNtyZeB/7+ZB61qH5Joum+wJ/lioCA0X+pxvU5QAGOpLcZ1Jag34uXEFOlSF9SlRjS 35IkdUKrrL5LN3Dfurc1pFwr+kIwPd3VTgfaSFnJpTgxLJ9czJR9z+nlfB7vzxHy9EtxshdshWvwl IxP5RSfqv6n3/6sA2VSrOFPYFtAxs8QGYS3fwS1AV1996HbgkJyTnEogkBL5xRhQQUFXUReEBeKM6 Fop/xmgTKQL9OAWHsJr3lnNssPfBntYqIuRnSOi0INo4o2aQCeammWhSS3qTT7rTUZXbHjPiLD/Hq p1D2hFYE5Furw+QnL8cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siq2b-0000000A5rd-1srx; Tue, 27 Aug 2024 06:50:57 +0000 Received: from mail-dm6nam12olkn2081a.outbound.protection.outlook.com ([2a01:111:f403:2c17::81a] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siq2X-0000000A5mx-0kJf for linux-riscv@lists.infradead.org; Tue, 27 Aug 2024 06:50:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xNzpyHIboeTYkE1v3UfZWZhofGrmAdOwmBIKYuZ3/nfrOefvEnFu8EnK6qW2wtlLjnlOZ0lSIpFK3xl2eTQsQ03xQCKEhXr6CJglO3PddLwdY1zEwvWq8ipjrrti274pTzERnw2DChSNE9Ndn9JhGxNxLIhzAghtMZRlw47RdtjFhy8KzZ6e/zw+POq1ZNc5xIG7251v5JITuIp5Y6xiPBeM6atCECmzLv05bJKtOnnPoHTLRLh4p+sWulvTzIJPlKH5fqJSRP1EdBd66jGJvnGZwCyQA137aKP9BhnHJBp3f2kNRXnSyEwYmJ7jaSfIP6jMttjKGVN2z563CIBmSA== 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=eSyGw6TkiOoOadCkh3Z3yjzv+o/yXcadNtEQNYBcT2vkriuajqMeqjlE5IPunkW/hEjHakvBRWVMvB8dfC0959b9DiSw+eSrGmQ+kDQecHwoQDRgRvbbxX+LZLJeksGTwnZgN5rstxIm3WpPRfUa3YYBmzSD6/7gax8WT2RZyTvLmxa+dIPA0A6Sd659+aqBefrEutz/ysb2z6HKMZruQwXtYWNWhYgRB+QpAeAyrLkEp3PciuAG0YRjdMerDHdVIU+2qO3wiPb9EefqvrkPYFW6z0RUMuI3pR2ycID7rKj7urC5Dt2MM/U1E6Lk4r8OWb2+KaHO9M2CNM7nK11Pag== 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=m6IizeQiFg99WGGd1B+FZrAzwTn1KdjhuBlf960eQB3FyfcjLNd22ko5PlykntabaneuJ8j7iW4gED6oI7+fMHaUyf1iJ0JSzaWhf889P1ZRZj3+LRaBjcfeq6H86K12dPs/rXCXIVYaiaZIxapA1ybZDZcsfvw9H7+f1/W9AUQ64gewYRHzJvE/xzCjM4CpHv/kzyzdc6FJjJbT8VvwabZsjmcMAfbAiscA3bnwV3GTRN0/dknNUV0lePwNMfarXufj+ExUlpY2odlBTtehF/JySHGY9KO58hujxr5bYqfXiYR9yUe4PTowMxc/QeF+TM/oSnWVvG2/jBiRwtlk3g== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DM3PR20MB6939.namprd20.prod.outlook.com (2603:10b6:0:42::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 06:50: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.7897.021; Tue, 27 Aug 2024 06:50:49 +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 v12 2/3] soc/sophgo: add top sysctrl layout file for CV18XX/SG200X Date: Tue, 27 Aug 2024 14:49:42 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-TMN: [wIfSYb+ThmSKJJNOoTEPRYYwzSxIihBFDd9afcB5b94=] X-ClientProxiedBy: TYCP301CA0076.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::10) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240827064944.740024-2-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DM3PR20MB6939:EE_ X-MS-Office365-Filtering-Correlation-Id: 219deba5-6367-4799-d48f-08dcc6649602 X-Microsoft-Antispam: BCL:0;ARA:14566002|15080799006|5072599009|19110799003|8060799006|461199028|3412199025|440099028|1710799026; X-Microsoft-Antispam-Message-Info: KRYKtmo8UWbmf/McumOA4ptllQsipcITj6ZjcBSeofCAFGyjFBs28aIg1GA/JA3kJRmkbNwHL9WSdxCTCDhf/9tW5b6DSzLp7MRwM3fSeL6Y+Jfn1qnr/Vr/1iImrCUCD/iQ67oV2W5Moyf0FmkG3EAz1IPvvHTFxD8/VAA93QiquMLPMLeAXkRg1C1aZfAwqisEdm6UKIc1R2db5tctvScHniQGQCDH7nnPq/LHv/nmaGdeRPh+jp160Hmv9kzhZC5aFznnsz1PNz+ZskOQ87f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qSldafEXpBF33iOeE94pUpoSZM5WYHFKIszzGv/8UKunEX05SvI8kkC1I85zeP4eorznyFVR49+oFVRQRPzmZDHyy6u71lC6afI5NYWAjFE/ex3hx9yDQCHApc/LbVKLtcgdLPh1D4LeUsQ64otM1yun9E7rBOGF3UqTbBwJOi+GSul+tGyUUMbzLi9DhlELNon71VYWTW5BJO3+yyw28yCLxxwKlKHHxbX5g0ISU8AV1DafWyTW0MafcKmTkHH0B8LSDhe8BH7mbe4HMlRdT7G/8vaf4lCe0KWlLsCVg3fUBjC8Jhq7Ik9Pbj1BrqyTJeEcVwY9+H9bLHwG6A12iZrN7vLe10JGl3YVduvtb0cL+bKP7cQFAPfsw27WIu6lMkyPRxf3G5N14+rwlHEPf47l1iS7LlVRpyXAQWmxswB67jlBZ7uCBBzMOFjSGoNYI4Kg8pVgp5DRpcege6QNKn4he9T9+4kHn3FXemJwuuJjh0tJrDPDxky9w13Ol0wpPC8Z2x3D7DgFctJygh0xjzIJ7fs14H44nTH5pWj67bQOOX+LbiH1I/7fcatdBv7lb6Tl7sczFeO5RDyDWn1xBy4mRQq6qXXKKszOl66RFJiMaabpaaCaajP3qRhyf5M/N5CgiQKUk/ZwoHAz+g1+vHCyycQwXEslwZ5gp48HV6gWR4lgjBJrUHkFSmYJC63ZMxwXWkU92oUHIMREzI8V0A1DXm X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 219deba5-6367-4799-d48f-08dcc6649602 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 06:50:49.7328 (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: DM3PR20MB6939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_235053_241876_C874AB4D X-CRM114-Status: UNSURE ( 9.24 ) 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 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 Aug 27 06:49:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13778988 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 5ED36C52D6F for ; Tue, 27 Aug 2024 06:51:05 +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=ZER7Q0g9UNcqKJ0YYjRdc07Y+CB8hvjNhhe2WwKuKSw=; b=i/or/yjdK/mGnh +RHC1lDuOn9r7LlkuB8pd0OoWmiVQ2ypmGegJ/2bG+bvUz7YdLo4JZYkoOuQnqvcW/nIKLLZuYu9J 9wDYEkEkiTYaqBnWMQgAJPmBaW0QifDnCEpUdZOwmtZIw6IvYJ1lr+gjc3hbIkxtmpOndwV86wMNS Rz3sQ+CYIkv6t6adv0FnI/8Fk9sQ0DJXqjx187+pBIqjSNED2zZrWRc0moYviCLERRHn9YA60CN7q mVSUx4BMMXbpSZdRMXJTTL+5HFEPhxhAZb8VC4PyxSL0WavDdzxSO+lnC+c2HVu2kDPFgD9MLDAoS ySS9kWr8qCubobZmggYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siq2g-0000000A5w2-1ve5; Tue, 27 Aug 2024 06:51:02 +0000 Received: from mail-dm6nam12olkn20823.outbound.protection.outlook.com ([2a01:111:f403:2c17::823] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siq2c-0000000A5sE-3FAp for linux-riscv@lists.infradead.org; Tue, 27 Aug 2024 06:51:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oXBxcAkv4UOf8GkCCl8gM1Klg4GPWQa/sgUNeunRRpe3jLJgNcpFzTIz50KL0kBsdq1IpyOOc3QOpw0nBWf5c+BtcCJGL3SAJSv/2YVfiJYRXkSi/SM+szlTZfGq/Sgxrb+COTsIJx6LNdRhjaiDeIFBHE2k8Ssd0IVcMR2S/qzIBcfb2HyE1JHMW/w1PKIiDH61CBO8IMoVGSjlEoHf4ZneB7fSQk0a6BSohcwqteUN40KxT7+ANCyi2yS7K5e8lbaaoGcyrJk5mppYOza4Sr5S4JXguWizhqw/K/1DeVxBi3I5sZDvnCmRQqHTEp23FaIYM4jpV7l8knRVktvSOw== 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=V/IRMbb/LeGWQ8Kidyr4zLAZYYjxnnMIE+RxmkPhF8Y=; b=h6Mo6ge8tVTPLk/u+ICfMBi7z+ACwBeCy4qC4d2tbCs/Da7FUxePZJAUOvJZo7A/kzKiTTArA83h2I46Ij8Jqqv6jD9VTZ2KBrbQUmSkpaWUFqFdcMsPoeKsN6nikHVPt5GslDB6MAo/kG152wd1DTp+2PWTQigQMWeTx3oGab5ucyhXjPKhOlQA9VV3ZWbh8XpVA1ZO8Ym2YVd6fh94sYBtseiYpIgIwIL4e1dHiaM/fcA5X3YsjOkON3NpuFt5EHJY2BXS+2ccnv8Mwxy5i18dJEN4ND6N5V7sHCdrqAJCVhkF2vtziXt8GyUB76L6be87KGVQwDhtvc32ZHi83A== 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=V/IRMbb/LeGWQ8Kidyr4zLAZYYjxnnMIE+RxmkPhF8Y=; b=RsgIvlvgsr0Ast08qLW6YUnKwpcY0wKhnjCFec2MUx3CaJlBKT1V6xngvHHQUECla1nwSNmSqujQ/Zp2i0qMovf+VdMoQQJftQ15rxxUbwo55OCoqLg1OkJ+hFWUKKqYgh3ZeHkXLYCOeSmgU7kGU+M6tpDlhVf+PLqa4CEAkdyFuNSIMRu/rDU3JxbSEYok6HaXQWMKT18tOXHmNcY3cbqfOpuu2PCCz2DyXAhUN1Q/jeV+ND6lxzfjAjyB4kxyRVHdHyFN8bjOeub1uwHMLjHTE1TXN2nd4BQ6I1zu4JN5dF+OqpVjOcSyGgYJ/WQR7ieq5Htco/8fb0VxeuUJvQ== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DM3PR20MB6939.namprd20.prod.outlook.com (2603:10b6:0:42::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 06:50:55 +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.7897.021; Tue, 27 Aug 2024 06:50:55 +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 v12 3/3] dmaengine: add driver for Sophgo CV18XX/SG200X dmamux Date: Tue, 27 Aug 2024 14:49:43 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-TMN: [2Bs68YJ9M9aZ+1w7lTMK74wJ6OVbNDrVA2HA4sBRTRU=] X-ClientProxiedBy: SG2PR02CA0123.apcprd02.prod.outlook.com (2603:1096:4:188::22) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240827064944.740024-3-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DM3PR20MB6939:EE_ X-MS-Office365-Filtering-Correlation-Id: 9283d008-89d1-4c12-a962-08dcc6649932 X-Microsoft-Antispam: BCL:0;ARA:14566002|15080799006|5072599009|19110799003|8060799006|461199028|3412199025|440099028|1710799026; X-Microsoft-Antispam-Message-Info: uCc23bp/Bw0wOydirwlvJhGOF7EEBjcn1OnyvygZRqb6u8JWfqC+CUMvBfShNEoSXgWo3ARBtK31m7mP6c+4/coAReDYEnSu/ztBO874EATrRFSXcTI5DyZI4VyFKVfi4cne6Jljt60m4vJRfoBS2ZN+cP6fqEfON8/kw4QKoWgApU9s7iosGcUP729LrU33mVwQx6c00yhTAXf91HcQClSjDmPMDW/EqeDhErgwNMU3Mh/dgsvLBnS4UciL9ONvfGqo81Emx9ywW9hhjCzd3Tt5cWh9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BJWWAyaFnOrath/SawHDKdhvFHsnoFHQTzBVoUatfJBmW1+Igo3qRT52mB2NK8SqDQ0bSSA9Z7xPhNlWCAU2jXVtnQIC+nAd4Wff4aNEszf/HgjaFRsRKDchp9nyfCAB2CT/qn6mjLKiD7u3kjlDw/CYkQaJZiHLtxiKNhZKqwmb6wco8tXTiK4cFHt1A5oiGfne8ht/BAtgTZq8AP2FdYo4N8pkiNrQNmkXwj9bY/2sFr3NRd/C2ReHDCa2tWT2RByVCaFT/7s8DwkbvseTKlED3F6m04SDR7fOMFBKVxtjYKLuT79qLdHOXcwVyVwCuSuaTEhP+DW/K6xAU8VPPUTnkRg0s8az62NQC4WHHtNb6vkebBP9gjr66wZirEqfFhVlqnw8sezyyILGdvARO6T453eEAk78SKNdFTK2s46FaslI0jT5JP2EiSqSPNrqxQVwdaSsVs+Cgd5F4kSTpko7KDPiqjeTXqUPF3hOzFhKLRmsfy3xToZ/jr9bMYt61mnRtDoUggYnr8M1L1cnls9GkE50m9F/2tKpSIwRUrheb+Hm0Lj6mgf+2PmbyJyjYH0lJX/IUzeOjGBE+WjA4JwWvF0ICzeV0dQQQIU/oakIBEc+e52nltdrrr0RJ7CXg4b815tsB3hcQEibq2bDd7e1GTav8NRpX2v4SwvHkRYZ5o2iU3bLQI0q9je/d3ZIEWLmf0HOnMXfFcbvI X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9283d008-89d1-4c12-a962-08dcc6649932 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 06:50:55.2641 (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: DM3PR20MB6939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_235058_972770_13638BAB X-CRM114-Status: GOOD ( 22.06 ) 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 | 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..a907c72325c7 --- /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_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + spin_lock_init(&data->lock); + init_llist_head(&data->free_maps); + init_llist_head(&data->reserve_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");