Skip to contentSkip to conversation

Add support for Broadcom iProc mailbox controller

PATCH Superseded Jonathan Richardson 2 participants 7 messages Jan 26, 2017

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add support for Broadcom iProc mailbox controller

This patch set contains mailbox support for Broadcom iProc based SoC's. The mailbox controller handles all communication with a Cortex-M0 MCU processor that provides support for power, clock, and reset management.

The patch set enables the mailbox controller for Cygnus and also interrupt support for the Cygnus CRMU GPIO driver which requires use of the M0 processor.

Changes from v2:
- Fixed binding to remove leading 0 (Rob's comment). Also added more detail as suggested by Jassi.
- Added changelog to dt binding and enable dts commits.
- Changed year in copyright in bcm_iproc_mailbox.h.
- Changes to bcm-cygnus.dtsi were prematurely merged into the mainline after Rob acked the DT changes but Jassi suggested changes to the mailbox driver. The result was that the mailbox controller node and changes to the crmu gpio driver to enable interrupt handling were incorrectly added to the dtsi. A commit is included in this patchset to revert those changes. Enabling interrupt handling in the the crmu gpio driver will be introduced when the interrupt controller driver is added to provide mailbox interrupt support.

Jonathan Richardson (4):
dt-bindings: Document Broadcom iProc mailbox controller driver
mailbox: Add iProc mailbox controller driver
ARM: dts: Remove Broadcom iProc mailbox controller node
ARM: dts: Enable Broadcom iProc mailbox controller

 .../bindings/mailbox/brcm,iproc-mailbox.txt        |  18 ++
 arch/arm/boot/dts/bcm-cygnus.dtsi                  |   8 +-
 drivers/mailbox/Kconfig                            |  10 ++
 drivers/mailbox/Makefile                           |   2 +
 drivers/mailbox/bcm-iproc-mailbox.c                | 199 +++++++++++++++++++++
 include/linux/mailbox/bcm_iproc_mailbox.h          |  32 ++++
 6 files changed, 262 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,iproc-mailbox.txt
 create mode 100644 drivers/mailbox/bcm-iproc-mailbox.c
 create mode 100644 include/linux/mailbox/bcm_iproc_mailbox.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/4 dt-bindings: Document Broadcom iProc mailbox controller driver

Add binding document for brcm,iproc-mailbox.

---
 .../devicetree/bindings/mailbox/brcm,iproc-mailbox.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,iproc-mailbox.txt
Documentation/devicetree/bindings/mailbox/brcm,iproc-mailbox.txt new file +18 -0
new file mode 100644
index 0000000..a832feb
@@ -0,0 +1,18 @@
+* Broadcom's iProc Mailbox Controller
+
+Broadcom iProc architected SoC's have an always on Cortex-M0 MCU processor that
+handles support for power, clock, and reset management. The iProc mailbox
+controller handles all communication with this processor.
+
+Required properties:
+- compatible: Must be "brcm,iproc-mailbox"
+- reg: Defines the base address of the mailbox controller.
+- #mbox-cells: Must be 1.
+
+Example:
+
+	mailbox: mailbox at 3024024 {
+		compatible = "brcm,iproc-mailbox";
+		reg = <0x03024024 0x8>;
+		#mbox-cells = <1>;
+	};
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 2/4 mailbox: Add iProc mailbox controller driver

In reply to Jonathan Richardson

The Broadcom iProc mailbox controller handles all communication with a Cortex-M0 MCU processor that provides support for power, clock, and reset management.

---
 drivers/mailbox/Kconfig                   |  10 ++
 drivers/mailbox/Makefile                  |   2 +
 drivers/mailbox/bcm-iproc-mailbox.c       | 199 ++++++++++++++++++++++++++++++
 include/linux/mailbox/bcm_iproc_mailbox.h |  32 +++++
 4 files changed, 243 insertions(+)
 create mode 100644 drivers/mailbox/bcm-iproc-mailbox.c
 create mode 100644 include/linux/mailbox/bcm_iproc_mailbox.h
drivers/mailbox/Kconfig +10 -0
index ceff415..b8828be 100644
@@ -152,4 +152,14 @@ config BCM_PDC_MBOX
 	  Mailbox implementation for the Broadcom PDC ring manager,
 	  which provides access to various offload engines on Broadcom
 	  SoCs. Say Y here if you want to use the Broadcom PDC.
+
+config BCM_IPROC_MBOX
+	bool "Broadcom iProc Mailbox"
+	depends on ARCH_BCM_IPROC || COMPILE_TEST
+	default ARCH_BCM_IPROC
+	help
+	  Broadcom iProc architected SoC's have an always on Cortex-M0 MCU processor
+	  that handles support for power, clock, and reset management. The iProc
+	  mailbox controller handles all communication with this processor.
+
 endif
drivers/mailbox/Makefile +2 -0
index 7dde4f6..374f852 100644
@@ -31,3 +31,5 @@ obj-$(CONFIG_HI6220_MBOX)	+= hi6220-mailbox.o
 obj-$(CONFIG_BCM_PDC_MBOX)	+= bcm-pdc-mailbox.o
 
 obj-$(CONFIG_TEGRA_HSP_MBOX)	+= tegra-hsp.o
+
+obj-$(CONFIG_BCM_IPROC_MBOX)	+= bcm-iproc-mailbox.o
drivers/mailbox/bcm-iproc-mailbox.c new file +199 -0

199 lines not on this page · raw message

include/linux/mailbox/bcm_iproc_mailbox.h new file +32 -0
new file mode 100644
index 0000000..6d0b07c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017 Broadcom.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef _BCM_IPROC_MAILBOX_H_
+#define _BCM_IPROC_MAILBOX_H_
+
+/*
+ * A message to send to the M0 processor.
+ * @cmd Command to send.
+ * @param Parameter corresponding to command.
+ * @wait_ack true if mbox_send_message() should wait for a reply from the M0,
+ *   false if the M0 doesn't reply. This depends on the message being sent.
+ * @reply_code The response code from the M0 for the command sent (wait_ack was
+ *   set to true).
+ */
+struct iproc_mbox_msg {
+	u32       cmd;
+	u32       param;
+	bool      wait_ack;
+	u32       reply_code;
+};
+
+#endif
Signature · 1 line
1.9.1
#3 lore raw

PATCH v3 3/4 ARM: dts: Remove Broadcom iProc mailbox controller node

In reply to Jonathan Richardson

The mailbox controller node and crmu gpio driver changes to enable interrupt support were prematurely merged and don't reflect the mailbox controller driver. They are being reverted.

---
 arch/arm/boot/dts/bcm-cygnus.dtsi | 12 ------------
 1 file changed, 12 deletions(-)
arch/arm/boot/dts/bcm-cygnus.dtsi +0 -12
index 8833a4c..cf02271 100644
@@ -121,15 +121,6 @@
 			      <0x0301d24c 0x2c>;
 		};
 
