From patchwork Tue Jun 18 15:12:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuntao Dai X-Patchwork-Id: 13702511 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 16C45C27C4F for ; Tue, 18 Jun 2024 15:13:32 +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=C0SIFQACFo5JI5OUMLqb6sGZ5WCk97rLzXlb5wJCbNo=; b=l0E5gwQ3i2y8m+ LgKiibv8H2JQrVGytmPsEC0jnkBKgvR2xTTNmY1Dy+D55FaRl2V53Ud/tCCC0px0MybcLi/OnBP1U oz5eDMD/R177M9/LzGVHZW7qgE2oxW3JQbDcA9R/yFSbl0MJVZuixRSgxUGlfmhk59TGVXWfBWplg /AEF/KIzlrv6bdifoyn49pOs1k95AM1IVYQ3O9Cqtb240TKOrgpqRBiuAcmffPEIl9NjB7wImz6n1 P8z8j7q47OJdBi/8FesMr2n8KjKrNIFvcleTq6B1Xj8xkymNLPQt0L07n3IovSkX+92FGpAdMeOn1 QbKVEiE3LXxWge0DfM5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJaWT-0000000FYvQ-0tTJ; Tue, 18 Jun 2024 15:13:25 +0000 Received: from mail-me3aus01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:2818::800] helo=AUS01-ME3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJaWP-0000000FYsY-0TEB for linux-riscv@lists.infradead.org; Tue, 18 Jun 2024 15:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E91G3qBiW7Aeo/jHIc8LMiO0vZQxgIO80zwU3216e/byIulmtDXHPltLLcuBF67is1BMJK0yA7xRZOg5oSsQV4jx5LThX6CDEPsG6nM8LsE7058Jaig8Gc6pdunjvjJTt6dYhNClr/NJuraDx9N9NDC8AWuY13VNvWckVwe6oo1Jc34hgNoSQUg1jIJui/LYSWeUAVQ+i+qo3pdqUrIHOIckpE5C91OmWlNIXFCne1n+w4qwznfXfBDKctj7qssq4PGkESTlzRm+IwwkaTzX4fghkUT75oK6sYe1h/E1qbdprd+wCmdGE+oLzd7NVpC9JRAOmaNft+kYZBzRnwi1aQ== 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=oKTCwDIG8pgERnO8qAnoPLFo+Gwfzux11mjqdeBWce4=; b=SeZXUJJzo+XhtRdg9V8Q0uKb/2XSGxhmO3Hi4IzLovEjxfCnWt2gYiV6ivLDUdDcN7BdpB3RHf6i+4jtPxSAWLlGU4zaLuTCCWeceP8D5kQDGsQcrUr2ZuWNTDMrUPHr1ie0HgSUbqmcfDwnsWhK4Eq572WfHXPCDZb6xkedFfM9PAqwPjSwIqVWrSLRaQ/MjXl8TUto/X0gUISaa6mmsibIijSJnaXVVdzSSA9+TVGZ3lHygckMZ4/0+qUyHxSa9u08HQw7ThnCyl2OlFdNe2IxBrDhepNmCCEpH8Sz4R2SanQUq1ZQrK+OOVsXa5tr3T0NBwtQqg8NuCGJtOf2Ng== 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=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oKTCwDIG8pgERnO8qAnoPLFo+Gwfzux11mjqdeBWce4=; b=QJ/s0HbbSmALNm0Yshrft3KLuVEHpKNwcdSskPY7SK1DPakxHHmnTYdQHFBsSmEfmi4XdHTBtBLd9Q2XvTXpeB768mpyt88lr1N8faZaUB70SakNpmBfTsNvjtQAJGuWWN+9+jLfW9KYoUE9cx51+WsbFFqtvVlNGZgnfuq0riVJueLNBT7/bdCtwqelUgzJstilsUv0q1h4tJD/j4C9aLuzvpNIM+TMUl1fj5h/cxrY02nDX2MFnGzEE234hF3Ieii+vYCOV/a20GQYFcpTD7sq3eN+hAnfVO3eg07xIyx8SlXsZ4F6n2Z6k4ONxsjeK7VdujiqFFkuZ6AKWCG8Vw== Received: from SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:9b::8) by SY7P282MB5268.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:2a9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 15:13:03 +0000 Received: from SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM ([fe80::ac24:7d2b:92fe:20c3]) by SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM ([fe80::ac24:7d2b:92fe:20c3%2]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 15:13:03 +0000 From: Yuntao Dai To: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, unicorn_wang@outlook.com, inochiama@outlook.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Yuntao Dai Subject: [PATCH 1/3] dt-bindings: mailbox: add Sophgo cv18x SoCs mailbox Date: Tue, 18 Jun 2024 23:12:33 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TMN: [ya4n5REVWOzKP9qb85v9Qjesqs2FEZkm] X-ClientProxiedBy: TYCP286CA0266.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:455::19) To SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:9b::8) X-Microsoft-Original-Message-ID: <20240618151235.5846-1-d1581209858@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SYBP282MB2238:EE_|SY7P282MB5268:EE_ X-MS-Office365-Filtering-Correlation-Id: 5afa7c5c-eba5-474b-f3c6-08dc8fa925ca X-Microsoft-Antispam: BCL:0;ARA:14566002|461199025|3412199022|440099025|4302099010|1602099009|1710799023; X-Microsoft-Antispam-Message-Info: A69YsiXfAwnkK2REcDdL3iBqSrLwxZiqpomZwJWxOS85yoFXysMOu40XbHZExopnEk+wTRUE/w8NVfmZN0vF0ATRFhg33raoZrYkZzYitJiuAzHhGmS0aCXcEkgUJcYpNhQrAacFvotQfLN1LS9HgtWCWi0r1t3VAzmaxSkxjR7H404n50yzqJHuCNyH/Dis6W2nFNBi56f507be2j0Zg8effjnB5Au/DLh8EsVlNMvWlYT0GjIRe+AkjDVpaK1YBGbMQBl746fo8kvQA8An/CC8+UY+LjV6SoSGrEx4HKS3/udrRCea4AUIWPwEqN2AHeHAb1dVrl/NUfh3doPK0ndAR0dyiJWgOXZNOODZHuas4n69uTQWa2FdwN4+SSpxX7n5SD7iLGI6eeyTCsqwoeJexCY4jEXJj2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dv8ao3DET3p1VAgTs4gIT86lqik1Vozg6XKPxk2Y0HV7zejOPpI+5JX8AOUq+HQRODcD9em9vjPlOAEteLRWlC6xzWzCrtNecY6D5jr3x67ZH/j9cfIJP6ZAf5YY4SpFC+ptdrcKl9cmwXEkvHofxby6d7gJvsG+ZTNw0nSu0aOXqsFRvyQBaofgnXiGYmdi8fiQ1BPXyyE5uqeoHBu4O/zVIoPxWgshGGQQnZeDg5NXHpJ7fQ8jM68LB0SJyo0OfiWy0lDY5o1yNYa78+5qlKfDaaoGwo0qOIPj3A/vqx/RIOx382LyAIclBbXgIqCujYyNpAXx7uuu5LuW0lPsADOBjxBywzvofas+OfQTek4Kg5xLcqJftZZ73KMkJFT0NLglHH0AnChtYnekn3KeSBY1qTgS61rdsaYGIN6WxWHj2f7+Pewr7XfzX11tIBK45MF42VbPrfJs8oaVSDM1N7FQcRUKipHnEMmnj3IRVtDnu0mTddCaMUUojiPzmSs+4qExuemIMr0Il2Dt/qObEjt5ajtTRW0vxEoQ+cBzP6WcbCtQVdpw5cpBGi4= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 5afa7c5c-eba5-474b-f3c6-08dc8fa925ca X-MS-Exchange-CrossTenant-AuthSource: SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 15:13:02.8511 (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: SY7P282MB5268 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240618_081321_175261_5AACD872 X-CRM114-Status: GOOD ( 11.52 ) 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 Add devicetree bindings documentation for Sophgo cv18x SoCs mailbox Signed-off-by: Yuntao Dai --- .../mailbox/sophgo,cv1800b-mailbox.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/sophgo,cv1800b-mailbox.yaml diff --git a/Documentation/devicetree/bindings/mailbox/sophgo,cv1800b-mailbox.yaml b/Documentation/devicetree/bindings/mailbox/sophgo,cv1800b-mailbox.yaml new file mode 100644 index 000000000..e1868aaf2 --- /dev/null +++ b/Documentation/devicetree/bindings/mailbox/sophgo,cv1800b-mailbox.yaml @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mailbox/sophgo,cv1800b-mailbox.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo cv1800b mailbox controller + +maintainers: + - Yuntao Dai + +description: + The Sophgo cv18x SoCs mailbox has 8 channels and 8 bytes per channel for + different processors. Any processer can write data in a channel, and + set co-responding register to raise interrupt to notice another processor, + and it is allowed to send data to itself. + Sophgo cv18x SoCs has 3 processors and numbered as + <1> C906L + <2> C906B + <3> 8051 + +properties: + compatible: + enum: + - sophgo,cv1800b-mailbox + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-names: + const: mailbox + + recvid: + maxItems: 1 + description: + This cell indicates the mailbox controller is running on which processor + + sendto: + maxItems: 1 + description: + This cell indicates the message sends to which processor + + + "#mbox-cells": + const: 1 + description: + This cell indicates which channel is used + +required: + - compatible + - reg + - interrupts + - recvid + - sendto + - "#mbox-cells" + +additionalProperties: false + +examples: + - | + #include + + mailbox: mailbox@1900000 { + compatible = "sophgo,cv1800b-mailbox"; + reg = <0x01900000 0x1000>; + interrupts = <101 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "mailbox"; + interrupt-parent = <&plic>; + recvid = <1>; + sendto = <2>; + #mbox-cells = <1>; + }; From patchwork Tue Jun 18 15:12:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuntao Dai X-Patchwork-Id: 13702512 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 EBF10C2BB85 for ; Tue, 18 Jun 2024 15:13:32 +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=h5V8MedD9wFXGBCk5MJWwY0niWXItrELsWiYsfvilhI=; b=kU6VbmIUbPTjOM tfRqrZK7gXXKFuKW9bMiz+y7BajE8Dy4xGNjUm3bfYmHZrRbKLipkPLAbWSjHmiM2Jf3mLLsj5oqH XVLKBm8/AH8fXmuKiOVZpiJhD/+GLqV3/Ts/JHuMqqzOTWdLloLT0Ck6baCjSIECl2BN6xJm0oMMM cRFuFcBJtf4mPZSAmJxey9spxFEtGQaTSzavr6RdvcsFjSUskzvzc3pD0J48ICLzPt25ZO3IXsvVI UaD1bYVSm/yCiuK7Erlz2Y/s5yuF77kZjwIHf3S+DSfKDnuIBN/efCSdmUrCjGU0Axb2kICttwrum 5ElaZXjiTHP4B8X90Law==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJaWU-0000000FYwe-2syj; Tue, 18 Jun 2024 15:13:26 +0000 Received: from mail-me3aus01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:2818::800] helo=AUS01-ME3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJaWR-0000000FYsY-1nOi for linux-riscv@lists.infradead.org; Tue, 18 Jun 2024 15:13:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gh0hpBBxvz6snPCLEBOBI9myDv4IlDf7NA4WCYJh1dtSyRY9E9dRHnW9qGrmFwjBBhYRAc5ZzdGpfnPQ/wuixIwxpBIV8+lpLij5m7zMxUY3sS4BtSvTZjMcvJfVgr4UTNTmQWbpqvrgtgc26dkHIWywNT6mh93TAHZhOpT1t+D9Y3PzSQZGxJx9+SAYbLrNvYjihViXLOnwJIHBJsLWs+s0b0JhHJTO1Lnplh7rXb/NQ2iyzunk4/6Pk3BRSTeAx10nJ6egGg79PI+8CCfA/MN+9CaKY3jCnm8faFWKj1vGHhOSEUlXI9IPxRIjP5tW06Bn1zNEY8tqpmT8BQ1bUw== 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=IX1D+I5IhkXeMvlbXxgultj/wTl/ZQhlfXJeiK5f66o=; b=hoZDw19Ac6AUhYknx4O+/G40GQPPbEafbytxgVPGOzXmumWe7W9NDbpw7isEabAHt9o+Zw+CgA7hHY9Q72rMYVGsc76fwD370wNqkKaIdoQUAiMtpE0mUAk2nfeR8tK2xZuQizOFDl9XZlsRM3okeA/Oe5HUgZTdcCLxL6XuLsPJcaAd7t3C+nY31mEkLxTOMB7BGAelUb8eBTui4GohnBKicuL80fJTImUK8wzXGmlDxgVP4wfEqK9kru5rSUMEbFnImCvwpaAEvC27Fq8u26cDBXjmA5O/C2v8uTIZg39C/tWOGZB4zEIvaZE9awKq0a6ekgRilFVr2+3V4nMctQ== 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=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IX1D+I5IhkXeMvlbXxgultj/wTl/ZQhlfXJeiK5f66o=; b=Tu2/F0KliI7ttM8o7J40hJzdsHkIscMd8aW05lP1rO3q6Hl0b2aHoz2EgZ9ZhlPNVoEIwhvhzjt5DCrtBEa1OEMj51+XuuFF5vlPS84RboeXR2xp1c4tgN2Lz1oq6le/VV6h7n5UcmLpKokEGYqpvJleZwKOr+imhxFRuUlvx3vaalLSVcHOc2Ax1w6nI9bpkNV/ckxHmLT/luKr4xclcql7OAGmLzDcwVGevyUQiygOYgyy7Iht8h4oAlEmdBGtLcw43pjAoViomRvohAoQS1h7IijffZCd1oHbhXmRS58AjClsZwYTw6KG1XH/J6iebBlsZZ/FtQUu+/ploacczg== Received: from SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:9b::8) by SY7P282MB5268.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:2a9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 15:13:07 +0000 Received: from SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM ([fe80::ac24:7d2b:92fe:20c3]) by SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM ([fe80::ac24:7d2b:92fe:20c3%2]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 15:13:07 +0000 From: Yuntao Dai To: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, unicorn_wang@outlook.com, inochiama@outlook.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Yuntao Dai Subject: [PATCH 2/3] riscv: dts: add mailbox for Sophgo cv18x SoCs Date: Tue, 18 Jun 2024 23:12:34 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TMN: [lYFp8H3WIKmqU1bEb8cQ6qVe/6dFhDgo] X-ClientProxiedBy: TYCP286CA0266.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:455::19) To SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:9b::8) X-Microsoft-Original-Message-ID: <20240618151235.5846-2-d1581209858@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SYBP282MB2238:EE_|SY7P282MB5268:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a6ddff0-d055-4cf4-7fe0-08dc8fa928a5 X-Microsoft-Antispam: BCL:0;ARA:14566002|461199025|3412199022|440099025|1710799023; X-Microsoft-Antispam-Message-Info: RcpI6mHHDHxOCwUHboeddy8DqbgnQ2ZmloNavYG++e6g+1XItlz0ngcGjnzOKVi/NwLcHl/rLxmocbH+WVvphufyKaawAQHMrBMAtkA+XdTKyEoHC7y3gFQNJQcpTBnUCGpTsFnEEWcyX7wrwKzhUa/Y3rh0wPSHBmf0tHqk9sB7Q64sUA8UitqV5iehH0q94H4a6y4FZxnKX5a091Ut/bKDYJxe9bvhgfvZJltV5sW3oRqDKK0tCBNj3TWz++5EJalyEbtUbso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yf+vFZ+oCgHahHCaZ5TbF8t/FhJsGUGVIQ8TIWExYFgRmVS/ZwPupRiIJErVxg68NKeTEXwQKf7oTwKIRZs7eyLJLBO4ouRKEf7ovDWo35lElFz9FT5qMX7T8q0y5ZwXgzvch1yem5hToooJhjcOmoQn58aN8fnBugheVlIok3NeFJSG3GDxG+gjLgkKfigbHxAfaO7IPzVwk7NQ4KL3ALRPXRAfWxf5iNYdRKOeSjEsW79lt2NFQHslU+EyL60Fy5kj1bJu6JWFjgvykBlCiYRse5VreAOINGLBYJrLjl/SMIRFVBSnK1tEYWYHo0M1RYDXjQRek7LdVfJ2ubl68RDWphdgOS5W1jqkLUnyLywHpa96ckat/eZbFC4LexTTXu70Ud8WJhCz+gtABtvA/b3L+YcWVpJwzZK2hKZ3gM/krADequD5n/WL3jmUdIYbheqzC5CoSEXA+zmEdt6vmuIsBIt27ElVn3alFKJ1pAMYu5tRU1ghIqlFM7AcVhZKcfCFVuvmq4z+fbvtGsxi8OCK+ZI13XGDo+qWBDRYLlt4XwGkM/guutDXONlLPfFyTYlNUNdxHGX0MOxa3DD2eTBBXGveLukKDiR7qI38mUXudk= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 9a6ddff0-d055-4cf4-7fe0-08dc8fa928a5 X-MS-Exchange-CrossTenant-AuthSource: SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 15:13:07.7980 (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: SY7P282MB5268 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240618_081323_507476_FDD85932 X-CRM114-Status: UNSURE ( 7.03 ) 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 Add mailbox node for Sophgo cv18x SoCs Signed-off-by: Yuntao Dai --- arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi index 891932ae4..48f309bfa 100644 --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi @@ -310,5 +310,16 @@ reg = <0x74000000 0x10000>; interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; }; + + mailbox: mailbox@1900000 { + compatible = "sophgo,cv1800b-mailbox"; + reg = <0x01900000 0x1000>; + interrupts = <101 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "mailbox"; + interrupt-parent = <&plic>; + recvid = <1>; + sendto = <2>; + #mbox-cells = <1>; + }; }; }; From patchwork Tue Jun 18 15:12:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuntao Dai X-Patchwork-Id: 13702513 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 D6207C27C4F for ; Tue, 18 Jun 2024 15:13:34 +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=lhV+VpKoUlp0Dcq5Ad/i8gckrmLdTXo2o7VlNvnIRWE=; b=bzQGO3psbBGcxN mq00F9spVDT/V5KlT2p5PrT7LWLBx3ukUL6QHkl4eL3vYMvNWY7hC60ik1cMTXgp+WXzjRyh9j5uI Vmdt9SFRUVWk/eAwue9Oz2GtXZTZ6ZcnUK9p15JnXnzeRdnbEMPC6DNSwHYfQrtpuQOLpMLJiwN3u yvm/1o4BXjAxIXiKoyk9RnbX1BIqH3jjwlIKdOh6DPQeED7IY4tPejDgAxd1bKhyNRbk3hVtnkXzY n7X11DNTOWuUDveuu/qGtDCX8MVFHyEyeodxtOPrQIYAgpvFBw2UKcBv1gjC+xTxYkJdLF4nP705P x6xGasdkTXerjC7NExTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJaWW-0000000FYxh-3go8; Tue, 18 Jun 2024 15:13:28 +0000 Received: from mail-me3aus01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:2818::800] helo=AUS01-ME3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJaWT-0000000FYsY-1lFy for linux-riscv@lists.infradead.org; Tue, 18 Jun 2024 15:13:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NEImUuKuPnQyBSr4eshPHl3KgZi9RoD+xvtVzy37JGp/4f6KuBrTqh3g8KTe9putiOCwMeowlKCP26qqHpV3BBWXRkxjWBc8LUR7MDo0liOeXwpPSjMkbSwz5pqWVd2u7ToZg3fXz5kLVH+y26G2PQbMGmC1pqW+yKBvXgVG68Cg2r+u7CPe0AFTrd7o2deVpXUsIg9JNkuIu3cQSpUze3QKjhhzaKmWQ3Pnjf7bKFBuWm8/1Bue8ouflyzkH03wILzVZH6zxBIi0xbWKLsa0OYQ3wMeI4UlYtan+hfgrG8N/f+90zIje4uuuHUw/912H54OpEFX4vb8gbtzlXjYYg== 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=5qRcENVB/ZWHZrlfBjkPdKJM0m6jFaudlENWzYlhVYE=; b=BuOOwacWvHY6ftIhevwZW3gNltQ+GWQ8EdcXOtJAFe7IOq/z0jTcZoAYPtLzJPKczvmNbn8vouu3fwGx4XxaqwCyW2Cp+q5O1YiqRxDigpszvhDUlXUM2VjG/J/R9jEOnd/cOYDKQ/rxSLNWA4RCGCmNuumb+zzsoDkf4nMfEx5Z0tSn1kewMrmqmLml6XXzEzu9DiVEFGnXR4MdDDf76sANtzGjDxH7UblS4AKMfIJ8dJillTA6XaSTjQMvvN78gditOhjte1vckuM+pcLrpgoA8I3ZE5FhBGpLW78rGgTaoiavCwY7X6jA3UNdUaLMoVaUAlH5HSgyxTsnqT+eNA== 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=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5qRcENVB/ZWHZrlfBjkPdKJM0m6jFaudlENWzYlhVYE=; b=ZqfGSJUWEdJ33StzHNBEu4wRajFAd3I5S045bWBI1mqBPsxPpmxAowYMvshxsRly0kMmAc1BRpZ5wiZqTxrM4iJ8N1QS3BDKDBFHJTD6c9ufxhOgtStSE0+Newy7HZULQMj8U+MwnaQ6Pc+UvJchtu6PM/qByXhTjT5vQ2+sWXv+/ot9F5kR2bN9c9J5gwvFjiftG5T/FR/zKHpDlcULWptYCQfs0uTVagEIc9jZ0kkDFRCKtrYBKkfRdbwfuLlgB8dfHrjMUVW3FRRKr5J/619vQINpADd3J7AuO1Iua/ziamcaGSC9uOFlC0NOewpM+PsfX2D+AOGEcRIIrZf8nw== Received: from SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:9b::8) by SY7P282MB5268.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:2a9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 15:13:12 +0000 Received: from SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM ([fe80::ac24:7d2b:92fe:20c3]) by SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM ([fe80::ac24:7d2b:92fe:20c3%2]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 15:13:12 +0000 From: Yuntao Dai To: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, unicorn_wang@outlook.com, inochiama@outlook.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Yuntao Dai Subject: [PATCH 3/3] mailbox: sophgo: add mailbox driver for cv18x SoCs Date: Tue, 18 Jun 2024 23:12:35 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TMN: [X1/wqH4EahMq5oJ1l9UEVIWlavA4Z7ET] X-ClientProxiedBy: TYCP286CA0266.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:455::19) To SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:9b::8) X-Microsoft-Original-Message-ID: <20240618151235.5846-3-d1581209858@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SYBP282MB2238:EE_|SY7P282MB5268:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d82d4f6-bea4-4faa-8132-08dc8fa92b51 X-Microsoft-Antispam: BCL:0;ARA:14566002|461199025|3412199022|440099025|1710799023; X-Microsoft-Antispam-Message-Info: 3lhjfyFgihBlperWGsdED3yguNsI0jDv7BzTn7tHMct7UqaKXbPU/yq0ljG2QejYv1MI3mykyYt1mGJ7bNWAsqfGy8GoBFKjokbQNz+CXNlSN3xEDCk/872H1e9BSXN7hfFc+u2LkSBgab8l4Zd+8YVq7EyOiwqVcrNN3cd0wTwNCrnMz2z8jS5edtMFsTl4yOAORQzUnDmgVMNrZxmuH709W9HreqBkim11e2b57mBFdMLSwR0ngwkJYQ596SSALEqUD/aN2rrqG8OboNnwaaH7BYRdsJkgmQ8L5ySelhpTh/qyKH/uUZ5GGiSY3gkp24fFVXmQlyUPi+Z+JyYHDDZ2Bz8EMv/W96m2wAWkrnw87IWKm7ZCmeKzXmKNQv/+hWizfDIlQ6TN3B5aAaeYUKTkY2ceOZGjGYrkSeqp4Z6/Imysq0LCxMRfeURf884/RmOntX4dQSRo+iBX2/gVUM79uHuwTM/MueDfbXjLbhcuuuFzN0CgKO6NtijRUZqAQT0nTeboD9oZDQiAA0asdXRDPPeivFMdQ06rqwRWj4rB6Xd4Cm45t6M4izwvHPawRUdUKpRLxpAFM2XXVqRdri066jItaMsdZuCPzuCRgS6U1aVl0U7pu7q8jv2s8QiM X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HAzbi7G5kX/wrWfjZZUv0yLl8tmJbI+oJMdje336gIQBy7PLPB4TAwBKIoQ54hnMsmvHG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Wzn/qKWlFa9Onr48Ql1JtO+/5mnPpnmZQurXAE13ONs33CMifqIJll3T8gNNmDpIGcL9eH4Pi4IOPzDSK+Wx2L/f+gAG5VnFufylSN98E2KPOU= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 7d82d4f6-bea4-4faa-8132-08dc8fa92b51 X-MS-Exchange-CrossTenant-AuthSource: SYBP282MB2238.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 15:13:12.1864 (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: SY7P282MB5268 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240618_081325_541657_4C2A11BC X-CRM114-Status: GOOD ( 22.41 ) 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 Add mailbox controller driver for cv18x SoCs, tested on mailbox-test client. Signed-off-by: Yuntao Dai --- drivers/mailbox/Kconfig | 11 ++ drivers/mailbox/Makefile | 2 + drivers/mailbox/cv1800b-mailbox.c | 181 ++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 drivers/mailbox/cv1800b-mailbox.c diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig index 3b8842c4a..4e5593861 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig @@ -286,4 +286,15 @@ config QCOM_IPCC acts as an interrupt controller for receiving interrupts from clients. Say Y here if you want to build this driver. +config CV1800B_MBOX + tristate "cv1800b mailbox" + depends on OF + depends on ARCH_SOPHGO || COMPILE_TEST + help + Mailbox driver implementation for Sophgo cv180x SoCs. This driver + can be used to send message between different processors in SoC. Any + processer can write data in a channel, and set co-responding register + to raise interrupt to notice another processor, and it is allowed to + send data to itself. + endif diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile index 5cf2f54de..71f0f746e 100644 --- a/drivers/mailbox/Makefile +++ b/drivers/mailbox/Makefile @@ -62,3 +62,5 @@ obj-$(CONFIG_SUN6I_MSGBOX) += sun6i-msgbox.o obj-$(CONFIG_SPRD_MBOX) += sprd-mailbox.o obj-$(CONFIG_QCOM_IPCC) += qcom-ipcc.o + +obj-$(CONFIG_CV1800B_MBOX) += cv1800b-mailbox.o \ No newline at end of file diff --git a/drivers/mailbox/cv1800b-mailbox.c b/drivers/mailbox/cv1800b-mailbox.c new file mode 100644 index 000000000..8ef2a5492 --- /dev/null +++ b/drivers/mailbox/cv1800b-mailbox.c @@ -0,0 +1,181 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAILBOX_MAX_CHAN 0x0008 +#define MAILBOX_DONE_OFFSET 0x0002 +#define MAILBOX_CONTEXT_SIZE 0x0040 +#define MAILBOX_CONTEXT_OFFSET 0x0400 + +#define MBOX_EN_REG(cpu) (cpu << 2) +#define MBOX_DONE_REG(cpu) ((cpu << 2) + MAILBOX_DONE_OFFSET) + +#define MBOX_SET_CLR_REG(cpu) (0x10 + (cpu << 4)) +#define MBOX_SET_INT_REG(cpu) (0x18 + (cpu << 4)) + +#define MBOX_SET_REG 0x60 + +struct cv1800b_mbox { + struct mbox_controller mbox; + struct mbox_chan chans[MAILBOX_MAX_CHAN]; + u64 *content[MAILBOX_MAX_CHAN]; + void __iomem *mbox_base; + int sendto; + int recvid; +}; + +static irqreturn_t cv1800b_mbox_isr(int irq, void *dev_id) +{ + struct cv1800b_mbox *mbox = (struct cv1800b_mbox *)dev_id; + size_t i; + + for (i = 0; i < MAILBOX_MAX_CHAN; i++) { + if (mbox->content[i]) { + mbox_chan_received_data(&mbox->chans[i], + mbox->content[i]); + mbox->content[i] = NULL; + return IRQ_HANDLED; + } + } + return IRQ_NONE; +} + +static irqreturn_t cv1800b_mbox_irq(int irq, void *dev_id) +{ + struct cv1800b_mbox *mbox = (struct cv1800b_mbox *)dev_id; + u8 set, valid; + u64 *addr; + size_t i; + + set = readb(mbox->mbox_base + MBOX_SET_INT_REG(mbox->recvid)); + + if (!set) + return IRQ_NONE; + + for (i = 0; i < MAILBOX_MAX_CHAN; i++) { + valid = set & (1 << i); + addr = (u64 *)(mbox->mbox_base + MAILBOX_CONTEXT_OFFSET) + i; + if (valid) { + mbox->content[i] = addr; + writeb(valid, mbox->mbox_base + + MBOX_SET_CLR_REG(mbox->recvid)); + writeb(~valid, + mbox->mbox_base + MBOX_EN_REG(mbox->recvid)); + return IRQ_WAKE_THREAD; + } + } + + return IRQ_NONE; +} + +static int cv1800b_mbox_send_data(struct mbox_chan *chan, void *data) +{ + struct cv1800b_mbox *mbox = dev_get_drvdata(chan->mbox->dev); + int idx = (int)chan->con_priv; + u8 en, valid; + u64 *addr = (u64 *)(mbox->mbox_base + MAILBOX_CONTEXT_OFFSET) + idx; + + memcpy_toio(addr, data, 8); + + valid = 1 << idx; + writeb(valid, mbox->mbox_base + MBOX_SET_CLR_REG(mbox->sendto)); + en = readb(mbox->mbox_base + MBOX_EN_REG(mbox->sendto)); + writeb(en | valid, mbox->mbox_base + MBOX_EN_REG(mbox->sendto)); + writeb(valid, mbox->mbox_base + MBOX_SET_REG); + + return 0; +} + +static bool cv1800b_last_tx_done(struct mbox_chan *chan) +{ + return true; +} + +static const struct mbox_chan_ops cv1800b_mbox_chan_ops = { + .send_data = cv1800b_mbox_send_data, + .last_tx_done = cv1800b_last_tx_done, +}; + +static const struct of_device_id cv1800b_mbox_of_match[] = { + { .compatible = "sophgo,cv1800b-mailbox", }, + {}, +}; +MODULE_DEVICE_TABLE(of, cv1800b_mbox_of_match); + +static int cv1800b_mbox_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct cv1800b_mbox *mb; + int irq, idx, err, cpu; + + if (!dev->of_node) + return -ENODEV; + + mb = devm_kzalloc(dev, sizeof(*mb), GFP_KERNEL); + if (!mb) + return -ENOMEM; + + mb->mbox_base = devm_of_iomap(dev, dev->of_node, 0, NULL); + if (IS_ERR(mb->mbox_base)) + return dev_err_probe(dev, PTR_ERR(mb->mbox_base), + "Failed to map resource\n"); + + err = of_property_read_s32(dev->of_node, "sendto", &cpu); + if (err) + return dev_err_probe(dev, err, + "Failed to find in of_node\n"); + + mb->sendto = cpu; + + err = of_property_read_s32(dev->of_node, "recvid", &cpu); + if (err) { + return dev_err_probe(dev, err, + "Failed to find in of_node\n"); + } + mb->recvid = cpu; + + mb->mbox.dev = dev; + mb->mbox.num_chans = MAILBOX_MAX_CHAN; + mb->mbox.chans = mb->chans; + mb->mbox.ops = &cv1800b_mbox_chan_ops; + mb->mbox.txdone_poll = true; + + irq = platform_get_irq_byname(pdev, "mailbox"); + err = devm_request_threaded_irq(dev, irq, cv1800b_mbox_irq, + cv1800b_mbox_isr, IRQF_ONESHOT, + dev_name(&pdev->dev), mb); + if (err < 0) + return dev_err_probe(dev, err, "Failed to register irq\n"); + + for (idx = 0; idx < MAILBOX_MAX_CHAN; idx++) + mb->mbox.chans[idx].con_priv = (void *)idx; + + err = devm_mbox_controller_register(dev, &mb->mbox); + if (err) + return dev_err_probe(dev, err, "Failed to register mailbox\n"); + + platform_set_drvdata(pdev, mb); + return 0; +} + +static struct platform_driver cv1800b_mbox_driver = { + .driver = { + .name = "cv1800b-mbox", + .of_match_table = cv1800b_mbox_of_match, + }, + .probe = cv1800b_mbox_probe, +}; + +module_platform_driver(cv1800b_mbox_driver); + +MODULE_DESCRIPTION("cv1800b mailbox driver"); +MODULE_LICENSE("GPL");