summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sin <davidsin@ti.com>2010-01-04 16:02:48 -0600
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2010-01-06 00:36:20 +0530
commiteb0885ba5fc1fcd4bc82b116c771010a64b78f3b (patch)
tree660cf3aa1245f44ecb6d1839586d9404d64a7a5f
parent372181d33497eaa4881617af022871265a20e706 (diff)
- remove wakeup build flagsti-2.6.31-omap4-L24.3-for-testing-p1
1. fix compile warnings 2. remove unused functions and structures 3. remove build flags used during wakeup 4. general code cleanup 5. added more memory checks 6. set managed page count to 16 7. relocated page array allocation 8. consolidated dmm register mapping 9. reduced debug messages
-rwxr-xr-xdrivers/media/video/tiler/dmm.c770
-rwxr-xr-xdrivers/media/video/tiler/dmm_2d_alloc.c145
-rw-r--r--drivers/media/video/tiler/dmm_2d_alloc.h6
-rw-r--r--drivers/media/video/tiler/dmm_drv.h599
-rwxr-xr-xdrivers/media/video/tiler/dmm_hl_drv.c580
-rw-r--r--drivers/media/video/tiler/dmm_ll_drv.c547
-rw-r--r--drivers/media/video/tiler/dmm_page_rep.c105
-rw-r--r--drivers/media/video/tiler/dmm_prv.h164
-rw-r--r--drivers/media/video/tiler/dmm_reg.h2
9 files changed, 244 insertions, 2674 deletions
diff --git a/drivers/media/video/tiler/dmm.c b/drivers/media/video/tiler/dmm.c
index f5f00a6e1be3..a30e20b604c9 100755
--- a/drivers/media/video/tiler/dmm.c
+++ b/drivers/media/video/tiler/dmm.c
@@ -16,409 +16,27 @@
#include <linux/init.h>
#include <linux/module.h>
-#include <linux/cdev.h> /* struct cdev */
-#include <linux/kdev_t.h> /* MKDEV() */
-#include <linux/fs.h> /* register_chrdev_region() */
-#include <linux/device.h> /* struct class */
-#include <linux/platform_device.h> /* platform_device() */
-#include <linux/err.h> /* IS_ERR() */
+#include <linux/cdev.h>
+#include <linux/kdev_t.h>
+#include <linux/fs.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
#include <linux/errno.h>
-#include <linux/io.h> /* ioremap() */
-#include <linux/mm.h> /* mmaping */
+#include <linux/io.h>
+#include <linux/mm.h>
#include <linux/mm_types.h>
-#include <linux/sched.h> /* current->mm */
-#include <linux/uaccess.h> /* copy_to_user() */
+#include <linux/sched.h>
+#include <linux/uaccess.h>
#include "tiler.h"
#include "dmm_drv.h"
#include "dmm_prv.h"
#include "dmm_def.h"
-#define __NEWCODE__
-#ifdef __NEWCODE__
-#include <linux/dma-mapping.h>
-#include <linux/hardirq.h>
-
-struct pat_area {
- int x0:8;
- int y0:8;
- int x1:8;
- int y1:8;
-};
-
-struct pat_ctrl {
- int start:4;
- int direction:4;
- int lut_id:8;
- int sync:12;
- int initiator:4;
-};
-
-struct pat_desc {
- struct pat_desc *next;
- struct pat_area area;
- struct pat_ctrl ctrl;
- unsigned long data;
-};
-
-void *dmm_base;
-
-static void pat_area_set(struct pat_area *area, char id);
-static void pat_data_set(unsigned long data, char id);
-static void pat_ctrl_set(struct pat_ctrl *ctrl, char id);
-static void pat_desc_set(struct pat_desc *desc, char id);
-static void hwinfo_get(void);
-static void pat_view_set(void);
-static void pat_view_map_set(void);
-static void pat_view_map_base_set(void);
-static void tiler_or_set(void);
-
-static void tiler_or_set() /* (struct tiler_or *or, char id) */
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set TILER_OR__0 register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)TILER_OR__0);
- reg_val = __raw_readl(reg);
- regdump("TILER_OR__0", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x88888888, reg); /* __raw_writel(new_val, reg); */
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)TILER_OR__0);
- reg_val = __raw_readl(reg);
- regdump("TILER_OR__0", reg_val);
-
- /* set TILER_OR__1 register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)TILER_OR__1);
- reg_val = __raw_readl(reg);
- regdump("TILER_OR__1", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x88888888, reg); /* __raw_writel(new_val, reg); */
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)TILER_OR__1);
- reg_val = __raw_readl(reg);
- regdump("TILER_OR__1", reg_val);
-}
-static void pat_view_set() /* (struct pat_view *view, char id) */
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_VIEW__0 register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW__0", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x88888888, reg); /* __raw_writel(new_val, reg); */
-
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW__0", reg_val);
-
- /* set PAT_VIEW__1 register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW__1);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW__1", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x88888888, reg); /* __raw_writel(new_val, reg); */
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW__1);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW__1", reg_val);
-}
-static void pat_view_map_set() /* (struct pat_view_map *map, char id) */
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_VIEW_MAP__0 register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW_MAP__0", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x80808080, reg); /* __raw_writel(new_val, reg); */
-
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW_MAP__0", reg_val);
-}
-
-static void pat_view_map_base_set()/*(struct pat_view_map_base *base, char id)*/
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_VIEW_MAP_BASE register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP_BASE);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW_MAP_BASE", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x80000000, reg); /* __raw_writel(new_val, reg); */
-
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP_BASE);
- reg_val = __raw_readl(reg);
- regdump("PAT_VIEW_MAP_BASE", reg_val);
-}
-
-static void hwinfo_get()
-{
- void __iomem *reg = NULL;
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)DMM_REVISION);
- regdump("DMM_REVISION", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)DMM_HWINFO);
- regdump("DMM_HWINFO", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)LISA_HWINFO);
- regdump("LISA_HWINFO", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)TILER_HWINFO);
- regdump("TILER_HWINFO", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_HWINFO);
- regdump("PAT_HWINFO", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_GEOMETRY);
- regdump("PAT_GEOMETRY", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_STATUS__0);
- regdump("PAT_STATUS__0", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_STATUS__1);
- regdump("PAT_STATUS__1", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_STATUS__2);
- regdump("PAT_STATUS__2", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_STATUS__3);
- regdump("PAT_STATUS__3", __raw_readl(reg));
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PEG_HWINFO);
- regdump("PEG_HWINFO", __raw_readl(reg));
-}
-static void pat_desc_set(struct pat_desc *desc, char id)
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* write to pat registers */
- /* opt to individually set each reg, so set PAT_DESC register to NULL */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_DESCR__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_DESCR__0", reg_val);
-
- bit_field = BITFIELD(31, 4);
- field_pos = 4;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)desc) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_DESCR__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_DESCR__0", reg_val);
-}
-static void pat_ctrl_set(struct pat_ctrl *ctrl, char id)
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_CTRL register */
- /* TODO: casting as unsigned long */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_CTRL__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_CTRL__0", reg_val);
-
- bit_field = BITFIELD(31, 28);
- field_pos = 28;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)ctrl->initiator) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(16, 16);
- field_pos = 16;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)ctrl->sync) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(9, 8);
- field_pos = 8;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)ctrl->lut_id) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(6, 4);
- field_pos = 4;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)ctrl->direction) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(0, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)ctrl->start) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_CTRL__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_CTRL__0", reg_val);
-}
-static void pat_data_set(unsigned long data, char id)
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_DATA register */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_DATA__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_DATA__0", reg_val);
-
- bit_field = BITFIELD(31, 4);
- field_pos = 4;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)data >> 4) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_DATA__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_DATA__0", reg_val);
-}
-static void pat_area_set(struct pat_area *area, char id)
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_AREA register */
- /* TODO: changed casting from char to unsigned long */
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_AREA__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_AREA__0", reg_val);
-
- bit_field = BITFIELD(30, 24);
- field_pos = 24;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)area->y1) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(23, 16);
- field_pos = 16;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)area->x1) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(14, 8);
- field_pos = 8;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)area->y0) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- bit_field = BITFIELD(7, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)area->x0) << field_pos) & bit_field);
- __raw_writel(new_val, reg);
-
- reg_val = __raw_readl(reg);
- reg = (void __iomem *)(
- (unsigned long)dmm_base | (unsigned long)PAT_AREA__0);
- reg_val = __raw_readl(reg);
- regdump("PAT_AREA__0", reg_val);
-}
-#endif /* end: #ifdef __NEWCODE__ */
-
#define DMM_MAJOR 0
#define DMM_MINOR 0
-#define DMM_IO_BASE_ADDR 0x4e000000
-unsigned long *dmm_virt_base_addr;
+void *dmm_base;
static struct dmmInstanceCtxT *ctxptr;
struct node {
@@ -437,7 +55,6 @@ static int dmm_ioctl(struct inode *i, struct file *f,
static int dmm_mmap(struct file *f, struct vm_area_struct *v);
static void dmm_vma_open(struct vm_area_struct *vma);
static void dmm_vma_close(struct vm_area_struct *vma);
-static void dmm_config(void);
static int removenode(struct node *listhead, int offset);
static int tiler_destroy_buf_info_list(struct node *listhead);
static int addnode(struct node *listhead, struct tiler_buf_info *p);
@@ -447,6 +64,11 @@ static int tiler_find_buf(unsigned long sysptr, struct tiler_block_info *blk);
static int
tiler_get_buf_info(struct node *listhead, struct tiler_buf_info **pp, int ofst);
+static void pat_view_set(void);
+static void pat_view_map_set(void);
+static void pat_view_map_base_set(void);
+static void tiler_or_set(void);
+
static int dmm_major;
static int dmm_minor;
@@ -474,9 +96,9 @@ static struct platform_driver tiler_driver_ldm = {
.name = "tiler",
},
.probe = NULL,
- .shutdown = NULL,
- .remove = NULL,
- };
+ .shutdown = NULL,
+ .remove = NULL,
+};
static int
__init dmm_init(void)
@@ -485,6 +107,7 @@ __init dmm_init(void)
int retval = -1;
int error = -1;
struct device *device = NULL;
+ void __iomem *reg = NULL;
if (dmm_major) {
dev = MKDEV(dmm_major, dmm_minor);
@@ -523,29 +146,21 @@ __init dmm_init(void)
retval = platform_driver_register(&tiler_driver_ldm);
- /* map the TILER i/o physical addr to krnl virt addr */
- dmm_virt_base_addr = (unsigned long *)ioremap(DMM_IO_BASE_ADDR, 2048);
-
ctxptr = kmalloc(sizeof(struct dmmInstanceCtxT), GFP_KERNEL);
+ if (!ctxptr)
+ return -ENOMEM;
memset(ctxptr, 0x0, sizeof(struct dmmInstanceCtxT));
error = dmm_instance_init((void *)ctxptr, TILER_WIDTH,
TILER_HEIGHT, NULL, NULL);
if (error == 1) {
retval = 0;
} else {
- mutex_destroy(((struct dmmInstanceCtxT *)
- dmmInstanceCtxPtr)->dmmTilerCtx.mtx);
+ mutex_destroy(&(ctxptr->dmmTilerCtx.mtx));
kfree(ctxptr);
return retval;
}
-#ifndef __NEWCODE__
- /* config LISA/PAT */
- dmm_config();
-#else
- void __iomem *reg = NULL;
dmm_base = ioremap(DMM_BASE, 0x1000);
- printk(KERN_NOTICE "dmm_base = %p", dmm_base);
reg = (void __iomem *)(
(unsigned long)dmm_base | (unsigned long)LISA_MAP__0);
@@ -559,21 +174,11 @@ __init dmm_init(void)
pat_view_map_set();
pat_view_map_base_set();
tiler_or_set();
-#endif
/* create buffer info list */
createlist(&lsthd);
id = 0xda7a000;
-#if 0
- void *va = NULL;
- dma_addr_t pa = 0x0;
- va = dma_alloc_coherent(NULL, 32000*4+16,
- &pa,
- (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL);
- memset((unsigned long *)va, 0x0, 32000*4+16);
-#endif
-
EXIT:
return retval;
}
@@ -581,8 +186,7 @@ EXIT:
static void
__exit dmm_exit(void)
{
- mutex_destroy(((struct dmmInstanceCtxT *)
- dmmInstanceCtxPtr)->dmmTilerCtx.mtx);
+ mutex_destroy(&(ctxptr->dmmTilerCtx.mtx));
kfree(ctxptr);
tiler_destroy_buf_info_list(lsthd);
@@ -594,7 +198,7 @@ __exit dmm_exit(void)
device_destroy(dmmdev_class, MKDEV(dmm_major, dmm_minor));
class_destroy(dmmdev_class);
- iounmap(dmm_virt_base_addr);
+ iounmap(dmm_base);
}
static int
@@ -633,16 +237,12 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
switch (cmd) {
case TILIOC_OPEN:
- debug(__LINE__);
retval = 0;
break;
case TILIOC_CLOSE:
- debug(__LINE__);
retval = 0;
break;
case TILIOC_GBUF:
- debug(__LINE__);
-
bytes = copy_from_user((void *)(&block_info),
(const void *)arg, sizeof(struct tiler_block_info));
if (bytes != 0)
@@ -672,8 +272,6 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
retval = 0;
break;
case TILIOC_FBUF:
- debug(__LINE__);
-
bytes = copy_from_user((void *)(&block_info),
(const void *)arg, sizeof(struct tiler_block_info));
if (bytes != 0)
@@ -684,8 +282,6 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
retval = 0;
break;
case TILIOC_GSSP:
- debug(__LINE__);
-
pgd = pgd_offset(current->mm, arg);
if (!(pgd_none(*pgd) || pgd_bad(*pgd))) {
pmd = pmd_offset(pgd, arg);
@@ -705,12 +301,9 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
retval = 0x0; /* va not in page table */
break;
case TILIOC_MBUF:
- debug(__LINE__);
retval = 0;
break;
case TILIOC_QBUF:
- debug(__LINE__);
-
bytes = copy_from_user((void *)(&buf_info),
(const void *)arg, sizeof(struct tiler_buf_info));
if (bytes != 0)
@@ -729,9 +322,9 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
retval = 0;
break;
case TILIOC_RBUF:
- debug(__LINE__);
-
bufinfo = kmalloc(sizeof(struct tiler_buf_info), GFP_KERNEL);
+ if (!bufinfo)
+ return retval;
memset(bufinfo, 0x0, sizeof(struct tiler_buf_info));
bytes = copy_from_user((void *)bufinfo,
(const void *)arg, sizeof(struct tiler_buf_info));
@@ -752,8 +345,6 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
retval = 0;
break;
case TILIOC_URBUF:
- debug(__LINE__);
-
bytes = copy_from_user((void *)(&buf_info),
(const void *)arg, sizeof(struct tiler_buf_info));
if (bytes != 0)
@@ -767,8 +358,6 @@ dmm_ioctl(struct inode *ip, struct file *filp, unsigned int cmd,
retval = 0;
break;
case TILIOC_QUERY_BLK:
- debug(__LINE__);
-
bytes = copy_from_user((void *)(&block_info),
(const void *)arg, sizeof(struct tiler_block_info));
if (bytes != 0)
@@ -800,7 +389,6 @@ dmm_mmap(struct file *filp, struct vm_area_struct *vma)
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- tilerdump(__LINE__);
ret = tiler_get_buf_info(lsthd, &b, vma->vm_pgoff << PAGE_SHIFT);
if (ret != 0) {
printk(KERN_ERR "%s::%s():%d: tiler_get_buf_info failed\n",
@@ -875,157 +463,6 @@ dmm_vma_close(struct vm_area_struct *vma)
/* printk(KERN_NOTICE "dmm VMA close.\n"); */
}
-static void
-dmm_config(void)
-{
- struct dmmPATIrqConfigLstT patEvents;
- struct dmmPATEngineConfigLstT patEngineConf[2];
- struct dmmPATViewConfigLstT patViewConf[16];
- struct dmmPATViewMapConfigLstT patViewMapConf[4];
- struct dmmLISAConfigLstT lisaMemMapConf[1];
- struct dmmTILERConfigLstT dmmTilerAliasView[16];
- unsigned int retCode = 0x0;
- unsigned int i = 0x0;
-
- tilerdump(__LINE__);
- /* clear irq event registers */
- patEvents.nextConf = NULL;
- patEvents.irqConf.clrEvents = 1;
- patEvents.irqConf.irqEvnts.irqAreaSelect = 0;
- patEvents.irqConf.irqEvnts.lutMiss = 1;
- patEvents.irqConf.irqEvnts.updData = 1;
- patEvents.irqConf.irqEvnts.updCtrl = 1;
- patEvents.irqConf.irqEvnts.updArea = 1;
- patEvents.irqConf.irqEvnts.invData = 1;
- patEvents.irqConf.irqEvnts.invDsc = 1;
- patEvents.irqConf.irqEvnts.fillLst = 1;
- patEvents.irqConf.irqEvnts.fillDsc = 1;
-
- if (dmm_pat_irq_config_set((struct dmmPATIrqConfigLstT *)&patEvents) !=
- DMM_NO_ERROR) {
- printk(KERN_ERR "%s::%s():%d: ERROR!\n",
- __FILE__, __func__, __LINE__);
- retCode = 0x2;
- }
-
- /* configure pat engines */
- patEngineConf[0].nextConf = &patEngineConf[1];
- patEngineConf[0].engineConf.dmmPatEngineSel = 0;
- patEngineConf[0].engineConf.engineMode = NORMAL_MODE;
-
- patEngineConf[1].nextConf = NULL;
- patEngineConf[1].engineConf.dmmPatEngineSel = 1;
- patEngineConf[1].engineConf.engineMode = NORMAL_MODE;
-
- if (dmm_module_config(NULL, NULL, NULL,
- (struct dmmPATEngineConfigLstT *)patEngineConf,
- NULL, NULL, NULL) !=
- DMM_NO_ERROR) {
- printk(KERN_ERR "%s::%s():%d: ERROR!\n",
- __FILE__, __func__, __LINE__);
- retCode = 0x2;
- }
-
- /* configure LISA map 0 */
- lisaMemMapConf[0].nextConf = NULL;
- lisaMemMapConf[0].mapConf.lisaMemMapIndx = 0;
- lisaMemMapConf[0].mapConf.sysAddr = 0x80;
- lisaMemMapConf[0].mapConf.sysSize = 0x5;
- lisaMemMapConf[0].mapConf.sdrcIntl = 0x0 ;
- lisaMemMapConf[0].mapConf.sdrcAddrspc = 0x1;
- lisaMemMapConf[0].mapConf.sdrcMap = 0x1;
- lisaMemMapConf[0].mapConf.sdrcAddr = 0x00;
-
- if (dmm_module_config(NULL, NULL,
- (struct dmmLISAConfigLstT *)lisaMemMapConf,
- NULL, NULL, NULL, NULL) != DMM_NO_ERROR) {
- printk(KERN_ERR "%s::%s():%d: ERROR!\n",
- __FILE__, __func__, __LINE__);
- retCode = 0x2;
- }
-
- /* */
- for (i = 0; i < 16; i++) {
- patViewConf[i].nextConf = &patViewConf[i+1];
- patViewConf[i].aliasViewConf.initiatorId = i;
- patViewConf[i].aliasViewConf.viewIndex = 0;
- }
- patViewConf[15].nextConf = NULL;
-
- if (dmm_module_config(NULL, NULL, NULL, NULL,
- (struct dmmPATViewConfigLstT *)&patViewConf,
- NULL, NULL) !=
- DMM_NO_ERROR) {
- printk(KERN_ERR "%s::%s():%d: ERROR!\n",
- __FILE__, __func__, __LINE__);
- retCode = 0x2;
- }
-
- /* configure pat view map 0 */
- patViewMapConf[0].nextConf = &patViewMapConf[1];
- patViewMapConf[0].viewConf.patViewMapIndx = 0;
- patViewMapConf[0].viewConf.memoryAccessMode = MODE_8_BIT;
- patViewMapConf[0].viewConf.contX = 0;
- patViewMapConf[0].viewConf.transType = INDIRECT;
-
- /* Setting only the MSB seems to have no effect whatsoever */
- patViewMapConf[0].viewConf.dmmPATViewBase = 0xFFFFFFFF;
-
- patViewMapConf[1].nextConf = &patViewMapConf[2];
- patViewMapConf[1].viewConf.patViewMapIndx = 0;
- patViewMapConf[1].viewConf.memoryAccessMode = MODE_16_BIT;
- patViewMapConf[1].viewConf.contX = 0;
- patViewMapConf[1].viewConf.transType = INDIRECT;
-
- /* Setting only the MSB seems to have no effect whatsoever */
- patViewMapConf[1].viewConf.dmmPATViewBase = 0xFFFFFFFF;
-
- patViewMapConf[2].nextConf = &patViewMapConf[3];
- patViewMapConf[2].viewConf.patViewMapIndx = 0;
- patViewMapConf[2].viewConf.memoryAccessMode = MODE_32_BIT;
- patViewMapConf[2].viewConf.contX = 0;
- patViewMapConf[2].viewConf.transType = INDIRECT;
-
- /* Setting only the MSB seems to have no effect whatsoever */
- patViewMapConf[2].viewConf.dmmPATViewBase = 0xFFFFFFFF;
-
- patViewMapConf[3].nextConf = NULL;
- patViewMapConf[3].viewConf.patViewMapIndx = 0;
- patViewMapConf[3].viewConf.memoryAccessMode = MODE_PAGE;
- patViewMapConf[3].viewConf.contX = 0;
- patViewMapConf[3].viewConf.transType = INDIRECT;
-
- /* Setting only the MSB seems to have no effect whatsoever */
- patViewMapConf[3].viewConf.dmmPATViewBase = 0xFFFFFFFF;
-
- if (dmm_module_config(NULL, NULL, NULL, NULL, NULL,
- (struct dmmPATViewMapConfigLstT *)&patViewMapConf,
- NULL) != DMM_NO_ERROR) {
- printk(KERN_ERR "%s::%s():%d: ERROR!\n",
- __FILE__, __func__, __LINE__);
- retCode = 0x2;
- }
-
- /* set all initiators to zero degree natural */
- for (i = 0; i < 16; i++) {
- dmmTilerAliasView[i].nextConf = &dmmTilerAliasView[i + 1];
- dmmTilerAliasView[i].aliasConf.initiatorId = i;
- dmmTilerAliasView[i].aliasConf.orient.dmm90Rotate = 0;
- dmmTilerAliasView[i].aliasConf.orient.dmmXInvert = 0;
- dmmTilerAliasView[i].aliasConf.orient.dmmYInvert = 0;
- }
- dmmTilerAliasView[15].nextConf = NULL;
-
- if (dmm_module_config((struct dmmTILERConfigLstT *)dmmTilerAliasView,
- NULL, NULL, NULL, NULL, NULL, NULL) !=
- DMM_NO_ERROR) {
- printk(KERN_ERR "%s::%s():%d: ERROR!\n",
- __FILE__, __func__, __LINE__);
- retCode = 0x2;
- }
- tilerdump(__LINE__);
-}
-
int
tiler_alloc_buf(enum tiler_fmt fmt,
unsigned long width,
@@ -1039,8 +476,6 @@ tiler_alloc_buf(enum tiler_fmt fmt,
void *custmPagesPtr = NULL;
enum dmmMemoryAccessT contMod;
- tilerdump(__LINE__);
-
if (fmt == TILFMT_8BIT)
contMod = MODE_8_BIT;
else if (fmt == TILFMT_16BIT)
@@ -1098,8 +533,6 @@ tiler_find_buf(unsigned long sysptr, struct tiler_block_info *blk)
struct dmmTILERContPageAreaT *area;
- tilerdump(__LINE__);
-
area = dmm_tiler_get_area_from_sysptr(dmmTilerCtx,
(void *)(DMM_ALIAS_VIEW_CLEAR & sysptr));
blk->ptr = NULL;
@@ -1157,8 +590,6 @@ tiler_free_buf(unsigned long sysptr)
struct dmmTILERContPageAreaT *areaToFree;
- tilerdump(__LINE__);
-
/* if (aliasViewPtr) {
allocedPtr = (void *)((unsigned long)allocedPtr &
DMM_ALIAS_VIEW_CLEAR);
@@ -1175,8 +606,6 @@ tiler_free_buf(unsigned long sysptr)
}
EXPORT_SYMBOL(tiler_free_buf);
-
-
#define DMM_SHIFT_PER_X_8 0
#define DMM_SHIFT_PER_Y_8 0
#define DMM_SHIFT_PER_X_16 0
@@ -1323,8 +752,6 @@ tiler_reorient_addr(unsigned long tsptr,
{
unsigned long x, y;
- tilerdump(__LINE__);
-
tiler_get_natural_xy(tsptr, &x, &y);
return tiler_get_address(orient, DMM_GET_ACC_MODE(tsptr), x, y);
}
@@ -1772,8 +1199,149 @@ tiler_get_buf_info(struct node *listhead, struct tiler_buf_info **pp, int offst)
return -1;
}
+static void tiler_or_set()
+{
+ void __iomem *reg = NULL;
+ unsigned long reg_val = 0x0;
+ unsigned long new_val = 0x0;
+ unsigned long bit_field = 0x0;
+ unsigned long field_pos = 0x0;
+
+ /* set TILER_OR__0 register */
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)TILER_OR__0);
+ reg_val = __raw_readl(reg);
+ regdump("TILER_OR__0", reg_val);
+
+ bit_field = BITFIELD(31, 0);
+ field_pos = 0;
+ new_val = (reg_val & (~(bit_field))) |
+ ((((unsigned long)0) << field_pos) & bit_field);
+ __raw_writel(0x88888888, reg);
+
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)TILER_OR__0);
+ reg_val = __raw_readl(reg);
+ regdump("TILER_OR__0", reg_val);
+
+ /* set TILER_OR__1 register */
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)TILER_OR__1);
+ reg_val = __raw_readl(reg);
+ regdump("TILER_OR__1", reg_val);
+
+ bit_field = BITFIELD(31, 0);
+ field_pos = 0;
+ new_val = (reg_val & (~(bit_field))) |
+ ((((unsigned long)0) << field_pos) & bit_field);
+ __raw_writel(0x88888888, reg);
+
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)TILER_OR__1);
+ reg_val = __raw_readl(reg);
+ regdump("TILER_OR__1", reg_val);
+}
+
+static void pat_view_set()
+{
+ void __iomem *reg = NULL;
+ unsigned long reg_val = 0x0;
+ unsigned long new_val = 0x0;
+ unsigned long bit_field = 0x0;
+ unsigned long field_pos = 0x0;
+
+ /* set PAT_VIEW__0 register */
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW__0);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW__0", reg_val);
+
+ bit_field = BITFIELD(31, 0);
+ field_pos = 0;
+ new_val = (reg_val & (~(bit_field))) |
+ ((((unsigned long)0) << field_pos) & bit_field);
+ __raw_writel(0x88888888, reg);
+
+
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW__0);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW__0", reg_val);
+
+ /* set PAT_VIEW__1 register */
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW__1);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW__1", reg_val);
+
+ bit_field = BITFIELD(31, 0);
+ field_pos = 0;
+ new_val = (reg_val & (~(bit_field))) |
+ ((((unsigned long)0) << field_pos) & bit_field);
+ __raw_writel(0x88888888, reg);
+
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW__1);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW__1", reg_val);
+}
+
+static void pat_view_map_set()
+{
+ void __iomem *reg = NULL;
+ unsigned long reg_val = 0x0;
+ unsigned long new_val = 0x0;
+ unsigned long bit_field = 0x0;
+ unsigned long field_pos = 0x0;
+
+ /* set PAT_VIEW_MAP__0 register */
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP__0);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW_MAP__0", reg_val);
+
+ bit_field = BITFIELD(31, 0);
+ field_pos = 0;
+ new_val = (reg_val & (~(bit_field))) |
+ ((((unsigned long)0) << field_pos) & bit_field);
+ __raw_writel(0x80808080, reg);
+
+
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP__0);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW_MAP__0", reg_val);
+}
+
+static void pat_view_map_base_set()
+{
+ void __iomem *reg = NULL;
+ unsigned long reg_val = 0x0;
+ unsigned long new_val = 0x0;
+ unsigned long bit_field = 0x0;
+ unsigned long field_pos = 0x0;
+
+ /* set PAT_VIEW_MAP_BASE register */
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP_BASE);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW_MAP_BASE", reg_val);
+
+ bit_field = BITFIELD(31, 0);
+ field_pos = 0;
+ new_val = (reg_val & (~(bit_field))) |
+ ((((unsigned long)0) << field_pos) & bit_field);
+ __raw_writel(0x80000000, reg);
+
+
+ reg = (void __iomem *)(
+ (unsigned long)dmm_base | (unsigned long)PAT_VIEW_MAP_BASE);
+ reg_val = __raw_readl(reg);
+ regdump("PAT_VIEW_MAP_BASE", reg_val);
+}
+
MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("davidsin@ti.com");
+MODULE_AUTHOR("a0869738@ti.com");
module_init(dmm_init);
module_exit(dmm_exit);
diff --git a/drivers/media/video/tiler/dmm_2d_alloc.c b/drivers/media/video/tiler/dmm_2d_alloc.c
index 19abfd6204e2..c12137d2f839 100755
--- a/drivers/media/video/tiler/dmm_2d_alloc.c
+++ b/drivers/media/video/tiler/dmm_2d_alloc.c
@@ -1,73 +1,30 @@
-/* =============================================================================
-* Texas Instruments OMAP(TM) Platform Software
-* (c) Copyright 2009, Texas Instruments Incorporated. All Rights Reserved.
-*
-* Use of this software is controlled by the terms and conditions found
-* in the license agreement under which this software has been supplied.
-* =========================================================================== */
-/**
-* @file dmm_2D_alloc.c
-*
-* Two dimensional allocation algorithm implementation file.
-*
-* @path WTSD_DucatiMMSW/drivers/drv_dmm/src
-*
-* @rev 00.02
-*/
-/* -------------------------------------------------------------------------- */
-/* ----------------------------------------------------------------------------
-*!
-*! Revision History
-*! ===================================
-*! 19-02-2009 Andreev: created.
-*! 27-03-2009 Andreev: bug fixes.
-*!
-* =========================================================================== */
-
-/* User code goes here */
-/* ------compilation control switches --------------------------------------- */
-/****************************************************************
- * INCLUDE FILES
- ***************************************************************/
-/* ----- system and platform files ----------------------------*/
-/*-------program files ----------------------------------------*/
+/*
+ * dmm_2d_alloc.c
+ *
+ * DMM driver support functions for TI OMAP processors.
+ *
+ * Copyright (C) 2009-2010 Texas Instruments, Inc.
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
#include <linux/module.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h> /* vmalloc_to_page */
-#include <linux/mmzone.h> /* __page_to_phys */
+#include <linux/mm.h>
+#include <linux/mmzone.h>
+#include <linux/io.h>
+#include <linux/dma-mapping.h>
+#include <linux/hardirq.h>
#include "dmm_def.h"
#include "dmm_2d_alloc.h"
#include "dmm_prv.h"
-#define __NEWCODE__
-
-#ifdef __NEWCODE__
-#include <linux/io.h>
-#include <linux/dma-mapping.h>
-#include <linux/hardirq.h>
-#endif
-
-/****************************************************************
-* EXTERNAL REFERENCES NOTE: only use if not found in header file
-****************************************************************/
-/*--------data declarations -----------------------------------*/
-/*--------function prototypes ---------------------------------*/
-
-/****************************************************************
-* PUBLIC DECLARATIONS Defined here, used elsewhere
-****************************************************************/
-/*--------data declarations -----------------------------------*/
-/*--------function prototypes ---------------------------------*/
-
-/****************************************************************
-* PRIVATE DECLARATIONS Defined here, used only here
-****************************************************************/
-/*--------macros ----------------------------------------------*/
-/*--------data declarations -----------------------------------*/
-/*--------function prototypes ---------------------------------*/
-#define DMM_ASSERT_BREAK tilerdump(__LINE__); while (1);
-#define DMM_ENTER_CRITICAL_SECTION()
-#define DMM_EXIT_CRITICAL_SETCTION
+#define DMM_ASSERT_BREAK printk(KERN_ERR "DMM Assert(Fail)\n"); while (1);
/* ========================================================================== */
/**
@@ -1100,7 +1057,6 @@ enum MSP_BOOL area_fit_to_left(struct dmmTILERContPageAreaT *areaReq,
if (X >= 0 && X <= tlrCtx->contSizeX && Y >= 0 && Y <=
tlrCtx->contSizeY) {
- tilerdump(__LINE__);
while (Y <= atchAr->y1) {
anchorY = Y;
if (1 == point_free_test(tlrCtx, X, Y, &areaHit)) {
@@ -1164,7 +1120,6 @@ enum MSP_BOOL area_fit_to_left(struct dmmTILERContPageAreaT *areaReq,
}
}
}
- tilerdump(__LINE__);
return fit;
}
@@ -1215,7 +1170,6 @@ enum MSP_BOOL area_fit_to_right(struct dmmTILERContPageAreaT *areaReq,
if (X >= 0 && X <= tlrCtx->contSizeX && Y >= 0 && Y <=
tlrCtx->contSizeY) {
- tilerdump(__LINE__);
while (Y <= atchAr->y1) {
anchorY = Y;
if (1 == point_free_test(tlrCtx, X, Y, &areaHit)) {
@@ -1280,7 +1234,6 @@ enum MSP_BOOL area_fit_to_right(struct dmmTILERContPageAreaT *areaReq,
}
}
}
- tilerdump(__LINE__);
return fit;
}
@@ -1331,7 +1284,6 @@ enum MSP_BOOL area_fit_to_top(struct dmmTILERContPageAreaT *areaReq,
if (X >= 0 && X < tlrCtx->contSizeX && Y >= 0 &&
Y < tlrCtx->contSizeY) {
- tilerdump(__LINE__);
while (X <= atchAr->x1) {
anchorX = X;
if (1 == point_free_test(tlrCtx, X, Y, &areaHit)) {
@@ -1395,7 +1347,6 @@ enum MSP_BOOL area_fit_to_top(struct dmmTILERContPageAreaT *areaReq,
}
}
}
- tilerdump(__LINE__);
return fit;
}
@@ -1446,7 +1397,6 @@ enum MSP_BOOL area_fit_to_bottom(struct dmmTILERContPageAreaT *areaReq,
if (X >= 0 && X < tlrCtx->contSizeX && Y >= 0 &&
Y < tlrCtx->contSizeY) {
- tilerdump(__LINE__);
while (X <= atchAr->x1) {
if (1 == point_free_test(tlrCtx, X, Y, &areaHit)) {
anchorX = X;
@@ -1510,7 +1460,6 @@ enum MSP_BOOL area_fit_to_bottom(struct dmmTILERContPageAreaT *areaReq,
}
}
}
- tilerdump(__LINE__);
return fit;
}
@@ -1548,32 +1497,26 @@ alloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
dmmTilerCtx->tmpArSelect.ttlExpndAr.x1 = dmmTilerCtx->contSizeX - 1;
dmmTilerCtx->tmpArSelect.ttlExpndAr.y1 = dmmTilerCtx->contSizeY - 1;
- /* DMM_ENTER_CRITICAL_SECTION(); */
mutex_lock(&dmmTilerCtx->mtx);
- tilerdump(__LINE__);
if (usedIter != NULL) {
int fit = 0;
while (usedIter != NULL) {
- tilerdump(__LINE__);
fit |= area_fit_to_top(areaReq,
&(usedIter->pgAr), dmmTilerCtx);
- tilerdump(__LINE__);
fit |= area_fit_to_right(areaReq,
&(usedIter->pgAr), dmmTilerCtx);
- tilerdump(__LINE__);
fit |= area_fit_to_bottom(areaReq,
&(usedIter->pgAr), dmmTilerCtx);
- tilerdump(__LINE__);
fit |= area_fit_to_left(areaReq,
&(usedIter->pgAr), dmmTilerCtx);
- tilerdump(__LINE__);
usedIter = usedIter->pgArNext;
}
if (fit > 0) {
- tilerdump(dmmTilerCtx);
allocatedArea = kmalloc
(sizeof(struct dmmTILERContPageLstT), GFP_KERNEL);
+ if (!allocatedArea)
+ return NULL;
memset(allocatedArea, 0x0,
sizeof(struct dmmTILERContPageLstT));
allocatedArea->pgAr.x0 =
@@ -1594,13 +1537,13 @@ alloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
while (usedIter->pgArNext != NULL)
usedIter = usedIter->pgArNext;
- tilerdump(allocatedArea);
usedIter->pgArNext = allocatedArea;
}
} else {
- tilerdump(__LINE__);
allocatedArea = kmalloc
(sizeof(struct dmmTILERContPageLstT), GFP_KERNEL);
+ if (!allocatedArea)
+ return NULL;
memset(allocatedArea, 0x0, sizeof(struct dmmTILERContPageLstT));
allocatedArea->pgAr.x0 = 0;
allocatedArea->pgAr.y0 = 0;
@@ -1609,21 +1552,15 @@ alloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
allocatedArea->pgAr.fitToSide = PSA_BOTTOM;
allocatedArea->anchrAr = NULL;
allocatedArea->pgArNext = NULL;
-
- tilerdump(allocatedArea);
dmmTilerCtx->usdArList = allocatedArea;
}
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&dmmTilerCtx->mtx);
- if (allocatedArea == NULL) {
- tilerdump(__LINE__);
+ if (allocatedArea == NULL)
return NULL;
- } else {
- tilerdump(&(allocatedArea->pgAr));
+ else
return &(allocatedArea->pgAr);
- }
}
/* ========================================================================== */
@@ -1652,18 +1589,15 @@ enum MSP_BOOL dealloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
struct dmmTILERContPageLstT *usedIter;
struct dmmTILERContPageLstT *usedPrev;
- /* DMM_ENTER_CRITICAL_SECTION(); */
mutex_lock(&dmmTilerCtx->mtx);
delItm = NULL;
usedIter = dmmTilerCtx->usdArList;
usedPrev = NULL;
- tilerdump(__LINE__);
while (usedIter != NULL) {
if (areaRem->x0 == usedIter->pgAr.x0 &&
areaRem->y0 == usedIter->pgAr.y0) {
- tilerdump(__LINE__);
delItm = usedIter;
if (usedPrev != NULL)
usedPrev->pgArNext = usedIter->pgArNext;
@@ -1678,7 +1612,6 @@ enum MSP_BOOL dealloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
usedIter = usedIter->pgArNext;
}
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&dmmTilerCtx->mtx);
if (delItm != NULL) {
@@ -1686,13 +1619,11 @@ enum MSP_BOOL dealloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
enum errorCodeT eCode = DMM_NO_ERROR;
unsigned long numPages = 0x0;
- tilerdump(__LINE__);
/* If the memory pages are provided by the dmm pages memory
pool, then free them. Otherwise leave them for the user
to free them.
*/
if (delItm->pgAr.patCustomPages == MSP_FALSE) {
- tilerdump(__LINE__);
numPages = (delItm->pgAr.x1 - delItm->pgAr.x0 + 1)*
(delItm->pgAr.y1 - delItm->pgAr.y0 + 1);
/* Get the area to free associated physical memory pages
@@ -1707,9 +1638,6 @@ enum MSP_BOOL dealloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
*/
for (i = 0;
i < numPages && eCode == DMM_NO_ERROR; i++) {
-#ifdef __NEWCODE__
- debug(i);
-#endif
eCode = dmm_free_phys_page(
(unsigned long *)
(delItm->pgAr.patPageEntries[i]));
@@ -1717,31 +1645,16 @@ enum MSP_BOOL dealloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
}
if (eCode == DMM_NO_ERROR) {
- tilerdump(__LINE__);
-#ifndef __NEWCODE__
- kfree(delItm->pgAr.patPageEntriesSpace);
- delItm->pgAr.patPageEntries = NULL;
- delItm->pgAr.patPageEntriesSpace = NULL;
-#else
- debug(__LINE__);
-#if 0
- iounmap(delItm->pgAr.page_list_virt);
- __free_page(delItm->pgAr.page_list);
-#else
dma_free_coherent(NULL, delItm->pgAr.dma_size,
delItm->pgAr.dma_va,
delItm->pgAr.dma_pa);
-#endif
delItm->pgAr.patPageEntries = NULL;
delItm->pgAr.patPageEntriesSpace = NULL;
-#endif
}
- tilerdump(__LINE__);
kfree(delItm);
return MSP_TRUE;
} else {
- tilerdump(__LINE__);
return MSP_FALSE;
}
}
@@ -1785,13 +1698,11 @@ search_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
while (usedIter != NULL) {
if (usedIter->pgAr.x0 <= X && X <= usedIter->pgAr.x1 &&
usedIter->pgAr.y0 <= Y && Y <= usedIter->pgAr.y1) {
- tilerdump(__LINE__);
return &(usedIter->pgAr);
}
usedIter = usedIter->pgArNext;
}
- tilerdump(__LINE__);
return NULL;
}
diff --git a/drivers/media/video/tiler/dmm_2d_alloc.h b/drivers/media/video/tiler/dmm_2d_alloc.h
index dcafee36aa33..d2526102918d 100644
--- a/drivers/media/video/tiler/dmm_2d_alloc.h
+++ b/drivers/media/video/tiler/dmm_2d_alloc.h
@@ -17,8 +17,6 @@
#ifndef _DMM_2D_ALLOC_H
#define _DMM_2D_ALLOC_H
-#define __NEWCODE__
-
#include <linux/dma-mapping.h>
enum MSP_BOOL {
@@ -46,13 +44,11 @@ struct dmmTILERContPageAreaT {
enum SideAffinity fitToSide;
int patCustomPages;
unsigned long *patPageEntriesSpace;
-#ifdef __NEWCODE__
struct page *page_list;
unsigned long *page_list_virt;
void *dma_va;
unsigned long dma_size;
dma_addr_t dma_pa;
-#endif
unsigned long *patPageEntries;
};
@@ -73,9 +69,7 @@ struct dmmTILERContCtxT {
signed long contSizeY;
struct dmmTILERContPageLstT *usdArList;
struct dmmTILERContPageAreaSpecT tmpArSelect;
-#ifdef __NEWCODE__
struct mutex mtx;
-#endif
};
/* ========================================================================== */
diff --git a/drivers/media/video/tiler/dmm_drv.h b/drivers/media/video/tiler/dmm_drv.h
index 82460ee0065e..6e9a076b1d0d 100644
--- a/drivers/media/video/tiler/dmm_drv.h
+++ b/drivers/media/video/tiler/dmm_drv.h
@@ -21,102 +21,6 @@
/* ========================================================================== */
/**
- * dmm_tiler_alias_orientation_set()
- *
- * @brief Set specific TILER alias orientation setting per initiator ID
- * (alias view).
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which alias view will be editted.
- *
- * @param viewOrientation - dmmViewOrientT - [in] New alias view orientation
- * setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmViewOrientT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_tiler_alias_orientation_set(signed long initiatorID,
- struct dmmViewOrientT viewOrientation);
-
-/* ========================================================================== */
-/**
- * dmm_tiler_alias_orientation_get()
- *
- * @brief Set specific TILER alias orientation setting per initiator ID
- * (alias view).
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which alias view will be editted.
- *
- * @param viewOrientation - dmmViewOrientT* - [out] Pointer to write alias view
- * orientation setting to.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmViewOrientT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_tiler_alias_orientation_get(signed long initiatorID,
- struct dmmViewOrientT *viewOrientation);
-
-/* ========================================================================== */
-/**
- * dmm_peg_priority_set()
- *
- * @brief Set specific PEG priority setting per initiator ID.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which priority will be editted.
- *
- * @param prio - unsigned long - [in] New priority setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_peg_priority_set(signed long initiatorID,
- unsigned long prio);
-
-/* ========================================================================== */
-/**
- * dmm_peg_priority_get()
- *
- * @brief Get specific PEG priority setting per initiator ID.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which priority will be editted.
- *
- * @param prio - unsigned long* - [out] Poitner to write the priority setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_peg_priority_get(signed long initiatorID,
- unsigned long *prio);
-
-/* ========================================================================== */
-/**
* dmm_pat_area_refill()
*
* @brief Initiate a PAT area refill (or terminate an ongoing - consult
@@ -179,509 +83,6 @@ enum errorCodeT dmm_pat_refill_area_status_get(signed long dmmPatAreaStatSel,
/* ========================================================================== */
/**
- * dmm_pat_refill_engine_config()
- *
- * @brief Configure the selected PAT refill engine.
- *
- * @param dmmPatEngineSel - signed long - [in] Selects which PAT engine will
- * be configured.
- *
- * @param engineMode - dmmPATEngineAccessT - [in] New engine mode.
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATEngineAccessT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_refill_engine_config(signed long dmmPatEngineSel,
- enum dmmPATEngineAccessT engineMode);
-
-/* ========================================================================== */
-/**
- * dmm_pat_refill_engine_config_get()
- *
- * @brief Get the selected PAT refill engine configuration.
- *
- * @param dmmPatEngineSel - signed long - [in] Selects which PAT engine will be
- * configured.
- *
- * @param engineMode - dmmPATEngineAccessT* - [out] Pointer to write the engine
- * mode.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATEngineAccessT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_refill_engine_config_get(signed long dmmPatEngineSel,
- enum dmmPATEngineAccessT *engineMode);
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_set()
- *
- * @brief Set specific PAT initiator view settings.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which PAT view will be editted.
- *
- * @param patViewIndx - signed long - [in] New view map setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_set(signed long initiatorID,
- signed long patViewIndx);
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_get()
- *
- * @brief Get specific PAT initiator view settings.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which PAT view will be editted.
- *
- * @param patViewIndx - signed long* - [out] Pointer to write the view map
- * setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_get(signed long initiatorID,
- signed long *patViewIndx);
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_map_config()
- *
- * @brief Configure selected PAT view map.
- *
- * @param patViewMapIndx - signed long - [in] Index of the selected PAT view
- * map.
- *
- * @param memoryAccessMode - dmmMemoryAccessT - [in] Type of memory access to
- * perform through this view.
- *
- * @param contX - unsigned long - [in] CONT_x register value.
- *
- * @param transType - dmmPATTranslationT - [in] Address translation schemes.
- *
- * @param dmmPATViewBase - unsigned long - [in] View map base address
- * (31-bit only considered).
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmMemoryAccessT, dmmPATTranslationT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_map_config(signed long patViewMapIndx,
- enum dmmMemoryAccessT memoryAccessMode,
- unsigned long contX,
- enum dmmPATTranslationT transType,
- unsigned long dmmPATViewBase);
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_map_config_get()
- *
- * @brief Get selected PAT view map configuration.
- *
- * @param patViewMapIndx - signed long - [in] Index of the selected PAT view
- * map.
- *
- * @param memoryAccessMode - dmmMemoryAccessT - [int] Type of memory access
- * that configuration is queried.
- *
- * @param contX - unsigned long* - [out] Pointer to write the CONT_x register
- * value.
- *
- * @param transType - dmmPATTranslationT* - [out] Pointer to write the
- * address translation schemes.
- *
- * @param dmmPATViewBase - unsigned long* - [out] Pointer to write the view
- * map base address.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmMemoryAccessT, dmmPATTranslationT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_map_config_get(signed long patViewMapIndx,
- enum dmmMemoryAccessT memoryAccessMode,
- unsigned long *contX,
- enum dmmPATTranslationT *transType,
- unsigned long *dmmPATViewBase);
-
-/* ========================================================================== */
-/**
- * dmm_lisa_memory_map_config()
- *
- * @brief Configure selected LISA memory map.
- *
- * @param lisaMemMapIndx - signed long - [in] Index of the selected LISA memory
- * map.
- *
- * @param sysSize - dmmMemSectionSizeT - [in] Size of the memory section.
- *
- * @param sdrcIntl - dmmMemSdrcIntlModeT - [in] SDRAM controller interleaving
- * mode
- *
- * @param sdrcAddrspc - unsigned long - [in] SDRAM controller address space.
- *
- * @param sdrcMap - dmmMemSectionMappingT - [in] SDRAM controller mapping.
- *
- * @param sdrcAddr - unsigned long - [in] SDRAM controller address MSB.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmMemSectionSizeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_lisa_memory_map_config(signed long lisaMemMapIndx,
- unsigned long sysAddr,
- enum dmmMemSectionSizeT sysSize,
- enum dmmMemSdrcIntlModeT sdrcIntl,
- unsigned long sdrcAddrspc,
- enum dmmMemSectionMappingT sdrcMap,
- unsigned long sdrcAddr);
-
-/* ========================================================================== */
-/**
- * dmm_lisa_memory_map_config_get()
- *
- * @brief Get selected LISA memory map configuration.
- *
- * @param lisaMemMapIndx - signed long - [in] Index of the selected LISA
- * memory map.
- *
- * @param sysSize - dmmMemSectionSizeT* - [out] Pointer to write size of
- * the memory section.
- *
- * @param sdrcIntl - dmmMemSdrcIntlModeT* - [out] Pointer to write SDRAM
- * controller interleaving mode.
- *
- * @param sdrcAddrspc - unsigned long* - [out] Pointer to write SDRAM
- * controller address space.
- *
- * @param sdrcMap - dmmMemSectionMappingT* - [out] Pointer to write SDRAM
- * controller mapping.
- *
- * @param sdrcAddr - unsigned long* - [out] Pointer to write SDRAM
- * controller address MSB.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmMemSectionSizeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_lisa_memory_map_config_get(signed long lisaMemMapIndx,
- unsigned long *sysAddr,
- enum dmmMemSectionSizeT *sysSize,
- enum dmmMemSdrcIntlModeT *sdrcIntl,
- unsigned long *sdrcAddrspc,
- enum dmmMemSectionMappingT *sdrcMap,
- unsigned long *sdrcAddr);
-
-/* ========================================================================== */
-/**
- * dmm_engage_lisa_lock()
- *
- * @brief Sets the LISA lock register preventing further writting to the
- * LISA memory map registers.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post Only a software reset of the DMM module can clear the lock bit.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_engage_lisa_lock(void);
-
-/* ========================================================================== */
-/**
- * dmm_sys_config_set()
- *
- * @brief DMM clock management configuration.
- *
- * @param dmmIdleMode - unsigned long - [in] Idle mode.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post Only a software reset of the DMM module can clear the lock bit.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_sys_config_set(unsigned long dmmIdleMode);
-
-/* ========================================================================== */
-/**
- * dmm_sys_config_get()
- *
- * @brief DMM clock management configuration.
- *
- * @param dmmIdleMode - unsigned long* - [out] Idle mode status.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_sys_config_get(unsigned long *dmmIdleMode);
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_mode_set()
- *
- * @brief Enable/disable PAT interrupt events.
- *
- * @param patIrqEvnt - dmmPATIrqEventsT* - [in] Interrupt events to set.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqEventsT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_irq_mode_set(struct dmmPATIrqEventsT *patIrqEvnt);
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_mode_get()
- *
- * @brief Enable/disable PAT interrupt events.
- *
- * @param patIrqEvnt - dmmPATIrqEventsT* - [in/out] Get interrupt events masks.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqEventsT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_irq_mode_get(struct dmmPATIrqEventsT *patIrqEvnt);
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_status_get()
- *
- * @brief Get the statuses of PAT interrupt events.
- *
- * @param patIrqEvnt - dmmPATIrqEventsT* - [in/out] Interrupt events statuses.
- *
- * @param clrEvents - int - [in] Celar events upon retrieval.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqEventsT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_irq_status_get(struct dmmPATIrqEventsT *patIrqEvnt,
- int clrEvents);
-
-/* ========================================================================== */
-/**
- * dmm_module_config()
- *
- * @brief Configure selected DMM modules.
- *
- * @param tilerConf - dmmTILERConfigLstT* - [in] A NULL termintated linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param pegConf - dmmPEGConfigLstT* - [in] A NULL termintated linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param lisaConf - dmmLISAConfigLstT* - [in] A NULL termintated linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param patEngineConf - dmmPATEngineConfigLstT* - [in] A NULL termintated
- * linked list of all configurations for the specific DMM module or NULL if
- * not to be configured.
- *
- * @param patViewCOnf - dmmPATViewConfigLstT* - [in] A NULL termintated
- * linked list of all configurations for the specific DMM module or NULL
- * if not to be configured.
- *
- * @param patViewMapConf - dmmPATViewMapConfigLstT* - [in] A NULL termintated
- * linked list of all configurations for the specific DMM module or NULL if
- * not to be configured.
- *
- * @param dmmSysConfig - unsigned long* - [in] Clock configuration of DMM,
- * NULL if not to be set.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmTILERConfigLstT, dmmPEGConfigLstT,
- * dmmLISAConfigLstT, dmmPATEngineConfigLstT, dmmPATViewConfigLstT,
- * dmmPATViewMapConfigLstT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_module_config(struct dmmTILERConfigLstT *tilerConf,
- struct dmmPEGConfigLstT *pegConf,
- struct dmmLISAConfigLstT *lisaConf,
- struct dmmPATEngineConfigLstT *patEngineConf,
- struct dmmPATViewConfigLstT *patViewCOnf,
- struct dmmPATViewMapConfigLstT *patViewMapConf,
- unsigned long *dmmSysConfig);
-
-/* ========================================================================== */
-/**
- * dmm_module_get_config()
- *
- * @brief Read the configuration of selected DMM modules.
- *
- * @param tilerConf - dmmTILERConfigLstT* - [out] A NULL termintated linked list
- * of all configurations for the specific DMM module to be read to.
- *
- * @param pegConf - dmmPEGConfigLstT* - [out] A NULL termintated linked list
- * of all configurations for the specific DMM module to be read to.
- *
- * @param lisaConf - dmmLISAConfigLstT* - [out] A NULL termintated linked list
- * of all configurations for the specific DMM module to be read to.
- *
- * @param patEngineConf - dmmPATEngineConfigLstT* - [out] A NULL termintated
- * linked list of all configurations for the specific DMM module to be read to.
- *
- * @param patViewCOnf - dmmPATViewConfigLstT* - [out] A NULL termintated linked
- * list of all configurations for the specific DMM module to be read to.
- *
- * @param patViewMapConf - dmmPATViewMapConfigLstT* - [out] A NULL termintated
- * linked list of all configurations for the specific DMM module to be read to.
- *
- * @param patAreaStatus - dmmPATStatusLstT* - [out] A NULL termintated linked
- * list of all PAT area status' to be read.
- *
- * @param dmmSysConfig - unsigned long* - [out] Clock configuration of DMM,
- * NULL if not to be read.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmTILERConfigLstT, dmmPEGConfigLstT,
- * dmmLISAConfigLstT, dmmPATEngineConfigLstT, dmmPATViewConfigLstT,
- * dmmPATViewMapConfigLstT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_module_get_config(struct dmmTILERConfigLstT *tilerConf,
- struct dmmPEGConfigLstT *pegConf,
- struct dmmLISAConfigLstT *lisaConf,
- struct dmmPATEngineConfigLstT *patEngineConf,
- struct dmmPATViewConfigLstT *patViewCOnf,
- struct dmmPATViewMapConfigLstT *patViewMapConf,
- struct dmmPATStatusLstT *patAreaStatus,
- unsigned long *dmmSysConfig);
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_config_set()
- *
- * @brief Configures PAT interrupt masks.
- *
- * @param irqMaskConf - dmmPATIrqConfigLstT* - [in] A NULL termintated linked
- * list of all interrupt masks.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqConfigLstT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_irq_config_set(struct dmmPATIrqConfigLstT *irqMaskConf);
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_config_get()
- *
- * @brief Configures PAT interrupt masks.
- *
- * @param irqMaskConf - dmmPATIrqConfigLstT* - [in/out] A NULL termintated
- * linked list of all interrupt masks.
- *
- * @param irqStatusConf - dmmPATIrqConfigLstT* - [in/out] A NULL termintated
- * linked list of all interrupt statuses to read.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqConfigLstT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_irq_config_get(struct dmmPATIrqConfigLstT *irqMaskConf,
- struct dmmPATIrqConfigLstT *irqStatusConf);
-
-/* ========================================================================== */
-/**
* dmm_instance_init()
*
* @brief Initializes the Tiler cotnext.
diff --git a/drivers/media/video/tiler/dmm_hl_drv.c b/drivers/media/video/tiler/dmm_hl_drv.c
index d87e5bf9cf15..c61ab443506a 100755
--- a/drivers/media/video/tiler/dmm_hl_drv.c
+++ b/drivers/media/video/tiler/dmm_hl_drv.c
@@ -15,344 +15,17 @@
*/
#include <linux/module.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h> /* vmalloc_to_page */
-#include <linux/mmzone.h> /* __page_to_phys */
-#include "dmm_def.h"
-#include "dmm_2d_alloc.h"
-#include "dmm_prv.h"
-#include "tiler.h"
-
-#define __NEWCODE__
-
-#ifdef __NEWCODE__
+#include <linux/mm.h>
+#include <linux/mmzone.h>
#include <linux/io.h>
-#include <linux/sched.h> /* current->mm */
+#include <linux/sched.h>
#include <linux/dma-mapping.h>
#include <linux/hardirq.h>
#include <linux/mutex.h>
-
-
-static unsigned long get_phys_addr(unsigned long arg)
-{
- pgd_t *pgd = NULL;
- pmd_t *pmd = NULL;
- pte_t *ptep = NULL, pte = 0x0;
- pgd = pgd_offset(current->mm, arg);
- if (!(pgd_none(*pgd) || pgd_bad(*pgd))) {
- pmd = pmd_offset(pgd, arg);
- if (!(pmd_none(*pmd) || pmd_bad(*pmd))) {
- ptep = pte_offset_map(pmd, arg);
- if (ptep) {
- pte = *ptep;
- if (pte_present(pte)) {
- return (pte & PAGE_MASK) |
- (~PAGE_MASK & arg);
- }
- }
- }
- }
- return 0x0; /* va not in page table */
-}
-#endif
-
-/* ========================================================================== */
-/**
- * dmm_module_config()
- *
- * @brief Configure selected DMM modules.
- *
- * @param tilerConf - dmmTILERConfigLstT* - [in] A NULL termintated linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param pegConf - dmmPEGConfigLstT* - [in] A NULL termintated linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param lisaConf - dmmLISAConfigLstT* - [in] A NULL termintated linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param patEngineConf - dmmPATEngineConfigLstT* - [in] A NULL termintated
- * linked list
- * of all configurations for the specific DMM module or NULL if not to be
- * configured.
- *
- * @param patViewCOnf - dmmPATViewConfigLstT* - [in] A NULL termintated
- * linked list of all configurations for the specific DMM module or NULL if
- * not to be configured.
- *
- * @param patViewMapConf - dmmPATViewMapConfigLstT* - [in] A NULL
- * termintated linked list of all configurations for the specific DMM module
- * or NULL if not to be configured.
- *
- * @param dmmSysConfig - unsigned long* - [in] Clock configuration of DMM,
- * NULL if not to be set.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmTILERConfigLstT, dmmPEGConfigLstT,
- * dmmLISAConfigLstT, dmmPATEngineConfigLstT, dmmPATViewConfigLstT,
- * dmmPATViewMapConfigLstT for further detail.
- */
-/* ========================================================================== */
-/* DHS */
-enum errorCodeT dmm_module_config(struct dmmTILERConfigLstT *tilerConf,
- struct dmmPEGConfigLstT *pegConf,
- struct dmmLISAConfigLstT *lisaConf,
- struct dmmPATEngineConfigLstT *patEngineConf,
- struct dmmPATViewConfigLstT *patViewCOnf,
- struct dmmPATViewMapConfigLstT *patViewMapConf,
- unsigned long *dmmSysConfig)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
-
- while (tilerConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_tiler_alias_orientation_set(
- tilerConf->aliasConf.initiatorId,
- tilerConf->aliasConf.orient);
- tilerConf = tilerConf->nextConf;
- }
-
- while (pegConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_peg_priority_set(pegConf->prioConf.initiatorId,
- pegConf->prioConf.prio);
- pegConf = pegConf->nextConf;
- }
-
- while (lisaConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_lisa_memory_map_config(
- lisaConf->mapConf.lisaMemMapIndx,
- lisaConf->mapConf.sysAddr,
- lisaConf->mapConf.sysSize,
- lisaConf->mapConf.sdrcIntl,
- lisaConf->mapConf.sdrcAddrspc,
- lisaConf->mapConf.sdrcMap,
- lisaConf->mapConf.sdrcAddr);
- lisaConf = lisaConf->nextConf;
- }
-
- while (patEngineConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_refill_engine_config(
- patEngineConf->engineConf.dmmPatEngineSel,
- patEngineConf->engineConf.engineMode);
- patEngineConf = patEngineConf->nextConf;
- }
-
- while (patViewCOnf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_view_set(patViewCOnf->aliasViewConf.initiatorId,
- patViewCOnf->aliasViewConf.viewIndex);
- patViewCOnf = patViewCOnf->nextConf;
- }
-
- while (patViewMapConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_view_map_config(
- patViewMapConf->viewConf.patViewMapIndx,
- patViewMapConf->viewConf.memoryAccessMode,
- patViewMapConf->viewConf.contX,
- patViewMapConf->viewConf.transType,
- patViewMapConf->viewConf.dmmPATViewBase);
- patViewMapConf = patViewMapConf->nextConf;
- }
-
- if (dmmSysConfig != NULL && eCode == DMM_NO_ERROR)
- eCode = dmm_sys_config_set(*dmmSysConfig);
-
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_module_get_config()
- *
- * @brief Read the configuration of selected DMM modules.
- *
- * @param tilerConf - dmmTILERConfigLstT* - [out] A NULL termintated linked list
- * of all configurations for the specific DMM module to be read to.
- *
- * @param pegConf - dmmPEGConfigLstT* - [out] A NULL termintated linked list
- * of all configurations for the specific DMM module to be read to.
- *
- * @param lisaConf - dmmLISAConfigLstT* - [out] A NULL termintated linked list
- * of all configurations for the specific DMM module to be read to.
- *
- * @param patEngineConf - dmmPATEngineConfigLstT* - [out] A NULL termintated
- * linked list of all configurations for the specific DMM module to be read to.
- *
- * @param patViewCOnf - dmmPATViewConfigLstT* - [out] A NULL termintated
- * linked list of all configurations for the specific DMM module to be read to.
- *
- * @param patViewMapConf - dmmPATViewMapConfigLstT* - [out] A NULL
- * termintated linked list of all configurations for the specific DMM module
- * to be read to.
- *
- * @param patAreaStatus - dmmPATStatusLstT* - [out] A NULL termintated
- * linked list of all PAT area status' to be read.
- *
- * @param dmmSysConfig - unsigned long* - [in] Clock configuration of
- * DMM, NULL if not to be read.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmTILERConfigLstT, dmmPEGConfigLstT,
- * dmmLISAConfigLstT, dmmPATEngineConfigLstT, dmmPATViewConfigLstT,
- * dmmPATViewMapConfigLstT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_module_get_config(struct dmmTILERConfigLstT *tilerConf,
- struct dmmPEGConfigLstT *pegConf,
- struct dmmLISAConfigLstT *lisaConf,
- struct dmmPATEngineConfigLstT *patEngineConf,
- struct dmmPATViewConfigLstT *patViewCOnf,
- struct dmmPATViewMapConfigLstT *patViewMapConf,
- struct dmmPATStatusLstT *patAreaStatus,
- unsigned long *dmmSysConfig)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
-
- while (tilerConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_tiler_alias_orientation_get(
- tilerConf->aliasConf.initiatorId,
- &(tilerConf->aliasConf.orient));
- tilerConf = tilerConf->nextConf;
- }
-
- while (pegConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_peg_priority_get(pegConf->prioConf.initiatorId,
- &(pegConf->prioConf.prio));
- pegConf = pegConf->nextConf;
- }
-
- while (lisaConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_lisa_memory_map_config_get(
- lisaConf->mapConf.lisaMemMapIndx,
- &(lisaConf->mapConf.sysAddr),
- &(lisaConf->mapConf.sysSize),
- &(lisaConf->mapConf.sdrcIntl),
- &(lisaConf->mapConf.sdrcAddrspc),
- &(lisaConf->mapConf.sdrcMap),
- &(lisaConf->mapConf.sdrcAddr));
- lisaConf = lisaConf->nextConf;
- }
-
- while (patEngineConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_refill_engine_config_get(
- patEngineConf->engineConf.dmmPatEngineSel,
- &(patEngineConf->engineConf.engineMode));
- patEngineConf = patEngineConf->nextConf;
- }
-
- while (patViewCOnf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_view_get(
- patViewCOnf->aliasViewConf.initiatorId,
- &(patViewCOnf->aliasViewConf.viewIndex));
- patViewCOnf = patViewCOnf->nextConf;
- }
-
- while (patViewMapConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_view_map_config_get(
- patViewMapConf->viewConf.patViewMapIndx,
- patViewMapConf->viewConf.memoryAccessMode,
- &(patViewMapConf->viewConf.contX),
- &(patViewMapConf->viewConf.transType),
- &(patViewMapConf->viewConf.dmmPATViewBase));
- patViewMapConf = patViewMapConf->nextConf;
- }
-
- while (patAreaStatus != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_refill_area_status_get(
- patAreaStatus->areaSelect,
- &(patAreaStatus->patAreaStatus));
-
- patAreaStatus = patAreaStatus->nextConf;
- }
-
- if (dmmSysConfig != NULL && eCode == DMM_NO_ERROR)
- eCode = dmm_sys_config_get(dmmSysConfig);
-
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_config_set()
- *
- * @brief Configures PAT interrupt masks.
- *
- * @param irqMaskConf - dmmPATIrqConfigLstT* - [in] A NULL termintated linked
- * list of all interrupt masks.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqConfigLstT for further detail.
- */
-/* ========================================================================== */
-/* DHS */
-enum errorCodeT dmm_pat_irq_config_set(struct dmmPATIrqConfigLstT *irqMaskConf)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
-
- while (irqMaskConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_irq_mode_set(&(irqMaskConf->irqConf.irqEvnts));
- irqMaskConf = irqMaskConf->nextConf;
- }
-
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_pat_irq_config_get()
- *
- * @brief Configures PAT interrupt masks.
- *
- * @param irqMaskConf - dmmPATIrqConfigLstT* - [in/out] A NULL termintated
- * linked list of all interrupt masks.
- *
- * @param irqStatusConf - dmmPATIrqConfigLstT* - [in/out] A NULL termintated
- * linked list of all interrupt statuses to read.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATIrqConfigLstT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_irq_config_get(struct dmmPATIrqConfigLstT *irqMaskConf,
- struct dmmPATIrqConfigLstT *irqStatusConf)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
-
- while (irqMaskConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_irq_mode_get(&(irqMaskConf->irqConf.irqEvnts));
- irqMaskConf = irqMaskConf->nextConf;
- }
-
- while (irqStatusConf != NULL && eCode == DMM_NO_ERROR) {
- eCode = dmm_pat_irq_status_get(
- &(irqStatusConf->irqConf.irqEvnts),
- irqStatusConf->irqConf.clrEvents);
- irqStatusConf = irqStatusConf->nextConf;
- }
-
- return eCode;
-}
+#include "dmm_def.h"
+#include "dmm_2d_alloc.h"
+#include "dmm_prv.h"
+#include "tiler.h"
/* ========================================================================== */
/**
@@ -372,7 +45,6 @@ enum errorCodeT dmm_pat_irq_config_get(struct dmmPATIrqConfigLstT *irqMaskConf,
* @see errorCodeT, dmmTILERContPageAreaT for further detail.
*/
/* ========================================================================== */
-/* DHS */
enum errorCodeT dmm_pat_start_refill(
struct dmmTILERContPageAreaT *bufferMappedZone)
{
@@ -392,18 +64,8 @@ enum errorCodeT dmm_pat_start_refill(
areaDesc.ctrl.sync = 0;
areaDesc.nextPatEntry = NULL;
-
-#ifndef __NEWCODE__
- areaDesc.data = (unsigned long)(bufferMappedZone->patPageEntries);
-#else
-#if 0
- areaDesc.data = (unsigned long)bufferMappedZone->patPageEntriesSpace;
-#else
areaDesc.data = (unsigned long)bufferMappedZone->dma_pa;
-#endif
-#endif
- tilerdump(__LINE__);
return dmm_pat_area_refill(&areaDesc, 0, MANUAL, 0);
}
@@ -428,7 +90,6 @@ enum errorCodeT dmm_pat_start_refill(
* @see errorCodeT, dmmTILERContPageAreaT for further detail.
*/
/* ========================================================================== */
-/* DHS */
enum errorCodeT dmm_pat_phy2virt_mapping(
struct dmmTILERContPageAreaT *bufferMappedZone,
void *custmPagesPtr)
@@ -436,72 +97,31 @@ enum errorCodeT dmm_pat_phy2virt_mapping(
unsigned long bfrPages;
enum errorCodeT eCode = DMM_NO_ERROR;
- tilerdump(__LINE__);
bfrPages =
(bufferMappedZone->xPageCount)*(bufferMappedZone->yPageCount);
if (bfrPages == 0) {
eCode = DMM_SYS_ERROR;
} else {
- tilerdump(__LINE__);
-#ifdef __NEWCODE__
-#if 0
- unsigned long order = 0x0;
-
- order = ((bfrPages*4 + 16) + 4095) / 4096;
-
- order = 5;
- debug(bfrPages*4 + 16);
- debug(order);
-
- bufferMappedZone->page_list = NULL;
- bufferMappedZone->page_list =
- (struct page *)alloc_pages(GFP_DMA, order);
- if (!bufferMappedZone->page_list) {
- debug(__LINE__); return DMM_SYS_ERROR;
- }
- bufferMappedZone->patPageEntriesSpace =
- (unsigned long *)page_to_phys(bufferMappedZone->page_list);
-
- bufferMappedZone->page_list_virt =
- ioremap((unsigned long)bufferMappedZone->patPageEntriesSpace,
- 0x1000 * 32); /* TODO: don't forget to unmap later */
-
- bufferMappedZone->patPageEntries =
- bufferMappedZone->page_list_virt;
- memset(bufferMappedZone->patPageEntries, 0x0, 0x1000 * 32);
- bufferMappedZone->patPageEntries =
- (unsigned long *)((((unsigned long)
- bufferMappedZone->patPageEntries) + 15) & ~15);
-#else
bufferMappedZone->dma_size = bfrPages*4+16;
bufferMappedZone->dma_va =
dma_alloc_coherent(NULL, bufferMappedZone->dma_size,
- &(bufferMappedZone->dma_pa),
- (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL);
+ &(bufferMappedZone->dma_pa), GFP_ATOMIC);
+ if (!bufferMappedZone->dma_va)
+ return DMM_SYS_ERROR;
memset(bufferMappedZone->dma_va,
0x0, bufferMappedZone->dma_size);
bufferMappedZone->patPageEntries =
(unsigned long *)((((unsigned long)
bufferMappedZone->dma_va) + 15) & ~15);
-#endif
-#endif
-#ifndef __NEWCODE__
- if (dmm_tiler_populate_pat_page_entry_data(bfrPages,
- &(bufferMappedZone->patPageEntries),
- &(bufferMappedZone->patPageEntriesSpace),
- custmPagesPtr
- ) != DMM_NO_ERROR) {
-#else
if (dmm_tiler_populate_pat_page_entry_data(bfrPages,
NULL,
NULL,
(void *)bufferMappedZone->patPageEntries
) != DMM_NO_ERROR) {
-#endif
eCode = DMM_SYS_ERROR;
return eCode;
}
@@ -510,7 +130,6 @@ enum errorCodeT dmm_pat_phy2virt_mapping(
bufferMappedZone->patCustomPages = 1;
else
bufferMappedZone->patCustomPages = 0;
- tilerdump(__LINE__);
eCode = dmm_pat_start_refill(bufferMappedZone);
}
@@ -552,137 +171,14 @@ enum errorCodeT dmm_tiler_populate_pat_page_entry_data(unsigned long numPages,
signed long iter;
unsigned long *patAreaEntries = NULL;
- tilerdump(__LINE__);
-
-#ifndef __NEWCODE__
- patAreaEntries = kmalloc(
- (numPages*4 + 16), GFP_KERNEL);
- /* Must be 16-byte aligned. */
- memset(patAreaEntries, 0x0, (numPages*4 + 16));
- *pageEntriesSpace = patAreaEntries;
-#else
-
-#if 0 /* move to caller */
- struct page *page = NULL;
- unsigned long *ioaddr = NULL;
- unsigned long pa = 0x0;
- unsigned long order = 0x0;
-
- order = ((numPages*4 + 16) + 4095) / 4096;
- debug(numPages*4 + 16);
- debug(order);
-
- /* page = (struct page *)alloc_page(GFP_DMA); */
- /*pa = page_to_phys(page);*/
- /*ioaddr = ioremap(pa, 0x1000);*/
- /*memset(ioaddr, 0x0, 0x1000);*/
-
- page = (struct page *)alloc_pages(GFP_DMA, order);
- if (!page)
- return DMM_SYS_ERROR;
- pa = page_to_phys(page);
- ioaddr = ioremap(pa, 0x1000 * order);
- memset(ioaddr, 0x0, 0x1000 * order);
-
- patAreaEntries = ioaddr;
- *pageEntriesSpace = (unsigned long *)pa;
- debug(*pageEntriesSpace);
- debug(patAreaEntries);
-#endif
-
-#if 0 /* not a good solution to use vmalloc */
- patAreaEntries = (unsigned long *)vmalloc(numPages*4 + 16);
- memset(patAreaEntries, 0x0, numPages*4 + 16);
- *pageEntriesSpace = patAreaEntries;
-
- debug(*pageEntriesSpace);
- debug(patAreaEntries);
-
- /* test different allocation methods */
- unsigned long mem = 0x0;
- struct page *pg = NULL;
- unsigned long *io = NULL;
-
- pg = alloc_page(GFP_DMA);
- mem = page_to_phys(pg);
- io = ioremap(mem, 0x1000);
- memset(io, 0x0, 0x1000);
- debug(pg);
- debug(mem);
- debug(get_phys_addr(mem));
- debug(io);
- iounmap(io);
- __free_page(pg);
-
- mem = (unsigned long)kmalloc(0x1000, GFP_DMA);
- debug(mem);
- debug(get_phys_addr(mem));
- memset((unsigned long *)mem, 0x0, 0x1000);
- kfree((void *)mem);
-
- mem = (unsigned long)vmalloc(0x1000);
- debug(mem);
- debug(get_phys_addr(mem));
- memset((unsigned long *)mem, 0x0, 0x1000);
- vfree((void *)mem);
-
- mem = __get_free_page(GFP_DMA);
- debug(mem);
- debug(get_phys_addr(mem));
- memset((unsigned long *)mem, 0x0, 0x1000);
- free_page(mem);
-#endif
-#endif
-
-#ifndef __NEWCODE__
- patAreaEntries = (unsigned long *)
- ((((unsigned long)patAreaEntries) + 15) & ~15);
-#else
patAreaEntries = (unsigned long *)custmPagesPtr;
-#endif
-
-#ifdef __NEWCODE__
- debug(patAreaEntries);
- debug(numPages);
-#endif
-
-#ifndef __NEWCODE__
- if (custmPagesPtr == NULL) {
- for (iter = 0; iter < numPages; iter++) {
- patAreaEntries[iter] =
- (unsigned long)dmm_get_phys_page();
- if (patAreaEntries[iter] == 0x0)
- return DMM_SYS_ERROR;
- }
- dsb();
- } else {
- for (iter = 0; iter < numPages; iter++) {
- patAreaEntries[iter] = (unsigned long)
- (((unsigned long *)custmPagesPtr)[iter]);
- }
- }
-#else
-/* using custmPagesPtr arguement in a diffent way, so remove the conditions */
for (iter = 0; iter < numPages; iter++) {
patAreaEntries[iter] =
(unsigned long)dmm_get_phys_page();
if (patAreaEntries[iter] == 0x0)
return DMM_SYS_ERROR;
}
-#endif
-
-#ifdef __NEWCODE__
- debug(__LINE__);
- debug(patAreaEntries[0]);
- debug(patAreaEntries[1]);
- debug(patAreaEntries[2]);
- debug(patAreaEntries[3]);
-#endif
-
-#ifndef __NEWCODE__
- *pageEntries = patAreaEntries;
-#endif
return DMM_NO_ERROR;
}
@@ -787,7 +283,6 @@ enum errorCodeT dmm_tiler_swap_pat_page_entry_data(unsigned long numPages,
* @see errorCodeT, dmmMemoryAccessT, dmmTILERContPageAreaT for further detail.
*/
/* ========================================================================== */
-/* DHS */
enum errorCodeT dmm_tiler_container_map_area(
struct dmmTILERContCtxT *dmmTilerCtx,
unsigned long sizeWidth,
@@ -805,7 +300,6 @@ enum errorCodeT dmm_tiler_container_map_area(
unsigned long addrShiftAlign = 0;
unsigned short tiled_pages_per_ss_page = 0;
- tilerdump(__LINE__);
switch (contMod) {
case MODE_8_BIT:
accessMode = 0;
@@ -872,7 +366,6 @@ enum errorCodeT dmm_tiler_container_map_area(
tiled_pages_per_ss_page = 64;
areaRequest.x1 = ((areaRequest.x1 + tiled_pages_per_ss_page) &
~(tiled_pages_per_ss_page - 1)) - 1;
- tilerdump(__LINE__);
if (areaRequest.x1 > dmmTilerCtx->contSizeX ||
areaRequest.y1 > dmmTilerCtx->contSizeY) {
@@ -893,9 +386,7 @@ enum errorCodeT dmm_tiler_container_map_area(
}
/* DBG_OVERLAP_TEST(dmmTilerCtx); */
- tilerdump(__LINE__);
if (eCode == DMM_NO_ERROR) {
- tilerdump(__LINE__);
if (accessMode == 0) {
*allocedPtr =
DMM_COMPOSE_TILER_ALIAS_PTR(
@@ -913,9 +404,7 @@ enum errorCodeT dmm_tiler_container_map_area(
(((*bufferMappedZone)->x0 << 7) |
((*bufferMappedZone)->y0 << 20)), accessMode);
}
- tilerdump(__LINE__);
} else {
- tilerdump(__LINE__);
*allocedPtr = NULL;
}
return eCode;
@@ -941,7 +430,6 @@ enum errorCodeT dmm_tiler_container_map_area(
* @see errorCodeT, dmmTILERContPageAreaT for further detail.
*/
/* ========================================================================== */
-/* DHS */
enum errorCodeT dmm_tiler_container_unmap_area(
struct dmmTILERContCtxT *dmmTilerCtx,
struct dmmTILERContPageAreaT *bufferMappedZone)
@@ -972,7 +460,6 @@ enum errorCodeT dmm_tiler_container_unmap_area(
* @see dmmTILERContPageAreaT for further detail.
*/
/* ========================================================================== */
-/* DHS */
struct dmmTILERContPageAreaT *dmm_tiler_get_area_from_sysptr(
struct dmmTILERContCtxT *dmmTilerCtx, void *sysPtr) {
unsigned long X;
@@ -980,11 +467,9 @@ struct dmmTILERContPageAreaT *dmm_tiler_get_area_from_sysptr(
enum dmmMemoryAccessT accessModeM;
struct dmmTILERContPageAreaT *found = NULL;
- tilerdump(sysPtr);
accessModeM = DMM_GET_ACC_MODE(sysPtr);
if (DMM_GET_ROTATED(sysPtr) == 0) {
- tilerdump(__LINE__);
if (accessModeM == MODE_PAGE) {
X = ((long)sysPtr & 0x7FFFFFF) >> 12;
Y = X / 256;
@@ -992,42 +477,30 @@ struct dmmTILERContPageAreaT *dmm_tiler_get_area_from_sysptr(
} else if (accessModeM == MODE_8_BIT) {
X = DMM_HOR_X_PAGE_COOR_GET_8(sysPtr);
Y = DMM_HOR_Y_PAGE_COOR_GET_8(sysPtr);
- tilerdump(__LINE__);
} else if (accessModeM == MODE_16_BIT) {
- tilerdump(__LINE__);
X = DMM_HOR_X_PAGE_COOR_GET_16(sysPtr);
Y = DMM_HOR_Y_PAGE_COOR_GET_16(sysPtr);
} else if (accessModeM == MODE_32_BIT) {
- tilerdump(__LINE__);
X = DMM_HOR_X_PAGE_COOR_GET_32(sysPtr);
Y = DMM_HOR_Y_PAGE_COOR_GET_32(sysPtr);
}
} else {
- tilerdump(__LINE__);
if (accessModeM == MODE_PAGE) {
X = ((long)sysPtr & 0x7FFFFFF) >> 12;
Y = X / 256;
X = X & 255;
} else if (accessModeM == MODE_8_BIT) {
- tilerdump(__LINE__);
X = DMM_VER_X_PAGE_COOR_GET_8(sysPtr);
Y = DMM_VER_Y_PAGE_COOR_GET_8(sysPtr);
} else if (accessModeM == MODE_16_BIT) {
- tilerdump(__LINE__);
X = DMM_VER_X_PAGE_COOR_GET_16(sysPtr);
Y = DMM_VER_Y_PAGE_COOR_GET_16(sysPtr);
} else if (accessModeM == MODE_32_BIT) {
- tilerdump(__LINE__);
X = DMM_VER_X_PAGE_COOR_GET_32(sysPtr);
Y = DMM_VER_Y_PAGE_COOR_GET_32(sysPtr);
}
}
- tilerdump(dmmTilerCtx);
- tilerdump(X);
- tilerdump(Y);
- tilerdump(DMM_GET_X_INVERTED(sysPtr));
- tilerdump(DMM_GET_Y_INVERTED(sysPtr));
/* printk(KERN_ERR " ? %p => x=%ld,y=%ld\n", sysPtr, X, Y); */
found = search_2d_area(dmmTilerCtx, X, Y, DMM_GET_X_INVERTED(sysPtr),
DMM_GET_Y_INVERTED(sysPtr));
@@ -1079,8 +552,6 @@ int dmm_instance_init(void *dmmInstanceCtxPtr,
&((struct dmmInstanceCtxT *)dmmInstanceCtxPtr)->dmmTilerCtx;
struct dmmHwdCtxT *dmmHwdCtx =
&((struct dmmInstanceCtxT *)dmmInstanceCtxPtr)->dmmHwdCtx;
- /* struct MSP_Dmm_eventNotificationT * dmmMspCtx =
- &((struct dmmInstanceCtxT*)dmmInstanceCtxPtr)->dmmMspCtx; */
if (contXSize > 256 || contYSize > 128)
return 0;
@@ -1099,20 +570,11 @@ int dmm_instance_init(void *dmmInstanceCtxPtr,
dmmTilerCtx->contSizeY = contYSize;
mutex_init(&dmmTilerCtx->mtx);
- /* Hwi_Params_init (&dmmHwdCtx->dmmIrqIntParams); */
- /* dmmHwdCtx->dmmIrqIntHandle =
- Hwi_create (DMM_PAT_AREA_IRQ, dmmPatIrqHandler,
- &dmmHwdCtx->dmmIrqIntParams, NULL); */
-
dmmHwdCtx->patIrqEvnt0.irqAreaSelect = 0;
dmmHwdCtx->patIrqEvnt1.irqAreaSelect = 1;
dmmHwdCtx->patIrqEvnt2.irqAreaSelect = 2;
dmmHwdCtx->patIrqEvnt3.irqAreaSelect = 3;
- /* dmmMspCtx->hMSP = hMSP; */
- /* dmmMspCtx->usrAppData = usrAppData; */
- /* dmmMspCtx->usrCallback = usrCallback; */
-
if (dmm_phys_page_rep_init() != DMM_NO_ERROR)
return 0;
}
@@ -1180,28 +642,6 @@ int dmm_instance_deinit(void *dmmInstanceCtxPtr)
/* ========================================================================== */
/**
-* dmm_pat_irq_handler()
-*
-* @brief Interrupt handler for PAT area status updates.
-*
-* @param data - UArg -
-*
-* @return none
-*
-* @pre There is no pre conditions.
-*
-* @post There is no post conditions.
-*
-* @see
-*
-*/
-/* ========================================================================== */
-void dmm_pat_irq_handler(unsigned long data)
-{
-}
-
-/* ========================================================================== */
-/**
* dmm_copy2tiler_alias_view()
*
* @brief Auxiliary function for copying data to the Tiler alias view.
diff --git a/drivers/media/video/tiler/dmm_ll_drv.c b/drivers/media/video/tiler/dmm_ll_drv.c
index df787790762b..fa794e7a8bd8 100644
--- a/drivers/media/video/tiler/dmm_ll_drv.c
+++ b/drivers/media/video/tiler/dmm_ll_drv.c
@@ -22,39 +22,6 @@
#include "dmm_reg.h"
MODULE_LICENSE("GPL v2");
-#define __NEWCODE__
-#ifdef __NEWCODE__
-/* extern unsigned long entry_data; */
-static void pat_config_set();
-
-static void pat_config_set()/* (struct pat_config_set *config, char id) */
-{
- void __iomem *reg = NULL;
- unsigned long reg_val = 0x0;
- unsigned long new_val = 0x0;
- unsigned long bit_field = 0x0;
- unsigned long field_pos = 0x0;
-
- /* set PAT_CONFIG register */
- reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr
- | (unsigned long)PAT_CONFIG);
- reg_val = __raw_readl(reg);
- regdump("PAT_CONFIG", reg_val);
-
- bit_field = BITFIELD(31, 0);
- field_pos = 0;
- new_val = (reg_val & (~(bit_field))) |
- ((((unsigned long)0) << field_pos) & bit_field);
- __raw_writel(0x0000000F, reg); /* __raw_writel(new_val, reg); */
-
- reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr |
- (unsigned long)PAT_CONFIG);
- reg_val = __raw_readl(reg);
- regdump("PAT_CONFIG", reg_val);
-}
-
struct pat_area {
int x0:8;
int y0:8;
@@ -89,7 +56,7 @@ static void pat_ctrl_set(struct pat_ctrl *ctrl, char id)
/* TODO: casting as unsigned long */
reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr |
+ (unsigned long)dmm_base |
(unsigned long)PAT_CTRL__0);
reg_val = __raw_readl(reg);
@@ -130,129 +97,6 @@ static void pat_ctrl_set(struct pat_ctrl *ctrl, char id)
dsb();
}
-#endif
-
-/* ========================================================================== */
-/**
- * dmm_tiler_alias_orientation_set()
- *
- * @brief Set specific TILER alias orientation setting per initiator ID
- * (alias view).
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which alias view will be editted.
- *
- * @param viewOrientation - dmmViewOrientT - [in] New alias view orientation
- * setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmViewOrientT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_tiler_alias_orientation_set(signed long initiatorID,
- struct dmmViewOrientT viewOrientation)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- void __iomem *reg = NULL;
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x220ul));
- __raw_writel(0x88888888, reg);
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x220ul+0x4));
- __raw_writel(0x88888888, reg);
-
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_tiler_alias_orientation_get()
- *
- * @brief Get specific TILER alias orientation setting per initiator ID
- * (alias view).
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which alias view will be editted.
- *
- * @param viewOrientation - dmmViewOrientT* - [out] Pointer to write alias view
- * orientation setting to.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmViewOrientT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_tiler_alias_orientation_get(signed long initiatorID,
- struct dmmViewOrientT *viewOrientation)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_peg_priority_set()
- *
- * @brief Set specific PEG priority setting per initiator ID.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which priority will be editted.
- *
- * @param prio - unsigned long - [in] New priority setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_peg_priority_set(signed long initiatorID,
- unsigned long prio)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_peg_priority_get()
- *
- * @brief Get specific PEG priority setting per initiator ID.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which priority will be editted.
- *
- * @param prio - unsigned long* - [out] Poitner to write the priority setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_peg_priority_get(signed long initiatorID,
- unsigned long *prio)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
/* ========================================================================== */
/**
@@ -295,10 +139,10 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
unsigned long writeval = 0xffffffff;
unsigned long f = 0xffffffff; /* field */
unsigned long fp = 0xffffffff; /* field position */
+ struct pat_desc pat_desc = {0};
struct dmmPATStatusT areaStat;
- tilerdump(__LINE__);
if (forcedRefill == 0) {
eCode = dmm_pat_refill_area_status_get(
dmmPatAreaSel, &areaStat);
@@ -316,7 +160,7 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
} else if (eCode == DMM_NO_ERROR) {
if (refillType == AUTO) {
reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr |
+ ((unsigned long)dmm_base |
(0x500ul + 0x0));
regval = __raw_readl(reg);
f = BITFIELD(31, 4);
@@ -329,7 +173,7 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
* an error.
*/
reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr |
+ (unsigned long)dmm_base |
(unsigned long)PAT_STATUS__0);
regval = __raw_readl(reg);
if ((regval & 0xFC00) != 0) {
@@ -341,7 +185,7 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
/* set DESC register to NULL */
reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr |
+ ((unsigned long)dmm_base |
(0x500ul + 0x0));
regval = __raw_readl(reg);
f = BITFIELD(31, 4);
@@ -350,7 +194,7 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
((((unsigned long)NULL) << fp) & f);
__raw_writel(writeval, reg);
reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr |
+ ((unsigned long)dmm_base |
(0x500ul + 0x4));
regval = __raw_readl(reg);
@@ -390,54 +234,15 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
(char)patDesc->area.y1);
dsb();
-#ifndef __NEWCODE__
- /* Apply 4 bit lft shft to counter the 4 bit rt shft */
- reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr | (0x500ul + 0xc));
- regval = __raw_readl(reg);
- f = BITFIELD(31, 4);
- fp = 4;
- writeval = (regval & (~(f))) |
- ((((unsigned long)(patDesc->data >> 4)) <<
- fp) & f);
- __raw_writel(writeval, reg);
- reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr |
- (0x500ul + 0x8));
- regval = __raw_readl(reg);
- f = BITFIELD(31, 28);
- fp = 28;
- writeval = (regval & (~(f))) |
- (((patDesc->ctrl.initiator) << fp) & f);
- __raw_writel(writeval, reg);
-
- f = BITFIELD(16, 16);
- fp = 16;
- writeval = (regval & (~(f))) |
- (((patDesc->ctrl.sync) << fp) & f);
- __raw_writel(writeval, reg);
-
- f = BITFIELD(6, 4);
- fp = 4;
- writeval = (regval & (~(f))) |
- (((patDesc->ctrl.direction) << fp) & f);
- __raw_writel(writeval, reg);
-
- f = BITFIELD(0, 0);
- fp = 0;
- writeval = (regval & (~(f))) |
- (((patDesc->ctrl.start) << fp) & f);
- __raw_writel(writeval, reg);
-#else
/* First, clear the PAT_IRQSTATUS register */
reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr |
+ (unsigned long)dmm_base |
(unsigned long)PAT_IRQSTATUS);
__raw_writel(0xFFFFFFFF, reg);
dsb();
reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr |
+ (unsigned long)dmm_base |
(unsigned long)PAT_IRQSTATUS_RAW);
regval = 0xFFFFFFFF;
while (regval != 0x0) {
@@ -447,7 +252,7 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
/* fill data register */
reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr | (0x500ul + 0xc));
+ ((unsigned long)dmm_base | (0x500ul + 0xc));
regval = __raw_readl(reg);
/* Apply 4 bit lft shft to counter the 4 bit rt shft */
@@ -465,7 +270,6 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
regdump("PAT_DATA__0", regval);
}
- struct pat_desc pat_desc = {0};
pat_desc.ctrl.start = 1;
pat_desc.ctrl.direction = 0;
pat_desc.ctrl.lut_id = 0;
@@ -476,16 +280,13 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
/* Now, check if PAT_IRQSTATUS_RAW has been set after
the PAT has been refilled */
reg = (void __iomem *)(
- (unsigned long)dmm_virt_base_addr |
+ (unsigned long)dmm_base |
(unsigned long)PAT_IRQSTATUS_RAW);
regval = 0x0;
while ((regval & 0x3) != 0x3) {
regval = __raw_readl(reg);
regdump("PAT_IRQSTATUS_RAW", regval);
}
-
- /* pat_config_set(); */
-#endif
} else {
eCode = DMM_WRONG_PARAM;
}
@@ -513,7 +314,6 @@ enum errorCodeT dmm_pat_area_refill(struct PATDescrT *patDesc,
}
}
}
- tilerdump(__LINE__);
return eCode;
}
@@ -546,7 +346,7 @@ enum errorCodeT dmm_pat_refill_area_status_get(signed long dmmPatAreaStatSel,
unsigned long stat = 0xffffffff;
void __iomem *statreg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr | 0x4c0ul);
+ ((unsigned long)dmm_base | 0x4c0ul);
if (dmmPatAreaStatSel >= 0 && dmmPatAreaStatSel <= 3) {
stat = __raw_readl(statreg);
@@ -568,328 +368,3 @@ enum errorCodeT dmm_pat_refill_area_status_get(signed long dmmPatAreaStatSel,
return eCode;
}
-/* ========================================================================== */
-/**
- * dmm_pat_refill_engine_config()
- *
- * @brief Configure the selected PAT refill engine.
- *
- * @param dmmPatEngineSel - signed long - [in] Selects which PAT engine will be
- * configured.
- *
- * @param engineMode - dmmPATEngineAccessT - [in] New engine mode.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATEngineAccessT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_refill_engine_config(signed long dmmPatEngineSel,
- enum dmmPATEngineAccessT engineMode)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- void __iomem *reg = NULL;
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x410ul));
- __raw_writel(0x00000000, reg);
-
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_pat_refill_engine_config_get()
- *
- * @brief Get the selected PAT refill engine configuration.
- *
- * @param dmmPatEngineSel - signed long - [in] Selects which PAT engine will be
- * configured.
- *
- * @param engineMode - dmmPATEngineAccessT* - [out] Pointer to write the engine
- * mode.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmPATEngineAccessT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_refill_engine_config_get(signed long dmmPatEngineSel,
- enum dmmPATEngineAccessT *engineMode)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_set()
- *
- * @brief Set specific PAT initiator view settings.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which PAT view will be editted.
- *
- * @param patViewIndx - signed long - [in] New view map setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_set(signed long initiatorID,
- signed long patViewIndx)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- void __iomem *reg = NULL;
-
- if (patViewIndx < 0 || patViewIndx > 3) {
- eCode = DMM_WRONG_PARAM;
- } else {
- reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr | (0x420ul));
- __raw_writel(0xDDDDDDDD, reg);
-
- reg = (void __iomem *)
- ((unsigned long)dmm_virt_base_addr | (0x420ul+0x4));
- __raw_writel(0xDDDDDDDD, reg);
- }
-
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_get()
- *
- * @brief Get specific PAT initiator view settings.
- *
- * @param initiatorID - signed long - [in] OCP id of DMM transfer initiator
- * which PAT view will be editted.
- *
- * @param patViewIndx - signed long* - [out] Pointer to write the view map
- * setting.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_get(
- signed long initiatorID, signed long *patViewIndx)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_pat_view_map_config()
- *
- * @brief Configure selected PAT view map.
- *
- * @param patViewMapIndx - signed long - [in] Index of the selected PAT view
- * map.
- *
- * @param memoryAccessMode - dmmMemoryAccessT - [in] Type of memory access to
- * perform through this view.
- *
- * @param contX - unsigned long - [in] CONT_x register value.
- *
- * @param transType - dmmPATTranslationT - [in] Address translation schemes.
- *
- * @param dmmPATViewBase - unsigned long - [in] View map base address
- * (31-bit only considered).
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmMemoryAccessT, dmmPATTranslationT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_pat_view_map_config(signed long patViewMapIndx,
- enum dmmMemoryAccessT memoryAccessMode,
- unsigned long contX,
- enum dmmPATTranslationT transType,
- unsigned long dmmPATViewBase)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- void __iomem *reg = NULL;
- unsigned long regval = 0xffffffff;
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x460ul));
- regval = __raw_readl(reg);
- __raw_writel(0xFFFFFFFF, reg);
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x440ul));
- regval = __raw_readl(reg);
- __raw_writel(0x80808080, reg);
-
- return eCode;
-}
-
-enum errorCodeT dmm_pat_view_map_config_get(signed long patViewMapIndx,
- enum dmmMemoryAccessT memoryAccessMode,
- unsigned long *contX,
- enum dmmPATTranslationT *transType,
- unsigned long *dmmPATViewBase)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_lisa_memory_map_config()
- *
- * @brief Configure selected LISA memory map.
- *
- * @param lisaMemMapIndx - signed long - [in] Index of the selected LISA memory
- * map.
- *
- * @param sysSize - dmmMemSectionSizeT - [in] Size of the memory section.
- *
- * @param sdrcIntl - dmmMemSdrcIntlModeT - [in] SDRAM controller interleaving
- * mode
- *
- * @param sdrcAddrspc - unsigned long - [in] SDRAM controller address space.
- *
- * @param sdrcMap - dmmMemSectionMappingT - [in] SDRAM controller mapping.
- *
- * @param sdrcAddr - unsigned long - [in] SDRAM controller address MSB.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see errorCodeT, dmmMemSectionSizeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_lisa_memory_map_config(signed long lisaMemMapIndx,
- unsigned long sysAddr,
- enum dmmMemSectionSizeT sysSize,
- enum dmmMemSdrcIntlModeT sdrcIntl,
- unsigned long sdrcAddrspc,
- enum dmmMemSectionMappingT sdrcMap,
- unsigned long sdrcAddr)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- void __iomem *reg = NULL;
-
- if (lisaMemMapIndx != 0)
- printk(KERN_WARNING "lisaMemMapIndx != 0\n");
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x40ul + (0x4*lisaMemMapIndx)));
- __raw_writel(0x80710100, reg);
-
- return eCode;
-}
-
-enum errorCodeT dmm_lisa_memory_map_config_get(signed long lisaMemMapIndx,
- unsigned long *sysAddr,
- enum dmmMemSectionSizeT *sysSize,
- enum dmmMemSdrcIntlModeT *sdrcIntl,
- unsigned long *sdrcAddrspc,
- enum dmmMemSectionMappingT *sdrcMap,
- unsigned long *sdrcAddr)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-/* ========================================================================== */
-/**
- * dmm_engage_lisa_lock()
- *
- * @brief Sets the LISA lock register preventing further writting to the
- * LISA memory map registers.
- *
- * @return errorCodeT
- *
- * @pre There is no pre conditions.
- *
- * @post Only a software reset of the DMM module can clear the lock bit.
- *
- * @see errorCodeT for further detail.
- */
-/* ========================================================================== */
-enum errorCodeT dmm_engage_lisa_lock()
-{
- void __iomem *reg = NULL;
- unsigned long regval = 0xffffffff;
- unsigned long writeval = 0xffffffff;
- unsigned long f = 0xffffffff; /* field */
- unsigned long fp = 0xffffffff; /* field position */
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x1cul));
- regval = __raw_readl(reg);
-
- f = BITFIELD(0, 0);
- fp = 0;
- writeval = (regval & (~(f))) | (((0x1ul) << fp) & f);
- __raw_writel(writeval, reg);
-
- return DMM_NO_ERROR;
-}
-
-enum errorCodeT dmm_sys_config_set(unsigned long dmmIdleMode)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-enum errorCodeT dmm_sys_config_get(unsigned long *dmmIdleMode)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-enum errorCodeT dmm_pat_irq_mode_set(struct dmmPATIrqEventsT *patIrqEvnt)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- void __iomem *reg = NULL;
-
- reg = (void __iomem *)((unsigned long)dmm_virt_base_addr |
- (0x4a0ul));
-
- __raw_writel(0x0000FFFF, reg); /* clr all irq registers */
- return eCode;
-}
-
-enum errorCodeT dmm_pat_irq_mode_get(struct dmmPATIrqEventsT *patIrqEvnt)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
-
-enum errorCodeT dmm_pat_irq_status_get(struct dmmPATIrqEventsT *patIrqEvnt,
- int clrEvents)
-{
- enum errorCodeT eCode = DMM_NO_ERROR;
- return eCode;
-}
diff --git a/drivers/media/video/tiler/dmm_page_rep.c b/drivers/media/video/tiler/dmm_page_rep.c
index a0a82fa1adc5..9e185d4661d4 100644
--- a/drivers/media/video/tiler/dmm_page_rep.c
+++ b/drivers/media/video/tiler/dmm_page_rep.c
@@ -14,26 +14,13 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <linux/vmalloc.h>
-#include <linux/mm.h> /* vmalloc_to_page */
-#include <linux/mmzone.h> /* __page_to_phys */
-#include "dmm_prv.h"
-
-#define __NEWCODE__
-
-#ifdef __NEWCODE__
+#include <linux/mm.h>
+#include <linux/mmzone.h>
#include <asm/cacheflush.h>
#include <linux/mutex.h>
+#include "dmm_prv.h"
static struct mutex mtx;
-#endif
-
-#define __KERN_TO_ALLOC__
-
-#ifndef __KERN_TO_ALLOC__
-#define BASE_MEM_ADDR 0x98000000
-static unsigned long page_addr;
-#endif
#ifdef CHECK_STACK
#define lajosdump(x) printk(KERN_NOTICE "%s::%s():%d: %s=%p\n",\
@@ -79,8 +66,6 @@ static void check_stack(struct dmmPhysPgLLT *stack, char *prefix, int line)
}
#endif
-/*--------function prototypes ---------------------------------*/
-
/* ========================================================================== */
/**
* dmmPhysPageRepRefil()
@@ -96,29 +81,25 @@ static void check_stack(struct dmmPhysPgLLT *stack, char *prefix, int line)
* @see
*/
/* ========================================================================== */
-void dmm_phys_page_rep_refil(void)
+enum errorCodeT dmm_phys_page_rep_refil(void)
{
unsigned long iter;
+ struct page *page = NULL;
- tilerdump(__LINE__);
for (iter = 0; iter < DMM_MNGD_PHYS_PAGES; iter++) {
- struct dmmPhysPgLLT *tmpPgNode = kmalloc
- (sizeof(struct dmmPhysPgLLT), GFP_KERNEL);
+ struct dmmPhysPgLLT *tmpPgNode = NULL;
+
+ tmpPgNode = kmalloc(sizeof(struct dmmPhysPgLLT), GFP_KERNEL);
+ if (!tmpPgNode)
+ return DMM_SYS_ERROR;
memset(tmpPgNode, 0x0, sizeof(struct dmmPhysPgLLT));
if (tmpPgNode != NULL) {
-
tmpPgNode->nextPhysPg = NULL;
tmpPgNode->prevPhysPg = NULL;
-#ifndef __NEWCODE__
- tmpPgNode->physPgPtr =
- (unsigned long *)__get_free_page(
- GFP_KERNEL | GFP_DMA);
-#else
-#ifdef __KERN_TO_ALLOC__
- struct page *page = NULL;
-
page = (struct page *)alloc_page(GFP_KERNEL | GFP_DMA);
+ if (!page)
+ return DMM_SYS_ERROR;
tmpPgNode->physPgPtr =
(unsigned long *)page_to_phys(page);
tmpPgNode->page_addr = page;
@@ -126,11 +107,6 @@ void dmm_phys_page_rep_refil(void)
(void *)page_address(page) + 0x1000);
outer_flush_range((unsigned long)tmpPgNode->physPgPtr,
(unsigned long)tmpPgNode->physPgPtr + 0x1000);
-#else
- tmpPgNode->physPgPtr = (unsigned long *)page_addr;
- page_addr += 0x1000;
-#endif
-#endif
/* add to end */
if (freePagesStack != NULL) {
@@ -150,6 +126,7 @@ void dmm_phys_page_rep_refil(void)
#ifdef CHECK_STACK
check_stack(freePagesStack, "free: ", __LINE__);
#endif
+ return DMM_NO_ERROR;
}
/* ========================================================================== */
@@ -169,24 +146,18 @@ void dmm_phys_page_rep_refil(void)
/* ========================================================================== */
enum errorCodeT dmm_phys_page_rep_init(void)
{
+ int r = DMM_SYS_ERROR;
mutex_init(&mtx);
- /* DMM_ENTER_CRITICAL_SECTION */
mutex_lock(&mtx);
freePagesStack = NULL;
usedPagesStack = NULL;
-
freePageCnt = 0;
-#ifndef __KERN_TO_ALLOC__
- page_addr = BASE_MEM_ADDR;
-#endif
-
- dmm_phys_page_rep_refil();
+ r = dmm_phys_page_rep_refil();
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&mtx);
- return DMM_NO_ERROR;
+ return r;
}
/* ========================================================================== */
@@ -207,43 +178,26 @@ enum errorCodeT dmm_phys_page_rep_init(void)
/* ========================================================================== */
enum errorCodeT dmm_phys_page_rep_deinit(void)
{
- /* DMM_ENTER_CRITICAL_SECTION */
- mutex_lock(&mtx);
struct dmmPhysPgLLT *tmpPgNode = NULL;
+ mutex_lock(&mtx);
+
while (usedPagesStack != NULL) {
tmpPgNode = usedPagesStack->prevPhysPg;
-#ifndef __NEWCODE__
- free_page((unsigned long)usedPagesStack->physPgPtr);
- kfree(usedPagesStack);
-#else
-#ifdef __KERN_TO_ALLOC__
__free_page(usedPagesStack->page_addr);
-#else
-#endif
kfree(usedPagesStack);
-#endif
usedPagesStack = tmpPgNode;
}
while (freePagesStack != NULL) {
tmpPgNode = freePagesStack->prevPhysPg;
-#ifndef __NEWCODE__
- free_page((unsigned long)freePagesStack->physPgPtr);
- kfree(freePagesStack);
-#else
-#ifdef __KERN_TO_ALLOC__
__free_page(freePagesStack->page_addr);
-#else
-#endif
kfree(freePagesStack);
-#endif
freePagesStack = tmpPgNode;
}
freePageCnt = 0;
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&mtx);
mutex_destroy(&mtx);
return DMM_NO_ERROR;
@@ -267,12 +221,15 @@ enum errorCodeT dmm_phys_page_rep_deinit(void)
unsigned long *dmm_get_phys_page(void)
{
unsigned long *physPgPtr = NULL;
+ int r = -1;
- /* DMM_ENTER_CRITICAL_SECTION */
mutex_lock(&mtx);
- if (freePagesStack == NULL)
- dmm_phys_page_rep_refil();
+ if (freePagesStack == NULL) {
+ r = dmm_phys_page_rep_refil();
+ if (r != DMM_NO_ERROR)
+ return NULL;
+ }
if (freePagesStack != NULL) {
struct dmmPhysPgLLT *tmpPgNode = freePagesStack;
@@ -302,7 +259,6 @@ unsigned long *dmm_get_phys_page(void)
check_stack(freePagesStack, "free: ", __LINE__);
check_stack(usedPagesStack, "used: ", __LINE__);
#endif
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&mtx);
return physPgPtr;
}
@@ -329,7 +285,6 @@ enum errorCodeT dmm_free_phys_page(unsigned long *physPgPtr)
{
struct dmmPhysPgLLT *iterPgNode = usedPagesStack;
- /* DMM_ENTER_CRITICAL_SECTION */
mutex_lock(&mtx);
while (iterPgNode != NULL) {
@@ -349,7 +304,6 @@ enum errorCodeT dmm_free_phys_page(unsigned long *physPgPtr)
} else if (iterPgNode == usedPagesStack) {
usedPagesStack = usedPagesStack->prevPhysPg;
} else {
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&mtx);
lajosdump(iterPgNode);
return DMM_SYS_ERROR;
@@ -365,23 +319,13 @@ enum errorCodeT dmm_free_phys_page(unsigned long *physPgPtr)
while (freePageCnt > DMM_MNGD_PHYS_PAGES &&
freePagesStack != NULL) {
iterPgNode = freePagesStack->prevPhysPg;
-#ifndef __NEWCODE__
- free_page((unsigned long)
- freePagesStack->physPgPtr);
- kfree(freePagesStack);
-#else
-#ifdef __KERN_TO_ALLOC__
__free_page(freePagesStack->page_addr);
-#else
-#endif
kfree(freePagesStack);
-#endif
freePagesStack = iterPgNode;
freePageCnt--;
}
freePagesStack->nextPhysPg = NULL;
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&mtx);
#ifdef CHECK_STACK
check_stack(freePagesStack, "free: ", __LINE__);
@@ -393,7 +337,6 @@ enum errorCodeT dmm_free_phys_page(unsigned long *physPgPtr)
iterPgNode = iterPgNode->prevPhysPg;
}
- /* DMM_EXIT_CRITICAL_SETCTION */
mutex_unlock(&mtx);
#ifdef CHECK_STACK
check_stack(freePagesStack, "free: ", __LINE__);
diff --git a/drivers/media/video/tiler/dmm_prv.h b/drivers/media/video/tiler/dmm_prv.h
index 24f775d4be33..d69c374caac6 100644
--- a/drivers/media/video/tiler/dmm_prv.h
+++ b/drivers/media/video/tiler/dmm_prv.h
@@ -21,17 +21,10 @@
#include "dmm_drv.h"
#include "dmm_reg.h"
-#define __NEWCODE__
-#ifdef __NEWCODE__
-
#if 0
-#define debug(x) printk(KERN_NOTICE "%s()::%d:%s=(0x%08x)\n", \
- __func__, __LINE__, #x, (int)x);
-
#define regdump(x, y) printk(KERN_NOTICE "%s()::%d:%s=(0x%08x)\n", \
__func__, __LINE__, x, (int)y);
#else
-#define debug(x)
#define regdump(x, y)
#endif
@@ -69,25 +62,11 @@
#define PEG_HWINFO 0x608
#define PEG_PRIO 0x620
#define PEG_PRIO_PAT 0x640
-#endif
-
-#undef __DEBUG__
-
-#ifdef __DEBUG__
-#define tilerdump(x) printk(KERN_NOTICE "%s():%s=(0x%08x)\n", \
- __func__, #x, (int)x);
-#else
-#define tilerdump(x)
-#endif
#define DMM__DMM DMM__DMM
#define DMM_PAT_AREA_IRQ (0)
-#ifndef __NEWCODE__
-#define DMM_MNGD_PHYS_PAGES (256)
-#else
#define DMM_MNGD_PHYS_PAGES (16)
-#endif
#define DMM_TILE_DIMM_X_MODE_8 (32)
#define DMM_TILE_DIMM_Y_MODE_8 (32)
@@ -222,16 +201,13 @@
(yInv << DMM_Y_INVERT_SHIFT) | (xInv << DMM_X_INVERT_SHIFT) |\
(accM << DMM_ACC_MODE_SHIFT)))
-/*--------data declarations -----------------------------------*/
/** @struc dmmPhysPgLLT
* Structure defining Dmm physical memory pages managment linked list. */
struct dmmPhysPgLLT {
struct dmmPhysPgLLT *nextPhysPg;
struct dmmPhysPgLLT *prevPhysPg;
unsigned long *physPgPtr;
-#ifdef __NEWCODE__
struct page *page_addr;
-#endif
};
/** @struc dmmHwdCtxT
@@ -337,7 +313,6 @@ struct DMM_rStruct_t {
#endif /* __DMM_DEBUG_BUILD__ */
-/*--------function prototypes ---------------------------------*/
/* ========================================================================== */
/**
* dmm_tiler_container_map_area()
@@ -411,6 +386,7 @@ enum errorCodeT dmm_tiler_populate_pat_page_entry_data(unsigned long bfrSize,
unsigned long **pageEntries,
unsigned long **pageEntriesSpace,
void *custmPagesPtr);
+
/* ========================================================================== */
/**
* dmm_tiler_swap_pat_page_entry_data()
@@ -496,51 +472,6 @@ struct dmmTILERContPageAreaT *dmm_tiler_get_area_from_sysptr(
/* ========================================================================== */
/**
- * dmmEventReport()
- *
- * @brief Signal events to the user modules (wrapper to the user supplied
- * callback).
- *
- * @param dmmInstanceCtxPtr - void * - [in] Dmm context instance.
- *
- * @param mspEvent - MSP_EVENT_TYPE - [in] MSP event type.
- *
- * @param eData - void * - [in] MSP event data pointer.
- *
- * @return errorCodeT error if event can't be signaled.
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see dmmTILERContCtxT for further detail.
- */
-/* ========================================================================== */
-/* enum errorCodeT dmmEventReport(void * dmmInstanceCtxPtr,
- MSP_EVENT_TYPE mspEvent, void * eData); */
-
-/* ========================================================================== */
-/**
-* dmmPatIrqHandler()
-*
-* @brief Interrupt handler for PAT area status updates.
-*
-* @param data - UArg -
-*
-* @return none
-*
-* @pre There is no pre conditions.
-*
-* @post There is no post conditions.
-*
-* @see
-*
-*/
-/* ========================================================================== */
-/* Void dmmPatIrqHandler(UArg data); */
-
-/* ========================================================================== */
-/**
* dmm_phys_page_rep_init()
*
* @brief Initializes the physical memory page repository instance.
@@ -658,99 +589,6 @@ enum errorCodeT dmm_pat_phy2virt_mapping(
enum errorCodeT dmm_pat_start_refill(
struct dmmTILERContPageAreaT *bufferMappedZone);
-/*--------function prototypes ---------------------------------*/
-
-/* ========================================================================== */
-/**
- * dmm_enter_critical_section()
- *
- * @brief Enter a critical code execution section.
- *
- * @return none
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see
- */
-/* ========================================================================== */
-void dmm_enter_critical_section(void);
-
-/* ========================================================================== */
-/**
- * dmm_leave_critical_section()
- *
- * @brief Exit a critical code execution section.
- *
- * @return none
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see
- */
-/* ========================================================================== */
-void dmm_leave_critical_section(void);
-
-/* ========================================================================== */
-/**
- * dmm_memory_size_alloc()
- *
- * @brief Allocates a physical memory page.
- *
- * @param pageNum - unsigned long - [in] Number of physical pages to allocate.
- *
- * @return void * pointer to the physical memory.
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see
- */
-/* ========================================================================== */
-void *dmm_memory_size_alloc(unsigned long memSize);
-
-/* ========================================================================== */
-/**
- * dmm_memory_page_alloc()
- *
- * @brief Allocates a physical memory page.
- *
- * @param pageNum - unsigned long - [in] Number of physical pages to allocate.
- *
- * @return void * pointer to the physical memory.
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see
- */
-/* ========================================================================== */
-void *dmm_memory_page_alloc(unsigned long pageNum);
-
-/* ========================================================================== */
-/**
- * dmm_memory_page_free()
- *
- * @brief Frees a physical memory page.
- *
- * @param pagePtr - void * - [in] Pointer to the physical pages to free.
- *
- * @return none
- *
- * @pre There is no pre conditions.
- *
- * @post There is no post conditions.
- *
- * @see
- */
-/* ========================================================================== */
-void dmm_memory_page_free(void *pagePtr);
-
/* ========================================================================== */
/**
* overlapping_test()
diff --git a/drivers/media/video/tiler/dmm_reg.h b/drivers/media/video/tiler/dmm_reg.h
index dbd8683c58b4..4d8ed98bec7a 100644
--- a/drivers/media/video/tiler/dmm_reg.h
+++ b/drivers/media/video/tiler/dmm_reg.h
@@ -24,6 +24,6 @@
#define BITFIELD BITFIELD_32
-extern unsigned long *dmm_virt_base_addr;
+extern void *dmm_base;
#endif