summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/host1x/host1x_cdma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/host/host1x/host1x_cdma.c')
-rw-r--r--drivers/video/tegra/host/host1x/host1x_cdma.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/drivers/video/tegra/host/host1x/host1x_cdma.c b/drivers/video/tegra/host/host1x/host1x_cdma.c
index 00289fc6d980..7a01cca3be4b 100644
--- a/drivers/video/tegra/host/host1x/host1x_cdma.c
+++ b/drivers/video/tegra/host/host1x/host1x_cdma.c
@@ -33,9 +33,9 @@
static inline u32 host1x_channel_dmactrl(int stop, int get_rst, int init_get)
{
- return HOST1X_CREATE(CHANNEL_DMACTRL, DMASTOP, stop)
- | HOST1X_CREATE(CHANNEL_DMACTRL, DMAGETRST, get_rst)
- | HOST1X_CREATE(CHANNEL_DMACTRL, DMAINITGET, init_get);
+ return host1x_channel_dmactrl_dmastop_f(stop)
+ | host1x_channel_dmactrl_dmagetrst_f(get_rst)
+ | host1x_channel_dmactrl_dmainitget_f(init_get);
}
static void cdma_timeout_handler(struct work_struct *work);
@@ -222,7 +222,8 @@ static void cdma_timeout_destroy(struct nvhost_cdma *cdma)
* Increment timedout buffer's syncpt via CPU.
*/
static void cdma_timeout_cpu_incr(struct nvhost_cdma *cdma, u32 getptr,
- u32 syncpt_incrs, u32 syncval, u32 nr_slots)
+ u32 syncpt_incrs, u32 syncval, u32 nr_slots,
+ u32 waitbases)
{
struct nvhost_master *dev = cdma_to_dev(cdma);
struct push_buffer *pb = &cdma->push_buffer;
@@ -235,10 +236,10 @@ static void cdma_timeout_cpu_incr(struct nvhost_cdma *cdma, u32 getptr,
nvhost_syncpt_update_min(&dev->syncpt, cdma->timeout.syncpt_id);
/* update WAITBASE_3D by same number of incrs */
- if (cdma->timeout.syncpt_id == NVSYNCPT_3D) {
+ if (waitbases) {
void __iomem *p;
- p = dev->sync_aperture + HOST1X_SYNC_SYNCPT_BASE_0 +
- (NVWAITBASE_3D * sizeof(u32));
+ p = dev->sync_aperture + host1x_sync_syncpt_base_0_r() +
+ (ffs(waitbases) * sizeof(u32));
writel(syncval, p);
}
@@ -269,20 +270,20 @@ static void cdma_start(struct nvhost_cdma *cdma)
cdma->last_put = cdma_pb_op().putptr(&cdma->push_buffer);
writel(host1x_channel_dmactrl(true, false, false),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
/* set base, put, end pointer (all of memory) */
- writel(0, chan_regs + HOST1X_CHANNEL_DMASTART);
- writel(cdma->last_put, chan_regs + HOST1X_CHANNEL_DMAPUT);
- writel(0xFFFFFFFF, chan_regs + HOST1X_CHANNEL_DMAEND);
+ writel(0, chan_regs + host1x_channel_dmastart_r());
+ writel(cdma->last_put, chan_regs + host1x_channel_dmaput_r());
+ writel(0xFFFFFFFF, chan_regs + host1x_channel_dmaend_r());
/* reset GET */
writel(host1x_channel_dmactrl(true, true, true),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
/* start the command DMA */
writel(host1x_channel_dmactrl(false, false, false),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
cdma->running = true;
}
@@ -304,32 +305,32 @@ static void cdma_timeout_restart(struct nvhost_cdma *cdma, u32 getptr)
cdma->last_put = cdma_pb_op().putptr(&cdma->push_buffer);
writel(host1x_channel_dmactrl(true, false, false),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
/* set base, end pointer (all of memory) */
- writel(0, chan_regs + HOST1X_CHANNEL_DMASTART);
- writel(0xFFFFFFFF, chan_regs + HOST1X_CHANNEL_DMAEND);
+ writel(0, chan_regs + host1x_channel_dmastart_r());
+ writel(0xFFFFFFFF, chan_regs + host1x_channel_dmaend_r());
/* set GET, by loading the value in PUT (then reset GET) */
- writel(getptr, chan_regs + HOST1X_CHANNEL_DMAPUT);
+ writel(getptr, chan_regs + host1x_channel_dmaput_r());
writel(host1x_channel_dmactrl(true, true, true),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
dev_dbg(&dev->dev->dev,
"%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n",
__func__,
- readl(chan_regs + HOST1X_CHANNEL_DMAGET),
- readl(chan_regs + HOST1X_CHANNEL_DMAPUT),
+ readl(chan_regs + host1x_channel_dmaget_r()),
+ readl(chan_regs + host1x_channel_dmaput_r()),
cdma->last_put);
/* deassert GET reset and set PUT */
writel(host1x_channel_dmactrl(true, false, false),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
- writel(cdma->last_put, chan_regs + HOST1X_CHANNEL_DMAPUT);
+ chan_regs + host1x_channel_dmactrl_r());
+ writel(cdma->last_put, chan_regs + host1x_channel_dmaput_r());
/* start the command DMA */
writel(host1x_channel_dmactrl(false, false, false),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
cdma->running = true;
}
@@ -347,7 +348,7 @@ static void cdma_kick(struct nvhost_cdma *cdma)
if (put != cdma->last_put) {
void __iomem *chan_regs = cdma_to_channel(cdma)->aperture;
wmb();
- writel(put, chan_regs + HOST1X_CHANNEL_DMAPUT);
+ writel(put, chan_regs + host1x_channel_dmaput_r());
cdma->last_put = put;
}
}
@@ -360,7 +361,7 @@ static void cdma_stop(struct nvhost_cdma *cdma)
if (cdma->running) {
nvhost_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY);
writel(host1x_channel_dmactrl(true, false, false),
- chan_regs + HOST1X_CHANNEL_DMACTRL);
+ chan_regs + host1x_channel_dmactrl_r());
cdma->running = false;
}
mutex_unlock(&cdma->lock);
@@ -395,21 +396,21 @@ void cdma_timeout_teardown_begin(struct nvhost_cdma *cdma)
dev_dbg(&dev->dev->dev,
"begin channel teardown (channel id %d)\n", ch->chid);
- cmdproc_stop = readl(dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ cmdproc_stop = readl(dev->sync_aperture + host1x_sync_cmdproc_stop_r());
cmdproc_stop |= BIT(ch->chid);
- writel(cmdproc_stop, dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ writel(cmdproc_stop, dev->sync_aperture + host1x_sync_cmdproc_stop_r());
dev_dbg(&dev->dev->dev,
"%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n",
__func__,
- readl(ch->aperture + HOST1X_CHANNEL_DMAGET),
- readl(ch->aperture + HOST1X_CHANNEL_DMAPUT),
+ readl(ch->aperture + host1x_channel_dmaget_r()),
+ readl(ch->aperture + host1x_channel_dmaput_r()),
cdma->last_put);
writel(host1x_channel_dmactrl(true, false, false),
- ch->aperture + HOST1X_CHANNEL_DMACTRL);
+ ch->aperture + host1x_channel_dmactrl_r());
- writel(BIT(ch->chid), dev->sync_aperture + HOST1X_SYNC_CH_TEARDOWN);
+ writel(BIT(ch->chid), dev->sync_aperture + host1x_sync_ch_teardown_r());
nvhost_module_reset(ch->dev);
cdma->running = false;
@@ -428,9 +429,9 @@ void cdma_timeout_teardown_end(struct nvhost_cdma *cdma, u32 getptr)
"end channel teardown (id %d, DMAGET restart = 0x%x)\n",
ch->chid, getptr);
- cmdproc_stop = readl(dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ cmdproc_stop = readl(dev->sync_aperture + host1x_sync_cmdproc_stop_r());
cmdproc_stop &= ~(BIT(ch->chid));
- writel(cmdproc_stop, dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ writel(cmdproc_stop, dev->sync_aperture + host1x_sync_cmdproc_stop_r());
cdma->torndown = false;
cdma_timeout_restart(cdma, getptr);
@@ -468,9 +469,9 @@ static void cdma_timeout_handler(struct work_struct *work)
}
/* stop processing to get a clean snapshot */
- prev_cmdproc = readl(dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ prev_cmdproc = readl(dev->sync_aperture + host1x_sync_cmdproc_stop_r());
cmdproc_stop = prev_cmdproc | BIT(ch->chid);
- writel(cmdproc_stop, dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ writel(cmdproc_stop, dev->sync_aperture + host1x_sync_cmdproc_stop_r());
dev_dbg(&dev->dev->dev, "cdma_timeout: cmdproc was 0x%x is 0x%x\n",
prev_cmdproc, cmdproc_stop);
@@ -485,7 +486,7 @@ static void cdma_timeout_handler(struct work_struct *work)
/* restore */
cmdproc_stop = prev_cmdproc & ~(BIT(ch->chid));
writel(cmdproc_stop,
- dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
+ dev->sync_aperture + host1x_sync_cmdproc_stop_r());
mutex_unlock(&cdma->lock);
return;
}
@@ -501,7 +502,7 @@ static void cdma_timeout_handler(struct work_struct *work)
/* stop HW, resetting channel/module */
cdma_op().timeout_teardown_begin(cdma);
- nvhost_cdma_update_sync_queue(cdma, sp, &dev->dev->dev);
+ nvhost_cdma_update_sync_queue(cdma, sp, dev->dev);
mutex_unlock(&cdma->lock);
}