Skip to content

Commit 7b2c9e4

Browse files
committed
Merge tag 'mailbox-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/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
2 parents 77fa2fb + 96cb7a4 commit 7b2c9e4

File tree

9 files changed

+117
-39
lines changed

9 files changed

+117
-39
lines changed

Documentation/devicetree/bindings/mailbox/fsl,mu.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ properties:
7272
type : Channel type
7373
channel : Channel number
7474
75-
This MU support 5 type of unidirectional channels, each type
75+
This MU support 6 type of unidirectional channels, each type
7676
has 4 channels except RST channel which only has 1 channel.
77-
A total of 17 channels. Following types are
77+
A total of 21 channels. Following types are
7878
supported:
7979
0 - TX channel with 32bit transmit register and IRQ transmit
8080
acknowledgment support.
8181
1 - RX channel with 32bit receive register and IRQ support
8282
2 - TX doorbell channel. Without own register and no ACK support.
8383
3 - RX doorbell channel.
8484
4 - RST channel
85+
5 - Tx doorbell channel. With S/W ACK from the other side.
8586
const: 2
8687

8788
clocks:

Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,12 @@ allOf:
125125
items:
126126
- description: primary pll parent of the clock driver
127127
- description: XO clock
128+
- description: GCC GPLL0 clock source
128129
clock-names:
129130
items:
130131
- const: pll
131132
- const: xo
133+
- const: gpll0
132134

133135
- if:
134136
properties:

Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ properties:
3434
- qcom,sm8350-ipcc
3535
- qcom,sm8450-ipcc
3636
- qcom,sm8550-ipcc
37+
- qcom,sm8650-ipcc
3738
- const: qcom,ipcc
3839

3940
reg:

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ patternProperties:
7474
type: object # DT nodes are json objects
7575
additionalProperties: false
7676
properties:
77+
78+
compatible:
79+
const: xlnx,zynqmp-ipi-dest-mailbox
80+
7781
xlnx,ipi-id:
7882
description:
7983
Remote Xilinx IPI agent ID of which the mailbox is connected to.
@@ -95,6 +99,7 @@ patternProperties:
9599
- const: remote_response_region
96100

