aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@freescale.com>2011-12-22 09:19:40 +0800
committerEric Miao <eric.miao@linaro.org>2012-01-14 23:22:30 +0800
commit436df16bff674affc8987ceef5c04417902539b1 (patch)
tree1c8d7c0ab39cce21007bc02fb9baf9974410987d
parentba31f9bc45d0a96ca50b69feb341d10dc13bee25 (diff)
downloadlinux-linaro-436df16bff674affc8987ceef5c04417902539b1.tar.gz
gpu-viv: add reserve memory support, reserve 128M memory.
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c21
-rw-r--r--arch/arm/plat-mxc/include/mach/mx6q.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/viv_gpu.h23
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c6
4 files changed, 50 insertions, 2 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 6fd12411c32..a971e44c603 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -25,6 +25,7 @@
#include <linux/dma-mapping.h>
#include <linux/clk.h>
#include <linux/fsl_devices.h>
+#include <linux/memblock.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
@@ -36,6 +37,7 @@
#include <mach/iomux-mx6q.h>
#include <mach/ipu-v3.h>
#include <mach/mxc_vpu.h>
+#include <mach/viv_gpu.h>
#include "devices-imx6q.h"
static iomux_v3_cfg_t imx6q_sabrelite_pads[] = {
@@ -170,10 +172,15 @@ static struct mxc_vpu_platform_data vpu_pdata = {
.reset = mx6q_vpu_reset,
};
+static struct viv_gpu_platform_data gpu_pdata = {
+ .reserved_mem_size = SZ_128M,
+};
+
static const struct of_dev_auxdata imx6q_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("fsl,imx6q-ipu", MX6Q_IPU1_BASE_ADDR, "imx-ipuv3.0", &ipuv3_pdata),
OF_DEV_AUXDATA("fsl,imx6q-ipu", MX6Q_IPU2_BASE_ADDR, "imx-ipuv3.1", &ipuv3_pdata),
OF_DEV_AUXDATA("fsl,vpu", MX6Q_VPU_BASE_ADDR, "mxc_vpu.0", &vpu_pdata),
+ OF_DEV_AUXDATA("viv,galcore", MX6Q_GPU_3D_BASE_ADDR, "galcore", &gpu_pdata),
OF_DEV_AUXDATA("fsl,imx6q-ahci", MX6Q_SATA_BASE_ADDR, "imx6q-ahci", &imx_sata_pdata),
};
@@ -306,11 +313,25 @@ static const char *imx6q_dt_compat[] __initdata = {
NULL,
};
+static void __init imx6q_sabrelite_reserve(void)
+{
+ phys_addr_t phys;
+
+ if (gpu_pdata.reserved_mem_size) {
+ phys = memblock_alloc_base(gpu_pdata.reserved_mem_size,
+ SZ_4K, SZ_2G);
+ memblock_free(phys, gpu_pdata.reserved_mem_size);
+ memblock_remove(phys, gpu_pdata.reserved_mem_size);
+ gpu_pdata.reserved_mem_base = phys;
+ }
+}
+
DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad (Device Tree)")
.map_io = imx6q_map_io,
.init_irq = imx6q_init_irq,
.handle_irq = imx6q_handle_irq,
.timer = &imx6q_timer,
+ .reserve = imx6q_sabrelite_reserve,
.init_machine = imx6q_init_machine,
.dt_compat = imx6q_dt_compat,
.restart = imx6q_restart,
diff --git a/arch/arm/plat-mxc/include/mach/mx6q.h b/arch/arm/plat-mxc/include/mach/mx6q.h
index a289ffe2ddd..fc2c4553831 100644
--- a/arch/arm/plat-mxc/include/mach/mx6q.h
+++ b/arch/arm/plat-mxc/include/mach/mx6q.h
@@ -54,4 +54,6 @@
*/
#define MX6Q_SATA_BASE_ADDR 0x02200000
+#define MX6Q_GPU_3D_BASE_ADDR 0x00130000
+
#endif /* __MACH_MX6Q_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/viv_gpu.h b/arch/arm/plat-mxc/include/mach/viv_gpu.h
new file mode 100644
index 00000000000..f3136cec2de
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/viv_gpu.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2011 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 as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#ifndef __MACH_VIV_GPU_H_
+#define __MACH_VIV_GPU_H_
+
+struct viv_gpu_platform_data {
+ resource_size_t reserved_mem_base;
+ resource_size_t reserved_mem_size;
+};
+
+#endif /* __MACH_VIV_GPU_H_ */
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
index 4262e328787..6b8eff847f0 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
@@ -24,6 +24,7 @@
#include <linux/device.h>
#include <linux/slab.h>
+#include <mach/viv_gpu.h>
#include "gc_hal_kernel_linux.h"
#include "gc_hal_driver.h"
@@ -943,6 +944,7 @@ static int __devinit gpu_probe(struct platform_device *pdev)
{
int ret = -ENODEV;
struct resource* res;
+ struct viv_gpu_platform_data *pdata;
gcmkHEADER();
@@ -978,13 +980,13 @@ static int __devinit gpu_probe(struct platform_device *pdev)
registerMemBaseVG = res->start;
registerMemSizeVG = res->end - res->start + 1;
}
-#if 0
+
pdata = pdev->dev.platform_data;
if (pdata) {
contiguousBase = pdata->reserved_mem_base;
contiguousSize = pdata->reserved_mem_size;
}
-#endif
+
ret = drv_init();
if (!ret)