aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig3
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-mipi_csi2.c49
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx6q.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/ipu-v3.h1
-rw-r--r--arch/arm/plat-mxc/include/mach/mipi_csi2.h108
-rw-r--r--arch/arm/plat-mxc/include/mach/mx6.h1
8 files changed, 174 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 3df688f3541..60c42ef46d2 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -157,3 +157,6 @@ config IMX_HAVE_PLATFORM_IMX_ASRC
config IMX_HAVE_PLATFORM_IMX_MIPI_DSI
bool
+
+config IMX_HAVE_PLATFORM_IMX_MIPI_CSI2
+ bool
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 360b5a3a0c4..aa7d7bf4930 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -57,3 +57,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_HDMI) += platform-imx-hdmi-soc.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_HDMI) += platform-imx-hdmi-soc-dai.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_ASRC) += platform-imx-asrc.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_MIPI_DSI) += platform-imx-mipi_dsi.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_MIPI_CSI2) += platform-imx-mipi_csi2.o
diff --git a/arch/arm/plat-mxc/devices/platform-imx-mipi_csi2.c b/arch/arm/plat-mxc/devices/platform-imx-mipi_csi2.c
new file mode 100644
index 00000000000..ed8a2fbd74e
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx-mipi_csi2.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * 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.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_mipi_csi2_data_entry_single(soc, _id, size) \
+{ \
+ .id = _id, \
+ .iobase = soc ## _MIPI_CSI2_BASE_ADDR, \
+ .iosize = size, \
+}
+
+#ifdef CONFIG_SOC_IMX6Q
+const struct imx_mipi_csi2_data imx6q_mipi_csi2_data __initconst =
+ imx_mipi_csi2_data_entry_single(MX6Q, 0, SZ_4K);
+#endif
+
+struct platform_device *__init imx_add_mipi_csi2(
+ const struct imx_mipi_csi2_data *data,
+ const struct mipi_csi2_platform_data *pdata) {
+ struct resource res[] = {
+ {
+ .start = data->iobase,
+ .end = data->iobase + data->iosize - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ };
+
+ return imx_add_platform_device("mxc_mipi_csi2", -1,
+ res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
+}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 18738960a91..339018118d0 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -592,3 +592,13 @@ struct imx_mipi_dsi_data {
struct platform_device *__init imx_add_mipi_dsi(
const struct imx_mipi_dsi_data *data,
const struct mipi_dsi_platform_data *pdata);
+
+#include <mach/mipi_csi2.h>
+struct imx_mipi_csi2_data {
+ int id;
+ resource_size_t iobase;
+ resource_size_t iosize;
+};
+struct platform_device *__init imx_add_mipi_csi2(
+ const struct imx_mipi_csi2_data *data,
+ const struct mipi_csi2_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx6q.h b/arch/arm/plat-mxc/include/mach/iomux-mx6q.h
index 15f12b4b2d2..a1c53aa8d62 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx6q.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx6q.h
@@ -6102,7 +6102,7 @@ typedef enum iomux_config {
#define MX6Q_PAD_CSI0_MCLK__PCIE_CTRL_DIAG_STATUS_BUS_MUX_13 \
(_MX6Q_PAD_CSI0_MCLK__PCIE_CTRL_DIAG_STATUS_BUS_MUX_13 | MUX_PAD_CTRL(NO_PAD_CTRL))
#define MX6Q_PAD_CSI0_MCLK__CCM_CLKO \
- (_MX6Q_PAD_CSI0_MCLK__CCM_CLKO | MUX_PAD_CTRL(NO_PAD_CTRL))
+ (_MX6Q_PAD_CSI0_MCLK__CCM_CLKO | MUX_PAD_CTRL(MX6Q_CCM_CLK0_PAD_CTRL))
#define MX6Q_PAD_CSI0_MCLK__SDMA_DEBUG_PC_1 \
(_MX6Q_PAD_CSI0_MCLK__SDMA_DEBUG_PC_1 | MUX_PAD_CTRL(NO_PAD_CTRL))
#define MX6Q_PAD_CSI0_MCLK__GPIO_5_19 \
diff --git a/arch/arm/plat-mxc/include/mach/ipu-v3.h b/arch/arm/plat-mxc/include/mach/ipu-v3.h
index 0816ae9b4c4..480b4ea338e 100644
--- a/arch/arm/plat-mxc/include/mach/ipu-v3.h
+++ b/arch/arm/plat-mxc/include/mach/ipu-v3.h
@@ -125,6 +125,7 @@ typedef union {
struct {
uint32_t csi;
uint32_t mipi_id;
+ uint32_t mipi_vc;
bool mipi_en;
bool interlaced;
} csi_mem;
diff --git a/arch/arm/plat-mxc/include/mach/mipi_csi2.h b/arch/arm/plat-mxc/include/mach/mipi_csi2.h
new file mode 100644
index 00000000000..b2660836c29
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mipi_csi2.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __INCLUDE_MIPI_CSI2_H
+#define __INCLUDE_MIPI_CSI2_H
+
+/* mipi csi2 register */
+#define CSI2_VERSION 0x000
+#define CSI2_N_LANES (0x004/4)
+#define CSI2_PHY_SHUTDOWNZ (0x008/4)
+#define CSI2_DPHY_RSTZ (0x00c/4)
+#define CSI2_RESETN (0x010/4)
+#define CSI2_PHY_STATE (0x014/4)
+#define CSI2_DATA_IDS_1 (0x018/4)
+#define CSI2_DATA_IDS_2 (0x01c/4)
+#define CSI2_ERR1 (0x020/4)
+#define CSI2_ERR2 (0x024/4)
+#define CSI2_MSK1 (0x028/4)
+#define CSI2_MSK2 (0x02c/4)
+#define CSI2_PHY_TST_CTRL0 (0x030/4)
+#define CSI2_PHY_TST_CTRL1 (0x034/4)
+#define CSI2_SFT_RESET (0xf00/4)
+
+/* mipi data type */
+#define MIPI_DT_YUV422 0x1e
+#define MIPI_DT_RGB444 0x20
+#define MIPI_DT_RGB555 0x21
+#define MIPI_DT_RGB565 0x22
+#define MIPI_DT_RGB888 0x24
+#define MIPI_DT_RAW8 0x2a
+#define MIPI_DT_RAW10 0x2b
+
+
+struct mipi_csi2_info;
+/* mipi csi2 API */
+struct mipi_csi2_info *mipi_csi2_get_info(void);
+
+int mipi_csi2_get_bind_ipu(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_get_bind_csi(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_get_virtual_channel(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_set_lanes(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_set_datatype(struct mipi_csi2_info *info,
+ unsigned int datatype);
+
+unsigned int mipi_csi2_get_datatype(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_dphy_status(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_get_error1(struct mipi_csi2_info *info);
+
+unsigned int mipi_csi2_get_error2(struct mipi_csi2_info *info);
+
+int mipi_csi2_pixelclk_enable(struct mipi_csi2_info *info);
+
+void mipi_csi2_pixelclk_disable(struct mipi_csi2_info *info);
+
+int mipi_csi2_reset(struct mipi_csi2_info *info);
+
+/**
+ * struct mipi_csi2_platform_data - MIPI CSI2 driver platform data.
+ *
+ * This structure communicates platform-specific information to the
+ * MIPI CSI2 driver that can't be expressed as resources.
+ *
+ * @ipu_id: the id of IPUs on which this MIPI CSI2 works
+ *
+ * @csi_id: the id of IPU CSI interfaces
+ *
+ * @v_channel: mipi virtual channel num
+ *
+ * @lanes: mipi lanes
+ *
+ * @init: A pointer to a function the driver will call to
+ * initialize the platform (e.g., set up the pin mux).
+ * @exit: A pointer to a function the driver will call to
+ * exit the platform (e.g., free pins).
+ */
+struct mipi_csi2_platform_data {
+ int ipu_id;
+ unsigned int csi_id;
+ unsigned int v_channel;
+ unsigned int lanes;
+ char *dphy_clk;
+ char *pixel_clk;
+ int (*init)(struct platform_device *);
+ void (*exit)(struct platform_device *);
+};
+
+#endif
diff --git a/arch/arm/plat-mxc/include/mach/mx6.h b/arch/arm/plat-mxc/include/mach/mx6.h
index 81c90e75b66..5100add84d0 100644
--- a/arch/arm/plat-mxc/include/mach/mx6.h
+++ b/arch/arm/plat-mxc/include/mach/mx6.h
@@ -249,6 +249,7 @@
#define MX6Q_UART4_BASE_ADDR UART4_BASE_ADDR
#define MX6Q_FEC_BASE_ADDR ENET_BASE_ADDR
#define MX6Q_MIPI_DSI_BASE_ADDR MIPI_DSI_BASE_ADDR
+#define MX6Q_MIPI_CSI2_BASE_ADDR MIPI_CSI2_BASE_ADDR
/* define virtual address */
#define PERIPBASE_VIRT 0xF2000000