[PATCH v7 0/6] Allwinner sun6i message box support

30 views
Skip to first unread message

Samuel Holland

unread,
Feb 22, 2020, 11:09:00 PM2/22/20
to Jassi Brar, Maxime Ripard, Chen-Yu Tsai, Rob Herring, Mark Rutland, Philipp Zabel, Ondrej Jirman, Vasily Khoruzhick, devic...@vger.kernel.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux...@googlegroups.com, Samuel Holland
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 ARISC CPU.

I have tested this driver with various firmware programs and mailbox
clients on the A64, H5, and H6 SoCs (including specifically a patched
version of the arm_scpi driver), and Ondrej Jirman has tested the driver
on the A83T (using a similar patch to arm_scpi).

This patch series includes just the driver and the device tree changes.

Thanks,
Samuel

Changes from v6:
- Rebased on tag v5.6-rc2
- Collected Acked-by/Reviewed-by tags
- Dropped "FIFO full" check in sun6i_msgbox_send_data()

Changes from v5:
- Rebased on tag sunxi-dt-for-5.5-2
- Dropped unnecessary/unrelated patches
- Addressed Maxime's dt-binding comments
- Used devm_reset_control_get_exclusive

Changes from v4:
- Rebased on sunxi-next
- Dropped AR100 clock patch, as it was controversial and unnecessary
- Renamed sunxi-msgbox to sun6i-msgbox and sun6i-a31-msgbox
- Added comments about not asserting the reset line
- Dropped A80 DTS changes as they were untested
- Added Ondrej's Tested-by for A83T
- Dropped the demo; replaced with a real arm_scpi fix

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 (6):
dt-bindings: mailbox: Add a binding for the sun6i msgbox
mailbox: sun6i-msgbox: Add a new mailbox driver
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

.../mailbox/allwinner,sun6i-a31-msgbox.yaml | 80 +++++
arch/arm/boot/dts/sun8i-a83t.dtsi | 10 +
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 10 +
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 10 +
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 +
drivers/mailbox/Kconfig | 9 +
drivers/mailbox/Makefile | 2 +
drivers/mailbox/sun6i-msgbox.c | 326 ++++++++++++++++++
8 files changed, 457 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mailbox/allwinner,sun6i-a31-msgbox.yaml
create mode 100644 drivers/mailbox/sun6i-msgbox.c

--
2.24.1

Samuel Holland

unread,
Feb 22, 2020, 11:09:00 PM2/22/20
to Jassi Brar, Maxime Ripard, Chen-Yu Tsai, Rob Herring, Mark Rutland, Philipp Zabel, Ondrej Jirman, Vasily Khoruzhick, devic...@vger.kernel.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux...@googlegroups.com, Samuel Holland
The H3 and H5 SoCs contain a message box that can be used to send
messages and interrupts back and forth between the ARM application CPUs
and the ARISC coprocessor. Add a device tree node for it.

Signed-off-by: Samuel Holland <sam...@sholland.org>
---
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
index 5e9c3060aa08..effae97593b7 100644
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
@@ -239,6 +239,16 @@ ths_calibration: thermal-sensor-calibration@34 {
};
};

+ msgbox: mailbox@1c17000 {
+ compatible = "allwinner,sun8i-h3-msgbox",
+ "allwinner,sun6i-a31-msgbox";
+ reg = <0x01c17000 0x1000>;
+ clocks = <&ccu CLK_BUS_MSGBOX>;
+ resets = <&ccu RST_BUS_MSGBOX>;
+ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+ #mbox-cells = <1>;
+ };
+
usb_otg: usb@1c19000 {
compatible = "allwinner,sun8i-h3-musb";
reg = <0x01c19000 0x400>;
--
2.24.1

Samuel Holland

unread,
Feb 22, 2020, 11:09:01 PM2/22/20
to Jassi Brar, Maxime Ripard, Chen-Yu Tsai, Rob Herring, Mark Rutland, Philipp Zabel, Ondrej Jirman, Vasily Khoruzhick, devic...@vger.kernel.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux...@googlegroups.com, Samuel Holland
The A64 SoC contains a message box that can be used to send messages and
interrupts back and forth between the ARM application CPUs and the ARISC
coprocessor. Add a device tree node for it.

Signed-off-by: Samuel Holland <sam...@sholland.org>
---
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 862b47dc9dc9..18492b542260 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -545,6 +545,16 @@ crypto: crypto@1c15000 {
resets = <&ccu RST_BUS_CE>;
};

+ msgbox: mailbox@1c17000 {
+ compatible = "allwinner,sun50i-a64-msgbox",
+ "allwinner,sun6i-a31-msgbox";
+ reg = <0x01c17000 0x1000>;
+ clocks = <&ccu CLK_BUS_MSGBOX>;
+ resets = <&ccu RST_BUS_MSGBOX>;
+ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+ #mbox-cells = <1>;
+ };
+
usb_otg: usb@1c19000 {
compatible = "allwinner,sun8i-a33-musb";
reg = <0x01c19000 0x0400>;
--
2.24.1

Samuel Holland

unread,
Feb 22, 2020, 11:09:01 PM2/22/20
to Jassi Brar, Maxime Ripard, Chen-Yu Tsai, Rob Herring, Mark Rutland, Philipp Zabel, Ondrej Jirman, Vasily Khoruzhick, devic...@vger.kernel.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux...@googlegroups.com, Samuel Holland
The H6 SoC contains a message box that can be used to send messages and
interrupts back and forth between the ARM application CPUs and the ARISC
coprocessor. Add a device tree node for it.

Signed-off-by: Samuel Holland <sam...@sholland.org>
---
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 3329283e38ab..46e2cb28c86b 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -239,6 +239,16 @@ dma: dma-controller@3002000 {
#dma-cells = <1>;
};

+ msgbox: mailbox@3003000 {
+ compatible = "allwinner,sun50i-h6-msgbox",
+ "allwinner,sun6i-a31-msgbox";
+ reg = <0x03003000 0x1000>;
+ clocks = <&ccu CLK_BUS_MSGBOX>;
+ resets = <&ccu RST_BUS_MSGBOX>;
+ interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+ #mbox-cells = <1>;
+ };
+
sid: efuse@3006000 {
compatible = "allwinner,sun50i-h6-sid";
reg = <0x03006000 0x400>;
--
2.24.1

Samuel Holland

unread,
Apr 1, 2020, 12:55:41 PM4/1/20
to Maxime Ripard, Chen-Yu Tsai, Jassi Brar, Rob Herring, Mark Rutland, Philipp Zabel, Ondrej Jirman, Vasily Khoruzhick, devic...@vger.kernel.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux...@googlegroups.com
On 2/22/20 10:08 PM, Samuel Holland wrote:
> Samuel Holland (6):
> dt-bindings: mailbox: Add a binding for the sun6i msgbox
> mailbox: sun6i-msgbox: Add a new mailbox driver

These two patches have been applied for 5.7[1], so the DTS changes should be
ready to apply as well.

[1]:
https://lore.kernel.org/lkml/CABb+yY0-q+5+pqP-rBHCYpw-...@mail.gmail.com/

Cheers,
Samuel
Reply all
Reply to author
Forward
0 new messages