Skip to contentSkip to conversation

mailbox: Add Altera mailbox driver

PATCH New Ley Foon Tan 1 participant 1 message Feb 4, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mailbox: Add Altera mailbox driver

The Altera mailbox allows for interprocessor communication. It supports only one channel and work as either sender or receiver.

---

v3:
- s/readl/readl_relaxed and s/writel/writel_relaxed
- Change polling interval to 5ms
- Change to use polling mode if request_irq() is failed

v2:
Resolved comment from Dinh and Suman.
- Alphabetize the headers.
- Removed WARN_ON() checking
- Use devm_kzalloc to allocate struct mbox_chan
- Change __raw_readl/__raw_writel to readl/writel
- Check interrupt mode before enable interrupt
- Change to use module_platform_driver()
- Remove platform_set_drvdata(pdev, NULL);
- Fix "Alignment should match open parenthesis" warning
- Update MAINTAINERS file

---
 .../devicetree/bindings/mailbox/altera-mailbox.txt |   49 +++
 MAINTAINERS                                        |    6 +
 drivers/mailbox/Kconfig                            |    6 +
 drivers/mailbox/Makefile                           |    2 +
 drivers/mailbox/mailbox-altera.c                   |  388 ++++++++++++++++++++
 5 files changed, 451 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mailbox/altera-mailbox.txt
 create mode 100644 drivers/mailbox/mailbox-altera.c
Documentation/devicetree/bindings/mailbox/altera-mailbox.txt new file +49 -0
new file mode 100644
index 0000000..c261979
@@ -0,0 +1,49 @@
+Altera Mailbox Driver
+=====================
+
+Required properties:
+- compatible :	"altr,mailbox-1.0".
+- reg : 	physical base address of the mailbox and length of
+		memory mapped region.
+- #mbox-cells:	Common mailbox binding property to identify the number
+		of cells required for the mailbox specifier. Should be 1.
+
+Optional properties:
+- interrupt-parent :	interrupt source phandle.
+- interrupts :		interrupt number. The interrupt specifier format
+			depends on the interrupt controller parent.
+
+Example:
+	mbox_tx: mailbox@0x100 {
+		compatible = "altr,mailbox-1.0";
+		reg = <0x100 0x8>;
+		interrupt-parent = < &gic_0 >;
+		interrupts = <5>;
+		#mbox-cells = <1>;
+	};
+
+	mbox_rx: mailbox@0x200 {
+		compatible = "altr,mailbox-1.0";
+		reg = <0x200 0x8>;
+		interrupt-parent = < &gic_0 >;
+		interrupts = <6>;
+		#mbox-cells = <1>;
+	};
+
+Mailbox client
+===============
+"mboxes" and the optional "mbox-names" (please see
+Documentation/devicetree/bindings/mailbox/mailbox.txt for details). Each value
+of the mboxes property should contain a phandle to the mailbox controller
+device node and second argument is the channel index. It must be 0 (hardware
+support only one channel).The equivalent "mbox-names" property value can be
+used to give a name to the communication channel to be used by the client user.
+
+Example:
+	mclient0: mclient0@0x400 {
+		compatible = "client-1.0";
+		reg = <0x400 0x10>;
+		mbox-names = "mbox-tx", "mbox-rx";
+		mboxes = <&mbox_tx 0>,
+			 <&mbox_rx 0>;
+	};
MAINTAINERS +6 -0
index aaa039d..f2f0faf 100644
@@ -563,6 +563,12 @@ S:	Odd Fixes
 L:	[email protected]
 F:	arch/alpha/
 
+ALTERA MAILBOX DRIVER
+M:	Ley Foon Tan <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	drivers/mailbox/mailbox-altera.c
+
 ALTERA TRIPLE SPEED ETHERNET DRIVER
 M:	Vince Bridgers <[email protected]>
 L:	[email protected]
drivers/mailbox/Kconfig +6 -0
index c04fed9..84325f2 100644
@@ -45,4 +45,10 @@ config PCC
 	  states). Select this driver if your platform implements the
 	  PCC clients mentioned above.
 
+config ALTERA_MBOX
+	tristate "Altera Mailbox"
+	help
+	  An implementation of the Altera Mailbox soft core. It is used
+	  to send message between processors. Say Y here if you want to use the
+	  Altera mailbox support.
 endif
drivers/mailbox/Makefile +2 -0
index dd412c2..2e79231 100644
@@ -7,3 +7,5 @@ obj-$(CONFIG_PL320_MBOX)	+= pl320-ipc.o
 obj-$(CONFIG_OMAP2PLUS_MBOX)	+= omap-mailbox.o
 
 obj-$(CONFIG_PCC)		+= pcc.o
+
+obj-$(CONFIG_ALTERA_MBOX)	+= mailbox-altera.o
drivers/mailbox/mailbox-altera.c new file +388 -0

388 lines not on this page · raw message

Signature · 1 line
1.7.7.4