diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-04 14:11:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-04 14:11:23 -0500 |
commit | 8ac4840a3c90cf45830b265c0a4d0876358e8f59 (patch) | |
tree | 287d7fc903e18ac98657334b81450d4abed8d5bc | |
parent | 4141cf676b9e345d3ddeb1710dd3156a09c50244 (diff) | |
parent | 0ae7d327a64b262443b7d3ebee5831e4dde47b89 (diff) |
Merge tag 'mailbox-v4.16' of git://git.linaro.org/landing-teams/working/fujitsu/integration
Pull mailbox updates from Jassi Brar:
"Misc driver changes only:
- TI-MsgMgr: Fix print format for a printk
- TI-MSgMgr: SPDX license switch for the driver
- QCOM-IPC: Convert driver to use regmap
- QCOM-IPC: Spawn sibling clock device from mailbox driver"
* tag 'mailbox-v4.16' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
dt-bindings: mailbox: qcom: Document the APCS clock binding
mailbox: qcom: Create APCS child device for clock controller
mailbox: qcom: Convert APCS IPC driver to use regmap
mailbox: ti-msgmgr: Use %zu for size_t print format
mailbox: ti-msgmgr: Switch to SPDX Licensing
-rw-r--r-- | Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt | 18 | ||||
-rw-r--r-- | drivers/mailbox/qcom-apcs-ipc-mailbox.c | 35 | ||||
-rw-r--r-- | drivers/mailbox/ti-msgmgr.c | 14 |
3 files changed, 51 insertions, 16 deletions
diff --git a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt index fb961c310f44..16964f0c1773 100644 --- a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt +++ b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt | |||
@@ -15,12 +15,21 @@ platforms. | |||
15 | Usage: required | 15 | Usage: required |
16 | Value type: <prop-encoded-array> | 16 | Value type: <prop-encoded-array> |
17 | Definition: must specify the base address and size of the global block | 17 | Definition: must specify the base address and size of the global block |
18 | - clocks: | ||
19 | Usage: required if #clocks-cells property is present | ||
20 | Value type: <phandle> | ||
21 | Definition: phandle to the input PLL, which feeds the APCS mux/divider | ||
18 | 22 | ||
19 | - #mbox-cells: | 23 | - #mbox-cells: |
20 | Usage: required | 24 | Usage: required |
21 | Value type: <u32> | 25 | Value type: <u32> |
22 | Definition: as described in mailbox.txt, must be 1 | 26 | Definition: as described in mailbox.txt, must be 1 |
23 | 27 | ||
28 | - #clock-cells: | ||
29 | Usage: optional | ||
30 | Value type: <u32> | ||
31 | Definition: as described in clock.txt, must be 0 | ||
32 | |||
24 | 33 | ||
25 | = EXAMPLE | 34 | = EXAMPLE |
26 | The following example describes the APCS HMSS found in MSM8996 and part of the | 35 | The following example describes the APCS HMSS found in MSM8996 and part of the |
@@ -44,3 +53,12 @@ GLINK RPM referencing the "rpm_hlos" doorbell therein. | |||
44 | mbox-names = "rpm_hlos"; | 53 | mbox-names = "rpm_hlos"; |
45 | }; | 54 | }; |
46 | 55 | ||
56 | Below is another example of the APCS binding on MSM8916 platforms: | ||
57 | |||
58 | apcs: mailbox@b011000 { | ||
59 | compatible = "qcom,msm8916-apcs-kpss-global"; | ||
60 | reg = <0xb011000 0x1000>; | ||
61 | #mbox-cells = <1>; | ||
62 | clocks = <&a53pll>; | ||
63 | #clock-cells = <0>; | ||
64 | }; | ||
diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c index 9924c6d7f05d..57bde0dfd12f 100644 --- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c +++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/regmap.h> | ||
21 | #include <linux/mailbox_controller.h> | 22 | #include <linux/mailbox_controller.h> |
22 | 23 | ||
23 | #define QCOM_APCS_IPC_BITS 32 | 24 | #define QCOM_APCS_IPC_BITS 32 |
@@ -26,8 +27,17 @@ struct qcom_apcs_ipc { | |||
26 | struct mbox_controller mbox; | 27 | struct mbox_controller mbox; |
27 | struct mbox_chan mbox_chans[QCOM_APCS_IPC_BITS]; | 28 | struct mbox_chan mbox_chans[QCOM_APCS_IPC_BITS]; |
28 | 29 | ||
29 | void __iomem *reg; | 30 | struct regmap *regmap; |
30 | unsigned long offset; | 31 | unsigned long offset; |
32 | struct platform_device *clk; | ||
33 | }; | ||
34 | |||
35 | static const struct regmap_config apcs_regmap_config = { | ||
36 | .reg_bits = 32, | ||
37 | .reg_stride = 4, | ||
38 | .val_bits = 32, | ||
39 | .max_register = 0x1000, | ||
40 | .fast_io = true, | ||
31 | }; | 41 | }; |
32 | 42 | ||
33 | static int qcom_apcs_ipc_send_data(struct mbox_chan *chan, void *data) | 43 | static int qcom_apcs_ipc_send_data(struct mbox_chan *chan, void *data) |
@@ -36,9 +46,7 @@ static int qcom_apcs_ipc_send_data(struct mbox_chan *chan, void *data) | |||
36 | struct qcom_apcs_ipc, mbox); | 46 | struct qcom_apcs_ipc, mbox); |
37 | unsigned long idx = (unsigned long)chan->con_priv; | 47 | unsigned long idx = (unsigned long)chan->con_priv; |
38 | 48 | ||
39 | writel(BIT(idx), apcs->reg); | 49 | return regmap_write(apcs->regmap, apcs->offset, BIT(idx)); |
40 | |||
41 | return 0; | ||
42 | } | 50 | } |
43 | 51 | ||
44 | static const struct mbox_chan_ops qcom_apcs_ipc_ops = { | 52 | static const struct mbox_chan_ops qcom_apcs_ipc_ops = { |
@@ -47,7 +55,9 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = { | |||
47 | 55 | ||
48 | static int qcom_apcs_ipc_probe(struct platform_device *pdev) | 56 | static int qcom_apcs_ipc_probe(struct platform_device *pdev) |
49 | { | 57 | { |
58 | struct device_node *np = pdev->dev.of_node; | ||
50 | struct qcom_apcs_ipc *apcs; | 59 | struct qcom_apcs_ipc *apcs; |
60 | struct regmap *regmap; | ||
51 | struct resource *res; | 61 | struct resource *res; |
52 | unsigned long offset; | 62 | unsigned long offset; |
53 | void __iomem *base; | 63 | void __iomem *base; |
@@ -63,9 +73,14 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) | |||
63 | if (IS_ERR(base)) | 73 | if (IS_ERR(base)) |
64 | return PTR_ERR(base); | 74 | return PTR_ERR(base); |
65 | 75 | ||
76 | regmap = devm_regmap_init_mmio(&pdev->dev, base, &apcs_regmap_config); | ||
77 | if (IS_ERR(regmap)) | ||
78 | return PTR_ERR(regmap); | ||
79 | |||
66 | offset = (unsigned long)of_device_get_match_data(&pdev->dev); | 80 | offset = (unsigned long)of_device_get_match_data(&pdev->dev); |
67 | 81 | ||
68 | apcs->reg = base + offset; | 82 | apcs->regmap = regmap; |
83 | apcs->offset = offset; | ||
69 | 84 | ||
70 | /* Initialize channel identifiers */ | 85 | /* Initialize channel identifiers */ |
71 | for (i = 0; i < ARRAY_SIZE(apcs->mbox_chans); i++) | 86 | for (i = 0; i < ARRAY_SIZE(apcs->mbox_chans); i++) |
@@ -82,6 +97,14 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) | |||
82 | return ret; | 97 | return ret; |
83 | } | 98 | } |
84 | 99 | ||
100 | if (of_device_is_compatible(np, "qcom,msm8916-apcs-kpss-global")) { | ||
101 | apcs->clk = platform_device_register_data(&pdev->dev, | ||
102 | "qcom-apcs-msm8916-clk", | ||
103 | -1, NULL, 0); | ||
104 | if (IS_ERR(apcs->clk)) | ||
105 | dev_err(&pdev->dev, "failed to register APCS clk\n"); | ||
106 | } | ||
107 | |||
85 | platform_set_drvdata(pdev, apcs); | 108 | platform_set_drvdata(pdev, apcs); |
86 | 109 | ||
87 | return 0; | 110 | return 0; |
@@ -90,8 +113,10 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) | |||
90 | static int qcom_apcs_ipc_remove(struct platform_device *pdev) | 113 | static int qcom_apcs_ipc_remove(struct platform_device *pdev) |
91 | { | 114 | { |
92 | struct qcom_apcs_ipc *apcs = platform_get_drvdata(pdev); | 115 | struct qcom_apcs_ipc *apcs = platform_get_drvdata(pdev); |
116 | struct platform_device *clk = apcs->clk; | ||
93 | 117 | ||
94 | mbox_controller_unregister(&apcs->mbox); | 118 | mbox_controller_unregister(&apcs->mbox); |
119 | platform_device_unregister(clk); | ||
95 | 120 | ||
96 | return 0; | 121 | return 0; |
97 | } | 122 | } |
diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c index 54b9e4cb4cfa..78753a87ba4d 100644 --- a/drivers/mailbox/ti-msgmgr.c +++ b/drivers/mailbox/ti-msgmgr.c | |||
@@ -1,17 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Texas Instruments' Message Manager Driver | 3 | * Texas Instruments' Message Manager Driver |
3 | * | 4 | * |
4 | * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ | 5 | * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/ |
5 | * Nishanth Menon | 6 | * Nishanth Menon |
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
12 | * kind, whether express or implied; without even the implied warranty | ||
13 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | 7 | */ |
16 | 8 | ||
17 | #define pr_fmt(fmt) "%s: " fmt, __func__ | 9 | #define pr_fmt(fmt) "%s: " fmt, __func__ |
@@ -291,7 +283,7 @@ static int ti_msgmgr_send_data(struct mbox_chan *chan, void *data) | |||
291 | desc = inst->desc; | 283 | desc = inst->desc; |
292 | 284 | ||
293 | if (desc->max_message_size < message->len) { | 285 | if (desc->max_message_size < message->len) { |
294 | dev_err(dev, "Queue %s message length %d > max %d\n", | 286 | dev_err(dev, "Queue %s message length %zu > max %d\n", |
295 | qinst->name, message->len, desc->max_message_size); | 287 | qinst->name, message->len, desc->max_message_size); |
296 | return -EINVAL; | 288 | return -EINVAL; |
297 | } | 289 | } |