97101
required:
102+
- compatible
98103
- reg
99104
- reg-names
100105
- "#mbox-cells"
@@ -124,6 +129,7 @@ examples:
124129
ranges;
125130
126131
mailbox: mailbox@ff9905c0 {
132+
compatible = "xlnx,zynqmp-ipi-dest-mailbox";
127133
reg = <0x0 0xff9905c0 0x0 0x20>,
128134
<0x0 0xff9905e0 0x0 0x20>,
129135
<0x0 0xff990e80 0x0 0x20>,

drivers/mailbox/bcm-pdc-mailbox.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@
3333
#include <linux/interrupt.h>
3434
#include <linux/wait.h>
3535
#include <linux/platform_device.h>
36+
#include <linux/property.h>
3637
#include <linux/io.h>
3738
#include <linux/of.h>
38-
#include <linux/of_device.h>
39-
#include <linux/of_address.h>
4039
#include <linux/of_irq.h>
4140
#include <linux/mailbox_controller.h>
4241
#include <linux/mailbox/brcm-message.h>
@@ -1494,7 +1493,6 @@ static int pdc_dt_read(struct platform_device *pdev, struct pdc_state *pdcs)
14941493
{
14951494
struct device *dev = &pdev->dev;
14961495
struct device_node *dn = pdev->dev.of_node;
1497-
const struct of_device_id *match;
14981496
const int *hw_type;
14991497
int err;
15001498

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

15101508
pdcs->hw_type = PDC_HW;
15111509

1512-
match = of_match_device(of_match_ptr(pdc_mbox_of_match), dev);
1513-
if (match != NULL) {
1514-
hw_type = match->data;
1510+
hw_type = device_get_match_data(dev);
1511+
if (hw_type)
15151512
pdcs->hw_type = *hw_type;
1516-
}
15171513

15181514
return 0;
15191515
}

drivers/mailbox/imx-mailbox.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#include <linux/suspend.h>
2121
#include <linux/slab.h>
2222

23-
#define IMX_MU_CHANS 17
23+
#include "mailbox.h"
24+
25+
#define IMX_MU_CHANS 24
2426
/* TX0/RX0/RXDB[0-3] */
2527
#define IMX_MU_SCU_CHANS 6
2628
/* TX0/RX0 */
@@ -39,6 +41,7 @@ enum imx_mu_chan_type {
3941
IMX_MU_TYPE_TXDB = 2, /* Tx doorbell */
4042
IMX_MU_TYPE_RXDB = 3, /* Rx doorbell */
4143
IMX_MU_TYPE_RST = 4, /* Reset */
44+
IMX_MU_TYPE_TXDB_V2 = 5, /* Tx doorbell with S/W ACK */
4245
};
4346

4447
enum imx_mu_xcr {
@@ -226,6 +229,9 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
226229
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
227230
tasklet_schedule(&cp->txdb_tasklet);
228231
break;
232+
case IMX_MU_TYPE_TXDB_V2:
233+
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
234+
break;
229235
default:
230236
dev_warn_ratelimited(priv->dev, "Send data on wrong channel type: %d\n", cp->type);
231237
return -EINVAL;
@@ -554,6 +560,9 @@ static int imx_mu_startup(struct mbox_chan *chan)
554560
int ret;
555561

556562
pm_runtime_get_sync(priv->dev);
563+
if (cp->type == IMX_MU_TYPE_TXDB_V2)
564+
return 0;
565+
557566
if (cp->type == IMX_MU_TYPE_TXDB) {
558567
/* Tx doorbell don't have ACK support */
559568
tasklet_init(&cp->txdb_tasklet, imx_mu_txdb_tasklet,
@@ -595,6 +604,11 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
595604
int ret;
596605
u32 sr;
597606

607+
if (cp->type == IMX_MU_TYPE_TXDB_V2) {
608+
pm_runtime_put_sync(priv->dev);
609+
return;
610+
}
611+
598612
if (cp->type == IMX_MU_TYPE_TXDB) {
599613
tasklet_kill(&cp->txdb_tasklet);
600614
pm_runtime_put_sync(priv->dev);
@@ -671,6 +685,7 @@ static struct mbox_chan *imx_mu_specific_xlate(struct mbox_controller *mbox,
671685
static struct mbox_chan * imx_mu_xlate(struct mbox_controller *mbox,
672686
const struct of_phandle_args *sp)
673687
{
688+
struct mbox_chan *p_chan;
674689
u32 type, idx, chan;
675690

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

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

699+
/* RST only supports 1 channel */
700+
if ((type == IMX_MU_TYPE_RST) && idx) {
701+
dev_err(mbox->dev, "Invalid RST channel %d\n", idx);
702+
return ERR_PTR(-EINVAL);
703+
}
704+
705+
chan = type * 4 + idx;
685706
if (chan >= mbox->num_chans) {
686707
dev_err(mbox->dev, "Not supported channel number: %d. (type: %d, idx: %d)\n", chan, type, idx);
687708
return ERR_PTR(-EINVAL);
688709
}
689710

690-
return &mbox->chans[chan];
711+
p_chan = &mbox->chans[chan];
712+
713+
if (type == IMX_MU_TYPE_TXDB_V2)
714+
p_chan->txdone_method = TXDONE_BY_ACK;
715+
716+
return p_chan;
691717
}
692718

693719
static struct mbox_chan *imx_mu_seco_xlate(struct mbox_controller *mbox,

drivers/mailbox/mailbox-sti.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include <linux/mailbox_controller.h>
1818
#include <linux/module.h>
1919
#include <linux/of.h>
20-
#include <linux/of_device.h>
2120
#include <linux/platform_device.h>
21+
#include <linux/property.h>
2222
#include <linux/slab.h>
2323

2424
#include "mailbox.h"
@@ -403,20 +403,18 @@ MODULE_DEVICE_TABLE(of, sti_mailbox_match);
403403

404404
static int sti_mbox_probe(struct platform_device *pdev)
405405
{
406-
const struct of_device_id *match;
407406
struct mbox_controller *mbox;
408407
struct sti_mbox_device *mdev;
409408
struct device_node *np = pdev->dev.of_node;
410409
struct mbox_chan *chans;
411410
int irq;
412411
int ret;
413412

414-
match = of_match_device(sti_mailbox_match, &pdev->dev);
415-
if (!match) {
413+
pdev->dev.platform_data = (struct sti_mbox_pdata *)device_get_match_data(&pdev->dev);
414+
if (!pdev->dev.platform_data) {
416415
dev_err(&pdev->dev, "No configuration found\n");
417416
return -ENODEV;
418417
}
419-
pdev->dev.platform_data = (struct sti_mbox_pdata *) match->data;
420418

421419
mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL);
422420
if (!mdev)

0 commit comments

Comments
 (0)