diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2011-10-10 18:18:33 -0400 |
---|---|---|
committer | Ohad Ben-Cohen <ohad@wizery.com> | 2011-12-05 08:47:39 -0500 |
commit | fabdbca8c991dfa0ea1ff26214ae7d18e5740cc3 (patch) | |
tree | eb749033a25fd557e21756936ba83180fefdb8c8 /drivers/iommu/omap-iovmm.c | |
parent | c8eaab3b74f1326c989e1db8d7c0c14981556e4e (diff) |
iommu/omap: eliminate the public omap_find_iommu_device() method
Eliminate the public omap_find_iommu_device() method, and don't
expect clients to provide the omap_iommu handle anymore.
Instead, OMAP's iommu driver now utilizes dev_archdata's private iommu
extension to be able to access the required iommu information.
This way OMAP IOMMU users are now able to use the generic IOMMU API without
having to call any omap-specific binding method.
Update omap3isp appropriately.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: Hiroshi Doyu <hdoyu@nvidia.com>
Diffstat (limited to 'drivers/iommu/omap-iovmm.c')
-rw-r--r-- | drivers/iommu/omap-iovmm.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 46be456fcc00..23655945e30c 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c | |||
@@ -231,12 +231,14 @@ static struct iovm_struct *__find_iovm_area(struct omap_iommu *obj, | |||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * omap_find_iovm_area - find iovma which includes @da | 233 | * omap_find_iovm_area - find iovma which includes @da |
234 | * @dev: client device | ||
234 | * @da: iommu device virtual address | 235 | * @da: iommu device virtual address |
235 | * | 236 | * |
236 | * Find the existing iovma starting at @da | 237 | * Find the existing iovma starting at @da |
237 | */ | 238 | */ |
238 | struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da) | 239 | struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da) |
239 | { | 240 | { |
241 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
240 | struct iovm_struct *area; | 242 | struct iovm_struct *area; |
241 | 243 | ||
242 | mutex_lock(&obj->mmap_lock); | 244 | mutex_lock(&obj->mmap_lock); |
@@ -343,14 +345,15 @@ static void free_iovm_area(struct omap_iommu *obj, struct iovm_struct *area) | |||
343 | 345 | ||
344 | /** | 346 | /** |
345 | * omap_da_to_va - convert (d) to (v) | 347 | * omap_da_to_va - convert (d) to (v) |
346 | * @obj: objective iommu | 348 | * @dev: client device |
347 | * @da: iommu device virtual address | 349 | * @da: iommu device virtual address |
348 | * @va: mpu virtual address | 350 | * @va: mpu virtual address |
349 | * | 351 | * |
350 | * Returns mpu virtual addr which corresponds to a given device virtual addr | 352 | * Returns mpu virtual addr which corresponds to a given device virtual addr |
351 | */ | 353 | */ |
352 | void *omap_da_to_va(struct omap_iommu *obj, u32 da) | 354 | void *omap_da_to_va(struct device *dev, u32 da) |
353 | { | 355 | { |
356 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
354 | void *va = NULL; | 357 | void *va = NULL; |
355 | struct iovm_struct *area; | 358 | struct iovm_struct *area; |
356 | 359 | ||
@@ -582,16 +585,18 @@ __iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, | |||
582 | 585 | ||
583 | /** | 586 | /** |
584 | * omap_iommu_vmap - (d)-(p)-(v) address mapper | 587 | * omap_iommu_vmap - (d)-(p)-(v) address mapper |
585 | * @obj: objective iommu | 588 | * @domain: iommu domain |
589 | * @dev: client device | ||
586 | * @sgt: address of scatter gather table | 590 | * @sgt: address of scatter gather table |
587 | * @flags: iovma and page property | 591 | * @flags: iovma and page property |
588 | * | 592 | * |
589 | * Creates 1-n-1 mapping with given @sgt and returns @da. | 593 | * Creates 1-n-1 mapping with given @sgt and returns @da. |
590 | * All @sgt element must be io page size aligned. | 594 | * All @sgt element must be io page size aligned. |
591 | */ | 595 | */ |
592 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 596 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, |
593 | const struct sg_table *sgt, u32 flags) | 597 | const struct sg_table *sgt, u32 flags) |
594 | { | 598 | { |
599 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
595 | size_t bytes; | 600 | size_t bytes; |
596 | void *va = NULL; | 601 | void *va = NULL; |
597 | 602 | ||
@@ -622,15 +627,17 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmap); | |||
622 | 627 | ||
623 | /** | 628 | /** |
624 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' | 629 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' |
625 | * @obj: objective iommu | 630 | * @domain: iommu domain |
631 | * @dev: client device | ||
626 | * @da: iommu device virtual address | 632 | * @da: iommu device virtual address |
627 | * | 633 | * |
628 | * Free the iommu virtually contiguous memory area starting at | 634 | * Free the iommu virtually contiguous memory area starting at |
629 | * @da, which was returned by 'omap_iommu_vmap()'. | 635 | * @da, which was returned by 'omap_iommu_vmap()'. |
630 | */ | 636 | */ |
631 | struct sg_table * | 637 | struct sg_table * |
632 | omap_iommu_vunmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da) | 638 | omap_iommu_vunmap(struct iommu_domain *domain, struct device *dev, u32 da) |
633 | { | 639 | { |
640 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
634 | struct sg_table *sgt; | 641 | struct sg_table *sgt; |
635 | /* | 642 | /* |
636 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. | 643 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. |
@@ -647,7 +654,7 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap); | |||
647 | 654 | ||
648 | /** | 655 | /** |
649 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper | 656 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper |
650 | * @obj: objective iommu | 657 | * @dev: client device |
651 | * @da: contiguous iommu virtual memory | 658 | * @da: contiguous iommu virtual memory |
652 | * @bytes: allocation size | 659 | * @bytes: allocation size |
653 | * @flags: iovma and page property | 660 | * @flags: iovma and page property |
@@ -656,9 +663,10 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap); | |||
656 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. | 663 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. |
657 | */ | 664 | */ |
658 | u32 | 665 | u32 |
659 | omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 666 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, u32 da, |
660 | size_t bytes, u32 flags) | 667 | size_t bytes, u32 flags) |
661 | { | 668 | { |
669 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
662 | void *va; | 670 | void *va; |
663 | struct sg_table *sgt; | 671 | struct sg_table *sgt; |
664 | 672 | ||
@@ -698,15 +706,16 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmalloc); | |||
698 | 706 | ||
699 | /** | 707 | /** |
700 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' | 708 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' |
701 | * @obj: objective iommu | 709 | * @dev: client device |
702 | * @da: iommu device virtual address | 710 | * @da: iommu device virtual address |
703 | * | 711 | * |
704 | * Frees the iommu virtually continuous memory area starting at | 712 | * Frees the iommu virtually continuous memory area starting at |
705 | * @da, as obtained from 'omap_iommu_vmalloc()'. | 713 | * @da, as obtained from 'omap_iommu_vmalloc()'. |
706 | */ | 714 | */ |
707 | void omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, | 715 | void omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, |
708 | const u32 da) | 716 | const u32 da) |
709 | { | 717 | { |
718 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
710 | struct sg_table *sgt; | 719 | struct sg_table *sgt; |
711 | 720 | ||
712 | sgt = unmap_vm_area(domain, obj, da, vfree, | 721 | sgt = unmap_vm_area(domain, obj, da, vfree, |