diff options
author | Andy Gross <agross@codeaurora.org> | 2015-08-26 15:42:45 -0400 |
---|---|---|
committer | Andy Gross <agross@codeaurora.org> | 2015-09-09 16:57:09 -0400 |
commit | 93dbed9121cc8e0fcc93edd9fca901322bdfbd1a (patch) | |
tree | 31c7b083530842660b714713445fcd458b15a46b | |
parent | 18912806bbf8bd6e2b5cb12317679790eb0e0ce4 (diff) |
soc: qcom: smd: Use correct remote processor ID
This patch fixes SMEM addressing issues when remote processors need to use
secure SMEM partitions.
Signed-off-by: Andy Gross <agross@codeaurora.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
-rw-r--r-- | Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt | 6 | ||||
-rw-r--r-- | drivers/soc/qcom/smd.c | 16 |
2 files changed, 18 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt index f65c76db9859..97d9b3e1bf39 100644 --- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt | |||
@@ -37,6 +37,12 @@ The edge is described by the following properties: | |||
37 | Definition: the identifier of the remote processor in the smd channel | 37 | Definition: the identifier of the remote processor in the smd channel |
38 | allocation table | 38 | allocation table |
39 | 39 | ||
40 | - qcom,remote-pid: | ||
41 | Usage: optional | ||
42 | Value type: <u32> | ||
43 | Definition: the identifier for the remote processor as known by the rest | ||
44 | of the system. | ||
45 | |||
40 | = SMD DEVICES | 46 | = SMD DEVICES |
41 | 47 | ||
42 | In turn, subnodes of the "edges" represent devices tied to SMD channels on that | 48 | In turn, subnodes of the "edges" represent devices tied to SMD channels on that |
diff --git a/drivers/soc/qcom/smd.c b/drivers/soc/qcom/smd.c index 327adcf117c1..edd9d9a37238 100644 --- a/drivers/soc/qcom/smd.c +++ b/drivers/soc/qcom/smd.c | |||
@@ -96,6 +96,7 @@ static const struct { | |||
96 | * @smd: handle to qcom_smd | 96 | * @smd: handle to qcom_smd |
97 | * @of_node: of_node handle for information related to this edge | 97 | * @of_node: of_node handle for information related to this edge |
98 | * @edge_id: identifier of this edge | 98 | * @edge_id: identifier of this edge |
99 | * @remote_pid: identifier of remote processor | ||
99 | * @irq: interrupt for signals on this edge | 100 | * @irq: interrupt for signals on this edge |
100 | * @ipc_regmap: regmap handle holding the outgoing ipc register | 101 | * @ipc_regmap: regmap handle holding the outgoing ipc register |
101 | * @ipc_offset: offset within @ipc_regmap of the register for ipc | 102 | * @ipc_offset: offset within @ipc_regmap of the register for ipc |
@@ -111,6 +112,7 @@ struct qcom_smd_edge { | |||
111 | struct qcom_smd *smd; | 112 | struct qcom_smd *smd; |
112 | struct device_node *of_node; | 113 | struct device_node *of_node; |
113 | unsigned edge_id; | 114 | unsigned edge_id; |
115 | unsigned remote_pid; | ||
114 | 116 | ||
115 | int irq; | 117 | int irq; |
116 | 118 | ||
@@ -572,7 +574,7 @@ static irqreturn_t qcom_smd_edge_intr(int irq, void *data) | |||
572 | * have to scan if the amount of available space in smem have changed | 574 | * have to scan if the amount of available space in smem have changed |
573 | * since last scan. | 575 | * since last scan. |
574 | */ | 576 | */ |
575 | available = qcom_smem_get_free_space(edge->edge_id); | 577 | available = qcom_smem_get_free_space(edge->remote_pid); |
576 | if (available != edge->smem_available) { | 578 | if (available != edge->smem_available) { |
577 | edge->smem_available = available; | 579 | edge->smem_available = available; |
578 | edge->need_rescan = true; | 580 | edge->need_rescan = true; |
@@ -976,7 +978,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed | |||
976 | spin_lock_init(&channel->recv_lock); | 978 | spin_lock_init(&channel->recv_lock); |
977 | init_waitqueue_head(&channel->fblockread_event); | 979 | init_waitqueue_head(&channel->fblockread_event); |
978 | 980 | ||
979 | ret = qcom_smem_get(edge->edge_id, smem_info_item, (void **)&info, &info_size); | 981 | ret = qcom_smem_get(edge->remote_pid, smem_info_item, (void **)&info, |
982 | &info_size); | ||
980 | if (ret) | 983 | if (ret) |
981 | goto free_name_and_channel; | 984 | goto free_name_and_channel; |
982 | 985 | ||
@@ -997,7 +1000,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed | |||
997 | goto free_name_and_channel; | 1000 | goto free_name_and_channel; |
998 | } | 1001 | } |
999 | 1002 | ||
1000 | ret = qcom_smem_get(edge->edge_id, smem_fifo_item, &fifo_base, &fifo_size); | 1003 | ret = qcom_smem_get(edge->remote_pid, smem_fifo_item, &fifo_base, |
1004 | &fifo_size); | ||
1001 | if (ret) | 1005 | if (ret) |
1002 | goto free_name_and_channel; | 1006 | goto free_name_and_channel; |
1003 | 1007 | ||
@@ -1041,7 +1045,7 @@ static void qcom_discover_channels(struct qcom_smd_edge *edge) | |||
1041 | int i; | 1045 | int i; |
1042 | 1046 | ||
1043 | for (tbl = 0; tbl < SMD_ALLOC_TBL_COUNT; tbl++) { | 1047 | for (tbl = 0; tbl < SMD_ALLOC_TBL_COUNT; tbl++) { |
1044 | ret = qcom_smem_get(edge->edge_id, | 1048 | ret = qcom_smem_get(edge->remote_pid, |
1045 | smem_items[tbl].alloc_tbl_id, | 1049 | smem_items[tbl].alloc_tbl_id, |
1046 | (void **)&alloc_tbl, | 1050 | (void **)&alloc_tbl, |
1047 | NULL); | 1051 | NULL); |
@@ -1184,6 +1188,10 @@ static int qcom_smd_parse_edge(struct device *dev, | |||
1184 | return -EINVAL; | 1188 | return -EINVAL; |
1185 | } | 1189 | } |
1186 | 1190 | ||
1191 | edge->remote_pid = QCOM_SMEM_HOST_ANY; | ||
1192 | key = "qcom,remote-pid"; | ||
1193 | of_property_read_u32(node, key, &edge->remote_pid); | ||
1194 | |||
1187 | syscon_np = of_parse_phandle(node, "qcom,ipc", 0); | 1195 | syscon_np = of_parse_phandle(node, "qcom,ipc", 0); |
1188 | if (!syscon_np) { | 1196 | if (!syscon_np) { |
1189 | dev_err(dev, "no qcom,ipc node\n"); | 1197 | dev_err(dev, "no qcom,ipc node\n"); |