Skip to content

Commit cdeffe8

Browse files
committed
Merge tag 'mailbox-v5.19' of git://git.linaro.org/landing-teams/working/fujitsu/integration
Pull mailbox updates from Jassi Brar: "api: - hrtimer fix qcom: - log pending irq during resume - minor cosmetic changes omap: - use pm_runtime_resume_and_get imx: - use pm_runtime_resume_and_get - remove redundant initializer mtk: - added GCE header for MT8186 - enable support for MT8186 tegra: - remove redundant NULL check - added hsp_sm_ops for send/recv api - support shared mailboxes stm: - remove unsupported "wakeup" irq pcc: - sanitize mbox allocated memory before use misc: - documentation fixes for arm_mhu and qcom-ipcc" * tag 'mailbox-v5.19' of git://git.linaro.org/landing-teams/working/fujitsu/integration: mailbox: qcom-ipcc: Fix -Wunused-function with CONFIG_PM_SLEEP=n mailbox: forward the hrtimer if not queued and under a lock mailbox: qcom-ipcc: Log the pending interrupt during resume mailbox: pcc: Fix an invalid-load caught by the address sanitizer dt-bindings: mailbox: remove the IPCC "wakeup" IRQ mailbox: correct kerneldoc mailbox: omap: using pm_runtime_resume_and_get to simplify the code mailbox:imx: using pm_runtime_resume_and_get mailbox: mediatek: support mt8186 adsp mailbox dt-bindings: mailbox: mtk,adsp-mbox: add mt8186 compatible name mailbox: tegra-hsp: Add 128-bit shared mailbox support dt-bindings: tegra186-hsp: add type for shared mailboxes mailbox: tegra-hsp: Add tegra_hsp_sm_ops dt-bindings: gce: add the GCE header file for MT8186 mailbox: remove an unneeded NULL check on list iterator mailbox: imx: remove redundant initializer dt-bindings: mailbox: qcom-ipcc: simplify the example
2 parents 7182e89 + 79f9fbe commit cdeffe8

File tree

16 files changed

+628
-79
lines changed

16 files changed

+628
-79
lines changed

Documentation/devicetree/bindings/mailbox/mtk,adsp-mbox.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ maintainers:
1111

1212
description: |
1313
The MTK ADSP mailbox Inter-Processor Communication (IPC) enables the SoC
14-
to ommunicate with ADSP by passing messages through two mailbox channels.
14+
to communicate with ADSP by passing messages through two mailbox channels.
1515
The MTK ADSP mailbox IPC also provides the ability for one processor to
1616
signal the other processor using interrupts.
1717
1818
properties:
1919
compatible:
20-
items:
21-
- const: mediatek,mt8195-adsp-mbox
20+
enum:
21+
- mediatek,mt8195-adsp-mbox
22+
- mediatek,mt8186-adsp-mbox
2223

2324
"#mbox-cells":
2425
const: 0

Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ description: |
2626
second cell is used to identify the mailbox that the client is going
2727
to use.
2828
29+
For shared mailboxes, the first cell composed of two fields:
30+
- bits 15..8:
31+
A bit mask of flags that further specifies the type of shared
32+
mailbox to be used (based on the data size). If no flag is
33+
specified then, 32-bit shared mailbox is used.
34+
- bits 7..0:
35+
Defines the type of the mailbox to be used. This field should be
36+
TEGRA_HSP_MBOX_TYPE_SM for shared mailboxes.
37+
2938
For doorbells, the second cell specifies the index of the doorbell to
3039
use.
3140

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

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,14 @@ additionalProperties: false
6262

6363
examples:
6464
- |
65-
#include <dt-bindings/interrupt-controller/arm-gic.h>
66-
#include <dt-bindings/mailbox/qcom-ipcc.h>
65+
#include <dt-bindings/interrupt-controller/arm-gic.h>
66+
#include <dt-bindings/mailbox/qcom-ipcc.h>
6767
68-
mailbox@408000 {
69-
compatible = "qcom,sm8250-ipcc", "qcom,ipcc";
70-
reg = <0x408000 0x1000>;
71-
interrupts = <GIC_SPI 229 IRQ_TYPE_LEVEL_HIGH>;
72-
interrupt-controller;
73-
#interrupt-cells = <3>;
74-
#mbox-cells = <2>;
75-
};
76-
77-
smp2p-modem {
78-
compatible = "qcom,smp2p";
79-
interrupts-extended = <&ipcc_mproc IPCC_CLIENT_MPSS
80-
IPCC_MPROC_SIGNAL_SMP2P IRQ_TYPE_EDGE_RISING>;
81-
mboxes = <&ipcc_mproc IPCC_CLIENT_MPSS IPCC_MPROC_SIGNAL_SMP2P>;
82-
83-
/* Other SMP2P fields */
84-
};
68+
mailbox@408000 {
69+
compatible = "qcom,sm8250-ipcc", "qcom,ipcc";
70+
reg = <0x408000 0x1000>;
71+
interrupts = <GIC_SPI 229 IRQ_TYPE_LEVEL_HIGH>;
72+
interrupt-controller;
73+
#interrupt-cells = <3>;
74+
#mbox-cells = <2>;
75+
};

Documentation/devicetree/bindings/mailbox/st,stm32-ipcc.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,11 @@ properties:
3030
items:
3131
- description: rx channel occupied
3232
- description: tx channel free
33-
- description: wakeup source
34-
minItems: 2
3533

3634
interrupt-names:
3735
items:
3836
- const: rx
3937
- const: tx
40-
- const: wakeup
41-
minItems: 2
4238

4339
wakeup-source: true
4440

@@ -70,10 +66,9 @@ examples:
7066
#mbox-cells = <1>;
7167
reg = <0x4c001000 0x400>;
7268
st,proc-id = <0>;
73-
interrupts-extended = <&intc GIC_SPI 100 IRQ_TYPE_NONE>,
74-
<&intc GIC_SPI 101 IRQ_TYPE_NONE>,
75-
<&aiec 62 1>;
76-
interrupt-names = "rx", "tx", "wakeup";
69+
interrupts-extended = <&exti 61 1>,
70+
<&intc GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
71+
interrupt-names = "rx", "tx";
7772
clocks = <&rcc_clk IPCC>;
7873
wakeup-source;
7974
};

drivers/mailbox/arm_mhu_db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct arm_mhu {
4444
};
4545

4646
/**
47-
* ARM MHU Mailbox allocated channel information
47+
* struct mhu_db_channel - ARM MHU Mailbox allocated channel information
4848
*
4949
* @mhu: Pointer to parent mailbox device
5050
* @pchan: Physical channel within which this doorbell resides in

drivers/mailbox/arm_mhuv2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ enum mhuv2_frame {
160160
* struct mhuv2 - MHUv2 mailbox controller data
161161
*
162162
* @mbox: Mailbox controller belonging to the MHU frame.
163-
* @send/recv: Base address of the register mapping region.
163+
* @send: Base address of the register mapping region.
164+
* @recv: Base address of the register mapping region.
164165
* @frame: Frame type: RECEIVER_FRAME or SENDER_FRAME.
165166
* @irq: Interrupt.
166167
* @windows: Channel windows implemented by the platform.

drivers/mailbox/imx-mailbox.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -830,11 +830,9 @@ static int imx_mu_probe(struct platform_device *pdev)
830830

831831
pm_runtime_enable(dev);
832832

833-
ret = pm_runtime_get_sync(dev);
834-
if (ret < 0) {
835-
pm_runtime_put_noidle(dev);
833+
ret = pm_runtime_resume_and_get(dev);
834+
if (ret < 0)
836835
goto disable_runtime_pm;
837-
}
838836

839837
ret = pm_runtime_put_sync(dev);
840838
if (ret < 0)
@@ -886,7 +884,6 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = {
886884
.rx = imx_mu_generic_rx,
887885
.rxdb = imx_mu_generic_rxdb,
888886
.init = imx_mu_init_generic,
889-
.rxdb = imx_mu_generic_rxdb,
890887
.type = IMX_MU_V2,
891888
.xTR = 0x200,
892889
.xRR = 0x280,

drivers/mailbox/mailbox.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ static void msg_submit(struct mbox_chan *chan)
8282
exit:
8383
spin_unlock_irqrestore(&chan->lock, flags);
8484

85-
/* kick start the timer immediately to avoid delays */
8685
if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
87-
/* but only if not already active */
88-
if (!hrtimer_active(&chan->mbox->poll_hrt))
89-
hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
86+
/* kick start the timer immediately to avoid delays */
87+
spin_lock_irqsave(&chan->mbox->poll_hrt_lock, flags);
88+
hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
89+
spin_unlock_irqrestore(&chan->mbox->poll_hrt_lock, flags);
9090
}
9191
}
9292

@@ -120,20 +120,26 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
120120
container_of(hrtimer, struct mbox_controller, poll_hrt);
121121
bool txdone, resched = false;
122122
int i;
123+
unsigned long flags;
123124

124125
for (i = 0; i < mbox->num_chans; i++) {
125126
struct mbox_chan *chan = &mbox->chans[i];
126127

127128
if (chan->active_req && chan->cl) {
128-
resched = true;
129129
txdone = chan->mbox->ops->last_tx_done(chan);
130130
if (txdone)
131131
tx_tick(chan, 0);
132+
else
133+
resched = true;
132134
}
133135
}
134136

135137
if (resched) {
136-
hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period));
138+
spin_lock_irqsave(&mbox->poll_hrt_lock, flags);
139+
if (!hrtimer_is_queued(hrtimer))
140+
hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period));
141+
spin_unlock_irqrestore(&mbox->poll_hrt_lock, flags);
142+
137143
return HRTIMER_RESTART;
138144
}
139145
return HRTIMER_NORESTART;
@@ -500,6 +506,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
500506
hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
501507
HRTIMER_MODE_REL);
502508
mbox->poll_hrt.function = txdone_hrtimer;
509+
spin_lock_init(&mbox->poll_hrt_lock);
503510
}
504511

505512
for (i = 0; i < mbox->num_chans; i++) {

drivers/mailbox/mtk-adsp-mailbox.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ static int mtk_adsp_mbox_probe(struct platform_device *pdev)
149149
return devm_mbox_controller_register(dev, &priv->mbox);
150150
}
151151

152+
static const struct mtk_adsp_mbox_cfg mt8186_adsp_mbox_cfg = {
153+
.set_in = 0x00,
154+
.set_out = 0x04,
155+
.clr_in = 0x08,
156+
.clr_out = 0x0C,
157+
};
158+
152159
static const struct mtk_adsp_mbox_cfg mt8195_adsp_mbox_cfg = {
153160
.set_in = 0x00,
154161
.set_out = 0x1c,
@@ -157,6 +164,7 @@ static const struct mtk_adsp_mbox_cfg mt8195_adsp_mbox_cfg = {
157164
};
158165

159166
static const struct of_device_id mtk_adsp_mbox_of_match[] = {
167+
{ .compatible = "mediatek,mt8186-adsp-mbox", .data = &mt8186_adsp_mbox_cfg },
160168
{ .compatible = "mediatek,mt8195-adsp-mbox", .data = &mt8195_adsp_mbox_cfg },
161169
{},
162170
};

drivers/mailbox/omap-mailbox.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,11 +856,9 @@ static int omap_mbox_probe(struct platform_device *pdev)
856856
platform_set_drvdata(pdev, mdev);
857857
pm_runtime_enable(mdev->dev);
858858

859-
ret = pm_runtime_get_sync(mdev->dev);
860-
if (ret < 0) {
861-
pm_runtime_put_noidle(mdev->dev);
859+
ret = pm_runtime_resume_and_get(mdev->dev);
860+
if (ret < 0)
862861
goto unregister;
863-
}
864862

865863
/*
866864
* just print the raw revision register, the format is not

0 commit comments

Comments
 (0)