diff options
| author | Dave Airlie <airlied@redhat.com> | 2014-06-10 20:13:58 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2014-06-10 20:13:58 -0400 |
| commit | c1a6e9fe82b46159af8cc4cf34fb51ee47862f05 (patch) | |
| tree | 9ef7fc8fa3483dc7dc92034162118526a5d4377a | |
| parent | b06c47a13c52cec01902d0094fdd7f78f4d54152 (diff) | |
| parent | d6ca8ca7ec555bdd3372687d0d775c837a09ff6e (diff) | |
Merge branch 'topic/ipu-destaging' of git://git.pengutronix.de/git/pza/linux into drm-next
Destage IPUv3
* 'topic/ipu-destaging' of git://git.pengutronix.de/git/pza/linux:
gpu: ipu-v3: Register the CSI modules
gpu: ipu-v3: Add CSI and SMFC module enable wrappers
gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
gpu: ipu-v3: Add SMFC code
gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging
| -rw-r--r-- | drivers/gpu/Makefile | 1 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/Kconfig | 7 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/Makefile (renamed from drivers/staging/imx-drm/ipu-v3/Makefile) | 4 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-common.c (renamed from drivers/staging/imx-drm/ipu-v3/ipu-common.c) | 82 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-dc.c (renamed from drivers/staging/imx-drm/ipu-v3/ipu-dc.c) | 3 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-di.c (renamed from drivers/staging/imx-drm/ipu-v3/ipu-di.c) | 2 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-dmfc.c (renamed from drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c) | 2 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-dp.c (renamed from drivers/staging/imx-drm/ipu-v3/ipu-dp.c) | 2 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-prv.h (renamed from drivers/staging/imx-drm/ipu-v3/ipu-prv.h) | 8 | ||||
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-smfc.c | 97 | ||||
| -rw-r--r-- | drivers/staging/imx-drm/Kconfig | 11 | ||||
| -rw-r--r-- | drivers/staging/imx-drm/Makefile | 1 | ||||
| -rw-r--r-- | drivers/staging/imx-drm/imx-hdmi.c | 2 | ||||
| -rw-r--r-- | drivers/staging/imx-drm/imx-tve.c | 2 | ||||
| -rw-r--r-- | drivers/staging/imx-drm/ipuv3-crtc.c | 2 | ||||
| -rw-r--r-- | drivers/staging/imx-drm/ipuv3-plane.c | 2 | ||||
| -rw-r--r-- | drivers/video/Kconfig | 1 | ||||
| -rw-r--r-- | include/video/imx-ipu-v3.h (renamed from drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h) | 16 |
18 files changed, 216 insertions, 29 deletions
diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile index d8a22c2a579d..70da9eb52a42 100644 --- a/drivers/gpu/Makefile +++ b/drivers/gpu/Makefile | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | obj-y += drm/ vga/ | 1 | obj-y += drm/ vga/ |
| 2 | obj-$(CONFIG_TEGRA_HOST1X) += host1x/ | 2 | obj-$(CONFIG_TEGRA_HOST1X) += host1x/ |
| 3 | obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/ | ||
diff --git a/drivers/gpu/ipu-v3/Kconfig b/drivers/gpu/ipu-v3/Kconfig new file mode 100644 index 000000000000..2f228a2f2a48 --- /dev/null +++ b/drivers/gpu/ipu-v3/Kconfig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | config IMX_IPUV3_CORE | ||
| 2 | tristate "IPUv3 core support" | ||
| 3 | depends on SOC_IMX5 || SOC_IMX6Q || SOC_IMX6SL || ARCH_MULTIPLATFORM | ||
| 4 | depends on RESET_CONTROLLER | ||
| 5 | help | ||
| 6 | Choose this if you have a i.MX5/6 system and want to use the Image | ||
| 7 | Processing Unit. This option only enables IPU base support. | ||
diff --git a/drivers/staging/imx-drm/ipu-v3/Makefile b/drivers/gpu/ipu-v3/Makefile index 28ed72e98a96..1887972b4ac2 100644 --- a/drivers/staging/imx-drm/ipu-v3/Makefile +++ b/drivers/gpu/ipu-v3/Makefile | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += imx-ipu-v3.o | 1 | obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o |
| 2 | 2 | ||
| 3 | imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o | 3 | imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o ipu-smfc.o |
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c index ca85d3d70ae3..719788ce7d9f 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c +++ b/drivers/gpu/ipu-v3/ipu-common.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | #include <drm/drm_fourcc.h> | 32 | #include <drm/drm_fourcc.h> |
| 33 | 33 | ||
| 34 | #include "imx-ipu-v3.h" | 34 | #include <video/imx-ipu-v3.h> |
| 35 | #include "ipu-prv.h" | 35 | #include "ipu-prv.h" |
| 36 | 36 | ||
| 37 | static inline u32 ipu_cm_read(struct ipu_soc *ipu, unsigned offset) | 37 | static inline u32 ipu_cm_read(struct ipu_soc *ipu, unsigned offset) |
| @@ -661,6 +661,39 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask) | |||
| 661 | } | 661 | } |
| 662 | EXPORT_SYMBOL_GPL(ipu_module_disable); | 662 | EXPORT_SYMBOL_GPL(ipu_module_disable); |
| 663 | 663 | ||
| 664 | int ipu_csi_enable(struct ipu_soc *ipu, int csi) | ||
| 665 | { | ||
| 666 | return ipu_module_enable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN); | ||
| 667 | } | ||
| 668 | EXPORT_SYMBOL_GPL(ipu_csi_enable); | ||
| 669 | |||
| 670 | int ipu_csi_disable(struct ipu_soc *ipu, int csi) | ||
| 671 | { | ||
| 672 | return ipu_module_disable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN); | ||
| 673 | } | ||
| 674 | EXPORT_SYMBOL_GPL(ipu_csi_disable); | ||
| 675 | |||
| 676 | int ipu_smfc_enable(struct ipu_soc *ipu) | ||
| 677 | { | ||
| 678 | return ipu_module_enable(ipu, IPU_CONF_SMFC_EN); | ||
| 679 | } | ||
| 680 | EXPORT_SYMBOL_GPL(ipu_smfc_enable); | ||
| 681 | |||
| 682 | int ipu_smfc_disable(struct ipu_soc *ipu) | ||
| 683 | { | ||
| 684 | return ipu_module_disable(ipu, IPU_CONF_SMFC_EN); | ||
| 685 | } | ||
| 686 | EXPORT_SYMBOL_GPL(ipu_smfc_disable); | ||
| 687 | |||
| 688 | int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel) | ||
| 689 | { | ||
| 690 | struct ipu_soc *ipu = channel->ipu; | ||
| 691 | unsigned int chno = channel->num; | ||
| 692 | |||
| 693 | return (ipu_cm_read(ipu, IPU_CHA_CUR_BUF(chno)) & idma_mask(chno)) ? 1 : 0; | ||
| 694 | } | ||
| 695 | EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer); | ||
| 696 | |||
| 664 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num) | 697 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num) |
| 665 | { | 698 | { |
| 666 | struct ipu_soc *ipu = channel->ipu; | 699 | struct ipu_soc *ipu = channel->ipu; |
| @@ -874,8 +907,17 @@ static int ipu_submodules_init(struct ipu_soc *ipu, | |||
| 874 | goto err_dp; | 907 | goto err_dp; |
| 875 | } | 908 | } |
| 876 | 909 | ||
| 910 | ret = ipu_smfc_init(ipu, dev, ipu_base + | ||
| 911 | devtype->cm_ofs + IPU_CM_SMFC_REG_OFS); | ||
| 912 | if (ret) { | ||
| 913 | unit = "smfc"; | ||
| 914 | goto err_smfc; | ||
| 915 | } | ||
| 916 | |||
| 877 | return 0; | 917 | return 0; |
| 878 | 918 | ||
| 919 | err_smfc: | ||
| 920 | ipu_dp_exit(ipu); | ||
| 879 | err_dp: | 921 | err_dp: |
| 880 | ipu_dmfc_exit(ipu); | 922 | ipu_dmfc_exit(ipu); |
| 881 | err_dmfc: | 923 | err_dmfc: |
| @@ -947,6 +989,7 @@ EXPORT_SYMBOL_GPL(ipu_idmac_channel_irq); | |||
| 947 | 989 | ||
| 948 | static void ipu_submodules_exit(struct ipu_soc *ipu) | 990 | static void ipu_submodules_exit(struct ipu_soc *ipu) |
| 949 | { | 991 | { |
| 992 | ipu_smfc_exit(ipu); | ||
| 950 | ipu_dp_exit(ipu); | 993 | ipu_dp_exit(ipu); |
| 951 | ipu_dmfc_exit(ipu); | 994 | ipu_dmfc_exit(ipu); |
| 952 | ipu_dc_exit(ipu); | 995 | ipu_dc_exit(ipu); |
| @@ -971,6 +1014,7 @@ static void platform_device_unregister_children(struct platform_device *pdev) | |||
| 971 | struct ipu_platform_reg { | 1014 | struct ipu_platform_reg { |
| 972 | struct ipu_client_platformdata pdata; | 1015 | struct ipu_client_platformdata pdata; |
| 973 | const char *name; | 1016 | const char *name; |
| 1017 | int reg_offset; | ||
| 974 | }; | 1018 | }; |
| 975 | 1019 | ||
| 976 | static const struct ipu_platform_reg client_reg[] = { | 1020 | static const struct ipu_platform_reg client_reg[] = { |
| @@ -992,13 +1036,29 @@ static const struct ipu_platform_reg client_reg[] = { | |||
| 992 | .dma[1] = -EINVAL, | 1036 | .dma[1] = -EINVAL, |
| 993 | }, | 1037 | }, |
| 994 | .name = "imx-ipuv3-crtc", | 1038 | .name = "imx-ipuv3-crtc", |
| 1039 | }, { | ||
| 1040 | .pdata = { | ||
| 1041 | .csi = 0, | ||
| 1042 | .dma[0] = IPUV3_CHANNEL_CSI0, | ||
| 1043 | .dma[1] = -EINVAL, | ||
| 1044 | }, | ||
| 1045 | .reg_offset = IPU_CM_CSI0_REG_OFS, | ||
| 1046 | .name = "imx-ipuv3-camera", | ||
| 1047 | }, { | ||
| 1048 | .pdata = { | ||
| 1049 | .csi = 1, | ||
| 1050 | .dma[0] = IPUV3_CHANNEL_CSI1, | ||
| 1051 | .dma[1] = -EINVAL, | ||
| 1052 | }, | ||
| 1053 | .reg_offset = IPU_CM_CSI1_REG_OFS, | ||
| 1054 | .name = "imx-ipuv3-camera", | ||
| 995 | }, | 1055 | }, |
| 996 | }; | 1056 | }; |
| 997 | 1057 | ||
| 998 | static DEFINE_MUTEX(ipu_client_id_mutex); | 1058 | static DEFINE_MUTEX(ipu_client_id_mutex); |
| 999 | static int ipu_client_id; | 1059 | static int ipu_client_id; |
| 1000 | 1060 | ||
| 1001 | static int ipu_add_client_devices(struct ipu_soc *ipu) | 1061 | static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
| 1002 | { | 1062 | { |
| 1003 | struct device *dev = ipu->dev; | 1063 | struct device *dev = ipu->dev; |
| 1004 | unsigned i; | 1064 | unsigned i; |
| @@ -1012,9 +1072,19 @@ static int ipu_add_client_devices(struct ipu_soc *ipu) | |||
| 1012 | for (i = 0; i < ARRAY_SIZE(client_reg); i++) { | 1072 | for (i = 0; i < ARRAY_SIZE(client_reg); i++) { |
| 1013 | const struct ipu_platform_reg *reg = &client_reg[i]; | 1073 | const struct ipu_platform_reg *reg = &client_reg[i]; |
| 1014 | struct platform_device *pdev; | 1074 | struct platform_device *pdev; |
| 1015 | 1075 | struct resource res; | |
| 1016 | pdev = platform_device_register_data(dev, reg->name, | 1076 | |
| 1017 | id++, ®->pdata, sizeof(reg->pdata)); | 1077 | if (reg->reg_offset) { |
| 1078 | memset(&res, 0, sizeof(res)); | ||
| 1079 | res.flags = IORESOURCE_MEM; | ||
| 1080 | res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset; | ||
| 1081 | res.end = res.start + PAGE_SIZE - 1; | ||
| 1082 | pdev = platform_device_register_resndata(dev, reg->name, | ||
| 1083 | id++, &res, 1, ®->pdata, sizeof(reg->pdata)); | ||
| 1084 | } else { | ||
| 1085 | pdev = platform_device_register_data(dev, reg->name, | ||
| 1086 | id++, ®->pdata, sizeof(reg->pdata)); | ||
| 1087 | } | ||
| 1018 | 1088 | ||
| 1019 | if (IS_ERR(pdev)) | 1089 | if (IS_ERR(pdev)) |
| 1020 | goto err_register; | 1090 | goto err_register; |
| @@ -1210,7 +1280,7 @@ static int ipu_probe(struct platform_device *pdev) | |||
| 1210 | if (ret) | 1280 | if (ret) |
| 1211 | goto failed_submodules_init; | 1281 | goto failed_submodules_init; |
| 1212 | 1282 | ||
| 1213 | ret = ipu_add_client_devices(ipu); | 1283 | ret = ipu_add_client_devices(ipu, ipu_base); |
| 1214 | if (ret) { | 1284 | if (ret) { |
| 1215 | dev_err(&pdev->dev, "adding client devices failed with %d\n", | 1285 | dev_err(&pdev->dev, "adding client devices failed with %d\n", |
| 1216 | ret); | 1286 | ret); |
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c b/drivers/gpu/ipu-v3/ipu-dc.c index d5de8bb5c803..9f1e5efa3acf 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c +++ b/drivers/gpu/ipu-v3/ipu-dc.c | |||
| @@ -20,8 +20,7 @@ | |||
| 20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
| 21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
| 22 | 22 | ||
| 23 | #include "../imx-drm.h" | 23 | #include <video/imx-ipu-v3.h> |
| 24 | #include "imx-ipu-v3.h" | ||
| 25 | #include "ipu-prv.h" | 24 | #include "ipu-prv.h" |
| 26 | 25 | ||
| 27 | #define DC_MAP_CONF_PTR(n) (0x108 + ((n) & ~0x1) * 2) | 26 | #define DC_MAP_CONF_PTR(n) (0x108 + ((n) & ~0x1) * 2) |
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index 82a9ebad697c..42e60b447ae7 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
| 21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
| 22 | 22 | ||
| 23 | #include "imx-ipu-v3.h" | 23 | #include <video/imx-ipu-v3.h> |
| 24 | #include "ipu-prv.h" | 24 | #include "ipu-prv.h" |
| 25 | 25 | ||
| 26 | struct ipu_di { | 26 | struct ipu_di { |
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c b/drivers/gpu/ipu-v3/ipu-dmfc.c index 45213017fa4b..e1493ab36ca2 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c +++ b/drivers/gpu/ipu-v3/ipu-dmfc.c | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
| 18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
| 19 | 19 | ||
| 20 | #include "imx-ipu-v3.h" | 20 | #include <video/imx-ipu-v3.h> |
| 21 | #include "ipu-prv.h" | 21 | #include "ipu-prv.h" |
| 22 | 22 | ||
| 23 | #define DMFC_RD_CHAN 0x0000 | 23 | #define DMFC_RD_CHAN 0x0000 |
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dp.c b/drivers/gpu/ipu-v3/ipu-dp.c index 58f87c8d7c07..e17fa3f7c4b6 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-dp.c +++ b/drivers/gpu/ipu-v3/ipu-dp.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
| 20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
| 21 | 21 | ||
| 22 | #include "imx-ipu-v3.h" | 22 | #include <video/imx-ipu-v3.h> |
| 23 | #include "ipu-prv.h" | 23 | #include "ipu-prv.h" |
| 24 | 24 | ||
| 25 | #define DP_SYNC 0 | 25 | #define DP_SYNC 0 |
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h b/drivers/gpu/ipu-v3/ipu-prv.h index 4df00501adc2..acf181183f0b 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h +++ b/drivers/gpu/ipu-v3/ipu-prv.h | |||
| @@ -22,7 +22,7 @@ struct ipu_soc; | |||
| 22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
| 23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
| 24 | 24 | ||
| 25 | #include "imx-ipu-v3.h" | 25 | #include <video/imx-ipu-v3.h> |
| 26 | 26 | ||
| 27 | #define IPUV3_CHANNEL_CSI0 0 | 27 | #define IPUV3_CHANNEL_CSI0 0 |
| 28 | #define IPUV3_CHANNEL_CSI1 1 | 28 | #define IPUV3_CHANNEL_CSI1 1 |
| @@ -151,6 +151,8 @@ struct ipuv3_channel { | |||
| 151 | struct ipu_dc_priv; | 151 | struct ipu_dc_priv; |
| 152 | struct ipu_dmfc_priv; | 152 | struct ipu_dmfc_priv; |
| 153 | struct ipu_di; | 153 | struct ipu_di; |
| 154 | struct ipu_smfc_priv; | ||
| 155 | |||
| 154 | struct ipu_devtype; | 156 | struct ipu_devtype; |
| 155 | 157 | ||
| 156 | struct ipu_soc { | 158 | struct ipu_soc { |
| @@ -178,6 +180,7 @@ struct ipu_soc { | |||
| 178 | struct ipu_dp_priv *dp_priv; | 180 | struct ipu_dp_priv *dp_priv; |
| 179 | struct ipu_dmfc_priv *dmfc_priv; | 181 | struct ipu_dmfc_priv *dmfc_priv; |
| 180 | struct ipu_di *di_priv[2]; | 182 | struct ipu_di *di_priv[2]; |
| 183 | struct ipu_smfc_priv *smfc_priv; | ||
| 181 | }; | 184 | }; |
| 182 | 185 | ||
| 183 | void ipu_srm_dp_sync_update(struct ipu_soc *ipu); | 186 | void ipu_srm_dp_sync_update(struct ipu_soc *ipu); |
| @@ -203,4 +206,7 @@ void ipu_dc_exit(struct ipu_soc *ipu); | |||
| 203 | int ipu_cpmem_init(struct ipu_soc *ipu, struct device *dev, unsigned long base); | 206 | int ipu_cpmem_init(struct ipu_soc *ipu, struct device *dev, unsigned long base); |
| 204 | void ipu_cpmem_exit(struct ipu_soc *ipu); | 207 | void ipu_cpmem_exit(struct ipu_soc *ipu); |
| 205 | 208 | ||
| 209 | int ipu_smfc_init(struct ipu_soc *ipu, struct device *dev, unsigned long base); | ||
| 210 | void ipu_smfc_exit(struct ipu_soc *ipu); | ||
| 211 | |||
| 206 | #endif /* __IPU_PRV_H__ */ | 212 | #endif /* __IPU_PRV_H__ */ |
diff --git a/drivers/gpu/ipu-v3/ipu-smfc.c b/drivers/gpu/ipu-v3/ipu-smfc.c new file mode 100644 index 000000000000..e4f85ad286fc --- /dev/null +++ b/drivers/gpu/ipu-v3/ipu-smfc.c | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 3 | * | ||
| 4 | * The code contained herein is licensed under the GNU General Public | ||
| 5 | * License. You may obtain a copy of the GNU General Public License | ||
| 6 | * Version 2 or later at the following locations: | ||
| 7 | * | ||
| 8 | * http://www.opensource.org/licenses/gpl-license.html | ||
| 9 | * http://www.gnu.org/copyleft/gpl.html | ||
| 10 | */ | ||
| 11 | #define DEBUG | ||
| 12 | #include <linux/export.h> | ||
| 13 | #include <linux/types.h> | ||
| 14 | #include <linux/init.h> | ||
| 15 | #include <linux/io.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | #include <linux/spinlock.h> | ||
| 18 | #include <linux/delay.h> | ||
| 19 | #include <linux/clk.h> | ||
| 20 | #include <video/imx-ipu-v3.h> | ||
| 21 | |||
| 22 | #include "ipu-prv.h" | ||
| 23 | |||
| 24 | struct ipu_smfc_priv { | ||
| 25 | void __iomem *base; | ||
| 26 | spinlock_t lock; | ||
| 27 | }; | ||
| 28 | |||
| 29 | /*SMFC Registers */ | ||
| 30 | #define SMFC_MAP 0x0000 | ||
| 31 | #define SMFC_WMC 0x0004 | ||
| 32 | #define SMFC_BS 0x0008 | ||
| 33 | |||
| 34 | int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize) | ||
| 35 | { | ||
| 36 | struct ipu_smfc_priv *smfc = ipu->smfc_priv; | ||
| 37 | unsigned long flags; | ||
| 38 | u32 val, shift; | ||
| 39 | |||
| 40 | spin_lock_irqsave(&smfc->lock, flags); | ||
| 41 | |||
| 42 | shift = channel * 4; | ||
| 43 | val = readl(smfc->base + SMFC_BS); | ||
| 44 | val &= ~(0xf << shift); | ||
| 45 | val |= burstsize << shift; | ||
| 46 | writel(val, smfc->base + SMFC_BS); | ||
| 47 | |||
| 48 | spin_unlock_irqrestore(&smfc->lock, flags); | ||
| 49 | |||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | EXPORT_SYMBOL_GPL(ipu_smfc_set_burstsize); | ||
| 53 | |||
| 54 | int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id) | ||
| 55 | { | ||
| 56 | struct ipu_smfc_priv *smfc = ipu->smfc_priv; | ||
| 57 | unsigned long flags; | ||
| 58 | u32 val, shift; | ||
| 59 | |||
| 60 | spin_lock_irqsave(&smfc->lock, flags); | ||
| 61 | |||
| 62 | shift = channel * 3; | ||
| 63 | val = readl(smfc->base + SMFC_MAP); | ||
| 64 | val &= ~(0x7 << shift); | ||
| 65 | val |= ((csi_id << 2) | mipi_id) << shift; | ||
| 66 | writel(val, smfc->base + SMFC_MAP); | ||
| 67 | |||
| 68 | spin_unlock_irqrestore(&smfc->lock, flags); | ||
| 69 | |||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | EXPORT_SYMBOL_GPL(ipu_smfc_map_channel); | ||
| 73 | |||
| 74 | int ipu_smfc_init(struct ipu_soc *ipu, struct device *dev, | ||
| 75 | unsigned long base) | ||
| 76 | { | ||
| 77 | struct ipu_smfc_priv *smfc; | ||
| 78 | |||
| 79 | smfc = devm_kzalloc(dev, sizeof(*smfc), GFP_KERNEL); | ||
| 80 | if (!smfc) | ||
| 81 | return -ENOMEM; | ||
| 82 | |||
| 83 | ipu->smfc_priv = smfc; | ||
| 84 | spin_lock_init(&smfc->lock); | ||
| 85 | |||
| 86 | smfc->base = devm_ioremap(dev, base, PAGE_SIZE); | ||
| 87 | if (!smfc->base) | ||
| 88 | return -ENOMEM; | ||
| 89 | |||
| 90 | pr_debug("%s: ioremap 0x%08lx -> %p\n", __func__, base, smfc->base); | ||
| 91 | |||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | void ipu_smfc_exit(struct ipu_soc *ipu) | ||
| 96 | { | ||
| 97 | } | ||
diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/staging/imx-drm/Kconfig index c6e8ba7b3e4e..82fb758a29bc 100644 --- a/drivers/staging/imx-drm/Kconfig +++ b/drivers/staging/imx-drm/Kconfig | |||
| @@ -39,19 +39,10 @@ config DRM_IMX_LDB | |||
| 39 | Choose this to enable the internal LVDS Display Bridge (LDB) | 39 | Choose this to enable the internal LVDS Display Bridge (LDB) |
| 40 | found on i.MX53 and i.MX6 processors. | 40 | found on i.MX53 and i.MX6 processors. |
| 41 | 41 | ||
| 42 | config DRM_IMX_IPUV3_CORE | ||
| 43 | tristate "IPUv3 core support" | ||
| 44 | depends on DRM_IMX | ||
| 45 | depends on RESET_CONTROLLER | ||
| 46 | help | ||
| 47 | Choose this if you have a i.MX5/6 system and want | ||
| 48 | to use the IPU. This option only enables IPU base | ||
| 49 | support. | ||
| 50 | |||
| 51 | config DRM_IMX_IPUV3 | 42 | config DRM_IMX_IPUV3 |
| 52 | tristate "DRM Support for i.MX IPUv3" | 43 | tristate "DRM Support for i.MX IPUv3" |
| 53 | depends on DRM_IMX | 44 | depends on DRM_IMX |
| 54 | depends on DRM_IMX_IPUV3_CORE | 45 | depends on IMX_IPUV3_CORE |
| 55 | help | 46 | help |
| 56 | Choose this if you have a i.MX5 or i.MX6 processor. | 47 | Choose this if you have a i.MX5 or i.MX6 processor. |
| 57 | 48 | ||
diff --git a/drivers/staging/imx-drm/Makefile b/drivers/staging/imx-drm/Makefile index 129e3a3f59f1..582c438d8cbd 100644 --- a/drivers/staging/imx-drm/Makefile +++ b/drivers/staging/imx-drm/Makefile | |||
| @@ -6,7 +6,6 @@ obj-$(CONFIG_DRM_IMX) += imxdrm.o | |||
| 6 | obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += parallel-display.o | 6 | obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += parallel-display.o |
| 7 | obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o | 7 | obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o |
| 8 | obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o | 8 | obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o |
| 9 | obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += ipu-v3/ | ||
| 10 | 9 | ||
| 11 | imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o | 10 | imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o |
| 12 | obj-$(CONFIG_DRM_IMX_IPUV3) += imx-ipuv3-crtc.o | 11 | obj-$(CONFIG_DRM_IMX_IPUV3) += imx-ipuv3-crtc.o |
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index 9fbe6d6a989d..76749231c48a 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | #include <drm/drm_crtc_helper.h> | 27 | #include <drm/drm_crtc_helper.h> |
| 28 | #include <drm/drm_edid.h> | 28 | #include <drm/drm_edid.h> |
| 29 | #include <drm/drm_encoder_slave.h> | 29 | #include <drm/drm_encoder_slave.h> |
| 30 | #include <video/imx-ipu-v3.h> | ||
| 30 | 31 | ||
| 31 | #include "ipu-v3/imx-ipu-v3.h" | ||
| 32 | #include "imx-hdmi.h" | 32 | #include "imx-hdmi.h" |
| 33 | #include "imx-drm.h" | 33 | #include "imx-drm.h" |
| 34 | 34 | ||
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c index 4caef2b1653d..c628fcdc22ae 100644 --- a/drivers/staging/imx-drm/imx-tve.c +++ b/drivers/staging/imx-drm/imx-tve.c | |||
| @@ -30,8 +30,8 @@ | |||
| 30 | #include <drm/drmP.h> | 30 | #include <drm/drmP.h> |
| 31 | #include <drm/drm_fb_helper.h> | 31 | #include <drm/drm_fb_helper.h> |
| 32 | #include <drm/drm_crtc_helper.h> | 32 | #include <drm/drm_crtc_helper.h> |
| 33 | #include <video/imx-ipu-v3.h> | ||
| 33 | 34 | ||
| 34 | #include "ipu-v3/imx-ipu-v3.h" | ||
| 35 | #include "imx-drm.h" | 35 | #include "imx-drm.h" |
| 36 | 36 | ||
| 37 | #define TVE_COM_CONF_REG 0x00 | 37 | #define TVE_COM_CONF_REG 0x00 |
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index c48f640db006..d6913d2e6f77 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <drm/drm_gem_cma_helper.h> | 30 | #include <drm/drm_gem_cma_helper.h> |
| 31 | #include <drm/drm_fb_cma_helper.h> | 31 | #include <drm/drm_fb_cma_helper.h> |
| 32 | 32 | ||
| 33 | #include "ipu-v3/imx-ipu-v3.h" | 33 | #include <video/imx-ipu-v3.h> |
| 34 | #include "imx-drm.h" | 34 | #include "imx-drm.h" |
| 35 | #include "ipuv3-plane.h" | 35 | #include "ipuv3-plane.h" |
| 36 | 36 | ||
diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c index 27a8d735dae0..02b4486435a0 100644 --- a/drivers/staging/imx-drm/ipuv3-plane.c +++ b/drivers/staging/imx-drm/ipuv3-plane.c | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <drm/drm_fb_cma_helper.h> | 17 | #include <drm/drm_fb_cma_helper.h> |
| 18 | #include <drm/drm_gem_cma_helper.h> | 18 | #include <drm/drm_gem_cma_helper.h> |
| 19 | 19 | ||
| 20 | #include "ipu-v3/imx-ipu-v3.h" | 20 | #include "video/imx-ipu-v3.h" |
| 21 | #include "ipuv3-plane.h" | 21 | #include "ipuv3-plane.h" |
| 22 | 22 | ||
| 23 | #define to_ipu_plane(x) container_of(x, struct ipu_plane, base) | 23 | #define to_ipu_plane(x) container_of(x, struct ipu_plane, base) |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index c7b4f0f927b1..8bf495ffb020 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
| @@ -20,6 +20,7 @@ source "drivers/char/agp/Kconfig" | |||
| 20 | source "drivers/gpu/vga/Kconfig" | 20 | source "drivers/gpu/vga/Kconfig" |
| 21 | 21 | ||
| 22 | source "drivers/gpu/host1x/Kconfig" | 22 | source "drivers/gpu/host1x/Kconfig" |
| 23 | source "drivers/gpu/ipu-v3/Kconfig" | ||
| 23 | 24 | ||
| 24 | menu "Direct Rendering Manager" | 25 | menu "Direct Rendering Manager" |
| 25 | source "drivers/gpu/drm/Kconfig" | 26 | source "drivers/gpu/drm/Kconfig" |
diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index c4d14ead5837..61d6d25caf95 100644 --- a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h | |||
| @@ -103,6 +103,7 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms); | |||
| 103 | 103 | ||
| 104 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, | 104 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, |
| 105 | bool doublebuffer); | 105 | bool doublebuffer); |
| 106 | int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel); | ||
| 106 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); | 107 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); |
| 107 | 108 | ||
| 108 | /* | 109 | /* |
| @@ -160,6 +161,20 @@ int ipu_dp_set_window_pos(struct ipu_dp *, u16 x_pos, u16 y_pos); | |||
| 160 | int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha, | 161 | int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha, |
| 161 | bool bg_chan); | 162 | bool bg_chan); |
| 162 | 163 | ||
| 164 | /* | ||
| 165 | * IPU CMOS Sensor Interface (csi) functions | ||
| 166 | */ | ||
| 167 | int ipu_csi_enable(struct ipu_soc *ipu, int csi); | ||
| 168 | int ipu_csi_disable(struct ipu_soc *ipu, int csi); | ||
| 169 | |||
| 170 | /* | ||
| 171 | * IPU Sensor Multiple FIFO Controller (SMFC) functions | ||
| 172 | */ | ||
| 173 | int ipu_smfc_enable(struct ipu_soc *ipu); | ||
| 174 | int ipu_smfc_disable(struct ipu_soc *ipu); | ||
| 175 | int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id); | ||
| 176 | int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize); | ||
| 177 | |||
| 163 | #define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size)) | 178 | #define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size)) |
| 164 | 179 | ||
| 165 | #define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22) | 180 | #define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22) |
| @@ -316,6 +331,7 @@ static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p, | |||
| 316 | }; | 331 | }; |
| 317 | 332 | ||
| 318 | struct ipu_client_platformdata { | 333 | struct ipu_client_platformdata { |
| 334 | int csi; | ||
| 319 | int di; | 335 | int di; |
| 320 | int dc; | 336 | int dc; |
| 321 | int dp; | 337 | int dp; |
