Commit 11d84197 authored by Robin Murphy's avatar Robin Murphy
Browse files

media/omap3isp: Clean up IOMMU workaround



Now that arch/arm is wired up for default domains and iommu-dma, devices
behind IOMMUs will get mappings set up automatically as appropriate, so
there is no need for drivers to do so manually.

Signed-off-by: Robin Murphy's avatarRobin Murphy <robin.murphy@arm.com>
parent 3535c205
...@@ -56,10 +56,6 @@ ...@@ -56,10 +56,6 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#ifdef CONFIG_ARM_DMA_USE_IOMMU
#include <asm/dma-iommu.h>
#endif
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-fwnode.h> #include <media/v4l2-fwnode.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
...@@ -1942,51 +1938,6 @@ static int isp_initialize_modules(struct isp_device *isp) ...@@ -1942,51 +1938,6 @@ static int isp_initialize_modules(struct isp_device *isp)
return ret; return ret;
} }
static void isp_detach_iommu(struct isp_device *isp)
{
#ifdef CONFIG_ARM_DMA_USE_IOMMU
arm_iommu_detach_device(isp->dev);
arm_iommu_release_mapping(isp->mapping);
isp->mapping = NULL;
#endif
}
static int isp_attach_iommu(struct isp_device *isp)
{
#ifdef CONFIG_ARM_DMA_USE_IOMMU
struct dma_iommu_mapping *mapping;
int ret;
/*
* Create the ARM mapping, used by the ARM DMA mapping core to allocate
* VAs. This will allocate a corresponding IOMMU domain.
*/
mapping = arm_iommu_create_mapping(&platform_bus_type, SZ_1G, SZ_2G);
if (IS_ERR(mapping)) {
dev_err(isp->dev, "failed to create ARM IOMMU mapping\n");
return PTR_ERR(mapping);
}
isp->mapping = mapping;
/* Attach the ARM VA mapping to the device. */
ret = arm_iommu_attach_device(isp->dev, mapping);
if (ret < 0) {
dev_err(isp->dev, "failed to attach device to VA mapping\n");
goto error;
}
return 0;
error:
arm_iommu_release_mapping(isp->mapping);
isp->mapping = NULL;
return ret;
#else
return -ENODEV;
#endif
}
/* /*
* isp_remove - Remove ISP platform device * isp_remove - Remove ISP platform device
* @pdev: Pointer to ISP platform device * @pdev: Pointer to ISP platform device
...@@ -2002,10 +1953,6 @@ static int isp_remove(struct platform_device *pdev) ...@@ -2002,10 +1953,6 @@ static int isp_remove(struct platform_device *pdev)
isp_cleanup_modules(isp); isp_cleanup_modules(isp);
isp_xclk_cleanup(isp); isp_xclk_cleanup(isp);
__omap3isp_get(isp, false);
isp_detach_iommu(isp);
__omap3isp_put(isp, false);
media_entity_enum_cleanup(&isp->crashed); media_entity_enum_cleanup(&isp->crashed);
v4l2_async_notifier_cleanup(&isp->notifier); v4l2_async_notifier_cleanup(&isp->notifier);
...@@ -2383,18 +2330,11 @@ static int isp_probe(struct platform_device *pdev) ...@@ -2383,18 +2330,11 @@ static int isp_probe(struct platform_device *pdev)
isp->mmio_hist_base_phys = isp->mmio_hist_base_phys =
mem->start + isp_res_maps[m].offset[OMAP3_ISP_IOMEM_HIST]; mem->start + isp_res_maps[m].offset[OMAP3_ISP_IOMEM_HIST];
/* IOMMU */
ret = isp_attach_iommu(isp);
if (ret < 0) {
dev_err(&pdev->dev, "unable to attach to IOMMU\n");
goto error_isp;
}
/* Interrupt */ /* Interrupt */
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret <= 0) { if (ret <= 0) {
ret = -ENODEV; ret = -ENODEV;
goto error_iommu; goto error_isp;
} }
isp->irq_num = ret; isp->irq_num = ret;
...@@ -2402,13 +2342,13 @@ static int isp_probe(struct platform_device *pdev) ...@@ -2402,13 +2342,13 @@ static int isp_probe(struct platform_device *pdev)
"OMAP3 ISP", isp)) { "OMAP3 ISP", isp)) {
dev_err(isp->dev, "Unable to request IRQ\n"); dev_err(isp->dev, "Unable to request IRQ\n");
ret = -EINVAL; ret = -EINVAL;
goto error_iommu; goto error_isp;
} }
/* Entities */ /* Entities */
ret = isp_initialize_modules(isp); ret = isp_initialize_modules(isp);
if (ret < 0) if (ret < 0)
goto error_iommu; goto error_isp;
ret = isp_register_entities(isp); ret = isp_register_entities(isp);
if (ret < 0) if (ret < 0)
...@@ -2433,8 +2373,6 @@ static int isp_probe(struct platform_device *pdev) ...@@ -2433,8 +2373,6 @@ static int isp_probe(struct platform_device *pdev)
isp_unregister_entities(isp); isp_unregister_entities(isp);
error_modules: error_modules:
isp_cleanup_modules(isp); isp_cleanup_modules(isp);
error_iommu:
isp_detach_iommu(isp);
error_isp: error_isp:
isp_xclk_cleanup(isp); isp_xclk_cleanup(isp);
__omap3isp_put(isp, false); __omap3isp_put(isp, false);
......
...@@ -145,7 +145,6 @@ struct isp_xclk { ...@@ -145,7 +145,6 @@ struct isp_xclk {
* @syscon: Regmap for the syscon register space * @syscon: Regmap for the syscon register space
* @syscon_offset: Offset of the CSIPHY control register in syscon * @syscon_offset: Offset of the CSIPHY control register in syscon
* @phy_type: ISP_PHY_TYPE_{3430,3630} * @phy_type: ISP_PHY_TYPE_{3430,3630}
* @mapping: IOMMU mapping
* @stat_lock: Spinlock for handling statistics * @stat_lock: Spinlock for handling statistics
* @isp_mutex: Mutex for serializing requests to ISP. * @isp_mutex: Mutex for serializing requests to ISP.
* @stop_failure: Indicates that an entity failed to stop. * @stop_failure: Indicates that an entity failed to stop.
...@@ -185,8 +184,6 @@ struct isp_device { ...@@ -185,8 +184,6 @@ struct isp_device {
u32 syscon_offset; u32 syscon_offset;
u32 phy_type; u32 phy_type;
struct dma_iommu_mapping *mapping;
/* ISP Obj */ /* ISP Obj */
spinlock_t stat_lock; /* common lock for statistic drivers */ spinlock_t stat_lock; /* common lock for statistic drivers */
struct mutex isp_mutex; /* For handling ref_count field */ struct mutex isp_mutex; /* For handling ref_count field */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment