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

Commit 35ddb06a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull mailbox updates from Jassi Brar:

 - Introduce device-managed registration
   devm_mbox_controller_un/register and convert drivers to use it

 - Introduce flush api to support clients that must busy-wait in atomic
   context

 - Support multiple controllers per device

 - Hi3660: a bugfix and constify ops structure

 - TI-MsgMgr: off by one bugfix.

 - BCM: switch to spdx license

 - Tegra-HSP: support for shared mailboxes and suspend/resume.

* tag 'mailbox-v4.21' of git://git.linaro.org/landing-teams/working/fujitsu/integration: (30 commits)
  mailbox: tegra-hsp: Use device-managed registration API
  mailbox: tegra-hsp: use devm_kstrdup_const()
  mailbox: tegra-hsp: Add suspend/resume support
  mailbox: tegra-hsp: Add support for shared mailboxes
  dt-bindings: tegra186-hsp: Add shared mailboxes
  mailbox: Allow multiple controllers per device
  mailbox: Support blocking transfers in atomic context
  mailbox: ti-msgmgr: Use device-managed registration API
  mailbox: stm32-ipcc: Use device-managed registration API
  mailbox: rockchip: Use device-managed registration API
  mailbox: qcom-apcs: Use device-managed registration API
  mailbox: platform-mhu: Use device-managed registration API
  mailbox: omap: Use device-managed registration API
  mailbox: mtk-cmdq: Remove needless devm_kfree() calls
  mailbox: mtk-cmdq: Use device-managed registration API
  mailbox: xgene-slimpro: Use device-managed registration API
  mailbox: sti: Use device-managed registration API
  mailbox: altera: Use device-managed registration API
  mailbox: imx: Use device-managed registration API
  mailbox: hi6220: Use device-managed registration API
  ...
parents 6aa293d8 d69e1164
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -15,12 +15,15 @@ Required properties:
    Array of strings.
    one of:
    - "nvidia,tegra186-hsp"
    - "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"
- reg : Offset and length of the register set for the device.
- interrupt-names
    Array of strings.
    Contains a list of names for the interrupts described by the interrupt
    property. May contain the following entries, in any order:
    - "doorbell"
    - "sharedN", where 'N' is a number from zero up to the number of
      external interrupts supported by the HSP instance minus one.
    Users of this binding MUST look up entries in the interrupt property
    by name, using this interrupt-names property to do so.
- interrupts
@@ -29,12 +32,29 @@ Required properties:
    in a matching order.
- #mbox-cells : Should be 2.

The mbox specifier of the "mboxes" property in the client node should
contain two data. The first one should be the HSP type and the second
one should be the ID that the client is going to use. Those information
can be found in the following file.
The mbox specifier of the "mboxes" property in the client node should contain
two cells. The first cell determines the HSP type and the second cell is used
to identify the mailbox that the client is going to use.

- <dt-bindings/mailbox/tegra186-hsp.h>.
For doorbells, the second cell specifies the index of the doorbell to use.

For shared mailboxes, the second cell is composed of two fields:
- bits 31..24:
    A bit mask of flags that further specify how the shared mailbox will be
    used. Valid flags are:
    - bit 31:
        Defines the direction of the mailbox. If set, the mailbox will be used
        as a producer (i.e. used to send data). If cleared, the mailbox is the
        consumer of data sent by a producer.

- bits 23.. 0:
    The index of the shared mailbox to use. The number of available mailboxes
    may vary by instance of the HSP block and SoC generation.

The following file contains definitions that can be used to construct mailbox
specifiers:

    <dt-bindings/mailbox/tegra186-hsp.h>

Example:

+1 −11
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ static int mhu_probe(struct amba_device *adev, const struct amba_id *id)

	amba_set_drvdata(adev, mhu);

	err = mbox_controller_register(&mhu->mbox);
	err = devm_mbox_controller_register(dev, &mhu->mbox);
	if (err) {
		dev_err(dev, "Failed to register mailboxes %d\n", err);
		return err;
@@ -162,15 +162,6 @@ static int mhu_probe(struct amba_device *adev, const struct amba_id *id)
	return 0;
}

