Skip to content

Commit 75dee3b

Browse files
committed
Merge tag 'mailbox-v5.9' of git://git.linaro.org/landing-teams/working/fujitsu/integration
Pull mailbox updates from Jassi Brar: "mediatek: - add support for mt6779 gce - shutdown cleanup and address shift support qcom: - add msm8994 apcs and sdm660 hmss compatibility imx: - mark PM funcs __maybe pcc: - put acpi table before bailout misc: - replace http with https links" * tag 'mailbox-v5.9' of git://git.linaro.org/landing-teams/working/fujitsu/integration: mailbox: mediatek: cmdq: clear task in channel before shutdown mailbox: cmdq: support mt6779 gce platform definition mailbox: cmdq: variablize address shift in platform dt-binding: gce: add gce header file for mt6779 mailbox: qcom: Add msm8994 apcs compatible mailbox: qcom: Add sdm660 hmss compatible mailbox: imx: Mark PM functions as __maybe_unused mailbox: pcc: Put the PCCT table for error path mailbox: Replace HTTP links with HTTPS ones
2 parents ce615f5 + 8849969 commit 75dee3b

File tree

10 files changed

+338
-24
lines changed

10 files changed

+338
-24
lines changed

Documentation/devicetree/bindings/mailbox/mtk-gce.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ CMDQ driver uses mailbox framework for communication. Please refer to
99
mailbox.txt for generic information about mailbox device-tree bindings.
1010

1111
Required properties:
12-
- compatible: can be "mediatek,mt8173-gce" or "mediatek,mt8183-gce"
12+
- compatible: can be "mediatek,mt8173-gce", "mediatek,mt8183-gce" or
13+
"mediatek,mt6779-gce".
1314
- reg: Address range of the GCE unit
1415
- interrupts: The interrupt signal from the GCE block
1516
- clock: Clocks according to the common clock binding
@@ -34,8 +35,9 @@ Optional properties for a client device:
3435
start_offset: the start offset of register address that GCE can access.
3536
size: the total size of register address that GCE can access.
3637

37-
Some vaules of properties are defined in 'dt-bindings/gce/mt8173-gce.h'
38-
or 'dt-binding/gce/mt8183-gce.h'. Such as sub-system ids, thread priority, event ids.
38+
Some vaules of properties are defined in 'dt-bindings/gce/mt8173-gce.h',
39+
'dt-binding/gce/mt8183-gce.h' or 'dt-bindings/gce/mt6779-gce.h'. Such as
40+
sub-system ids, thread priority, event ids.
3941

4042
Example:
4143

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ properties:
1818
enum:
1919
- qcom,ipq8074-apcs-apps-global
2020
- qcom,msm8916-apcs-kpss-global
21+
- qcom,msm8994-apcs-kpss-global
2122
- qcom,msm8996-apcs-hmss-global
2223
- qcom,msm8998-apcs-hmss-global
2324
- qcom,qcs404-apcs-apps-global
2425
- qcom,sc7180-apss-shared
26+
- qcom,sdm660-apcs-hmss-global
2527
- qcom,sdm845-apss-shared
2628
- qcom,sm8150-apss-shared
2729

drivers/mailbox/imx-mailbox.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static const struct of_device_id imx_mu_dt_ids[] = {
598598
};
599599
MODULE_DEVICE_TABLE(of, imx_mu_dt_ids);
600600

601-
static int imx_mu_suspend_noirq(struct device *dev)
601+
static int __maybe_unused imx_mu_suspend_noirq(struct device *dev)
602602
{
603603
struct imx_mu_priv *priv = dev_get_drvdata(dev);
604604

@@ -608,7 +608,7 @@ static int imx_mu_suspend_noirq(struct device *dev)
608608
return 0;
609609
}
610610

611-
static int imx_mu_resume_noirq(struct device *dev)
611+
static int __maybe_unused imx_mu_resume_noirq(struct device *dev)
612612
{
613613
struct imx_mu_priv *priv = dev_get_drvdata(dev);
614614

@@ -626,7 +626,7 @@ static int imx_mu_resume_noirq(struct device *dev)
626626
return 0;
627627
}
628628

