aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/ste_modem_rproc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 17:04:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 17:04:56 -0400
commitde9c9f86be0dc3495de98dc65c80abe6e7c7d643 (patch)
tree47ad4787412b26eea9f49b858855f919b0cb4898 /drivers/remoteproc/ste_modem_rproc.c
parent3e11a00d8561622a2598254853e2e8cc3e51e544 (diff)
parentb9777859ec015a78dae1476e317d04f851bfdd0d (diff)
Merge tag 'remoteproc-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc
Pull remoteproc update from Ohad Ben-Cohen: - Some refactoring, cleanups and small improvements from Sjur Brændeland. The improvements are mainly about better supporting varios virtio properties (such as virtio's config space, status and features). I now see that I messed up while commiting one of Sjur's patches and erroneously put myself as the author, as well as letting a nasty typo sneak in. I will not fix this in order to avoid rebasing the patches. Sjur - sorry! - A new remoteproc driver for OMAP-L13x (technically a DaVinci platform) from Robert Tivy. - Extend OMAP support to OMAP5 as well, from Vincent Stehlé. - Fix Kconfig VIRTUALIZATION dependency, from Suman Anna (a non-critical fix which arrived late during the rc cycle). * tag 'remoteproc-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc: remoteproc: fix kconfig dependencies for VIRTIO remoteproc/davinci: add a remoteproc driver for OMAP-L13x DSP remoteproc: support default firmware name in rproc_alloc() remoteproc/omap: support OMAP5 too remoteproc: set vring addresses in resource table remoteproc: support virtio config space. remoteproc: perserve resource table data remoteproc: calculate max_notifyid by counting vrings remoteproc: code cleanup of resource parsing remoteproc: parse STE-firmware and find resource table address remoteproc: add find_loaded_rsc_table firmware ops remoteproc: refactor rproc_elf_find_rsc_table()
Diffstat (limited to 'drivers/remoteproc/ste_modem_rproc.c')
-rw-r--r--drivers/remoteproc/ste_modem_rproc.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/drivers/remoteproc/ste_modem_rproc.c b/drivers/remoteproc/ste_modem_rproc.c
index fb95c4220052..1ec39a4c0b3e 100644
--- a/drivers/remoteproc/ste_modem_rproc.c
+++ b/drivers/remoteproc/ste_modem_rproc.c
@@ -64,26 +64,18 @@ static int sproc_load_segments(struct rproc *rproc, const struct firmware *fw)
64} 64}
65 65
66/* Find the entry for resource table in the Table of Content */ 66/* Find the entry for resource table in the Table of Content */
67static struct ste_toc_entry *sproc_find_rsc_entry(const struct firmware *fw) 67static const struct ste_toc_entry *sproc_find_rsc_entry(const void *data)
68{ 68{
69 int i; 69 int i;
70 struct ste_toc *toc; 70 const struct ste_toc *toc;
71 71 toc = data;
72 if (!fw)
73 return NULL;
74
75 toc = (void *)fw->data;
76 72
77 /* Search the table for the resource table */ 73 /* Search the table for the resource table */
78 for (i = 0; i < SPROC_MAX_TOC_ENTRIES && 74 for (i = 0; i < SPROC_MAX_TOC_ENTRIES &&
79 toc->table[i].start != 0xffffffff; i++) { 75 toc->table[i].start != 0xffffffff; i++) {
80
81 if (!strncmp(toc->table[i].name, SPROC_RESOURCE_NAME, 76 if (!strncmp(toc->table[i].name, SPROC_RESOURCE_NAME,
82 sizeof(toc->table[i].name))) { 77 sizeof(toc->table[i].name)))
83 if (toc->table[i].start > fw->size)
84 return NULL;
85 return &toc->table[i]; 78 return &toc->table[i];
86 }
87 } 79 }
88 80
89 return NULL; 81 return NULL;
@@ -96,9 +88,12 @@ sproc_find_rsc_table(struct rproc *rproc, const struct firmware *fw,
96{ 88{
97 struct sproc *sproc = rproc->priv; 89 struct sproc *sproc = rproc->priv;
98 struct resource_table *table; 90 struct resource_table *table;
99 struct ste_toc_entry *entry; 91 const struct ste_toc_entry *entry;
100 92
101 entry = sproc_find_rsc_entry(fw); 93 if (!fw)
94 return NULL;
95
96 entry = sproc_find_rsc_entry(fw->data);
102 if (!entry) { 97 if (!entry) {
103 sproc_err(sproc, "resource table not found in fw\n"); 98 sproc_err(sproc, "resource table not found in fw\n");
104 return NULL; 99 return NULL;
@@ -149,10 +144,30 @@ sproc_find_rsc_table(struct rproc *rproc, const struct firmware *fw,
149 return table; 144 return table;
150} 145}
151 146
147/* Find the resource table inside the remote processor's firmware. */
148static struct resource_table *
149sproc_find_loaded_rsc_table(struct rproc *rproc, const struct firmware *fw)
150{
151 struct sproc *sproc = rproc->priv;
152 const struct ste_toc_entry *entry;
153
154 if (!fw || !sproc->fw_addr)
155 return NULL;
156
157 entry = sproc_find_rsc_entry(sproc->fw_addr);
158 if (!entry) {
159 sproc_err(sproc, "resource table not found in fw\n");
160 return NULL;
161 }
162
163 return sproc->fw_addr + entry->start;
164}
165
152/* STE modem firmware handler operations */ 166/* STE modem firmware handler operations */
153const struct rproc_fw_ops sproc_fw_ops = { 167const struct rproc_fw_ops sproc_fw_ops = {
154 .load = sproc_load_segments, 168 .load = sproc_load_segments,
155 .find_rsc_table = sproc_find_rsc_table, 169 .find_rsc_table = sproc_find_rsc_table,
170 .find_loaded_rsc_table = sproc_find_loaded_rsc_table,
156}; 171};
157 172
158/* Kick the modem with specified notification id */ 173/* Kick the modem with specified notification id */
@@ -198,7 +213,7 @@ static int sproc_start(struct rproc *rproc)
198 } 213 }
199 214
200 /* Subscribe to notifications */ 215 /* Subscribe to notifications */
201 for (i = 0; i < rproc->max_notifyid; i++) { 216 for (i = 0; i <= rproc->max_notifyid; i++) {
202 err = sproc->mdev->ops.kick_subscribe(sproc->mdev, i); 217 err = sproc->mdev->ops.kick_subscribe(sproc->mdev, i);
203 if (err) { 218 if (err) {
204 sproc_err(sproc, 219 sproc_err(sproc,