static int mhu_remove(struct amba_device *adev)
{
	struct arm_mhu *mhu = amba_get_drvdata(adev);

	mbox_controller_unregister(&mhu->mbox);

	return 0;
}

static struct amba_id mhu_ids[] = {
	{
		.id	= 0x1bb098,
@@ -186,7 +177,6 @@ static struct amba_driver arm_mhu_driver = {
	},
	.id_table	= mhu_ids,
	.probe		= mhu_probe,
	.remove		= mhu_remove,
};
module_amba_driver(arm_mhu_driver);

+1 −3
Original line number Diff line number Diff line
@@ -1665,7 +1665,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
		mbox->controller.chans[index].con_priv = &mbox->rings[index];

	/* Register mailbox controller */
	ret = mbox_controller_register(&mbox->controller);
	ret = devm_mbox_controller_register(dev, &mbox->controller);
	if (ret)
		goto fail_free_debugfs_root;

@@ -1691,8 +1691,6 @@ static int flexrm_mbox_remove(struct platform_device *pdev)
	struct device *dev = &pdev->dev;
	struct flexrm_mbox *mbox = platform_get_drvdata(pdev);

	mbox_controller_unregister(&mbox->controller);

	debugfs_remove_recursive(mbox->root);

	platform_msi_domain_free_irqs(dev);
+1 −3
Original line number Diff line number Diff line
@@ -1471,7 +1471,7 @@ static int pdc_mb_init(struct pdc_state *pdcs)
		mbc->chans[chan_index].con_priv = pdcs;

	/* Register mailbox controller */
	err = mbox_controller_register(mbc);
	err = devm_mbox_controller_register(dev, mbc);
	if (err) {
		dev_crit(dev,
			 "Failed to register PDC mailbox controller. Error %d.",
@@ -1641,8 +1641,6 @@ static int pdc_remove(struct platform_device *pdev)

	pdc_hw_disable(pdcs);

	mbox_controller_unregister(&pdcs->mbc);

	dma_pool_destroy(pdcs->rx_buf_pool);
	dma_pool_destroy(pdcs->ring_pool);
	return 0;
+2 −16
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 *  Copyright (C) 2010,2015 Broadcom
 *  Copyright (C) 2013-2014 Lubomir Rintel
 *  Copyright (C) 2013 Craig McGeachie
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This device provides a mechanism for writing to the mailboxes,
 * that are shared between the ARM and the VideoCore processor
 *
 * Parts of the driver are based on:
 *  - arch/arm/mach-bcm2708/vcio.c file written by Gray Girling that was
 *    obtained from branch "rpi-3.6.y" of git://github.com/raspberrypi/
@@ -178,7 +172,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev)
	if (!mbox->controller.chans)
		return -ENOMEM;

	ret = mbox_controller_register(&mbox->controller);
	ret = devm_mbox_controller_register(dev, &mbox->controller);
	if (ret)
		return ret;

@@ -188,13 +182,6 @@ static int bcm2835_mbox_probe(struct platform_device *pdev)
	return ret;
}

static int bcm2835_mbox_remove(struct platform_device *pdev)
{
	struct bcm2835_mbox *mbox = platform_get_drvdata(pdev);
	mbox_controller_unregister(&mbox->controller);
	return 0;
}

static const struct of_device_id bcm2835_mbox_of_match[] = {
	{ .compatible = "brcm,bcm2835-mbox", },
	{},
@@ -207,7 +194,6 @@ static struct platform_driver bcm2835_mbox_driver = {
		.of_match_table = bcm2835_mbox_of_match,
	},
	.probe		= bcm2835_mbox_probe,
	.remove		= bcm2835_mbox_remove,
};
module_platform_driver(bcm2835_mbox_driver);

Loading