From patchwork Tue Oct 8 17:48:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michal Wilczynski X-Patchwork-Id: 13826768 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 71CACCEFC39 for ; Tue, 8 Oct 2024 17:53: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:References:MIME-Version: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:In-Reply-To: List-Owner; bh=lIK2qhWEOB0T5LTwhlsObWQWJM0hehTWJ18wFSfOJls=; b=Egv9DQVxXMjuZl To3DQLLnASYLk6PqSegg2gu/NcznDHH5ms1zMyIAi5iFUoovFnmCw+a5QIsb17t2YYW6sP4kbkdDr R4uHLIq2ePD6nKeFwOADBIzMffeIAD3hjj300poFqqKyRBEzBy2JtvbFw+jes6lnaAXSp9YdiXDM8 Er+6X5uTZ+Zq+A+WhR55jrvy2Lr2NlhFhloINFcgCASxLurehdZeJGBiFHx29p+7KMcKmwUo5J5Ev yFQ+9lDuKauGQnHwgVKy0TF2mWC4Y/BJV/k2OcrHerhgoDT32y79gzXAmy0dY3Vgx8BvaSL5X9x3n xd6lN6+m9nRwhfubQi1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syEOL-00000006iVq-2X2N; Tue, 08 Oct 2024 17:53:01 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syEKe-00000006htR-0pKI for linux-riscv@lists.infradead.org; Tue, 08 Oct 2024 17:49:14 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20241008174909euoutp01a046a59cd64546e4bf4512f8f6a12dbc~8i4Jl1myi3183731837euoutp01O for ; Tue, 8 Oct 2024 17:49:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20241008174909euoutp01a046a59cd64546e4bf4512f8f6a12dbc~8i4Jl1myi3183731837euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1728409749; bh=8vrYJB8Siw9RAOlVinaG8bxKGfgftgY8netEzRiOTRc=; h=From:To:Cc:Subject:Date:References:From; b=KFeE6dY1BNR9Dg4rMIWrCCKwV+pGQQa6BJd8qDHod0+ufETt2T921spDo95uvDf56 VqBD19WWazc1RFNS4GW+GUOhsKlw0TEjRoDF6xkXG6afOeqSpnZnrCZgzI2mgAcyDO 8bk3aeB4E+cf9uLFjNzjVkG7RAwTiAQXZ9lE3WmA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20241008174908eucas1p1c65fb2196e9986025af67b2602ae0619~8i4JLK_DL2026120261eucas1p19; Tue, 8 Oct 2024 17:49:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 4E.2E.09624.49075076; Tue, 8 Oct 2024 18:49:08 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20241008174907eucas1p1100fe37efdcb49cc20c5171248492fed~8i4IUrnN41985419854eucas1p14; Tue, 8 Oct 2024 17:49:07 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241008174907eusmtrp228ebb2c5ca0e6368bfe5b9dd3dfafc09~8i4IUAIxA2980729807eusmtrp2m; Tue, 8 Oct 2024 17:49:07 +0000 (GMT) X-AuditID: cbfec7f2-bfbff70000002598-f4-67057094a608 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 88.40.19096.39075076; Tue, 8 Oct 2024 18:49:07 +0100 (BST) Received: from AMDC4942.home (unknown [106.210.136.40]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241008174906eusmtip2082484b90db97fd8aa733cecde52b13c~8i4HhAlrM2347223472eusmtip25; Tue, 8 Oct 2024 17:49:06 +0000 (GMT) From: Michal Wilczynski To: drew@pdp7.com, guoren@kernel.org, wefu@redhat.com, jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, m.szyprowski@samsung.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Michal Wilczynski Subject: [PATCH v3 0/3] Introduce support for T-head TH1520 Mailbox Date: Tue, 8 Oct 2024 19:48:49 +0200 Message-Id: <20241008174852.222374-1-m.wilczynski@samsung.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIKsWRmVeSWpSXmKPExsWy7djPc7pTCljTDW7M1LDY+nsWu8WaveeY LOYfOcdqce/SFiaLF3sbWSyurZjLbvFy1j02i8u75rBZbPvcwmax9shddov1X+czWby83MNs 0TaL3+L/nh3sFi37p7A48Hu8efmSxeNwxxd2j52z7rJ7bFrVyeaxeUm9R8vaY0we7/ddZfPo 27KK0eNS83V2j8+b5AK4orh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3sbWSyurZjLbvFy1j02i8u75rBZbPvcwmax9shddov1X+czWby83MNs 0TaL3+L/nh3sFi37p7A48Hu8efmSxeNwxxd2j52z7rJ7bFrVyeaxeUm9R8vaY0we7/ddZfPo 27KK0eNS83V2j8+b5AK4ovRsivJLS1IVMvKLS2yVog0tjPQMLS30jEws9QyNzWOtjEyV9O1s UlJzMstSi/TtEvQy9izawlpwQ6xi0d9G5gbGNqEuRk4OCQETidlLLrJ0MXJxCAksZZQ4OnUV G0RCRuJa90sWCFtY4s+1LjaIoleMEo+WzmUHSbAJGEk8WD6fFSQhIvCHUeL6szeMIA6zwERG iZtz7zOCVAkLOEu8X/YNzGYRUJX40bGBFcTmFbCTOLv5PhPECnmJ/QfPMkPEBSVOznwCtJoD aJC6xPp5YKcyA5U0b53NPIGRfxaSqlkIVbOQVC1gZF7FKJJaWpybnltspFecmFtcmpeul5yf u4kRGJPbjv3csoNx5auPeocYmTgYDzFKcDArifBGrGFMF+JNSaysSi3Kjy8qzUktPsRoCnT1 RGYp0eR8YFLIK4k3NDMwNTQxszQwtTQzVhLnZbtyPk1IID2xJDU7NbUgtQimj4mDU6qBSXOu 2V0Tg7ijyfmJtxSyxM1LHmqG3NU5eTpK5OzcY4fYlMOYOJaemFM9fePB8pp/vzbzFaXX+F/5 FfB2/eK98TnzWlYEJwRKpc1+kKFZyWe1yU73w3r5RZFFz0vnSy/mfpx0vi3PdN2nQN0/G87v erFq6sYNx75t3+NdNPPY8qeVj8rttBe+1N9xSfjUay7t6mm8lzc0RHo4RB0R0CgwsHKef3Tp zvkaBh+Cr4Q+1Fxep3RrDmfNRHufC8VbYx06ZU1sg1qm9PpZfZiwjGO3j87lZc3+xic2iaev uB40c/u2Xf9UmZxfB181jJl0S33Jvw3Fq9QOO4qkWi7+8Uf6j83BN/PME/UVJU6pcz7Uf63E UpyRaKjFXFScCACHylRoUgMAAA== X-CMS-MailID: 20241008174907eucas1p1100fe37efdcb49cc20c5171248492fed X-Msg-Generator: CA X-RootMTR: 20241008174907eucas1p1100fe37efdcb49cc20c5171248492fed X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20241008174907eucas1p1100fe37efdcb49cc20c5171248492fed References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_104912_666124_A27184B4 X-CRM114-Status: GOOD ( 18.28 ) 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 T-head TH1520 SoC supports a hardware mailbox that enables two cores within the SoC to communicate and coordinate [1]. One example of such coordination would be cooperation with the T-Head E902 core, which is responsible for power, clock, and resource management. For example, in the specific case of the BXM-4-64 GPU, it needs to be powered on by the E902 core, and the kernel running on the E910 needs to 'ask' the firmware running on the E902 core to enable power to the GPU island. Given recent advancements in work on the upstream GPU driver [2], there is an emerging need to get this code in the mainline kernel. Link: https://openbeagle.org/beaglev-ahead/beaglev-ahead/-/blob/main/docs/TH1520%20System%20User%20Manual.pdf [1] Link: https://gitlab.freedesktop.org/imagination/linux-firmware/-/issues/1 [2] Thanks, Krzysztof and Rob, for your review! Since this series is gaining some interest, I'm dropping the RFC prefix with this v3 update. v3: - added a comment about mixing devm_ and non-devm resources in the context of shared interrupts and explained why it's safe to do so in this particular case - changed the order of resource freeing in the .shutdown callback - used a wrapper function for register mapping - since the only conceivable use case for this mailbox driver is communication with cores not managed by the kernel, I’ve hard-coded this by removing the thead,icu-cpu-id property and adjusted the mailbox driver code accordingly. - added a more detailed description for mbox-cells. - made some cosmetic changes. - retested by applying the patch with non-yet-upstreamed patches, confirming that the drm/imagination driver can read the registers correctly. v2: - fixed thead,th1520-mbox.yaml binding file by dropping redundant descriptions, renaming reg-names, removing unnecessary clocks, providing constraints and defining ICU's - fixed the mailbox driver code to work well with updated binding-file, removed clocks support, as it's not necessary for mailbox to work - adjusted the device tree node instance of mbox_910t so it will work with updated bindings file Michal Wilczynski (3): mailbox: Introduce support for T-head TH1520 Mailbox driver dt-bindings: mailbox: Add thead,th1520-mailbox bindings riscv: dts: thead: Add mailbox node .../bindings/mailbox/thead,th1520-mbox.yaml | 81 +++ MAINTAINERS | 2 + arch/riscv/boot/dts/thead/th1520.dtsi | 12 + drivers/mailbox/Kconfig | 10 + drivers/mailbox/Makefile | 2 + drivers/mailbox/mailbox-th1520.c | 576 ++++++++++++++++++ 6 files changed, 683 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/thead,th1520-mbox.yaml create mode 100644 drivers/mailbox/mailbox-th1520.c