iommu/exynos: Add callback for initializing devices from device tree
This patch adds implementation of of_xlate callback, which prepares masters device for attaching to IOMMU. This callback is called during creating devices from device tree. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Родитель
8ed55c812f
Коммит
aa759fd376
|
@ -1146,6 +1146,33 @@ static void exynos_iommu_remove_device(struct device *dev)
|
||||||
iommu_group_remove_device(dev);
|
iommu_group_remove_device(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int exynos_iommu_of_xlate(struct device *dev,
|
||||||
|
struct of_phandle_args *spec)
|
||||||
|
{
|
||||||
|
struct exynos_iommu_owner *owner = dev->archdata.iommu;
|
||||||
|
struct platform_device *sysmmu = of_find_device_by_node(spec->np);
|
||||||
|
struct sysmmu_drvdata *data;
|
||||||
|
|
||||||
|
if (!sysmmu)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
data = platform_get_drvdata(sysmmu);
|
||||||
|
if (!data)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
if (!owner) {
|
||||||
|
owner = kzalloc(sizeof(*owner), GFP_KERNEL);
|
||||||
|
if (!owner)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&owner->controllers);
|
||||||
|
dev->archdata.iommu = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_add_tail(&data->owner_node, &owner->controllers);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct iommu_ops exynos_iommu_ops = {
|
static struct iommu_ops exynos_iommu_ops = {
|
||||||
.domain_alloc = exynos_iommu_domain_alloc,
|
.domain_alloc = exynos_iommu_domain_alloc,
|
||||||
.domain_free = exynos_iommu_domain_free,
|
.domain_free = exynos_iommu_domain_free,
|
||||||
|
@ -1158,6 +1185,7 @@ static struct iommu_ops exynos_iommu_ops = {
|
||||||
.add_device = exynos_iommu_add_device,
|
.add_device = exynos_iommu_add_device,
|
||||||
.remove_device = exynos_iommu_remove_device,
|
.remove_device = exynos_iommu_remove_device,
|
||||||
.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
|
.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
|
||||||
|
.of_xlate = exynos_iommu_of_xlate,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool init_done;
|
static bool init_done;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче