diff options
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/Kconfig | 3 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isp.c | 45 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isp.h | 5 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispccdc.c | 25 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispstat.c | 11 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 4 |
6 files changed, 62 insertions, 31 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f574dc012cad..620106937ec6 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -763,8 +763,7 @@ source "drivers/media/video/m5mols/Kconfig" | |||
763 | 763 | ||
764 | config VIDEO_OMAP3 | 764 | config VIDEO_OMAP3 |
765 | tristate "OMAP 3 Camera support (EXPERIMENTAL)" | 765 | tristate "OMAP 3 Camera support (EXPERIMENTAL)" |
766 | select OMAP_IOMMU | 766 | depends on OMAP_IOVMM && VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3 && EXPERIMENTAL |
767 | depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3 && EXPERIMENTAL | ||
768 | ---help--- | 767 | ---help--- |
769 | Driver for an OMAP 3 camera controller. | 768 | Driver for an OMAP 3 camera controller. |
770 | 769 | ||
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index 5cea2bbd7014..a7ed98596883 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c | |||
@@ -80,6 +80,13 @@ | |||
80 | #include "isph3a.h" | 80 | #include "isph3a.h" |
81 | #include "isphist.h" | 81 | #include "isphist.h" |
82 | 82 | ||
83 | /* | ||
84 | * this is provided as an interim solution until omap3isp doesn't need | ||
85 | * any omap-specific iommu API | ||
86 | */ | ||
87 | #define to_iommu(dev) \ | ||
88 | (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)) | ||
89 | |||
83 | static unsigned int autoidle; | 90 | static unsigned int autoidle; |
84 | module_param(autoidle, int, 0444); | 91 | module_param(autoidle, int, 0444); |
85 | MODULE_PARM_DESC(autoidle, "Enable OMAP3ISP AUTOIDLE support"); | 92 | MODULE_PARM_DESC(autoidle, "Enable OMAP3ISP AUTOIDLE support"); |
@@ -1108,7 +1115,7 @@ static void isp_save_ctx(struct isp_device *isp) | |||
1108 | { | 1115 | { |
1109 | isp_save_context(isp, isp_reg_list); | 1116 | isp_save_context(isp, isp_reg_list); |
1110 | if (isp->iommu) | 1117 | if (isp->iommu) |
1111 | iommu_save_ctx(isp->iommu); | 1118 | omap_iommu_save_ctx(isp->iommu); |
1112 | } | 1119 | } |
1113 | 1120 | ||
1114 | /* | 1121 | /* |
@@ -1122,7 +1129,7 @@ static void isp_restore_ctx(struct isp_device *isp) | |||
1122 | { | 1129 | { |
1123 | isp_restore_context(isp, isp_reg_list); | 1130 | isp_restore_context(isp, isp_reg_list); |
1124 | if (isp->iommu) | 1131 | if (isp->iommu) |
1125 | iommu_restore_ctx(isp->iommu); | 1132 | omap_iommu_restore_ctx(isp->iommu); |
1126 | omap3isp_ccdc_restore_context(isp); | 1133 | omap3isp_ccdc_restore_context(isp); |
1127 | omap3isp_preview_restore_context(isp); | 1134 | omap3isp_preview_restore_context(isp); |
1128 | } | 1135 | } |
@@ -1975,7 +1982,8 @@ static int isp_remove(struct platform_device *pdev) | |||
1975 | isp_cleanup_modules(isp); | 1982 | isp_cleanup_modules(isp); |
1976 | 1983 | ||
1977 | omap3isp_get(isp); | 1984 | omap3isp_get(isp); |
1978 | iommu_put(isp->iommu); | 1985 | iommu_detach_device(isp->domain, isp->iommu_dev); |
1986 | iommu_domain_free(isp->domain); | ||
1979 | omap3isp_put(isp); | 1987 | omap3isp_put(isp); |
1980 | 1988 | ||
1981 | free_irq(isp->irq_num, isp); | 1989 | free_irq(isp->irq_num, isp); |
@@ -2123,25 +2131,41 @@ static int isp_probe(struct platform_device *pdev) | |||
2123 | } | 2131 | } |
2124 | 2132 | ||
2125 | /* IOMMU */ | 2133 | /* IOMMU */ |
2126 | isp->iommu = iommu_get("isp"); | 2134 | isp->iommu_dev = omap_find_iommu_device("isp"); |
2127 | if (IS_ERR_OR_NULL(isp->iommu)) { | 2135 | if (!isp->iommu_dev) { |
2128 | isp->iommu = NULL; | 2136 | dev_err(isp->dev, "omap_find_iommu_device failed\n"); |
2129 | ret = -ENODEV; | 2137 | ret = -ENODEV; |
2130 | goto error_isp; | 2138 | goto error_isp; |
2131 | } | 2139 | } |
2132 | 2140 | ||
2141 | /* to be removed once iommu migration is complete */ | ||
2142 | isp->iommu = to_iommu(isp->iommu_dev); | ||
2143 | |||
2144 | isp->domain = iommu_domain_alloc(pdev->dev.bus); | ||
2145 | if (!isp->domain) { | ||
2146 | dev_err(isp->dev, "can't alloc iommu domain\n"); | ||
2147 | ret = -ENOMEM; | ||
2148 | goto error_isp; | ||
2149 | } | ||
2150 | |||
2151 | ret = iommu_attach_device(isp->domain, isp->iommu_dev); | ||
2152 | if (ret) { | ||
2153 | dev_err(&pdev->dev, "can't attach iommu device: %d\n", ret); | ||
2154 | goto free_domain; | ||
2155 | } | ||
2156 | |||
2133 | /* Interrupt */ | 2157 | /* Interrupt */ |
2134 | isp->irq_num = platform_get_irq(pdev, 0); | 2158 | isp->irq_num = platform_get_irq(pdev, 0); |
2135 | if (isp->irq_num <= 0) { | 2159 | if (isp->irq_num <= 0) { |
2136 | dev_err(isp->dev, "No IRQ resource\n"); | 2160 | dev_err(isp->dev, "No IRQ resource\n"); |
2137 | ret = -ENODEV; | 2161 | ret = -ENODEV; |
2138 | goto error_isp; | 2162 | goto detach_dev; |
2139 | } | 2163 | } |
2140 | 2164 | ||
2141 | if (request_irq(isp->irq_num, isp_isr, IRQF_SHARED, "OMAP3 ISP", isp)) { | 2165 | if (request_irq(isp->irq_num, isp_isr, IRQF_SHARED, "OMAP3 ISP", isp)) { |
2142 | dev_err(isp->dev, "Unable to request IRQ\n"); | 2166 | dev_err(isp->dev, "Unable to request IRQ\n"); |
2143 | ret = -EINVAL; | 2167 | ret = -EINVAL; |
2144 | goto error_isp; | 2168 | goto detach_dev; |
2145 | } | 2169 | } |
2146 | 2170 | ||
2147 | /* Entities */ | 2171 | /* Entities */ |
@@ -2162,8 +2186,11 @@ error_modules: | |||
2162 | isp_cleanup_modules(isp); | 2186 | isp_cleanup_modules(isp); |
2163 | error_irq: | 2187 | error_irq: |
2164 | free_irq(isp->irq_num, isp); | 2188 | free_irq(isp->irq_num, isp); |
2189 | detach_dev: | ||
2190 | iommu_detach_device(isp->domain, isp->iommu_dev); | ||
2191 | free_domain: | ||
2192 | iommu_domain_free(isp->domain); | ||
2165 | error_isp: | 2193 | error_isp: |
2166 | iommu_put(isp->iommu); | ||
2167 | omap3isp_put(isp); | 2194 | omap3isp_put(isp); |
2168 | error: | 2195 | error: |
2169 | isp_put_clocks(isp); | 2196 | isp_put_clocks(isp); |
diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index 529e582ef948..81fdd85deb60 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
34 | #include <linux/wait.h> | 34 | #include <linux/wait.h> |
35 | #include <linux/iommu.h> | ||
35 | #include <plat/iommu.h> | 36 | #include <plat/iommu.h> |
36 | #include <plat/iovmm.h> | 37 | #include <plat/iovmm.h> |
37 | 38 | ||
@@ -294,7 +295,9 @@ struct isp_device { | |||
294 | unsigned int sbl_resources; | 295 | unsigned int sbl_resources; |
295 | unsigned int subclk_resources; | 296 | unsigned int subclk_resources; |
296 | 297 | ||
297 | struct iommu *iommu; | 298 | struct omap_iommu *iommu; |
299 | struct iommu_domain *domain; | ||
300 | struct device *iommu_dev; | ||
298 | 301 | ||
299 | struct isp_platform_callback platform_cb; | 302 | struct isp_platform_callback platform_cb; |
300 | }; | 303 | }; |
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index 80796eb0c53e..892671922f8a 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -366,7 +366,7 @@ static void ccdc_lsc_free_request(struct isp_ccdc_device *ccdc, | |||
366 | dma_unmap_sg(isp->dev, req->iovm->sgt->sgl, | 366 | dma_unmap_sg(isp->dev, req->iovm->sgt->sgl, |
367 | req->iovm->sgt->nents, DMA_TO_DEVICE); | 367 | req->iovm->sgt->nents, DMA_TO_DEVICE); |
368 | if (req->table) | 368 | if (req->table) |
369 | iommu_vfree(isp->iommu, req->table); | 369 | omap_iommu_vfree(isp->domain, isp->iommu, req->table); |
370 | kfree(req); | 370 | kfree(req); |
371 | } | 371 | } |
372 | 372 | ||
@@ -438,15 +438,15 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, | |||
438 | 438 | ||
439 | req->enable = 1; | 439 | req->enable = 1; |
440 | 440 | ||
441 | req->table = iommu_vmalloc(isp->iommu, 0, req->config.size, | 441 | req->table = omap_iommu_vmalloc(isp->domain, isp->iommu, 0, |
442 | IOMMU_FLAG); | 442 | req->config.size, IOMMU_FLAG); |
443 | if (IS_ERR_VALUE(req->table)) { | 443 | if (IS_ERR_VALUE(req->table)) { |
444 | req->table = 0; | 444 | req->table = 0; |
445 | ret = -ENOMEM; | 445 | ret = -ENOMEM; |
446 | goto done; | 446 | goto done; |
447 | } | 447 | } |
448 | 448 | ||
449 | req->iovm = find_iovm_area(isp->iommu, req->table); | 449 | req->iovm = omap_find_iovm_area(isp->iommu, req->table); |
450 | if (req->iovm == NULL) { | 450 | if (req->iovm == NULL) { |
451 | ret = -ENOMEM; | 451 | ret = -ENOMEM; |
452 | goto done; | 452 | goto done; |
@@ -462,7 +462,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, | |||
462 | dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl, | 462 | dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl, |
463 | req->iovm->sgt->nents, DMA_TO_DEVICE); | 463 | req->iovm->sgt->nents, DMA_TO_DEVICE); |
464 | 464 | ||
465 | table = da_to_va(isp->iommu, req->table); | 465 | table = omap_da_to_va(isp->iommu, req->table); |
466 | if (copy_from_user(table, config->lsc, req->config.size)) { | 466 | if (copy_from_user(table, config->lsc, req->config.size)) { |
467 | ret = -EFAULT; | 467 | ret = -EFAULT; |
468 | goto done; | 468 | goto done; |
@@ -731,18 +731,19 @@ static int ccdc_config(struct isp_ccdc_device *ccdc, | |||
731 | 731 | ||
732 | /* | 732 | /* |
733 | * table_new must be 64-bytes aligned, but it's | 733 | * table_new must be 64-bytes aligned, but it's |
734 | * already done by iommu_vmalloc(). | 734 | * already done by omap_iommu_vmalloc(). |
735 | */ | 735 | */ |
736 | size = ccdc->fpc.fpnum * 4; | 736 | size = ccdc->fpc.fpnum * 4; |
737 | table_new = iommu_vmalloc(isp->iommu, 0, size, | 737 | table_new = omap_iommu_vmalloc(isp->domain, isp->iommu, |
738 | IOMMU_FLAG); | 738 | 0, size, IOMMU_FLAG); |
739 | if (IS_ERR_VALUE(table_new)) | 739 | if (IS_ERR_VALUE(table_new)) |
740 | return -ENOMEM; | 740 | return -ENOMEM; |
741 | 741 | ||
742 | if (copy_from_user(da_to_va(isp->iommu, table_new), | 742 | if (copy_from_user(omap_da_to_va(isp->iommu, table_new), |
743 | (__force void __user *) | 743 | (__force void __user *) |
744 | ccdc->fpc.fpcaddr, size)) { | 744 | ccdc->fpc.fpcaddr, size)) { |
745 | iommu_vfree(isp->iommu, table_new); | 745 | omap_iommu_vfree(isp->domain, isp->iommu, |
746 | table_new); | ||
746 | return -EFAULT; | 747 | return -EFAULT; |
747 | } | 748 | } |
748 | 749 | ||
@@ -752,7 +753,7 @@ static int ccdc_config(struct isp_ccdc_device *ccdc, | |||
752 | 753 | ||
753 | ccdc_configure_fpc(ccdc); | 754 | ccdc_configure_fpc(ccdc); |
754 | if (table_old != 0) | 755 | if (table_old != 0) |
755 | iommu_vfree(isp->iommu, table_old); | 756 | omap_iommu_vfree(isp->domain, isp->iommu, table_old); |
756 | } | 757 | } |
757 | 758 | ||
758 | return ccdc_lsc_config(ccdc, ccdc_struct); | 759 | return ccdc_lsc_config(ccdc, ccdc_struct); |
@@ -2287,5 +2288,5 @@ void omap3isp_ccdc_cleanup(struct isp_device *isp) | |||
2287 | ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue); | 2288 | ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue); |
2288 | 2289 | ||
2289 | if (ccdc->fpc.fpcaddr != 0) | 2290 | if (ccdc->fpc.fpcaddr != 0) |
2290 | iommu_vfree(isp->iommu, ccdc->fpc.fpcaddr); | 2291 | omap_iommu_vfree(isp->domain, isp->iommu, ccdc->fpc.fpcaddr); |
2291 | } | 2292 | } |
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c index 808065948ac1..732905552261 100644 --- a/drivers/media/video/omap3isp/ispstat.c +++ b/drivers/media/video/omap3isp/ispstat.c | |||
@@ -366,7 +366,8 @@ static void isp_stat_bufs_free(struct ispstat *stat) | |||
366 | dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl, | 366 | dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl, |
367 | buf->iovm->sgt->nents, | 367 | buf->iovm->sgt->nents, |
368 | DMA_FROM_DEVICE); | 368 | DMA_FROM_DEVICE); |
369 | iommu_vfree(isp->iommu, buf->iommu_addr); | 369 | omap_iommu_vfree(isp->domain, isp->iommu, |
370 | buf->iommu_addr); | ||
370 | } else { | 371 | } else { |
371 | if (!buf->virt_addr) | 372 | if (!buf->virt_addr) |
372 | continue; | 373 | continue; |
@@ -399,8 +400,8 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size) | |||
399 | struct iovm_struct *iovm; | 400 | struct iovm_struct *iovm; |
400 | 401 | ||
401 | WARN_ON(buf->dma_addr); | 402 | WARN_ON(buf->dma_addr); |
402 | buf->iommu_addr = iommu_vmalloc(isp->iommu, 0, size, | 403 | buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->iommu, 0, |
403 | IOMMU_FLAG); | 404 | size, IOMMU_FLAG); |
404 | if (IS_ERR((void *)buf->iommu_addr)) { | 405 | if (IS_ERR((void *)buf->iommu_addr)) { |
405 | dev_err(stat->isp->dev, | 406 | dev_err(stat->isp->dev, |
406 | "%s: Can't acquire memory for " | 407 | "%s: Can't acquire memory for " |
@@ -409,7 +410,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size) | |||
409 | return -ENOMEM; | 410 | return -ENOMEM; |
410 | } | 411 | } |
411 | 412 | ||
412 | iovm = find_iovm_area(isp->iommu, buf->iommu_addr); | 413 | iovm = omap_find_iovm_area(isp->iommu, buf->iommu_addr); |
413 | if (!iovm || | 414 | if (!iovm || |
414 | !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents, | 415 | !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents, |
415 | DMA_FROM_DEVICE)) { | 416 | DMA_FROM_DEVICE)) { |
@@ -418,7 +419,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size) | |||
418 | } | 419 | } |
419 | buf->iovm = iovm; | 420 | buf->iovm = iovm; |
420 | 421 | ||
421 | buf->virt_addr = da_to_va(stat->isp->iommu, | 422 | buf->virt_addr = omap_da_to_va(stat->isp->iommu, |
422 | (u32)buf->iommu_addr); | 423 | (u32)buf->iommu_addr); |
423 | buf->empty = 1; | 424 | buf->empty = 1; |
424 | dev_dbg(stat->isp->dev, "%s: buffer[%d] allocated." | 425 | dev_dbg(stat->isp->dev, "%s: buffer[%d] allocated." |
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index fd965adfd597..912ac071b104 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -446,7 +446,7 @@ ispmmu_vmap(struct isp_device *isp, const struct scatterlist *sglist, int sglen) | |||
446 | sgt->nents = sglen; | 446 | sgt->nents = sglen; |
447 | sgt->orig_nents = sglen; | 447 | sgt->orig_nents = sglen; |
448 | 448 | ||
449 | da = iommu_vmap(isp->iommu, 0, sgt, IOMMU_FLAG); | 449 | da = omap_iommu_vmap(isp->domain, isp->iommu, 0, sgt, IOMMU_FLAG); |
450 | if (IS_ERR_VALUE(da)) | 450 | if (IS_ERR_VALUE(da)) |
451 | kfree(sgt); | 451 | kfree(sgt); |
452 | 452 | ||
@@ -462,7 +462,7 @@ static void ispmmu_vunmap(struct isp_device *isp, dma_addr_t da) | |||
462 | { | 462 | { |
463 | struct sg_table *sgt; | 463 | struct sg_table *sgt; |
464 | 464 | ||
465 | sgt = iommu_vunmap(isp->iommu, (u32)da); | 465 | sgt = omap_iommu_vunmap(isp->domain, isp->iommu, (u32)da); |
466 | kfree(sgt); | 466 | kfree(sgt); |
467 | } | 467 | } |
468 | 468 | ||