Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a186d38 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents dac0bde4 17b860bb
Loading
Loading
Loading
Loading
+127 −0
Original line number Diff line number Diff line
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 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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);
+14 −12
Original line number Diff line number Diff line
@@ -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;
@@ -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,
@@ -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;
@@ -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");
@@ -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);
Loading