629-
static int imx_mu_runtime_suspend(struct device *dev)
629+
static int __maybe_unused imx_mu_runtime_suspend(struct device *dev)
630630
{
631631
struct imx_mu_priv *priv = dev_get_drvdata(dev);
632632

@@ -635,7 +635,7 @@ static int imx_mu_runtime_suspend(struct device *dev)
635635
return 0;
636636
}
637637

638-
static int imx_mu_runtime_resume(struct device *dev)
638+
static int __maybe_unused imx_mu_runtime_resume(struct device *dev)
639639
{
640640
struct imx_mu_priv *priv = dev_get_drvdata(dev);
641641
int ret;

drivers/mailbox/mtk-cmdq-mailbox.c

Lines changed: 84 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,22 @@ struct cmdq {
7575
struct cmdq_thread *thread;
7676
struct clk *clock;
7777
bool suspended;
78+
u8 shift_pa;
7879
};
7980

81+
struct gce_plat {
82+
u32 thread_nr;
83+
u8 shift;
84+
};
85+
86+
u8 cmdq_get_shift_pa(struct mbox_chan *chan)
87+
{
88+
struct cmdq *cmdq = container_of(chan->mbox, struct cmdq, mbox);
89+
90+
return cmdq->shift_pa;
91+
}
92+
EXPORT_SYMBOL(cmdq_get_shift_pa);
93+
8094
static int cmdq_thread_suspend(struct cmdq *cmdq, struct cmdq_thread *thread)
8195
{
8296
u32 status;
@@ -183,13 +197,15 @@ static void cmdq_task_handle_error(struct cmdq_task *task)
183197
{
184198
struct cmdq_thread *thread = task->thread;
185199
struct cmdq_task *next_task;
200+
struct cmdq *cmdq = task->cmdq;
186201

187-
dev_err(task->cmdq->mbox.dev, "task 0x%p error\n", task);
188-
WARN_ON(cmdq_thread_suspend(task->cmdq, thread) < 0);
202+
dev_err(cmdq->mbox.dev, "task 0x%p error\n", task);
203+
WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
189204
next_task = list_first_entry_or_null(&thread->task_busy_list,
190205
struct cmdq_task, list_entry);
191206
if (next_task)
192-
writel(next_task->pa_base, thread->base + CMDQ_THR_CURR_ADDR);
207+
writel(next_task->pa_base >> cmdq->shift_pa,
208+
thread->base + CMDQ_THR_CURR_ADDR);
193209
cmdq_thread_resume(thread);
194210
}
195211

@@ -219,7 +235,7 @@ static void cmdq_thread_irq_handler(struct cmdq *cmdq,
219235
else
220236
return;
221237

222-
curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR);
238+
curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) << cmdq->shift_pa;
223239

224240
list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
225241
list_entry) {
@@ -333,29 +349,39 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
333349

334350
if (list_empty(&thread->task_busy_list)) {
335351
WARN_ON(clk_enable(cmdq->clock) < 0);
352+
/*
353+
* The thread reset will clear thread related register to 0,
354+
* including pc, end, priority, irq, suspend and enable. Thus
355+
* set CMDQ_THR_ENABLED to CMDQ_THR_ENABLE_TASK will enable
356+
* thread and make it running.
357+
*/
336358
WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
337359

338-
writel(task->pa_base, thread->base + CMDQ_THR_CURR_ADDR);
339-
writel(task->pa_base + pkt->cmd_buf_size,
360+
writel(task->pa_base >> cmdq->shift_pa,
361+
thread->base + CMDQ_THR_CURR_ADDR);
362+
writel((task->pa_base + pkt->cmd_buf_size) >> cmdq->shift_pa,
340363
thread->base + CMDQ_THR_END_ADDR);
364+
341365
writel(thread->priority, thread->base + CMDQ_THR_PRIORITY);
342366
writel(CMDQ_THR_IRQ_EN, thread->base + CMDQ_THR_IRQ_ENABLE);
343367
writel(CMDQ_THR_ENABLED, thread->base + CMDQ_THR_ENABLE_TASK);
344368
} else {
345369
WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
346-
curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR);
347-
end_pa = readl(thread->base + CMDQ_THR_END_ADDR);
370+
curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) <<
371+
cmdq->shift_pa;
372+
end_pa = readl(thread->base + CMDQ_THR_END_ADDR) <<
373+
cmdq->shift_pa;
348374
/* check boundary */
349375
if (curr_pa == end_pa - CMDQ_INST_SIZE ||
350376
curr_pa == end_pa) {
351377
/* set to this task directly */
352-
writel(task->pa_base,
378+
writel(task->pa_base >> cmdq->shift_pa,
353379
thread->base + CMDQ_THR_CURR_ADDR);
354380
} else {
355381
cmdq_task_insert_into_thread(task);
356382
smp_mb(); /* modify jump before enable thread */
357383
}
358-
writel(task->pa_base + pkt->cmd_buf_size,
384+
writel((task->pa_base + pkt->cmd_buf_size) >> cmdq->shift_pa,
359385
thread->base + CMDQ_THR_END_ADDR);
360386
cmdq_thread_resume(thread);
361387
}
@@ -371,6 +397,38 @@ static int cmdq_mbox_startup(struct mbox_chan *chan)
371397

372398
static void cmdq_mbox_shutdown(struct mbox_chan *chan)
373399
{
400+
struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
401+
struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
402+
struct cmdq_task *task, *tmp;
403+
unsigned long flags;
404+
405+
spin_lock_irqsave(&thread->chan->lock, flags);
406+
if (list_empty(&thread->task_busy_list))
407+
goto done;
408+
409+
WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
410+
411+
/* make sure executed tasks have success callback */
412+
cmdq_thread_irq_handler(cmdq, thread);
413+
if (list_empty(&thread->task_busy_list))
414+
goto done;
415+
416+
list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
417+
list_entry) {
418+
cmdq_task_exec_done(task, CMDQ_CB_ERROR);
419+
kfree(task);
420+
}
421+
422+
cmdq_thread_disable(cmdq, thread);
423+
clk_disable(cmdq->clock);
424+
done:
425+
/*
426+
* The thread->task_busy_list empty means thread already disable. The
427+
* cmdq_mbox_send_data() always reset thread which clear disable and
428+
* suspend statue when first pkt send to channel, so there is no need
429+
* to do any operation here, only unlock and leave.
430+
*/
431+
spin_unlock_irqrestore(&thread->chan->lock, flags);
374432
}
375433

376434
static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout)
@@ -453,6 +511,7 @@ static int cmdq_probe(struct platform_device *pdev)
453511
struct resource *res;
454512
struct cmdq *cmdq;
455513
int err, i;
514+
struct gce_plat *plat_data;
456515

457516
cmdq = devm_kzalloc(dev, sizeof(*cmdq), GFP_KERNEL);
458517
if (!cmdq)
@@ -471,7 +530,14 @@ static int cmdq_probe(struct platform_device *pdev)
471530
return -EINVAL;
472531
}
473532

474-
cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev);
533+
plat_data = (struct gce_plat *)of_device_get_match_data(dev);
534+
if (!plat_data) {
535+
dev_err(dev, "failed to get match data\n");
536+
return -EINVAL;
537+
}
538+
539+
cmdq->thread_nr = plat_data->thread_nr;
540+
cmdq->shift_pa = plat_data->shift;
475541
cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
476542
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
477543
"mtk_cmdq", cmdq);
@@ -534,9 +600,14 @@ static const struct dev_pm_ops cmdq_pm_ops = {
534600
.resume = cmdq_resume,
535601
};
536602

603+
static const struct gce_plat gce_plat_v2 = {.thread_nr = 16};
604+
static const struct gce_plat gce_plat_v3 = {.thread_nr = 24};
605+
static const struct gce_plat gce_plat_v4 = {.thread_nr = 24, .shift = 3};
606+
537607
static const struct of_device_id cmdq_of_ids[] = {
538-
{.compatible = "mediatek,mt8173-gce", .data = (void *)16},
539-
{.compatible = "mediatek,mt8183-gce", .data = (void *)24},
608+
{.compatible = "mediatek,mt8173-gce", .data = (void *)&gce_plat_v2},
609+
{.compatible = "mediatek,mt8183-gce", .data = (void *)&gce_plat_v3},
610+
{.compatible = "mediatek,mt6779-gce", .data = (void *)&gce_plat_v4},
540611
{}
541612
};
542613

