]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00274761-3 Upgrade VPU driver for Linux 3.10 kernel
authorHongzhang Yang <Hongzhang.Yang@freescale.com>
Mon, 12 Aug 2013 07:38:07 +0000 (15:38 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:13 +0000 (10:06 +0200)
Modify mxc_vpu.c to adapt to kernel 3.10 change
- Remove all references to header files in mach folder
- Include linux/clk.h instead of mach/clock.h
- Call device_reset instead of imx_src_reset_vpu
- Dummy PU and PM api callings before they are ready
- Dummy cpu_is_mx5? api callings
- Remove VM_RESERVED flags
- Call gen_pool instead of iram_alloc

Modify mxc_vpu.h
- Change CONFIG_ARCH_MX6 to CONFIG_SOC_IMX6Q

Modify Kconfig:
- Change ARCH_MX? to SOC_IMX?, remove ARCH_MX3/ARCH_MX37
  because for MX3 series only SOC_IMX31 and SOC_IMX35 are
  defined in Linux 3.10, and these chips don't have VPU.
  Need to add SOC_IMX37 to VPU Kconfig if MX37 could be
  supported later.

Add VPU to config and build path
- mxc/Kconfig
- mxc/Makefile

Signed-off-by: Hongzhang Yang <Hongzhang.Yang@freescale.com>
drivers/mxc/Kconfig
drivers/mxc/Makefile
drivers/mxc/vpu/Kconfig
drivers/mxc/vpu/mxc_vpu.c
include/linux/mxc_vpu.h

index 5b69a03d25f37a84e5a9525e5a2ae1bcc6538162..8aa5640059fd41e887815e17676667c1f8abb355 100644 (file)
@@ -14,6 +14,7 @@ config MXC_IPU
 source "drivers/mxc/gpu-viv/Kconfig"
 source "drivers/mxc/ipu3/Kconfig"
 source "drivers/mxc/asrc/Kconfig"
+source "drivers/mxc/vpu/Kconfig"
 
 endmenu
 
index f180fbb032074aab172166f5976a2ed96ed8a467..e18b67adb9e73dcc812eb43f15597d052c1f6f0b 100644 (file)
@@ -1,3 +1,4 @@
 obj-$(CONFIG_MXC_GPU_VIV) += gpu-viv/
 obj-$(CONFIG_MXC_IPU_V3) += ipu3/
 obj-$(CONFIG_MXC_ASRC) += asrc/
+obj-$(CONFIG_MXC_VPU) += vpu/
index 6562697f25f5134f8d7977f57c4cc61204189891..520209601dbe27e0f28fcca755586f4f92bc7d06 100644 (file)
@@ -6,7 +6,7 @@ menu "MXC VPU(Video Processing Unit) support"
 
 config MXC_VPU
          tristate "Support for MXC VPU(Video Processing Unit)"
-         depends on (ARCH_MX3 || ARCH_MX27 || ARCH_MX37 || ARCH_MX5 || ARCH_MX6)
+         depends on (SOC_IMX27 || SOC_IMX5 || SOC_IMX6Q)
          default y
        ---help---
          The VPU codec device provides codec function for H.264/MPEG4/H.263,
index a16c31f9c5c80ce6c116cb2a1af8217a014fa719..9baeeb4e3a512dd1cc06d28e552aea0444676e3a 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/platform_device.h>
 #include <linux/kdev_t.h>
 #include <linux/dma-mapping.h>
-#include <linux/iram_alloc.h>
 #include <linux/wait.h>
 #include <linux/list.h>
 #include <linux/clk.h>
 #include <linux/memblock.h>
 #include <linux/memory.h>
 #include <linux/version.h>
+#include <asm/page.h>
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
-#include <mach/busfreq.h>
-#include <mach/hardware.h>
-#include <mach/common.h>
-#endif
-#include <asm/page.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
 #include <linux/sizes.h>
-#else
-#include <asm/sizes.h>
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+#include <linux/iram_alloc.h>
 #include <mach/clock.h>
 #include <mach/hardware.h>
-
 #include <mach/mxc_vpu.h>
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+#include <linux/genalloc.h>
+#include <linux/of.h>
+#include <linux/reset.h>
+#include <linux/clk.h>
+#include <linux/mxc_vpu.h>
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
+#include <mach/busfreq.h>
+#include <mach/common.h>
+#else
+#include <asm/sizes.h>
+#endif
 
 /* Define one new pgprot which combined uncached and XN(never executable) */
 #define pgprot_noncachedxn(prot) \
@@ -86,6 +95,11 @@ struct iram_setting {
        u32 end;
 };
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+static struct gen_pool *iram_pool;
+static u32 iram_base;
+#endif
+
 static LIST_HEAD(head);
 
 static int vpu_major;
@@ -155,6 +169,39 @@ static int cpu_is_mx6q(void)
 }
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+static void imx_src_reset_vpu(void)
+{
+       device_reset(&vpu_pdev->dev);
+}
+
+static void imx_gpc_power_up_pu(int on)
+{
+}
+
+static void request_bus_freq(int freq)
+{
+}
+
+static void release_bus_freq(int freq)
+{
+}
+
+static int cpu_is_mx53(void)
+{
+       return 0;
+}
+
+static int cpu_is_mx51(void)
+{
+       return 0;
+}
+
+#define VM_RESERVED 0
+#define BUS_FREQ_HIGH 0
+
+#endif
+
 /*!
  * Private function to alloc dma buffer
  * @return status  0 success.
@@ -826,7 +873,25 @@ static int vpu_dev_probe(struct platform_device *pdev)
 
        err = of_property_read_u32(np, "iramsize", (u32 *)&iramsize);
        if (!err && iramsize)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+       {
+               iram_pool = of_get_named_gen_pool(np, "iram", 0);
+               if (!iram_pool) {
+                       printk(KERN_ERR "iram pool not available\n");
+                       return -ENOMEM;
+               }
+
+               iram_base = gen_pool_alloc(iram_pool, iramsize);
+               if (!iram_base) {
+                       printk(KERN_ERR "unable to alloc iram\n");
+                       return -ENOMEM;
+               }
+
+               addr = gen_pool_virt_to_phys(iram_pool, iram_base);
+       }
+#else
                iram_alloc(iramsize, &addr);
+#endif
        if (addr == 0)
                iram.start = iram.end = 0;
        else {
@@ -959,7 +1024,11 @@ static int vpu_dev_remove(struct platform_device *pdev)
        iounmap(vpu_base);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
        if (iram.start)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+               gen_pool_free(iram_pool, iram_base, iram.end-iram.start+1);
+#else
                iram_free(iram.start, iram.end-iram.start+1);
+#endif
 #else
        if (vpu_plat && vpu_plat->iram_enable && vpu_plat->iram_size)
                iram_free(iram.start,  vpu_plat->iram_size);
index 7869d59c5eeca6332005c87cd76503fe60c4902b..27f9377856aab4b432f33ddb34eedb9cd44c6daf 100644 (file)
  */
 
 /*!
- * @file plat-mxc/include/mach/mxc_vpu.h
+ * @file linux/mxc_vpu.h
  *
  * @brief VPU system initialization and file operation definition
  *
  * @ingroup VPU
  */
 
-#ifndef __ASM_ARCH_MXC_VPU_H__
-#define __ASM_ARCH_MXC_VPU_H__
+#ifndef __LINUX_MXC_VPU_H__
+#define __LINUX_MXC_VPU_H__
 
 #include <linux/fs.h>
 
@@ -79,7 +79,7 @@ struct vpu_mem_desc {
 #define BIT_FRAME_MEM_CTRL             BIT_WORK_CTRL_BUF_REG(4)
 #define BIT_BIT_STREAM_PARAM           BIT_WORK_CTRL_BUF_REG(5)
 
-#ifndef CONFIG_ARCH_MX6
+#ifndef CONFIG_SOC_IMX6Q
 #define BIT_RESET_CTRL                 0x11C
 #else
 #define BIT_RESET_CTRL                 0x128