-		mailbox: mailbox at 03024024 {
-			compatible = "brcm,iproc-mailbox";
-			reg = <0x03024024 0x40>;
-			interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
-			#interrupt-cells = <1>;
-			interrupt-controller;
-			#mbox-cells = <1>;
-		};
-
 		gpio_crmu: gpio at 03024800 {
 			compatible = "brcm,cygnus-crmu-gpio";
 			reg = <0x03024800 0x50>,
@@ -137,9 +128,6 @@
 			ngpios = <6>;
 			#gpio-cells = <2>;
 			gpio-controller;
-			interrupt-controller;
-			interrupt-parent = <&mailbox>;
-			interrupts = <0>;
 		};
 
 		i2c0: i2c at 18008000 {
Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 4/4 ARM: dts: Enable Broadcom iProc mailbox controller

In reply to Jonathan Richardson

Add node for iProc mailbox controller and enable.

---
 arch/arm/boot/dts/bcm-cygnus.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm-cygnus.dtsi +6 -0
index cf02271..606e11a 100644
@@ -121,6 +121,12 @@
 			      <0x0301d24c 0x2c>;
 		};
 
+		mailbox: mailbox at 03024024 {
+			compatible = "brcm,iproc-mailbox";
+			reg = <0x03024024 0x8>;
+			#mbox-cells = <1>;
+		};
+
 		gpio_crmu: gpio at 03024800 {
 			compatible = "brcm,cygnus-crmu-gpio";
 			reg = <0x03024800 0x50>,
Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 4/4 ARM: dts: Enable Broadcom iProc mailbox controller

Quoted 18 lines · Jonathan Richardson

Add node for iProc mailbox controller and enable.

---
 arch/arm/boot/dts/bcm-cygnus.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm-cygnus.dtsi +0 -0
index cf02271..606e11a 100644

arch/arm/boot/dts/bcm-cygnus.dtsi line 128

Quoted 8 lines
arch/arm/boot/dts/bcm-cygnus.dtsi +5 -0
@@ -121,6 +121,12 @@
 			      <0x0301d24c 0x2c>;
 		};
 
+		mailbox: mailbox at 03024024 {
+			compatible = "brcm,iproc-mailbox";
+			reg = <0x03024024 0x8>;
+			#mbox-cells = <1>;
+		};

Can you squash this change with the previous one? It seems to me like you are just removing the interrupt properties, and updating the reg property to be only 0x8 bytes.

Thank you

Signature · 1 line
Florian
#6 lore raw

PATCH v3 4/4 ARM: dts: Enable Broadcom iProc mailbox controller

Quoted 31 lines · Florian Fainelli
Quoted 18 lines · Jonathan Richardson

Add node for iProc mailbox controller and enable.

---
 arch/arm/boot/dts/bcm-cygnus.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm-cygnus.dtsi +0 -0
index cf02271..606e11a 100644

arch/arm/boot/dts/bcm-cygnus.dtsi line 128

Quoted 8 lines
arch/arm/boot/dts/bcm-cygnus.dtsi +5 -0
@@ -121,6 +121,12 @@
 			      <0x0301d24c 0x2c>;
 		};
 
+		mailbox: mailbox at 03024024 {
+			compatible = "brcm,iproc-mailbox";
+			reg = <0x03024024 0x8>;
+			#mbox-cells = <1>;
+		};

Can you squash this change with the previous one? It seems to me like you are just removing the interrupt properties, and updating the reg property to be only 0x8 bytes.

Quoted 1 line

Thank you

And removing the interrupt controller properties from the mailbox controller. I don't mind squashing it if there are no objections.