Skip to content

Commit

Permalink
Merge tag 'mailbox-v6.7' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jassibrar/mailbox

Pull mailbox updates from Jassi Brar:

 - imx: add support for TX Doorbell v2

 - mtk: implement runtime PM

 - zynqmp: add destination mailbox compatible

 - qcom:
    - add another clock provider for IPQ
    - add SM8650 compatible

 - misc: use preferred device_get_match_data()

* tag 'mailbox-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox:
  dt-bindings: mailbox: qcom-ipcc: document the SM8650 Inter-Processor Communication Controller
  mailbox: mtk-cmdq-mailbox: Implement Runtime PM with autosuspend
  mailbox: Use device_get_match_data()
  dt-bindings: zynqmp: add destination mailbox compatible
  dt-bindings: mailbox: qcom: add one more clock provider for IPQ mailbox
  mailbox: imx: support channel type tx doorbell v2
  dt-bindings: mailbox: fsl,mu: add new tx doorbell channel
  • Loading branch information
Linus Torvalds committed Nov 6, 2023
2 parents 77fa2fb + 96cb7a4 commit 7b2c9e4
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 39 deletions.
5 changes: 3 additions & 2 deletions Documentation/devicetree/bindings/mailbox/fsl,mu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@ properties:
type : Channel type
channel : Channel number
This MU support 5 type of unidirectional channels, each type
This MU support 6 type of unidirectional channels, each type
has 4 channels except RST channel which only has 1 channel.
A total of 17 channels. Following types are
A total of 21 channels. Following types are
supported:
0 - TX channel with 32bit transmit register and IRQ transmit
acknowledgment support.
1 - RX channel with 32bit receive register and IRQ support
2 - TX doorbell channel. Without own register and no ACK support.
3 - RX doorbell channel.
4 - RST channel
5 - Tx doorbell channel. With S/W ACK from the other side.
const: 2

clocks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ allOf:
items:
- description: primary pll parent of the clock driver
- description: XO clock
- description: GCC GPLL0 clock source
clock-names:
items:
- const: pll
- const: xo
- const: gpll0

- if:
properties:
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ properties:
- qcom,sm8350-ipcc
- qcom,sm8450-ipcc
- qcom,sm8550-ipcc
- qcom,sm8650-ipcc
- const: qcom,ipcc

reg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ patternProperties:
type: object # DT nodes are json objects
additionalProperties: false
properties:

compatible:
const: xlnx,zynqmp-ipi-dest-mailbox

xlnx,ipi-id:
description:
Remote Xilinx IPI agent ID of which the mailbox is connected to.
Expand All @@ -95,6 +99,7 @@ patternProperties:
- const: remote_response_region

