Mailbox: Provide support STi based platforms
Subsystems (2)
v4 cover Mailbox: Provide support STi based platforms
Hi Jassi,
This should be it. Exciting times!
ST's platforms currently support a maximum of 5 Mailboxes, one for each of the supported co-processors situated on the platform. Each Mailbox is divided up into 4 instances which consist of 32 channels. Messages are passed between the application and co-processors using shared memory areas.
Also included in the set is an example Client which should be generic enough to use as a testing environment for all Mailbox IPs which use shared memory or the API to pass messages. With small changes, it should also be able to test more extravagant implementations.
v3 -> v4:
- More protection in MBOX_BASE() MACRO
- Remove unused tx-only marker
v2 => v3:
- Controller
- Shared (DT <=> Device Driver) defines removed
- Return actual error codes instead of NULL in xlate()
- Not passing 'direction' configuration via DT anymore
- Removed all accompanying configuration checking code
- Test F/W
- Allow Rx-only and Tx-only controllers to be tested
- Cater for controllers requiring pre-Tx 'signal' to be sent
- Supply 'wr-' message debugfs file
- When written to, will Tx message through Mailbox Framework
- When read from, will print out a hexdump of Rx'ed message
v1 => v2:
- New MACRO() to obtain base address for a given instance
- Move locking into the structure it protects
- Stop checking for 'ready' state when sending data
- Don't clear channel data (that belongs to the API)
- #define register offsets instead of providing via pdata
- Register driver with module_platform_driver()
Lee Jones (5):
mailbox: dt: Supply bindings for ST's Mailbox IP
mailbox: Add support for ST's Mailbox IP
ARM: STi: stih407-family: Add nodes for Mailbox
mailbox: Add generic mechanism for testing Mailbox Controllers
ARM: STi: DT: STiH407: Enable Mailbox testing facility
.../devicetree/bindings/mailbox/sti-mailbox.txt | 52 +++ arch/arm/boot/dts/stih407-family.dtsi | 42 ++ drivers/mailbox/Kconfig | 14 + drivers/mailbox/Makefile | 4 + drivers/mailbox/mailbox-sti.c | 516 +++++++++++++++++++++ drivers/mailbox/mailbox-test.c | 361 ++++++++++++++ 6 files changed, 989 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/sti-mailbox.txt create mode 100644 drivers/mailbox/mailbox-sti.c create mode 100644 drivers/mailbox/mailbox-test.c
Signature · 1 line
1.9.1
PATCH v4 1/5 mailbox: dt: Supply bindings for ST's Mailbox IP
--- .../devicetree/bindings/mailbox/sti-mailbox.txt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/sti-mailbox.txt
Documentation/devicetree/bindings/mailbox/sti-mailbox.txt new file +52 -0
@@ -0,0 +1,52 @@ +ST Microelectronics Mailbox Driver + +Each ST Mailbox IP currently consists of 4 instances of 32 channels. Messages +are passed between Application and Remote processors using shared memory. + +Controller +---------- + +Required properties: +- compatible : Should be "st,stih407-mailbox" +- reg : Offset and length of the device's register set +- mbox-name : Name of the mailbox +- #mbox-cells: : Must be 2 + <&phandle instance channel direction> + phandle : Label name of controller + instance : Instance number + channel : Channel number + +Optional properties +- interrupts : Contains the IRQ line for a Rx mailbox +- tx-only : Denotes Mailbox cannot receive messages + +Example: + +mailbox0: mailbox at 0 { + compatible = "st,stih407-mailbox"; + reg = <0x08f00000 0x1000>; + interrupts = <GIC_SPI 1 IRQ_TYPE_NONE>; + #mbox-cells = <2>; + mbox-name = "a9"; +}; + +Client +------ + +Required properties: +- compatible : Many (See the client docs) +- reg : Shared (between Application and Remote) memory address +- mboxes : Standard property to specify a Mailbox (See ./mailbox.txt) + Cells must match 'mbox-cells' (See Controller docs above) + +Optional properties +- mbox-names : Name given to channels seen in the 'mboxes' property. + +Example: + +mailbox_test { + compatible = "mailbox_test"; + reg = <0x[shared_memory_address], [shared_memory_size]>; + mboxes = <&mailbox2 0 1>, <&mailbox0 2 1>; + mbox-names = "tx", "rx"; +};
Signature · 1 line
1.9.1
PATCH v4 2/5 mailbox: Add support for ST's Mailbox IP
In reply to Lee JonesST's platforms currently support a maximum of 5 Mailboxes, one for each of the supported co-processors situated on the platform. Each Mailbox is divided up into 4 instances which consist of 32 channels. Messages are passed between the application and co-processors using shared memory areas. It is the Client's responsibility to manage these areas.
--- drivers/mailbox/Kconfig | 7 + drivers/mailbox/Makefile | 2 + drivers/mailbox/mailbox-sti.c | 516 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 525 insertions(+) create mode 100644 drivers/mailbox/mailbox-sti.c
drivers/mailbox/Kconfig +7 -0
@@ -70,4 +70,11 @@ config BCM2835_MBOX the services of the Videocore. Say Y here if you want to use the BCM2835 Mailbox. +config STI_MBOX + tristate "STI Mailbox framework support" + depends on ARCH_STI && OF + help + Mailbox implementation for STMicroelectonics family chips with + hardware for interprocessor communication. + endif
drivers/mailbox/Makefile +2 -0
@@ -13,3 +13,5 @@ obj-$(CONFIG_PCC) += pcc.o obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o + +obj-$(CONFIG_STI_MBOX) += mailbox-sti.o
drivers/mailbox/mailbox-sti.c new file +516 -0
516 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 3/5 ARM: STi: stih407-family: Add nodes for Mailbox
In reply to Lee JonesThis patch supplies the Mailbox Controller nodes. In order to request channels, these nodes will be referenced by Mailbox Client nodes.
--- arch/arm/boot/dts/stih407-family.dtsi | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/arm/boot/dts/stih407-family.dtsi +36 -0
@@ -565,5 +565,41 @@ <&phy_port2 PHY_TYPE_USB3>; }; }; + + mailbox0: mailbox at 0 { + compatible = "st,stih407-mailbox"; + reg = <0x8f00000 0x1000>; + interrupts = <GIC_SPI 1 IRQ_TYPE_NONE>; + #mbox-cells = <2>; + mbox-name = "a9"; + status = "okay"; + }; + + mailbox1: mailbox at 1 { + compatible = "st,stih407-mailbox"; + reg = <0x8f01000 0x1000>; + #mbox-cells = <2>; + mbox-name = "st231_gp_1"; + status = "okay"; + tx-only; + }; + + mailbox2: mailbox at 2 { + compatible = "st,stih407-mailbox"; + reg = <0x8f02000 0x1000>; + #mbox-cells = <2>; + mbox-name = "st231_gp_0"; + status = "okay"; + tx-only; + }; + + mailbox3: mailbox at 3 { + compatible = "st,stih407-mailbox"; + reg = <0x8f03000 0x1000>; + #mbox-cells = <2>; + mbox-name = "st231_audio_video"; + status = "okay"; + tx-only; + }; }; };
Signature · 1 line
1.9.1
PATCH v4 4/5 mailbox: Add generic mechanism for testing Mailbox Controllers
In reply to Lee JonesThis particular Client implementation uses shared memory in order to pass messages between Mailbox users; however, it can be easily hacked to support any type of Controller.
--- drivers/mailbox/Kconfig | 7 + drivers/mailbox/Makefile | 2 + drivers/mailbox/mailbox-test.c | 361 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 370 insertions(+) create mode 100644 drivers/mailbox/mailbox-test.c
drivers/mailbox/Kconfig +7 -0
@@ -77,4 +77,11 @@ config STI_MBOX Mailbox implementation for STMicroelectonics family chips with hardware for interprocessor communication. +config MAILBOX_TEST + tristate "Mailbox Test Client" + depends on OF + help + Test client to help with testing new Controller driver + implementations. + endif
drivers/mailbox/Makefile +2 -0
@@ -2,6 +2,8 @@ obj-$(CONFIG_MAILBOX) += mailbox.o +obj-$(CONFIG_MAILBOX_TEST) += mailbox-test.o + obj-$(CONFIG_ARM_MHU) += arm_mhu.o obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o
drivers/mailbox/mailbox-test.c new file +361 -0
361 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 5/5 ARM: STi: DT: STiH407: Enable Mailbox testing facility
In reply to Lee JonesThis patch supplies a Client node to enable the Mailbox testing facility. It will be used to send and receive messages from any given co-processor in order to test the STi Mailbox Controller driver.
--- arch/arm/boot/dts/stih407-family.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/stih407-family.dtsi +6 -0
@@ -566,6 +566,12 @@ }; }; + mailbox_test { + compatible = "mailbox_test"; + mboxes = <&mailbox2 1 31>, <&mailbox0 1 31>; + mbox-names = "tx", "rx"; + }; + mailbox0: mailbox at 0 { compatible = "st,stih407-mailbox"; reg = <0x8f00000 0x1000>;
Signature · 1 line
1.9.1
Quoted 10 lines · Lee Jones
Hi Jassi,
This should be it. Exciting times!
ST's platforms currently support a maximum of 5 Mailboxes, one for each of the supported co-processors situated on the platform. Each Mailbox is divided up into 4 instances which consist of 32 channels. Messages are passed between the application and co-processors using shared memory areas.
Quoted 9 lines
Also included in the set is an example Client which should be generic enough to use as a testing environment for all Mailbox IPs which use shared memory or the API to pass messages. With small changes, it should also be able to test more extravagant implementations.
v3 -> v4:
- More protection inMBOX_BASE()MACRO
- Remove unused tx-only marker
Are you sure about the tx-only marker? :)
Since it is also a DT property, I think we should have it removed before we apply the patchset. Lets get it done today.
Thanks
Quoted 16 lines · Jassi Brar
Quoted 15 lines · Lee Jones
Hi Jassi,
This should be it. Exciting times!
ST's platforms currently support a maximum of 5 Mailboxes, one for each of the supported co-processors situated on the platform. Each Mailbox is divided up into 4 instances which consist of 32 channels. Messages are passed between the application and co-processors using shared memory areas.
Also included in the set is an example Client which should be generic enough to use as a testing environment for all Mailbox IPs which use shared memory or the API to pass messages. With small changes, it should also be able to test more extravagant implementations.
Quoted 8 lines
Quoted 4 lines
v3 -> v4:
- More protection inMBOX_BASE()MACRO
- Remove unused tx-only markerAre you sure about the tx-only marker? :)
Since it is also a DT property, I think we should have it removed before we apply the patchset. Lets get it done today.
Wow! I can't even explain that. It's gone from my local repo!
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog