Commit 47c298f7 authored by Lucas Stach's avatar Lucas Stach Committed by Philipp Zabel

gpu: ipu-v3: pre: only use internal clock gating

By setting the SFTRST bit, the PRE will be held in the lowest power state
with clocks to the internal blocks gated. When external clock gating is
used (from the external clock controller, or by setting the CLKGATE bit)
the PRE will sporadically fail to start.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Fixes: d2a34232 ("gpu: ipu-v3: add driver for Prefetch Resolve Engine")
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 3c2993b8
...@@ -131,8 +131,6 @@ int ipu_pre_get(struct ipu_pre *pre) ...@@ -131,8 +131,6 @@ int ipu_pre_get(struct ipu_pre *pre)
if (pre->in_use) if (pre->in_use)
return -EBUSY; return -EBUSY;
clk_prepare_enable(pre->clk_axi);
/* first get the engine out of reset and remove clock gating */ /* first get the engine out of reset and remove clock gating */
writel(0, pre->regs + IPU_PRE_CTRL); writel(0, pre->regs + IPU_PRE_CTRL);
...@@ -149,12 +147,7 @@ int ipu_pre_get(struct ipu_pre *pre) ...@@ -149,12 +147,7 @@ int ipu_pre_get(struct ipu_pre *pre)
void ipu_pre_put(struct ipu_pre *pre) void ipu_pre_put(struct ipu_pre *pre)
{ {
u32 val; writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL);
val = IPU_PRE_CTRL_SFTRST | IPU_PRE_CTRL_CLKGATE;
writel(val, pre->regs + IPU_PRE_CTRL);
clk_disable_unprepare(pre->clk_axi);
pre->in_use = false; pre->in_use = false;
} }
...@@ -249,6 +242,8 @@ static int ipu_pre_probe(struct platform_device *pdev) ...@@ -249,6 +242,8 @@ static int ipu_pre_probe(struct platform_device *pdev)
if (!pre->buffer_virt) if (!pre->buffer_virt)
return -ENOMEM; return -ENOMEM;
clk_prepare_enable(pre->clk_axi);
pre->dev = dev; pre->dev = dev;
platform_set_drvdata(pdev, pre); platform_set_drvdata(pdev, pre);
mutex_lock(&ipu_pre_list_mutex); mutex_lock(&ipu_pre_list_mutex);
...@@ -268,6 +263,8 @@ static int ipu_pre_remove(struct platform_device *pdev) ...@@ -268,6 +263,8 @@ static int ipu_pre_remove(struct platform_device *pdev)
available_pres--; available_pres--;
mutex_unlock(&ipu_pre_list_mutex); mutex_unlock(&ipu_pre_list_mutex);
clk_disable_unprepare(pre->clk_axi);
if (pre->buffer_virt) if (pre->buffer_virt)
gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt, gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt,
IPU_PRE_MAX_WIDTH * IPU_PRE_NUM_SCANLINES * 4); IPU_PRE_MAX_WIDTH * IPU_PRE_NUM_SCANLINES * 4);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment