Skip to content

Commit

Permalink
Merge tag 'mailbox-v5.1' of git://git.linaro.org/landing-teams/workin…
Browse files Browse the repository at this point in the history
…g/fujitsu/integration

Pull mailbox updates from Jassi Brar:

 - mailbox-test: support multiple controller instances

 - misc cleanup: IMX, STM32 and Tegra

 - new driver: ZynqMP IPI

* tag 'mailbox-v5.1' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
  mailbox: imx: keep MU irq working during suspend/resume
  dt-bindings: mailbox: Add Xilinx IPI Mailbox
  mailbox: ZynqMP IPI mailbox controller
  mailbox: stm32-ipcc: remove useless device_init_wakeup call
  mailbox: stm32-ipcc: do not enable wakeup source by default
  mailbox: mailbox-test: fix null pointer if no mmio
  mailbox: mailbox-test: fix debugfs in multi-instances
  mailbox: tegra-hsp: mark suspend function as __maybe_unused
  • Loading branch information
torvalds committed Mar 13, 2019
2 parents dac0bde + 17b860b commit 3a186d3
Show file tree
Hide file tree
Showing 9 changed files with 903 additions and 18 deletions.
127 changes: 127 additions & 0 deletions Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
Xilinx IPI Mailbox Controller
========================================

The Xilinx IPI(Inter Processor Interrupt) mailbox controller is to manage
messaging between two Xilinx Zynq UltraScale+ MPSoC IPI agents. Each IPI
agent owns registers used for notification and buffers for message.

+-------------------------------------+
| Xilinx ZynqMP IPI Controller |
+-------------------------------------+
+--------------------------------------------------+
ATF | |
| |
| |
+--------------------------+ |
| |
| |
+--------------------------------------------------+
+------------------------------------------+
| +----------------+ +----------------+ |
Hardware | | IPI Agent | | IPI Buffers | |
| | Registers | | | |
| | | | | |
| +----------------+ +----------------+ |
| |
| Xilinx IPI Agent Block |
+------------------------------------------+


Controller Device Node:
===========================
Required properties:
--------------------
IPI agent node:
- compatible: Shall be: "xlnx,zynqmp-ipi-mailbox"
- interrupt-parent: Phandle for the interrupt controller
- interrupts: Interrupt information corresponding to the
interrupt-names property.
- xlnx,ipi-id: local Xilinx IPI agent ID
- #address-cells: number of address cells of internal IPI mailbox nodes
- #size-cells: number of size cells of internal IPI mailbox nodes

Internal IPI mailbox node:
- reg: IPI buffers address ranges
- reg-names: Names of the reg resources. It should have:
* local_request_region
- IPI request msg buffer written by local and read
by remote
* local_response_region
- IPI response msg buffer written by local and read
by remote
* remote_request_region
- IPI request msg buffer written by remote and read
by local
* remote_response_region
- IPI response msg buffer written by remote and read
by local
- #mbox-cells: Shall be 1. It contains:
* tx(0) or rx(1) channel
- xlnx,ipi-id: remote Xilinx IPI agent ID of which the mailbox is
connected to.

Optional properties:
--------------------
- method: The method of accessing the IPI agent registers.
Permitted values are: "smc" and "hvc". Default is
"smc".

Client Device Node:
===========================
Required properties:
--------------------
- mboxes: Standard property to specify a mailbox
(See ./mailbox.txt)
- mbox-names: List of identifier strings for each mailbox
channel.

Example:
===========================
zynqmp_ipi {
compatible = "xlnx,zynqmp-ipi-mailbox";
interrupt-parent = <&gic>;
interrupts = <0 29 4>;
xlnx,ipi-id = <0>;
#address-cells = <1>;
#size-cells = <1>;
ranges;

/* APU<->RPU0 IPI mailbox controller */
ipi_mailbox_rpu0: mailbox@ff90400 {
reg = <0xff990400 0x20>,
<0xff990420 0x20>,
<0xff990080 0x20>,
<0xff9900a0 0x20>;
reg-names = "local_request_region",
"local_response_region",
"remote_request_region",
"remote_response_region";
#mbox-cells = <1>;
xlnx,ipi-id = <1>;
};
/* APU<->RPU1 IPI mailbox controller */
ipi_mailbox_rpu1: mailbox@ff990440 {
reg = <0xff990440 0x20>,
<0xff990460 0x20>,
<0xff990280 0x20>,
<0xff9902a0 0x20>;
reg-names = "local_request_region",
"local_response_region",
"remote_request_region",
"remote_response_region";
#mbox-cells = <1>;
xlnx,ipi-id = <2>;
};
};
rpu0 {
...
mboxes = <&ipi_mailbox_rpu0 0>,
<&ipi_mailbox_rpu0 1>;
mbox-names = "tx", "rx";
};
rpu1 {
...
mboxes = <&ipi_mailbox_rpu1 0>,
<&ipi_mailbox_rpu1 1>;
mbox-names = "tx", "rx";
};
11 changes: 11 additions & 0 deletions drivers/mailbox/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,15 @@ config MTK_CMDQ_MBOX
mailbox driver. The CMDQ is used to help read/write registers with
critical time limitation, such as updating display configuration
during the vblank.

config ZYNQMP_IPI_MBOX
bool "Xilinx ZynqMP IPI Mailbox"
depends on ARCH_ZYNQMP && OF
help
Say yes here to add support for Xilinx IPI mailbox driver.
This mailbox driver is used to send notification or short message
between processors with Xilinx ZynqMP IPI. It will place the
message to the IPI buffer and will access the IPI control
registers to kick the other processor or enquire status.

