aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Chen <jason.chen@linaro.org>2012-01-13 10:53:16 +0800
committerEric Miao <eric.miao@linaro.org>2012-01-13 14:49:58 +0800
commit87fce0dcb864fa943c19d9ec8ae7c42f5826772c (patch)
tree302f979d5ac3f0b62cc202545f375cf0d9359281
parentdce3069d947b6b3bf8af4ad5201438b6da51ff2d (diff)
downloadlinux-linaro-topic/lt-3.2-imx6-display.tar.gz
imx: ipu3: add hwtyp supporttopic/lt-3.2-imx6-display
Signed-off-by: Jason Chen <jason.chen@linaro.org>
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c4
-rw-r--r--drivers/mxc/ipu3/ipu_common.c39
-rw-r--r--drivers/mxc/ipu3/ipu_prv.h1
3 files changed, 35 insertions, 9 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 377a5ba27db..0bb8cd25385 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -119,8 +119,8 @@ static struct mxc_vpu_platform_data vpu_pdata = {
};
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,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),
};
diff --git a/drivers/mxc/ipu3/ipu_common.c b/drivers/mxc/ipu3/ipu_common.c
index 24c0f8a05c0..0a595d67732 100644
--- a/drivers/mxc/ipu3/ipu_common.c
+++ b/drivers/mxc/ipu3/ipu_common.c
@@ -30,6 +30,7 @@
#include <linux/irq.h>
#include <linux/irqdesc.h>
#include <linux/clk.h>
+#include <linux/of_device.h>
#include <mach/clock.h>
#include <mach/hardware.h>
#include <mach/ipu-v3.h>
@@ -45,6 +46,29 @@ static struct ipu_soc ipu_array[MXC_IPU_MAX_NUM];
static int ipu_idx;
int g_ipu_hw_rev;
+enum mxc_ipu_hwtype {
+ IMX5_IPU,
+ IMX6_IPU,
+};
+
+static struct platform_device_id mxc_ipu_devtype[] = {
+ {
+ .name = "imx5-ipu",
+ .driver_data = IMX5_IPU,
+ }, {
+ .name = "imx6-ipu",
+ .driver_data = IMX6_IPU,
+ }, {
+ /* sentinel */
+ }
+};
+
+static const struct of_device_id mxc_ipu_dt_ids[] = {
+ { .compatible = "fsl,imx5-ipu", .data = &mxc_ipu_devtype[IMX5_IPU], },
+ { .compatible = "fsl,imx6q-ipu", .data = &mxc_ipu_devtype[IMX6_IPU], },
+ { /* sentinel */ }
+};
+
/* Static functions */
static irqreturn_t ipu_irq_handler(int irq, void *desc);
@@ -377,6 +401,8 @@ void _ipu_put(struct ipu_soc *ipu)
static int __devinit ipu_probe(struct platform_device *pdev)
{
struct imx_ipuv3_platform_data *plat_data = pdev->dev.platform_data;
+ const struct of_device_id *of_id =
+ of_match_device(mxc_ipu_dt_ids, &pdev->dev);
struct ipu_soc *ipu;
struct resource *res;
unsigned long ipu_base;
@@ -391,6 +417,10 @@ static int __devinit ipu_probe(struct platform_device *pdev)
ipu = &ipu_array[pdev->id];
memset(ipu, 0, sizeof(struct ipu_soc));
+ if (of_id)
+ pdev->id_entry = of_id->data;
+ ipu->hwtype = pdev->id_entry->driver_data;
+
spin_lock_init(&ipu->spin_lock);
mutex_init(&ipu->mutex_lock);
atomic_set(&ipu->ipu_use_count, 0);
@@ -1253,7 +1283,7 @@ int32_t ipu_init_channel_buffer(struct ipu_soc *ipu, ipu_channel_t channel,
if (idma_is_set(ipu, IDMAC_CHA_PRI, dma_chan)) {
unsigned reg = IDMAC_CH_LOCK_EN_1;
uint32_t value = 0;
- if (cpu_is_mx53() || cpu_is_mx6q()) {
+ if (ipu->hwtype == IMX5_IPU || ipu->hwtype == IMX6_IPU) {
_ipu_ch_param_set_axi_id(ipu, dma_chan, 0);
switch (dma_chan) {
case 5:
@@ -1321,7 +1351,7 @@ int32_t ipu_init_channel_buffer(struct ipu_soc *ipu, ipu_channel_t channel,
} else
_ipu_ch_param_set_axi_id(ipu, dma_chan, 1);
} else {
- if (cpu_is_mx6q())
+ if (ipu->hwtype == IMX6_IPU)
_ipu_ch_param_set_axi_id(ipu, dma_chan, 1);
}
@@ -2940,11 +2970,6 @@ static const struct dev_pm_ops mxcipu_pm_ops = {
.resume_noirq = ipu_resume_noirq,
};
-static const struct of_device_id mxc_ipu_dt_ids[] = {
- { .compatible = "fsl,ipuv3", },
- { /* sentinel */ }
-};
-
/*!
* This structure contains pointers to the power management callback functions.
*/
diff --git a/drivers/mxc/ipu3/ipu_prv.h b/drivers/mxc/ipu3/ipu_prv.h
index 42060c954a1..7b245a5e197 100644
--- a/drivers/mxc/ipu3/ipu_prv.h
+++ b/drivers/mxc/ipu3/ipu_prv.h
@@ -51,6 +51,7 @@ enum csc_type_t {
};
struct ipu_soc {
+ u8 hwtype;
bool online;
/*clk*/