Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3498181ybl; Mon, 19 Aug 2019 20:25:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxu5MLqEOsKJO4VbH+89Fmqg2JoOqBXtJ9EZk3C+6j8pfXrKIWsfH5mJb0fMVfuIyKzqB/1 X-Received: by 2002:a17:902:9f8e:: with SMTP id g14mr26202590plq.67.1566271541028; Mon, 19 Aug 2019 20:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566271541; cv=none; d=google.com; s=arc-20160816; b=sq7VZIyLqFsbyvRfGzcCSOV+h6i9Ka8/LzGMHLg39kquU7QTIKfQyTe4X2yjUXe92s ovos8rJ0FyzOqqBT9ly0UY/etBrC1qZl6x3CPQixfweNhl+R8O1QBJnnXaLvfIEmLAQr giGqSA8k3kFgOGfEVd7Ku5fVBXMhz4z8l24ILV1pQzYDKDNEYL5j4691juxqQ1BsDQ79 RyYQcrRrcnBDQyaTrbGrc4S4LXg4k4l0mkhf5bwabz8Ma1fKR9bilF2M8m+1rzGYl5WC mge42n6JdDeRdCG4Rxodc/cYSQ3AnjGA2xM/2ZmWrVb5BZtW3AVkQjzivqzER4QNbpxM fstQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=9DYoy8NT9Ve7hFzyo3H6iPPmEACpZOYKDnCzHCSrpbQ=; b=uMYMk1vCcH8r9fMfvMEc49aq4NaKGY43gvvcHqL2tDq9JuF1FQoEzPbNrFJYtBRPW1 66WG8a1Ear1n2cLsj6sURJp9w8aGwVqwbxereX4gGmp/jRWNsDa91BqNPh9TNEJCH9JZ A6QYxHq32+OGgFmUZzgbGtr3zLsbrEpuYOKU0NyT+QG731zBj1flKCK+8Fzsm9+KJNWt Fv4/S5mB/v5oaL1dsZxq+egcHa/sqPFvnDKywT5RCkIT+JEFBvmjOKpr0FqRDq0QVPjN hzI/UoHbrJJR3kk19INSEdUjRfs4PGzMnzh1PYaV4nMpOLMH39JwjNYBNg4qZgceMcJq fqKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=4M37PdQB; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Ygys0yOa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si12143635pfp.158.2019.08.19.20.25.26; Mon, 19 Aug 2019 20:25:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=4M37PdQB; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Ygys0yOa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729260AbfHTDXt (ORCPT + 99 others); Mon, 19 Aug 2019 23:23:49 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:56153 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728734AbfHTDXO (ORCPT ); Mon, 19 Aug 2019 23:23:14 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 893FA3510; Mon, 19 Aug 2019 23:23:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 19 Aug 2019 23:23:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=9DYoy8NT9Ve7hFzyo3H6iPPmEA CpZOYKDnCzHCSrpbQ=; b=4M37PdQBCN/w6RTxxDoqh8EXYO5p4e3lRIbFwuRFpx xFN2vbw5G1DuPYMDJ1SKOpVrLfHxkdl3X1G93HgwHSVioOg63/micK86dWFRw0jE vaqJYzCDGdu+x39wFXjpqrOiR/NhEn20fAr4IK8z8hlRx+f5QLvyaimyef1UIiHJ dmtFD/e7m1BT+Rskj6EmHduJcxLiF/6ROGf6EZvhY8/s4iF2a7crTfu2jEKVQPTy LfxHV7DHBzGcaf7yaAw5+spV95x/NMnvnr04a1llb7nDlU8lQdtBh5Ma4D/yv8U5 Sm4cPMmg8HVQCHsaGSTe4KbOUnxaf+MoHkF2RWnNdPMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=9DYoy8NT9Ve7hFzyo 3H6iPPmEACpZOYKDnCzHCSrpbQ=; b=Ygys0yOa27lYONkNyUqaJ0xRhBRCmHouO ms0Y9NviXXDmwmyFFRZtHxj2stQLzwDLXHdkRhvQmNjmQamB9Lt/GmYGWFSCuGt5 n2uZvPm6IL2dgWkpoWHFpa1pyt23On0FQqzm+ThHUznjz1WSUZDd6AhEISvd06aH AB4xiqmXfMYfRm+6JyS9FnQ8Kkwjdg4NAAL/VPhriLCaFQosPXnT3raPYR9OEGGi EEb7BWIHHLSB7U7dPeYO7fSYKrXp1R1d/bsbwGAKRn6DSyWMtRM102ZOh5hQOz1z Iqo+agaukFYVOBs9FA9WhZRB/oNzv4KMBILau1z4OW/kkfkLthW+w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudegtddgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucffohhmrg hinhepghhithhhuhgsrdgtohhmnecukfhppeejtddrudefhedrudegkedrudehudenucfr rghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghnugdrohhrghenuc evlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 38A688005C; Mon, 19 Aug 2019 23:23:10 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jassi Brar , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland , Corentin Labbe , Vasily Khoruzhick Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Samuel Holland Subject: [PATCH v4 00/10] Allwinner sunxi message box support Date: Mon, 19 Aug 2019 22:23:01 -0500 Message-Id: <20190820032311.6506-1-samuel@sholland.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds support for the "hardware message box" in sun8i, sun9i, and sun50i SoCs, used for communication with the ARISC management processor (the platform's equivalent of the ARM SCP). The end goal is to use the arm_scpi driver as a client, communicating with firmware running on the AR100 CPU, or to use the mailbox to forward NMIs that the firmware picks up from R_INTC. Unfortunately, the ARM SCPI client no longer works with this driver since it now exposes all 8 hardware FIFOs individually. The SCPI client could be made to work (and I posted proof-of-concept code to that effect with v1 of this series), but that is a low priority, as Linux does not directly use SCPI with the current firmware version; all SCPI use goes through ATF via PSCI. As requested in the comments to v3 of this patchset, a demo client is provided in the final patch. This demo goes along with a toy firmware which shows that the driver does indeed work for two-way communication on all channels. To build the firmware component, run: git clone https://github.com/crust-firmware/meta meta git clone -b mailbox-demo https://github.com/crust-firmware/crust meta/crust cd meta make That will by default produce a U-Boot + ATF + SCP firmware image in [meta/]build/pinebook/u-boot-sunxi-with-spl.bin. See the top-level README.md for more information, such as cross-compiler setup. I've now used this driver with three separate clients over the past two years, and they all work. If there are no remaining concerns with the driver, I'd like it to get merged. Even without the driver, the clock patches (1-2) can go in at any time. Changes from v3: - Rebased on sunxi-next - Added Rob's Reviewed-by for patch 3 - Fixed a crash when receiving a message on a disabled channel - Cleaned up some comments/formatting in the driver - Fixed #mbox-cells in sunxi-h3-h5.dtsi (patch 7) - Removed the irqchip example (no longer relevant to the fw design) - Added a demo/example client that uses the driver and a toy firmware Changes from v2: - Merge patches 1-3 - Add a comment in the code explaining the CLK_IS_CRITICAL usage - Add a patch to mark the AR100 clocks as critical - Use YAML for the device tree binding - Include a not-for-merge example usage of the mailbox Changes from v1: - Marked message box clocks as critical instead of hacks in the driver - 8 unidirectional channels instead of 4 bidirectional pairs - Use per-SoC compatible strings and an A31 fallback compatible - Dropped the mailbox framework patch - Include DT patches for SoCs that document the message box Samuel Holland (10): clk: sunxi-ng: Mark msgbox clocks as critical clk: sunxi-ng: Mark AR100 clocks as critical dt-bindings: mailbox: Add a sunxi message box binding mailbox: sunxi-msgbox: Add a new mailbox driver ARM: dts: sunxi: a80: Add msgbox node ARM: dts: sunxi: a83t: Add msgbox node ARM: dts: sunxi: h3/h5: Add msgbox node arm64: dts: allwinner: a64: Add msgbox node arm64: dts: allwinner: h6: Add msgbox node [DO NOT MERGE] drivers: firmware: msgbox demo .../mailbox/allwinner,sunxi-msgbox.yaml | 79 +++++ arch/arm/boot/dts/sun8i-a83t.dtsi | 10 + arch/arm/boot/dts/sun9i-a80.dtsi | 10 + arch/arm/boot/dts/sunxi-h3-h5.dtsi | 10 + arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 34 ++ arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 24 ++ arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 + drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 3 +- drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 3 +- drivers/clk/sunxi-ng/ccu-sun8i-a23.c | 3 +- drivers/clk/sunxi-ng/ccu-sun8i-a33.c | 3 +- drivers/clk/sunxi-ng/ccu-sun8i-a83t.c | 3 +- drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 3 +- drivers/clk/sunxi-ng/ccu-sun8i-r.c | 2 +- drivers/clk/sunxi-ng/ccu-sun9i-a80.c | 3 +- drivers/firmware/Kconfig | 6 + drivers/firmware/Makefile | 1 + drivers/firmware/sunxi_msgbox_demo.c | 307 +++++++++++++++++ drivers/mailbox/Kconfig | 10 + drivers/mailbox/Makefile | 2 + drivers/mailbox/sunxi-msgbox.c | 323 ++++++++++++++++++ 22 files changed, 842 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/mailbox/allwinner,sunxi-msgbox.yaml create mode 100644 drivers/firmware/sunxi_msgbox_demo.c create mode 100644 drivers/mailbox/sunxi-msgbox.c -- 2.21.0