mailbox: rename pl320-ipc specific mailbox.h

The patch 30058677 "ARM / highbank: add support for pl320 IPC"
added a pl320 IPC specific header file as a generic mailbox.h.
This file has been renamed appropriately to allow the
introduction of the generic mailbox API framework.

Signed-off-by: Suman Anna <s-anna@ti.com>
Cc: Mark Langsdorf <mark.langsdorf@calxeda.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ARM: OMAP2+: mbox: remove dependencies with soc.h

The OMAP mailbox platform driver code has been cleaned up to
remove the dependencies with soc.h in preparation for moving
the mailbox code to drivers folder.

The code relied on cpu_is_xxx/soc_is_xxx macros previously to
pick the the right set of mailbox devices and register with the
mailbox driver. This data is now represented in a concise format
and moved to the respective omap_hwmod data files and published
to the driver through the platform data.

Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox: OMAP: introduce mailbox framework

Actually moving it from plat-omap, as this framework/driver code is
supposed to be under drivers/ folder. The framework should work with
the current supported OMAP processors (OMAP1+) that have mailbox and
can be used as a method of interprocessor communication.

The mailbox hardware (in OMAP) uses a queued mailbox-interrupt mechanism
that provides a communication channel between processors through a set of
registers and their associated interrupt signals by sending and receiving
messages.

As part of the migration from plat and mach code:
- Kconfig symbols have been renamed to build OMAP1 or OMAP2+ drivers.
- mailbox.h has been changed from plat to a dedicated drivers/ folder.

Module names have changed too, instead of mailbox_mach:
- OMAP1: mailbox-omap1.ko
- OMAP2+: mailbox-omap2.ko

Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
[s-anna@ti.com: Kconfig fixes for build errors]
Signed-off-by: Suman Anna <s-anna@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: split internal header from API header

Now internal structures can remain hidden to the user and just API
related functions and defines are made available.

Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: rename omap_mbox in mailbox

In order to create a generic mailbox framework, functions
and structures should be renamed in mailbox.

Taking care of remoteproc and tidspbridge while at it.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: create opened message type

Current message type is a u32 to fit HW fifo format.
This should be extended to support any message exchanges
and type of mailbox.

Proposed structure owns the original u32 and an optional
pointer on additional data.

Adaptations made to remoteproc and tidspbridge drivers.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: change protection mechanisms

TX: replace spin by mutex to release CPU
during wait on mailbox resource.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: add shared memory mailbox type

Some mailboxes are made up of cross interrupts
and associated shared memory.
Shared memory mapping is fixed and cross interrupt/shared
memory relation make impossible the use of virtio.
Mailbox framework must be enough opened to support
any kind of mailbox.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: add IRQF_NO_SUSPEND flag

Coprocessor must be accessible during suspend transitions.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: add no_irq send message

For debug purpose, mailbox must be available when
interrupts are disabled to collect dump information.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox: create dbx500 mailbox driver

Add STEriccson DBX500 PRCM mailbox support.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mailbox/omap: check iomem resource before dereferencing it

Add a NULL check for iomem resource in mailbox probe functions.

Signed-off-by: Fernando Guzman Lugo <lugo.fernando@gmail.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox: check for NULL nb in mailbox_put

The mailbox_put function must check the notifier block for
NULL before trying to unregister it.

Signed-off-by: Fernando Guzman Lugo <lugo.fernando@gmail.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox: call request_irq after mbox queues are allocated

The mailbox startup code is enabling the interrupt even before
any of the associated mailbox queues are allocated. Any pending
received mailbox message could cause a kernel panic as soon as
the interrupt is enabled due to the dereferencing of non-existing
mailbox queues within the ISR.

Signed-off-by: Fernando Guzman Lugo <lugo.fernando@gmail.com>
Signed-off-by: Suman Anna <s-anna@ti.com>