diff options
author | Sammy He <r62914@freescale.com> | 2012-01-04 15:30:14 +0800 |
---|---|---|
committer | Sammy He <r62914@freescale.com> | 2012-01-04 15:38:26 +0800 |
commit | 0224f38b433f770b9e54443f724265a2a655faa8 (patch) | |
tree | 15de24b2cf52f831528ee32f12d10691ee975971 | |
parent | 614017f46b445ef1cb38f36750261e21073b4e4f (diff) |
ENGR00170344 vpu: Reserve bitwork memory at vpu probe for android
Reserve bitwork memory at vpu probe since DMA zone is removed
on android.
Signed-off-by: Sammy He <r62914@freescale.com>
-rw-r--r-- | drivers/mxc/vpu/mxc_vpu.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c index c2d40bbfa1ec..33585f138970 100644 --- a/drivers/mxc/vpu/mxc_vpu.c +++ b/drivers/mxc/vpu/mxc_vpu.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2006-2012 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -45,6 +45,8 @@ #include <mach/mxc_vpu.h> +#define MAX_BITWORK_SIZE SZ_1M + struct vpu_priv { struct fasync_struct *async_queue; struct work_struct work; @@ -65,6 +67,8 @@ struct iram_setting { static DEFINE_SPINLOCK(vpu_lock); static LIST_HEAD(head); +static int vpu_inited; + static int vpu_major; static int vpu_clk_usercount; static struct class *vpu_class; @@ -463,6 +467,7 @@ static long vpu_ioctl(struct file *filp, u_int cmd, copy_to_user((void __user *)arg, &bitwork_mem, sizeof(struct vpu_mem_desc)); + vpu_inited = 1; break; } else { if (copy_from_user(&bitwork_mem, @@ -477,6 +482,8 @@ static long vpu_ioctl(struct file *filp, u_int cmd, sizeof(struct vpu_mem_desc))) ret = -EFAULT; + if (ret != -EFAULT) + vpu_inited = 1; } break; } @@ -715,8 +722,15 @@ static int vpu_dev_probe(struct platform_device *pdev) } #endif + vpu_inited = 0; + vpu_data.workqueue = create_workqueue("vpu_wq"); INIT_WORK(&vpu_data.work, vpu_worker_callback); + + bitwork_mem.size = MAX_BITWORK_SIZE; + if (vpu_alloc_dma_buffer(&bitwork_mem) == -1) + goto err_out_class; + printk(KERN_INFO "VPU initialized\n"); goto out; @@ -773,8 +787,8 @@ static int vpu_suspend(struct platform_device *pdev, pm_message_t state) clk_disable(vpu_clk); if (cpu_is_mx51()) { - clk_enable(vpu_clk); - if (bitwork_mem.cpu_addr != 0) { + if (bitwork_mem.cpu_addr != 0 && vpu_inited) { + clk_enable(vpu_clk); SAVE_WORK_REGS; SAVE_CTRL_REGS; SAVE_RDWR_PTR_REGS; @@ -784,8 +798,8 @@ static int vpu_suspend(struct platform_device *pdev, pm_message_t state) WRITE_REG(VPU_SLEEP_REG_VALUE, BIT_RUN_COMMAND); while (READ_REG(BIT_BUSY_FLAG)) ; + clk_disable(vpu_clk); } - clk_disable(vpu_clk); } if (cpu_is_mx51() && vpu_plat->pg) @@ -809,13 +823,14 @@ static int vpu_resume(struct platform_device *pdev) if (vpu_plat->pg) vpu_plat->pg(0); - clk_enable(vpu_clk); - if (bitwork_mem.cpu_addr != 0) { + if (bitwork_mem.cpu_addr != 0 && vpu_inited) { u32 *p = (u32 *) bitwork_mem.cpu_addr; u32 data; u16 data_hi; u16 data_lo; + clk_enable(vpu_clk); + RESTORE_WORK_REGS; WRITE_REG(0x0, BIT_RESET_CTRL); @@ -858,8 +873,9 @@ static int vpu_resume(struct platform_device *pdev) WRITE_REG(VPU_WAKE_REG_VALUE, BIT_RUN_COMMAND); while (READ_REG(BIT_BUSY_FLAG)) ; + + clk_disable(vpu_clk); } - clk_disable(vpu_clk); recover_clk: /* Recover vpu clock */ |