Skip to content

Commit 247ee3e

Browse files
committed
Merge tag 'mailbox-v5.16' of git://git.linaro.org/landing-teams/working/fujitsu/integration
Pull mailbox updates from Jassi Brar: "qcom: - add support for qcm2290 - consolidate msm8994 type apcs_data mtk: - fix clock id usage apple: - add driver for ASC/M3 controllers pcc: - reorganise PCC pcc_mbox_request_channel - add support for PCCT extended PCC subspaces misc: - make use of devm_platform_ioremap_resource() - change Altera, PCC and Apple mailbox maintainers" * tag 'mailbox-v5.16' of git://git.linaro.org/landing-teams/working/fujitsu/integration: (38 commits) mailbox: imx: support i.MX8ULP S4 MU dt-bindings: mailbox: imx-mu: add i.MX8ULP S400 MU support ACPI/PCC: Add maintainer for PCC mailbox driver mailbox: pcc: Move bulk of PCCT parsing into pcc_mbox_probe mailbox: pcc: Add support for PCCT extended PCC subspaces(type 3/4) mailbox: pcc: Drop handling invalid bit-width in {read,write}_register mailbox: pcc: Avoid accessing PCCT table in pcc_send_data and pcc_mbox_irq mailbox: pcc: Add PCC register bundle and associated accessor functions mailbox: pcc: Rename doorbell ack to platform interrupt ack register mailbox: pcc: Use PCC mailbox channel pointer instead of standard mailbox: pcc: Add pcc_mbox_chan structure to hold shared memory region info mailbox: pcc: Consolidate subspace doorbell register parsing mailbox: pcc: Consolidate subspace interrupt information parsing mailbox: pcc: Refactor all PCC channel information into a structure mailbox: pcc: Fix kernel doc warnings mailbox: apple: Add driver for Apple mailboxes dt-bindings: mailbox: Add Apple mailbox bindings MAINTAINERS: Add Apple mailbox files mailbox: mtk-cmdq: Fix local clock ID usage mailbox: mtk-cmdq: Validate alias_id on probe ...
2 parents 8a73c77 + 97961f7 commit 247ee3e

27 files changed

+1061
-417
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/mailbox/apple,mailbox.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Apple Mailbox Controller
8+
9+
maintainers:
10+
- Hector Martin <[email protected]>
11+
- Sven Peter <[email protected]>
12+
13+
description:
14+
The Apple mailbox consists of two FIFOs used to exchange 64+32 bit
15+
messages between the main CPU and a co-processor. Multiple instances
16+
of this mailbox can be found on Apple SoCs.
17+
One of the two FIFOs is used to send data to a co-processor while the other
18+
FIFO is used for the other direction.
19+
Various clients implement different IPC protocols based on these simple
20+
messages and shared memory buffers.
21+
22+
properties:
23+
compatible:
24+
oneOf:
25+
- description:
26+
ASC mailboxes are the most common variant found on the M1 used
27+
for example for the display controller, the system management
28+
controller and the NVMe coprocessor.
29+
items:
30+
- const: apple,t8103-asc-mailbox
31+
32+
- description:
33+
M3 mailboxes are an older variant with a slightly different MMIO
34+
interface still found on the M1. It is used for the Thunderbolt
35+
co-processors.
36+
items:
37+
- const: apple,t8103-m3-mailbox
38+
39+
reg:
40+
maxItems: 1
41+
42+
interrupts:
43+
items:
44+
- description: send fifo is empty interrupt
45+
- description: send fifo is not empty interrupt
46+
- description: receive fifo is empty interrupt
47+
- description: receive fifo is not empty interrupt
48+
49+
interrupt-names:
50+
items:
51+
- const: send-empty
52+
- const: send-not-empty
53+
- const: recv-empty
54+
- const: recv-not-empty
55+
56+
"#mbox-cells":
57+
const: 0
58+
59+
required:
60+
- compatible
61+
- reg
62+
- interrupts
63+
- interrupt-names
64+
- "#mbox-cells"
65+
66+
additionalProperties: false
67+
68+
examples:
69+
- |
70+
mailbox@77408000 {
71+
compatible = "apple,t8103-asc-mailbox";
72+
reg = <0x77408000 0x4000>;
73+
interrupts = <1 583 4>, <1 584 4>, <1 585 4>, <1 586 4>;
74+
interrupt-names = "send-empty", "send-not-empty",
75+
"recv-empty", "recv-not-empty";
76+
#mbox-cells = <0>;
77+
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ properties:
2828
- const: fsl,imx7ulp-mu
2929
- const: fsl,imx8ulp-mu
3030
- const: fsl,imx8-mu-scu
31+
- const: fsl,imx8ulp-mu-s4
3132
- items:
3233
- enum:
3334
- fsl,imx7s-mu

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description:
1111
platforms.
1212

1313
maintainers:
14-
- Sivaprakash Murugesan <[email protected]>
14+
- Jassi Brar <[email protected]>
1515

1616
properties:
1717
compatible:
@@ -24,6 +24,7 @@ properties:
2424
- qcom,msm8994-apcs-kpss-global
2525
- qcom,msm8996-apcs-hmss-global
2626
- qcom,msm8998-apcs-hmss-global
27+
- qcom,qcm2290-apcs-hmss-global
2728
- qcom,qcs404-apcs-apps-global
2829
- qcom,sc7180-apss-shared
2930
- qcom,sc8180x-apss-shared

MAINTAINERS

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,12 @@ L: [email protected]
401401
S: Maintained
402402
F: drivers/platform/x86/i2c-multi-instantiate.c
403403

404+
ACPI PCC(Platform Communication Channel) MAILBOX DRIVER
405+
M: Sudeep Holla <[email protected]>
406+
407+
S: Supported
408+
F: drivers/mailbox/pcc.c
409+
404410
ACPI PMIC DRIVERS
405411
M: "Rafael J. Wysocki" <[email protected]>
406412
M: Len Brown <[email protected]>
@@ -798,7 +804,7 @@ F: Documentation/devicetree/bindings/i2c/i2c-altera.txt
798804
F: drivers/i2c/busses/i2c-altera.c
799805

800806
ALTERA MAILBOX DRIVER
801-
M: Joyce Ooi <joyce.ooi@intel.com>
807+
M: Mun Yew Tham <mun.yew.tham@intel.com>
802808
S: Maintained
803809
F: drivers/mailbox/mailbox-altera.c
804810

@@ -1723,11 +1729,14 @@ C: irc://irc.oftc.net/asahi-dev
17231729
T: git https://github.com/AsahiLinux/linux.git
17241730
F: Documentation/devicetree/bindings/arm/apple.yaml
17251731
F: Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
1732+
F: Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
17261733
F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
17271734
F: arch/arm64/boot/dts/apple/
17281735
F: drivers/irqchip/irq-apple-aic.c
1736+
F: drivers/mailbox/apple-mailbox.c
17291737
F: include/dt-bindings/interrupt-controller/apple-aic.h
17301738
F: include/dt-bindings/pinctrl/apple.h
1739+
F: include/linux/apple-mailbox.h
17311740

17321741
ARM/ARTPEC MACHINE SUPPORT
17331742
M: Jesper Nilsson <[email protected]>

drivers/acpi/cppc_acpi.c

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <acpi/cppc_acpi.h>
4444

4545
struct cppc_pcc_data {
46-
struct mbox_chan *pcc_channel;
46+
struct pcc_mbox_chan *pcc_channel;
4747
void __iomem *pcc_comm_addr;
4848
bool pcc_channel_acquired;
4949
unsigned int deadline_us;
@@ -295,7 +295,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
295295
pcc_ss_data->platform_owns_pcc = true;
296296

297297
/* Ring doorbell */
298-
ret = mbox_send_message(pcc_ss_data->pcc_channel, &cmd);
298+
ret = mbox_send_message(pcc_ss_data->pcc_channel->mchan, &cmd);
299299
if (ret < 0) {
300300
pr_err("Err sending PCC mbox message. ss: %d cmd:%d, ret:%d\n",
301301
pcc_ss_id, cmd, ret);
@@ -308,10 +308,10 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
308308
if (pcc_ss_data->pcc_mrtt)
309309
pcc_ss_data->last_cmd_cmpl_time = ktime_get();
310310

311-
if (pcc_ss_data->pcc_channel->mbox->txdone_irq)
312-
mbox_chan_txdone(pcc_ss_data->pcc_channel, ret);
311+
if (pcc_ss_data->pcc_channel->mchan->mbox->txdone_irq)
312+
mbox_chan_txdone(pcc_ss_data->pcc_channel->mchan, ret);
313313
else
314-
mbox_client_txdone(pcc_ss_data->pcc_channel, ret);
314+
mbox_client_txdone(pcc_ss_data->pcc_channel->mchan, ret);
315315

316316
end:
317317
if (cmd == CMD_WRITE) {
@@ -493,46 +493,33 @@ EXPORT_SYMBOL_GPL(acpi_get_psd_map);
493493

494494
static int register_pcc_channel(int pcc_ss_idx)
495495
{
496-
struct acpi_pcct_hw_reduced *cppc_ss;
496+
struct pcc_mbox_chan *pcc_chan;
497497
u64 usecs_lat;
498498

499499
if (pcc_ss_idx >= 0) {
500-
pcc_data[pcc_ss_idx]->pcc_channel =
501-
pcc_mbox_request_channel(&cppc_mbox_cl, pcc_ss_idx);
500+
pcc_chan = pcc_mbox_request_channel(&cppc_mbox_cl, pcc_ss_idx);
502501

503-
if (IS_ERR(pcc_data[pcc_ss_idx]->pcc_channel)) {
502+
if (IS_ERR(pcc_chan)) {
504503
pr_err("Failed to find PCC channel for subspace %d\n",
505504
pcc_ss_idx);
506505
return -ENODEV;
507506
}
508507

509-
/*
510-
* The PCC mailbox controller driver should
511-
* have parsed the PCCT (global table of all
512-
* PCC channels) and stored pointers to the
513-
* subspace communication region in con_priv.
514-
*/
515-
cppc_ss = (pcc_data[pcc_ss_idx]->pcc_channel)->con_priv;
516-
517-
if (!cppc_ss) {
518-
pr_err("No PCC subspace found for %d CPPC\n",
519-
pcc_ss_idx);
520-
return -ENODEV;
521-
}
522-
508+
pcc_data[pcc_ss_idx]->pcc_channel = pcc_chan;
523509
/*
524510
* cppc_ss->latency is just a Nominal value. In reality
525511
* the remote processor could be much slower to reply.
526512
* So add an arbitrary amount of wait on top of Nominal.
527513
*/
528-
usecs_lat = NUM_RETRIES * cppc_ss->latency;
514+
usecs_lat = NUM_RETRIES * pcc_chan->latency;
529515
pcc_data[pcc_ss_idx]->deadline_us = usecs_lat;
530-
pcc_data[pcc_ss_idx]->pcc_mrtt = cppc_ss->min_turnaround_time;
531-
pcc_data[pcc_ss_idx]->pcc_mpar = cppc_ss->max_access_rate;
532-
pcc_data[pcc_ss_idx]->pcc_nominal = cppc_ss->latency;
516+
pcc_data[pcc_ss_idx]->pcc_mrtt = pcc_chan->min_turnaround_time;
517+
pcc_data[pcc_ss_idx]->pcc_mpar = pcc_chan->max_access_rate;
518+
pcc_data[pcc_ss_idx]->pcc_nominal = pcc_chan->latency;
533519

534520
pcc_data[pcc_ss_idx]->pcc_comm_addr =
535-
acpi_os_ioremap(cppc_ss->base_address, cppc_ss->length);
521+
acpi_os_ioremap(pcc_chan->shmem_base_addr,
522+
pcc_chan->shmem_size);
536523
if (!pcc_data[pcc_ss_idx]->pcc_comm_addr) {
537524
pr_err("Failed to ioremap PCC comm region mem for %d\n",
538525
pcc_ss_idx);

drivers/hwmon/xgene-hwmon.c

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct slimpro_resp_msg {
9393
struct xgene_hwmon_dev {
9494
struct device *dev;
9595
struct mbox_chan *mbox_chan;
96+
struct pcc_mbox_chan *pcc_chan;
9697
struct mbox_client mbox_client;
9798
int mbox_idx;
9899

@@ -652,7 +653,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
652653
goto out_mbox_free;
653654
}
654655
} else {
655-
struct acpi_pcct_hw_reduced *cppc_ss;
656+
struct pcc_mbox_chan *pcc_chan;
656657
const struct acpi_device_id *acpi_id;
657658
int version;
658659

@@ -671,26 +672,16 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
671672
}
672673

673674
cl->rx_callback = xgene_hwmon_pcc_rx_cb;
674-
ctx->mbox_chan = pcc_mbox_request_channel(cl, ctx->mbox_idx);
675-
if (IS_ERR(ctx->mbox_chan)) {
675+
pcc_chan = pcc_mbox_request_channel(cl, ctx->mbox_idx);
676+
if (IS_ERR(pcc_chan)) {
676677
dev_err(&pdev->dev,
677678
"PPC channel request failed\n");
678679
rc = -ENODEV;
679680
goto out_mbox_free;
680681
}
681682

682-
/*
683-
* The PCC mailbox controller driver should
684-
* have parsed the PCCT (global table of all
685-
* PCC channels) and stored pointers to the
686-
* subspace communication region in con_priv.
687-
*/
688-
cppc_ss = ctx->mbox_chan->con_priv;
689-
if (!cppc_ss) {
690-
dev_err(&pdev->dev, "PPC subspace not found\n");
691-
rc = -ENODEV;
692-
goto out;
693-
}
683+
ctx->pcc_chan = pcc_chan;
684+
ctx->mbox_chan = pcc_chan->mchan;
694685

695686
if (!ctx->mbox_chan->mbox->txdone_irq) {
696687
dev_err(&pdev->dev, "PCC IRQ not supported\n");
@@ -702,16 +693,16 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
702693
* This is the shared communication region
703694
* for the OS and Platform to communicate over.
704695
*/
705-
ctx->comm_base_addr = cppc_ss->base_address;
696+
ctx->comm_base_addr = pcc_chan->shmem_base_addr;
706697
if (ctx->comm_base_addr) {
707698
if (version == XGENE_HWMON_V2)
708699
ctx->pcc_comm_addr = (void __force *)ioremap(
709700
ctx->comm_base_addr,
710-
cppc_ss->length);
701+
pcc_chan->shmem_size);
711702
else
712703
ctx->pcc_comm_addr = memremap(
713704
ctx->comm_base_addr,
714-
cppc_ss->length,
705+
pcc_chan->shmem_size,
715706
MEMREMAP_WB);
716707
} else {
717708
dev_err(&pdev->dev, "Failed to get PCC comm region\n");
@@ -727,11 +718,11 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
727718
}
728719

729720
/*
730-
* cppc_ss->latency is just a Nominal value. In reality
721+
* pcc_chan->latency is just a Nominal value. In reality
731722
* the remote processor could be much slower to reply.
732723
* So add an arbitrary amount of wait on top of Nominal.
733724
*/
734-
ctx->usecs_lat = PCC_NUM_RETRIES * cppc_ss->latency;
725+
ctx->usecs_lat = PCC_NUM_RETRIES * pcc_chan->latency;
735726
}
736727

737728
ctx->hwmon_dev = hwmon_device_register_with_groups(ctx->dev,
@@ -757,7 +748,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
757748
if (acpi_disabled)
758749
mbox_free_channel(ctx->mbox_chan);
759750
else
760-
pcc_mbox_free_channel(ctx->mbox_chan);
751+
pcc_mbox_free_channel(ctx->pcc_chan);
761752
out_mbox_free:
762753
kfifo_free(&ctx->async_msg_fifo);
763754

@@ -773,7 +764,7 @@ static int xgene_hwmon_remove(struct platform_device *pdev)
773764
if (acpi_disabled)
774765
mbox_free_channel(ctx->mbox_chan);
775766
else
776-
pcc_mbox_free_channel(ctx->mbox_chan);
767+
pcc_mbox_free_channel(ctx->pcc_chan);
777768

778769
return 0;
779770
}

0 commit comments

Comments
 (0)