endif
2 changes: 2 additions & 0 deletions drivers/mailbox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ obj-$(CONFIG_TEGRA_HSP_MBOX) += tegra-hsp.o
obj-$(CONFIG_STM32_IPCC) += stm32-ipcc.o

obj-$(CONFIG_MTK_CMDQ_MBOX) += mtk-cmdq-mailbox.o

obj-$(CONFIG_ZYNQMP_IPI_MBOX) += zynqmp-ipi-mailbox.o
4 changes: 2 additions & 2 deletions drivers/mailbox/imx-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ static int imx_mu_startup(struct mbox_chan *chan)
return 0;
}

ret = request_irq(priv->irq, imx_mu_isr, IRQF_SHARED, cp->irq_desc,
chan);
ret = request_irq(priv->irq, imx_mu_isr, IRQF_SHARED |
IRQF_NO_SUSPEND, cp->irq_desc, chan);
if (ret) {
dev_err(priv->dev,
"Unable to acquire IRQ %d\n", priv->irq);
Expand Down
26 changes: 14 additions & 12 deletions drivers/mailbox/mailbox-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
(MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE))

static bool mbox_data_ready;
static struct dentry *root_debugfs_dir;

struct mbox_test_device {
struct device *dev;
Expand All @@ -45,6 +44,7 @@ struct mbox_test_device {
spinlock_t lock;
wait_queue_head_t waitq;
struct fasync_struct *async_queue;
struct dentry *root_debugfs_dir;
};

static ssize_t mbox_test_signal_write(struct file *filp,
Expand Down Expand Up @@ -262,16 +262,16 @@ static int mbox_test_add_debugfs(struct platform_device *pdev,
if (!debugfs_initialized())
return 0;

root_debugfs_dir = debugfs_create_dir("mailbox", NULL);
if (!root_debugfs_dir) {
tdev->root_debugfs_dir = debugfs_create_dir(dev_name(&pdev->dev), NULL);
if (!tdev->root_debugfs_dir) {
dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n");
return -EINVAL;
}

debugfs_create_file("message", 0600, root_debugfs_dir,
debugfs_create_file("message", 0600, tdev->root_debugfs_dir,
tdev, &mbox_test_message_ops);

debugfs_create_file("signal", 0200, root_debugfs_dir,
debugfs_create_file("signal", 0200, tdev->root_debugfs_dir,
tdev, &mbox_test_signal_ops);

return 0;
Expand Down Expand Up @@ -363,22 +363,24 @@ static int mbox_test_probe(struct platform_device *pdev)

/* It's okay for MMIO to be NULL */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
size = resource_size(res);
tdev->tx_mmio = devm_ioremap_resource(&pdev->dev, res);
if (PTR_ERR(tdev->tx_mmio) == -EBUSY)
if (PTR_ERR(tdev->tx_mmio) == -EBUSY) {
/* if reserved area in SRAM, try just ioremap */
size = resource_size(res);
tdev->tx_mmio = devm_ioremap(&pdev->dev, res->start, size);
else if (IS_ERR(tdev->tx_mmio))
} else if (IS_ERR(tdev->tx_mmio)) {
tdev->tx_mmio = NULL;
}

/* If specified, second reg entry is Rx MMIO */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
size = resource_size(res);
tdev->rx_mmio = devm_ioremap_resource(&pdev->dev, res);
if (PTR_ERR(tdev->rx_mmio) == -EBUSY)
if (PTR_ERR(tdev->rx_mmio) == -EBUSY) {
size = resource_size(res);
tdev->rx_mmio = devm_ioremap(&pdev->dev, res->start, size);
else if (IS_ERR(tdev->rx_mmio))
} else if (IS_ERR(tdev->rx_mmio)) {
tdev->rx_mmio = tdev->tx_mmio;
}

tdev->tx_channel = mbox_test_request_channel(pdev, "tx");
tdev->rx_channel = mbox_test_request_channel(pdev, "rx");
Expand Down Expand Up @@ -416,7 +418,7 @@ static int mbox_test_remove(struct platform_device *pdev)
{
struct mbox_test_device *tdev = platform_get_drvdata(pdev);

debugfs_remove_recursive(root_debugfs_dir);
debugfs_remove_recursive(tdev->root_debugfs_dir);

if (tdev->tx_channel)
mbox_free_channel(tdev->tx_channel);
Expand Down
4 changes: 1 addition & 3 deletions drivers/mailbox/stm32-ipcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,12 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
goto err_clk;
}

device_init_wakeup(dev, true);
device_set_wakeup_capable(dev, true);
ret = dev_pm_set_dedicated_wake_irq(dev, ipcc->wkp);
if (ret) {
dev_err(dev, "Failed to set wake up irq\n");
goto err_init_wkp;
}
} else {
device_init_wakeup(dev, false);
}

/* mailbox controller */
Expand Down
2 changes: 1 addition & 1 deletion drivers/mailbox/tegra-hsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ static int tegra_hsp_probe(struct platform_device *pdev)
return 0;
}

static int tegra_hsp_resume(struct device *dev)
static int __maybe_unused tegra_hsp_resume(struct device *dev)
{
struct tegra_hsp *hsp = dev_get_drvdata(dev);
unsigned int i;
Expand Down
Loading

0 comments on commit 3a186d3

Please sign in to comment.