drivers/mailbox/omap-mailbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* OMAP mailbox driver
44
*
55
* Copyright (C) 2006-2009 Nokia Corporation. All rights reserved.
6-
* Copyright (C) 2013-2019 Texas Instruments Incorporated - http://www.ti.com
6+
* Copyright (C) 2013-2019 Texas Instruments Incorporated - https://www.ti.com
77
*
88
* Contact: Hiroshi DOYU <[email protected]>
99
* Suman Anna <[email protected]>

drivers/mailbox/pcc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,17 @@ static int __init acpi_pcc_probe(void)
457457
pr_warn("Error parsing PCC subspaces from PCCT\n");
458458
else
459459
pr_warn("Invalid PCCT: %d PCC subspaces\n", count);
460-
return -EINVAL;
460+
461+
rc = -EINVAL;
462+
goto err_put_pcct;
461463
}
462464

463465
pcc_mbox_channels = kcalloc(count, sizeof(struct mbox_chan),
464466
GFP_KERNEL);
465467
if (!pcc_mbox_channels) {
466468
pr_err("Could not allocate space for PCC mbox channels\n");
467-
return -ENOMEM;
469+
rc = -ENOMEM;
470+
goto err_put_pcct;
468471
}
469472

470473
pcc_doorbell_vaddr = kcalloc(count, sizeof(void *), GFP_KERNEL);
@@ -535,6 +538,8 @@ static int __init acpi_pcc_probe(void)
535538
kfree(pcc_doorbell_vaddr);
536539
err_free_mbox:
537540
kfree(pcc_mbox_channels);
541+
err_put_pcct:
542+
acpi_put_table(pcct_tbl);
538543
return rc;
539544
}
540545

drivers/mailbox/qcom-apcs-ipc-mailbox.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ static const struct qcom_apcs_ipc_data msm8916_apcs_data = {
4141
.offset = 8, .clk_name = "qcom-apcs-msm8916-clk"
4242
};
4343

44+
static const struct qcom_apcs_ipc_data msm8994_apcs_data = {
45+
.offset = 8, .clk_name = NULL
46+
};
47+
4448
static const struct qcom_apcs_ipc_data msm8996_apcs_data = {
4549
.offset = 16, .clk_name = NULL
4650
};
@@ -49,6 +53,10 @@ static const struct qcom_apcs_ipc_data msm8998_apcs_data = {
4953
.offset = 8, .clk_name = NULL
5054
};
5155

56+
static const struct qcom_apcs_ipc_data sdm660_apcs_data = {
57+
.offset = 8, .clk_name = NULL
58+
};
59+
5260
static const struct qcom_apcs_ipc_data apps_shared_apcs_data = {
5361
.offset = 12, .clk_name = NULL
5462
};
@@ -146,10 +154,12 @@ static const struct of_device_id qcom_apcs_ipc_of_match[] = {
146154
{ .compatible = "qcom,ipq6018-apcs-apps-global", .data = &ipq6018_apcs_data },
147155
{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq8074_apcs_data },
148156
{ .compatible = "qcom,msm8916-apcs-kpss-global", .data = &msm8916_apcs_data },
157+
{ .compatible = "qcom,msm8994-apcs-kpss-global", .data = &msm8994_apcs_data },
149158
{ .compatible = "qcom,msm8996-apcs-hmss-global", .data = &msm8996_apcs_data },
150159
{ .compatible = "qcom,msm8998-apcs-hmss-global", .data = &msm8998_apcs_data },
151160
{ .compatible = "qcom,qcs404-apcs-apps-global", .data = &msm8916_apcs_data },
152161
{ .compatible = "qcom,sc7180-apss-shared", .data = &apps_shared_apcs_data },
162+
{ .compatible = "qcom,sdm660-apcs-hmss-global", .data = &sdm660_apcs_data },
153163
{ .compatible = "qcom,sdm845-apss-shared", .data = &apps_shared_apcs_data },
154164
{ .compatible = "qcom,sm8150-apss-shared", .data = &apps_shared_apcs_data },
155165
{}

drivers/mailbox/ti-msgmgr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Texas Instruments' Message Manager Driver
44
*
5-
* Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
5+
* Copyright (C) 2015-2017 Texas Instruments Incorporated - https://www.ti.com/
66
* Nishanth Menon
77
*/
88

0 commit comments

Comments
 (0)