aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Chen <jason.chen@linaro.org>2011-12-06 17:02:50 +0800
committerJason Chen <jason.chen@linaro.org>2011-12-06 17:02:50 +0800
commitbf1123d241218002147839756bc7076af1ea3bf7 (patch)
tree7470ee5a513ca5323c72affeab03879a25a9e0a8
parent0d559267751473a289db9e848e217e1177ec38c9 (diff)
downloadlinux-linaro-bf1123d241218002147839756bc7076af1ea3bf7.tar.gz
imx6q-sabrelite: add vpu dt support
Signed-off-by: Jason Chen <jason.chen@linaro.org>
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi3
-rw-r--r--arch/arm/mach-imx/clock-imx6q.c1
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c19
-rw-r--r--arch/arm/mach-imx/src.c16
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h1
-rw-r--r--arch/arm/plat-mxc/include/mach/mx6q.h5
-rw-r--r--drivers/mxc/vpu/mxc_vpu.c22
7 files changed, 63 insertions, 4 deletions
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 59b1ff51856..7dabaee87e0 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -203,8 +203,9 @@
};
vpu@02040000 {
+ compatible = "fsl,vpu";
reg = <0x02040000 0x3c000>;
- interrupts = <0 3 0x04 0 12 0x04>;
+ interrupts = <0 12 0x04 0 3 0x04>;
};
aipstz@0207c000 { /* AIPSTZ1 */
diff --git a/arch/arm/mach-imx/clock-imx6q.c b/arch/arm/mach-imx/clock-imx6q.c
index caf792dde9b..96e7a814741 100644
--- a/arch/arm/mach-imx/clock-imx6q.c
+++ b/arch/arm/mach-imx/clock-imx6q.c
@@ -1937,6 +1937,7 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK(NULL, "hdmi_iahb_clk", hdmi_iahb_clk),
_REGISTER_CLOCK(NULL, "ldb_di0_clk", ldb_di0_clk),
_REGISTER_CLOCK(NULL, "ldb_di1_clk", ldb_di1_clk),
+ _REGISTER_CLOCK(NULL, "vpu_clk", vpu_clk),
};
int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index af79cfc17db..5936a4c608c 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -17,6 +17,7 @@
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/dma-mapping.h>
+#include <linux/iram_alloc.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
#include <asm/mach/arch.h>
@@ -24,6 +25,7 @@
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/ipu-v3.h>
+#include <mach/mxc_vpu.h>
#include <mach/iomux-mx6q.h>
static iomux_v3_cfg_t mx6q_sabr_pads[] = {
@@ -83,9 +85,21 @@ static struct imx_ipuv3_platform_data ipuv3_pdata = {
.pg = mx6q_ipuv3_pg,
};
+static void mx6q_vpu_reset(void)
+{
+ imx_reset_vpu();
+}
+
+static struct mxc_vpu_platform_data vpu_pdata = {
+ .iram_enable = true,
+ .iram_size = 0x21000,
+ .reset = mx6q_vpu_reset,
+};
+
static const struct of_dev_auxdata imx6q_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("fsl,ipuv3", MX6Q_IPU1_BASE_ADDR, "imx-ipuv3.0", &ipuv3_pdata),
OF_DEV_AUXDATA("fsl,ipuv3", MX6Q_IPU2_BASE_ADDR, "imx-ipuv3.1", &ipuv3_pdata),
+ OF_DEV_AUXDATA("fsl,vpu", MX6Q_VPU_BASE_ADDR, "mxc_vpu.0", &vpu_pdata),
};
static void __init imx6q_init_machine(void)
@@ -125,7 +139,12 @@ static void __init imx6q_map_io(void)
imx_scu_map_io();
imx6q_clock_map_io();
+ iram_init(MX6Q_IRAM_BASE_ADDR, MX6Q_IRAM_SIZE);
+
init_consistent_dma_size(SZ_64M);
+
+ if (!system_rev)
+ system_rev = 0x63000;
}
static void __init imx6q_gpio_add_irq_domain(struct device_node *np,
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
index ac8eb58aeeb..bcc4e93acc5 100644
--- a/arch/arm/mach-imx/src.c
+++ b/arch/arm/mach-imx/src.c
@@ -28,6 +28,22 @@ static void __iomem *src_base;
#define cpu_logical_map(cpu) 0
#endif
+void imx_reset_vpu(void)
+{
+ u32 val;
+
+ /* mask interrupt due to vpu passed reset */
+ val = readl_relaxed(src_base + 0x18);
+ val |= 0x02;
+ writel_relaxed(val, src_base + 0x18);
+
+ val = readl_relaxed(src_base);
+ val |= 0x5; /* warm reset vpu */
+ writel_relaxed(val, src_base);
+ while (readl_relaxed(src_base) & 0x04)
+ ;
+}
+
void imx_reset_ipu(int ipu)
{
u32 val;
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 43490df0edd..4c282607e57 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -122,6 +122,7 @@ static inline void imx_scu_map_io(void) {}
static inline void imx_smp_prepare(void) {}
#endif
extern void imx_reset_ipu(int ipu);
+extern void imx_reset_vpu(void);
extern void imx_set_cpu_jump(int cpu, void *jump_addr);
extern void imx_src_init(void);
extern void imx_gpc_init(void);
diff --git a/arch/arm/plat-mxc/include/mach/mx6q.h b/arch/arm/plat-mxc/include/mach/mx6q.h
index 0814ad5159c..2bd3ba2c916 100644
--- a/arch/arm/plat-mxc/include/mach/mx6q.h
+++ b/arch/arm/plat-mxc/include/mach/mx6q.h
@@ -33,6 +33,11 @@
#define MX6Q_IOMUXC_BASE_ADDR 0x020e0000
#define MX6Q_IOMUXC_SIZE 0x4000
+#define MX6Q_IRAM_BASE_ADDR 0x00900000
+/* The last 4K is for cpu hotplug to workaround wdog issue*/
+#define MX6Q_IRAM_SIZE (SZ_256K - SZ_4K)
+
+#define MX6Q_VPU_BASE_ADDR 0x02040000
#define MX6Q_IPU1_BASE_ADDR 0x02400000
#define MX6Q_IPU2_BASE_ADDR 0x02800000
diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c
index c2d40bbfa1e..0f7be85e48f 100644
--- a/drivers/mxc/vpu/mxc_vpu.c
+++ b/drivers/mxc/vpu/mxc_vpu.c
@@ -19,6 +19,7 @@
* @ingroup VPU
*/
+#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
@@ -654,7 +655,10 @@ static int vpu_dev_probe(struct platform_device *pdev)
iram.end = addr + vpu_plat->iram_size - 1;
}
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vpu_regs");
+ if (pdev->dev.of_node)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ else
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vpu_regs");
if (!res) {
printk(KERN_ERR "vpu: unable to get vpu base addr\n");
return -ENODEV;
@@ -688,7 +692,10 @@ static int vpu_dev_probe(struct platform_device *pdev)
goto err_out_class;
}
- vpu_ipi_irq = platform_get_irq_byname(pdev, "vpu_ipi_irq");
+ if (pdev->dev.of_node)
+ vpu_ipi_irq = platform_get_irq(pdev, 0);
+ else
+ vpu_ipi_irq = platform_get_irq_byname(pdev, "vpu_ipi_irq");
if (vpu_ipi_irq < 0) {
printk(KERN_ERR "vpu: unable to get vpu interrupt\n");
err = -ENXIO;
@@ -700,7 +707,10 @@ static int vpu_dev_probe(struct platform_device *pdev)
goto err_out_class;
#ifdef MXC_VPU_HAS_JPU
- vpu_jpu_irq = platform_get_irq_byname(pdev, "vpu_jpu_irq");
+ if (pdev->dev.of_node)
+ vpu_jpu_irq = platform_get_irq(pdev, 1);
+ else
+ vpu_jpu_irq = platform_get_irq_byname(pdev, "vpu_jpu_irq");
if (vpu_jpu_irq < 0) {
printk(KERN_ERR "vpu: unable to get vpu jpu interrupt\n");
err = -ENXIO;
@@ -873,12 +883,18 @@ recover_clk:
#define vpu_resume NULL
#endif /* !CONFIG_PM */
+static const struct of_device_id mxc_vpu_dt_ids[] = {
+ { .compatible = "fsl,vpu", },
+ { /* sentinel */ }
+};
+
/*! Driver definition
*
*/
static struct platform_driver mxcvpu_driver = {
.driver = {
.name = "mxc_vpu",
+ .of_match_table = mxc_vpu_dt_ids,
},
.probe = vpu_dev_probe,
.remove = vpu_dev_remove,