aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/host1x/hw/cdma_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/host1x/hw/cdma_hw.c')
-rw-r--r--drivers/gpu/host1x/hw/cdma_hw.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
index 305ea8f3382d..659c1bbfeeba 100644
--- a/drivers/gpu/host1x/hw/cdma_hw.c
+++ b/drivers/gpu/host1x/hw/cdma_hw.c
@@ -41,7 +41,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
41{ 41{
42 struct host1x *host1x = cdma_to_host1x(cdma); 42 struct host1x *host1x = cdma_to_host1x(cdma);
43 struct push_buffer *pb = &cdma->push_buffer; 43 struct push_buffer *pb = &cdma->push_buffer;
44 u32 i; 44 unsigned int i;
45 45
46 for (i = 0; i < syncpt_incrs; i++) 46 for (i = 0; i < syncpt_incrs; i++)
47 host1x_syncpt_incr(cdma->timeout.syncpt); 47 host1x_syncpt_incr(cdma->timeout.syncpt);
@@ -58,6 +58,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
58 &pb->phys, getptr); 58 &pb->phys, getptr);
59 getptr = (getptr + 8) & (pb->size_bytes - 1); 59 getptr = (getptr + 8) & (pb->size_bytes - 1);
60 } 60 }
61
61 wmb(); 62 wmb();
62} 63}
63 64
@@ -162,12 +163,14 @@ static void cdma_stop(struct host1x_cdma *cdma)
162 struct host1x_channel *ch = cdma_to_channel(cdma); 163 struct host1x_channel *ch = cdma_to_channel(cdma);
163 164
164 mutex_lock(&cdma->lock); 165 mutex_lock(&cdma->lock);
166
165 if (cdma->running) { 167 if (cdma->running) {
166 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY); 168 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY);
167 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP, 169 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP,
168 HOST1X_CHANNEL_DMACTRL); 170 HOST1X_CHANNEL_DMACTRL);
169 cdma->running = false; 171 cdma->running = false;
170 } 172 }
173
171 mutex_unlock(&cdma->lock); 174 mutex_unlock(&cdma->lock);
172} 175}
173 176
@@ -213,11 +216,11 @@ static void cdma_resume(struct host1x_cdma *cdma, u32 getptr)
213 u32 cmdproc_stop; 216 u32 cmdproc_stop;
214 217
215 dev_dbg(host1x->dev, 218 dev_dbg(host1x->dev,
216 "resuming channel (id %d, DMAGET restart = 0x%x)\n", 219 "resuming channel (id %u, DMAGET restart = 0x%x)\n",
217 ch->id, getptr); 220 ch->id, getptr);
218 221
219 cmdproc_stop = host1x_sync_readl(host1x, HOST1X_SYNC_CMDPROC_STOP); 222 cmdproc_stop = host1x_sync_readl(host1x, HOST1X_SYNC_CMDPROC_STOP);
220 cmdproc_stop &= ~(BIT(ch->id)); 223 cmdproc_stop &= ~BIT(ch->id);
221 host1x_sync_writel(host1x, cmdproc_stop, HOST1X_SYNC_CMDPROC_STOP); 224 host1x_sync_writel(host1x, cmdproc_stop, HOST1X_SYNC_CMDPROC_STOP);
222 225
223 cdma->torndown = false; 226 cdma->torndown = false;
@@ -231,14 +234,11 @@ static void cdma_resume(struct host1x_cdma *cdma, u32 getptr)
231 */ 234 */
232static void cdma_timeout_handler(struct work_struct *work) 235static void cdma_timeout_handler(struct work_struct *work)
233{ 236{
237 u32 prev_cmdproc, cmdproc_stop, syncpt_val;
234 struct host1x_cdma *cdma; 238 struct host1x_cdma *cdma;
235 struct host1x *host1x; 239 struct host1x *host1x;
236 struct host1x_channel *ch; 240 struct host1x_channel *ch;
237 241
238 u32 syncpt_val;
239
240 u32 prev_cmdproc, cmdproc_stop;
241
242 cdma = container_of(to_delayed_work(work), struct host1x_cdma, 242 cdma = container_of(to_delayed_work(work), struct host1x_cdma,
243 timeout.wq); 243 timeout.wq);
244 host1x = cdma_to_host1x(cdma); 244 host1x = cdma_to_host1x(cdma);
@@ -277,9 +277,9 @@ static void cdma_timeout_handler(struct work_struct *work)
277 return; 277 return;
278 } 278 }
279 279
280 dev_warn(host1x->dev, "%s: timeout: %d (%s), HW thresh %d, done %d\n", 280 dev_warn(host1x->dev, "%s: timeout: %u (%s), HW thresh %d, done %d\n",
281 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, 281 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name,
282 syncpt_val, cdma->timeout.syncpt_val); 282 syncpt_val, cdma->timeout.syncpt_val);
283 283
284 /* stop HW, resetting channel/module */ 284 /* stop HW, resetting channel/module */
285 host1x_hw_cdma_freeze(host1x, cdma); 285 host1x_hw_cdma_freeze(host1x, cdma);
@@ -291,7 +291,7 @@ static void cdma_timeout_handler(struct work_struct *work)
291/* 291/*
292 * Init timeout resources 292 * Init timeout resources
293 */ 293 */
294static int cdma_timeout_init(struct host1x_cdma *cdma, u32 syncpt_id) 294static int cdma_timeout_init(struct host1x_cdma *cdma, unsigned int syncpt)
295{ 295{
296 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); 296 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler);
297 cdma->timeout.initialized = true; 297 cdma->timeout.initialized = true;
@@ -306,6 +306,7 @@ static void cdma_timeout_destroy(struct host1x_cdma *cdma)
306{ 306{
307 if (cdma->timeout.initialized) 307 if (cdma->timeout.initialized)
308 cancel_delayed_work(&cdma->timeout.wq); 308 cancel_delayed_work(&cdma->timeout.wq);
309
309 cdma->timeout.initialized = false; 310 cdma->timeout.initialized = false;
310} 311}
311 312