diff options
Diffstat (limited to 'drivers/mxc/amd-gpu/platform')
6 files changed, 46 insertions, 62 deletions
diff --git a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hal.c b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hal.c index 51270ada4d36..45740b53d9b7 100644 --- a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hal.c +++ b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hal.c @@ -1,5 +1,5 @@ /* Copyright (c) 2008-2010, Advanced Micro Devices. All rights reserved. - * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. + * Copyright (C) 2008-2012 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -17,10 +17,6 @@ * */ -/* - * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. - */ - #include "gsl_hal.h" #include "gsl_halconfig.h" #include "gsl_linux_map.h" @@ -49,6 +45,7 @@ extern int gmem_size; extern phys_addr_t gpu_reserved_mem; extern int gpu_reserved_mem_size; extern int gpu_2d_irq, gpu_3d_irq; +extern int enable_mmu; KGSLHAL_API int @@ -121,8 +118,7 @@ kgsl_hal_init(void) hal->has_z160 = 0; } - /* there is still some problem to enable mmu currently */ - gsl_driver.enable_mmu = 0; + gsl_driver.enable_mmu = enable_mmu; /* setup register space */ if (hal->has_z430) { diff --git a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hwaccess.h b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hwaccess.h index 305b2ee9066d..96abace9b736 100644 --- a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hwaccess.h +++ b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_hwaccess.h @@ -43,8 +43,6 @@ kgsl_hwaccess_memread(void *dst, unsigned int gpubase, unsigned int gpuoffset, u if (gsl_driver.enable_mmu && (gpubase >= GSL_LINUX_MAP_RANGE_START) && (gpubase < GSL_LINUX_MAP_RANGE_END)) { gsl_linux_map_read(dst, gpubase+gpuoffset, sizebytes, touserspace); } else { - mb(); - dsb(); if (touserspace) { if (copy_to_user(dst, (void *)(gpubase + gpuoffset), sizebytes)) @@ -56,8 +54,6 @@ kgsl_hwaccess_memread(void *dst, unsigned int gpubase, unsigned int gpuoffset, u { kos_memcpy(dst, (void *) (gpubase + gpuoffset), sizebytes); } - mb(); - dsb(); } } @@ -69,8 +65,6 @@ kgsl_hwaccess_memwrite(unsigned int gpubase, unsigned int gpuoffset, void *src, if (gsl_driver.enable_mmu && (gpubase >= GSL_LINUX_MAP_RANGE_START) && (gpubase < GSL_LINUX_MAP_RANGE_END)) { gsl_linux_map_write(src, gpubase+gpuoffset, sizebytes, fromuserspace); } else { - mb(); - dsb(); if (fromuserspace) { if (copy_from_user((void *)(gpubase + gpuoffset), src, sizebytes)) @@ -82,8 +76,6 @@ kgsl_hwaccess_memwrite(unsigned int gpubase, unsigned int gpuoffset, void *src, { kos_memcpy((void *)(gpubase + gpuoffset), src, sizebytes); } - mb(); - dsb(); } } @@ -95,11 +87,7 @@ kgsl_hwaccess_memset(unsigned int gpubase, unsigned int gpuoffset, unsigned int if (gsl_driver.enable_mmu && (gpubase >= GSL_LINUX_MAP_RANGE_START) && (gpubase < GSL_LINUX_MAP_RANGE_END)) { gsl_linux_map_set(gpuoffset+gpubase, value, sizebytes); } else { - mb(); - dsb(); kos_memset((void *)(gpubase + gpuoffset), value, sizebytes); - mb(); - dsb(); } } @@ -115,11 +103,7 @@ kgsl_hwaccess_regread(gsl_deviceid_t device_id, unsigned int gpubase, unsigned i reg = (unsigned int *)(gpubase + (offsetwords << 2)); - mb(); - dsb(); - *data = __raw_readl(reg); - mb(); - dsb(); + *data = readl(reg); } //---------------------------------------------------------------------------- @@ -133,10 +117,6 @@ kgsl_hwaccess_regwrite(gsl_deviceid_t device_id, unsigned int gpubase, unsigned (void) device_id; reg = (unsigned int *)(gpubase + (offsetwords << 2)); - mb(); - dsb(); - __raw_writel(data, reg); - mb(); - dsb(); + writel(data, reg); } #endif // __GSL_HWACCESS_WINCE_MX51_H diff --git a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod.c b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod.c index b67404150e10..2e6bc55e88fe 100644 --- a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod.c +++ b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod.c @@ -1,5 +1,5 @@ /* Copyright (c) 2008-2010, Advanced Micro Devices. All rights reserved. - * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. + * Copyright (C) 2008-2012 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -40,6 +40,7 @@ #include <linux/uaccess.h> #include <mach/mxc_gpu.h> +#include <linux/fsl_devices.h> int gpu_2d_irq, gpu_3d_irq; @@ -51,6 +52,7 @@ int gmem_size; phys_addr_t gpu_reserved_mem; int gpu_reserved_mem_size; int z160_version; +int enable_mmu; static ssize_t gsl_kmod_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr); static ssize_t gsl_kmod_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr); @@ -769,14 +771,15 @@ static int gpu_probe(struct platform_device *pdev) int i; struct resource *res; struct device *dev; - struct mxc_gpu_platform_data *pdata; + struct mxc_gpu_platform_data *gpu_data = NULL; - pdata = pdev->dev.platform_data; - if (pdata) { - z160_version = pdata->z160_revision; - gpu_reserved_mem = pdata->reserved_mem_base; - gpu_reserved_mem_size = pdata->reserved_mem_size; - } + gpu_data = (struct mxc_gpu_platform_data *)pdev->dev.platform_data; + + if (gpu_data == NULL) + return 0; + + z160_version = gpu_data->z160_revision; + enable_mmu = gpu_data->enable_mmu; for(i = 0; i < 2; i++){ res = platform_get_resource(pdev, IORESOURCE_IRQ, i); @@ -795,8 +798,8 @@ static int gpu_probe(struct platform_device *pdev) } } - for (i = 0; i < 3; i++) { - res = platform_get_resource(pdev, IORESOURCE_MEM, i); + for (i = 0; i < 4; i++) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); if (!res) { gpu_2d_regbase = 0; gpu_2d_regsize = 0; @@ -807,14 +810,17 @@ static int gpu_probe(struct platform_device *pdev) gpu_reserved_mem_size = 0; break; }else{ - if(strcmp(res->name, "gpu_2d_registers") == 0){ - gpu_2d_regbase = res->start; - gpu_2d_regsize = res->end - res->start + 1; - }else if(strcmp(res->name, "gpu_3d_registers") == 0){ - gpu_3d_regbase = res->start; - gpu_3d_regsize = res->end - res->start + 1; - }else if(strcmp(res->name, "gpu_graphics_mem") == 0){ - gmem_size = res->end - res->start + 1; + if (strcmp(res->name, "gpu_2d_registers") == 0) { + gpu_2d_regbase = res->start; + gpu_2d_regsize = res->end - res->start + 1; + } else if (strcmp(res->name, "gpu_3d_registers") == 0) { + gpu_3d_regbase = res->start; + gpu_3d_regsize = res->end - res->start + 1; + } else if (strcmp(res->name, "gpu_graphics_mem") == 0) { + gmem_size = res->end - res->start + 1; + } else if (strcmp(res->name, "gpu_reserved_mem") == 0) { + gpu_reserved_mem = res->start; + gpu_reserved_mem_size = res->end - res->start + 1; } } } diff --git a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod_cleanup.c b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod_cleanup.c index 3685a5756baf..911469b720d7 100644 --- a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod_cleanup.c +++ b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_kmod_cleanup.c @@ -173,10 +173,13 @@ int del_all_memblocks_from_allocated_list(struct file *fd) printk(KERN_INFO "Not all allocated memory blocks were freed. Doing it now.\n"); list_for_each_entry_safe(cursor, next, head, node) { - printk(KERN_INFO "Freeing list entry #%u, gpuaddr=%x\n", (u32)cursor->allocation_number, cursor->allocated_block.gpuaddr); - kgsl_sharedmem_free(&cursor->allocated_block); - list_del(&cursor->node); - kfree(cursor); + printk(KERN_DEBUG "Freeing list entry #%u, gpuaddr=%x\n", + (u32)cursor->allocation_number, + cursor->allocated_block.gpuaddr); + + kgsl_sharedmem_free(&cursor->allocated_block); + list_del(&cursor->node); + kfree(cursor); } } diff --git a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_linux_map.c b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_linux_map.c index 7fee7b814411..3c1e02e5bc42 100644 --- a/drivers/mxc/amd-gpu/platform/hal/linux/gsl_linux_map.c +++ b/drivers/mxc/amd-gpu/platform/hal/linux/gsl_linux_map.c @@ -61,7 +61,7 @@ void *gsl_linux_map_alloc(unsigned int gpu_addr, unsigned int size) } } - va = __vmalloc(size, GFP_KERNEL, pgprot_noncached(pgprot_kernel)); + va = __vmalloc(size, GFP_KERNEL, pgprot_writecombine(pgprot_kernel)); if(va == NULL){ mutex_unlock(&gsl_linux_map_mutex); return NULL; diff --git a/drivers/mxc/amd-gpu/platform/hal/linux/misc.c b/drivers/mxc/amd-gpu/platform/hal/linux/misc.c index b3a4582bb156..db7b8cf3a2d1 100644 --- a/drivers/mxc/amd-gpu/platform/hal/linux/misc.c +++ b/drivers/mxc/amd-gpu/platform/hal/linux/misc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2010-2012 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -38,9 +38,9 @@ typedef struct _gsl_autogate_t { } gsl_autogate_t; static gsl_autogate_t *g_autogate[2]; -static DEFINE_SEMAPHORE(sem_dev); +static DEFINE_MUTEX(sem_dev); -#define KGSL_DEVICE_IDLE_TIMEOUT 5000 /* unit ms */ +#define KGSL_DEVICE_IDLE_TIMEOUT 2000 /* unit ms */ static void clk_disable_task(struct work_struct *work) { @@ -79,10 +79,10 @@ static int _kgsl_device_active(gsl_device_t *dev, int all) int index; index = autogate->dev->id == GSL_DEVICE_G12 ? GSL_DEVICE_YAMATO - 1 : GSL_DEVICE_G12 - 1; - down(&sem_dev); + mutex_lock(&sem_dev); if (g_autogate[index]) _kgsl_device_active(g_autogate[index]->dev, 0); - up(&sem_dev); + mutex_unlock(&sem_dev); } return 0; } @@ -99,7 +99,6 @@ static void kgsl_device_inactive(unsigned long data) // printk(KERN_ERR "%s:%d id %d active %d\n", __func__, __LINE__, autogate->dev->id, autogate->active); del_timer(&autogate->timer); spin_lock_irqsave(&autogate->lock, flags); - WARN(!autogate->active, "GPU Device %d is already inactive\n", autogate->dev->id); if (autogate->active) { autogate->active = 0; autogate->pending = 1; @@ -137,7 +136,7 @@ int kgsl_device_autogate_init(gsl_device_t *dev) printk(KERN_ERR "%s: out of memory!\n", __func__); return -ENOMEM; } - down(&sem_dev); + mutex_lock(&sem_dev); autogate->dev = dev; autogate->active = 1; spin_lock_init(&autogate->lock); @@ -150,7 +149,7 @@ int kgsl_device_autogate_init(gsl_device_t *dev) INIT_WORK(&autogate->dis_task, clk_disable_task); dev->autogate = autogate; g_autogate[dev->id - 1] = autogate; - up(&sem_dev); + mutex_unlock(&sem_dev); return 0; } @@ -159,13 +158,13 @@ void kgsl_device_autogate_exit(gsl_device_t *dev) gsl_autogate_t *autogate = dev->autogate; // printk(KERN_ERR "%s:%d id %d active %d\n", __func__, __LINE__, dev->id, autogate->active); - down(&sem_dev); + mutex_lock(&sem_dev); del_timer_sync(&autogate->timer); if (!autogate->active) kgsl_clock(autogate->dev->id, 1); flush_work(&autogate->dis_task); g_autogate[dev->id - 1] = NULL; - up(&sem_dev); + mutex_unlock(&sem_dev); kfree(autogate); dev->autogate = NULL; } |