aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-10-19 10:33:27 -0400
committerThierry Reding <treding@nvidia.com>2017-10-19 10:33:27 -0400
commitd5d91f30860f9c1139c41a652461e9d54614670d (patch)
tree85d29bab0e81e7034d093e14c205f36a855ffc13
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff)
parent370d010f0ef09db7ab157a6b5d6d9a737b148f2a (diff)
Merge branch 'for-4.15/firmware' into for-4.15/soc
-rw-r--r--drivers/firmware/tegra/bpmp.c22
-rw-r--r--include/soc/tegra/bpmp.h1
2 files changed, 17 insertions, 6 deletions
diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
index 73ca55b7b7ec..33683b5a0d48 100644
--- a/drivers/firmware/tegra/bpmp.c
+++ b/drivers/firmware/tegra/bpmp.c
@@ -194,16 +194,24 @@ static int tegra_bpmp_wait_master_free(struct tegra_bpmp_channel *channel)
194} 194}
195 195
196static ssize_t __tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel, 196static ssize_t __tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,
197 void *data, size_t size) 197 void *data, size_t size, int *ret)
198{ 198{
199 int err;
200
199 if (data && size > 0) 201 if (data && size > 0)
200 memcpy(data, channel->ib->data, size); 202 memcpy(data, channel->ib->data, size);
201 203
202 return tegra_ivc_read_advance(channel->ivc); 204 err = tegra_ivc_read_advance(channel->ivc);
205 if (err < 0)
206 return err;
207
208 *ret = channel->ib->code;
209
210 return 0;
203} 211}
204 212
205static ssize_t tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel, 213static ssize_t tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,
206 void *data, size_t size) 214 void *data, size_t size, int *ret)
207{ 215{
208 struct tegra_bpmp *bpmp = channel->bpmp; 216 struct tegra_bpmp *bpmp = channel->bpmp;
209 unsigned long flags; 217 unsigned long flags;
@@ -217,7 +225,7 @@ static ssize_t tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,
217 } 225 }
218 226
219 spin_lock_irqsave(&bpmp->lock, flags); 227 spin_lock_irqsave(&bpmp->lock, flags);
220 err = __tegra_bpmp_channel_read(channel, data, size); 228 err = __tegra_bpmp_channel_read(channel, data, size, ret);
221 clear_bit(index, bpmp->threaded.allocated); 229 clear_bit(index, bpmp->threaded.allocated);
222 spin_unlock_irqrestore(&bpmp->lock, flags); 230 spin_unlock_irqrestore(&bpmp->lock, flags);
223 231
@@ -337,7 +345,8 @@ int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp,
337 if (err < 0) 345 if (err < 0)
338 return err; 346 return err;
339 347
340 return __tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size); 348 return __tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size,
349 &msg->rx.ret);
341} 350}
342EXPORT_SYMBOL_GPL(tegra_bpmp_transfer_atomic); 351EXPORT_SYMBOL_GPL(tegra_bpmp_transfer_atomic);
343 352
@@ -371,7 +380,8 @@ int tegra_bpmp_transfer(struct tegra_bpmp *bpmp,
371 if (err == 0) 380 if (err == 0)
372 return -ETIMEDOUT; 381 return -ETIMEDOUT;
373 382
374 return tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size); 383 return tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size,
384 &msg->rx.ret);
375} 385}
376EXPORT_SYMBOL_GPL(tegra_bpmp_transfer); 386EXPORT_SYMBOL_GPL(tegra_bpmp_transfer);
377 387
diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h
index 9ba65222bd3f..57519f4c126a 100644
--- a/include/soc/tegra/bpmp.h
+++ b/include/soc/tegra/bpmp.h
@@ -110,6 +110,7 @@ struct tegra_bpmp_message {
110 struct { 110 struct {
111 void *data; 111 void *data;
112 size_t size; 112 size_t size;
113 int ret;
113 } rx; 114 } rx;
114}; 115};
115 116