required:
- compatible
- reg
- reg-names
- "#mbox-cells"
Expand Down Expand Up @@ -124,6 +129,7 @@ examples:
ranges;
mailbox: mailbox@ff9905c0 {
compatible = "xlnx,zynqmp-ipi-dest-mailbox";
reg = <0x0 0xff9905c0 0x0 0x20>,
<0x0 0xff9905e0 0x0 0x20>,
<0x0 0xff990e80 0x0 0x20>,
Expand Down
10 changes: 3 additions & 7 deletions drivers/mailbox/bcm-pdc-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
#include <linux/interrupt.h>
#include <linux/wait.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/mailbox_controller.h>
#include <linux/mailbox/brcm-message.h>
Expand Down Expand Up @@ -1494,7 +1493,6 @@ static int pdc_dt_read(struct platform_device *pdev, struct pdc_state *pdcs)
{
struct device *dev = &pdev->dev;
struct device_node *dn = pdev->dev.of_node;
const struct of_device_id *match;
const int *hw_type;
int err;

Expand All @@ -1509,11 +1507,9 @@ static int pdc_dt_read(struct platform_device *pdev, struct pdc_state *pdcs)

pdcs->hw_type = PDC_HW;

match = of_match_device(of_match_ptr(pdc_mbox_of_match), dev);
if (match != NULL) {
hw_type = match->data;
hw_type = device_get_match_data(dev);
if (hw_type)
pdcs->hw_type = *hw_type;
}

return 0;
}
Expand Down
32 changes: 29 additions & 3 deletions drivers/mailbox/imx-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
#include <linux/suspend.h>
#include <linux/slab.h>

#define IMX_MU_CHANS 17
#include "mailbox.h"

#define IMX_MU_CHANS 24
/* TX0/RX0/RXDB[0-3] */
#define IMX_MU_SCU_CHANS 6
/* TX0/RX0 */
Expand All @@ -39,6 +41,7 @@ enum imx_mu_chan_type {
IMX_MU_TYPE_TXDB = 2, /* Tx doorbell */
IMX_MU_TYPE_RXDB = 3, /* Rx doorbell */
IMX_MU_TYPE_RST = 4, /* Reset */
IMX_MU_TYPE_TXDB_V2 = 5, /* Tx doorbell with S/W ACK */
};

enum imx_mu_xcr {
Expand Down Expand Up @@ -226,6 +229,9 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
tasklet_schedule(&cp->txdb_tasklet);
break;
case IMX_MU_TYPE_TXDB_V2:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
break;
default:
dev_warn_ratelimited(priv->dev, "Send data on wrong channel type: %d\n", cp->type);
return -EINVAL;
Expand Down Expand Up @@ -554,6 +560,9 @@ static int imx_mu_startup(struct mbox_chan *chan)
int ret;

pm_runtime_get_sync(priv->dev);
if (cp->type == IMX_MU_TYPE_TXDB_V2)
return 0;

if (cp->type == IMX_MU_TYPE_TXDB) {
/* Tx doorbell don't have ACK support */
tasklet_init(&cp->txdb_tasklet, imx_mu_txdb_tasklet,
Expand Down Expand Up @@ -595,6 +604,11 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
int ret;
u32 sr;

if (cp->type == IMX_MU_TYPE_TXDB_V2) {
pm_runtime_put_sync(priv->dev);
return;
}

if (cp->type == IMX_MU_TYPE_TXDB) {
tasklet_kill(&cp->txdb_tasklet);
pm_runtime_put_sync(priv->dev);
Expand Down Expand Up @@ -671,6 +685,7 @@ static struct mbox_chan *imx_mu_specific_xlate(struct mbox_controller *mbox,
static struct mbox_chan * imx_mu_xlate(struct mbox_controller *mbox,
const struct of_phandle_args *sp)
{
struct mbox_chan *p_chan;
u32 type, idx, chan;

if (sp->args_count != 2) {
Expand All @@ -680,14 +695,25 @@ static struct mbox_chan * imx_mu_xlate(struct mbox_controller *mbox,

type = sp->args[0]; /* channel type */
idx = sp->args[1]; /* index */
chan = type * 4 + idx;

/* RST only supports 1 channel */
if ((type == IMX_MU_TYPE_RST) && idx) {
dev_err(mbox->dev, "Invalid RST channel %d\n", idx);
return ERR_PTR(-EINVAL);
}

chan = type * 4 + idx;
if (chan >= mbox->num_chans) {
dev_err(mbox->dev, "Not supported channel number: %d. (type: %d, idx: %d)\n", chan, type, idx);
return ERR_PTR(-EINVAL);
}

return &mbox->chans[chan];
p_chan = &mbox->chans[chan];

if (type == IMX_MU_TYPE_TXDB_V2)
p_chan->txdone_method = TXDONE_BY_ACK;

return p_chan;
}

static struct mbox_chan *imx_mu_seco_xlate(struct mbox_controller *mbox,
Expand Down
8 changes: 3 additions & 5 deletions drivers/mailbox/mailbox-sti.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include <linux/mailbox_controller.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>

#include "mailbox.h"
Expand Down Expand Up @@ -403,20 +403,18 @@ MODULE_DEVICE_TABLE(of, sti_mailbox_match);

static int sti_mbox_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
struct mbox_controller *mbox;
struct sti_mbox_device *mdev;
struct device_node *np = pdev->dev.of_node;
struct mbox_chan *chans;
int irq;
int ret;

match = of_match_device(sti_mailbox_match, &pdev->dev);
if (!match) {
pdev->dev.platform_data = (struct sti_mbox_pdata *)device_get_match_data(&pdev->dev);
if (!pdev->dev.platform_data) {
dev_err(&pdev->dev, "No configuration found\n");
return -ENODEV;
}
pdev->dev.platform_data = (struct sti_mbox_pdata *) match->data;

mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL);
if (!mdev)
Expand Down
Loading

0 comments on commit 7b2c9e4

Please sign in to comment.