diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/iommu/tegra-gart.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/iommu/tegra-gart.c')
-rw-r--r-- | drivers/iommu/tegra-gart.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index 8219f1d596e..c33557ce5a6 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c | |||
@@ -29,17 +29,15 @@ | |||
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
31 | #include <linux/iommu.h> | 31 | #include <linux/iommu.h> |
32 | #include <linux/of.h> | ||
33 | 32 | ||
34 | #include <asm/cacheflush.h> | 33 | #include <asm/cacheflush.h> |
35 | 34 | ||
36 | /* bitmap of the page sizes currently supported */ | 35 | /* bitmap of the page sizes currently supported */ |
37 | #define GART_IOMMU_PGSIZES (SZ_4K) | 36 | #define GART_IOMMU_PGSIZES (SZ_4K) |
38 | 37 | ||
39 | #define GART_REG_BASE 0x24 | 38 | #define GART_CONFIG 0x24 |
40 | #define GART_CONFIG (0x24 - GART_REG_BASE) | 39 | #define GART_ENTRY_ADDR 0x28 |
41 | #define GART_ENTRY_ADDR (0x28 - GART_REG_BASE) | 40 | #define GART_ENTRY_DATA 0x2c |
42 | #define GART_ENTRY_DATA (0x2c - GART_REG_BASE) | ||
43 | #define GART_ENTRY_PHYS_ADDR_VALID (1 << 31) | 41 | #define GART_ENTRY_PHYS_ADDR_VALID (1 << 31) |
44 | 42 | ||
45 | #define GART_PAGE_SHIFT 12 | 43 | #define GART_PAGE_SHIFT 12 |
@@ -165,11 +163,6 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain, | |||
165 | return -EINVAL; | 163 | return -EINVAL; |
166 | domain->priv = gart; | 164 | domain->priv = gart; |
167 | 165 | ||
168 | domain->geometry.aperture_start = gart->iovmm_base; | ||
169 | domain->geometry.aperture_end = gart->iovmm_base + | ||
170 | gart->page_count * GART_PAGE_SIZE - 1; | ||
171 | domain->geometry.force_aperture = true; | ||
172 | |||
173 | client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL); | 166 | client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL); |
174 | if (!client) | 167 | if (!client) |
175 | return -ENOMEM; | 168 | return -ENOMEM; |
@@ -253,7 +246,7 @@ static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
253 | pfn = __phys_to_pfn(pa); | 246 | pfn = __phys_to_pfn(pa); |
254 | if (!pfn_valid(pfn)) { | 247 | if (!pfn_valid(pfn)) { |
255 | dev_err(gart->dev, "Invalid page: %08x\n", pa); | 248 | dev_err(gart->dev, "Invalid page: %08x\n", pa); |
256 | spin_unlock_irqrestore(&gart->pte_lock, flags); | 249 | spin_lock_irqsave(&gart->pte_lock, flags); |
257 | return -EINVAL; | 250 | return -EINVAL; |
258 | } | 251 | } |
259 | gart_set_pte(gart, iova, GART_PTE(pfn)); | 252 | gart_set_pte(gart, iova, GART_PTE(pfn)); |
@@ -398,7 +391,6 @@ static int tegra_gart_probe(struct platform_device *pdev) | |||
398 | do_gart_setup(gart, NULL); | 391 | do_gart_setup(gart, NULL); |
399 | 392 | ||
400 | gart_handle = gart; | 393 | gart_handle = gart; |
401 | bus_set_iommu(&platform_bus_type, &gart_iommu_ops); | ||
402 | return 0; | 394 | return 0; |
403 | 395 | ||
404 | fail: | 396 | fail: |
@@ -430,27 +422,19 @@ const struct dev_pm_ops tegra_gart_pm_ops = { | |||
430 | .resume = tegra_gart_resume, | 422 | .resume = tegra_gart_resume, |
431 | }; | 423 | }; |
432 | 424 | ||
433 | #ifdef CONFIG_OF | ||
434 | static struct of_device_id tegra_gart_of_match[] = { | ||
435 | { .compatible = "nvidia,tegra20-gart", }, | ||
436 | { }, | ||
437 | }; | ||
438 | MODULE_DEVICE_TABLE(of, tegra_gart_of_match); | ||
439 | #endif | ||
440 | |||
441 | static struct platform_driver tegra_gart_driver = { | 425 | static struct platform_driver tegra_gart_driver = { |
442 | .probe = tegra_gart_probe, | 426 | .probe = tegra_gart_probe, |
443 | .remove = tegra_gart_remove, | 427 | .remove = tegra_gart_remove, |
444 | .driver = { | 428 | .driver = { |
445 | .owner = THIS_MODULE, | 429 | .owner = THIS_MODULE, |
446 | .name = "tegra-gart", | 430 | .name = "tegra_gart", |
447 | .pm = &tegra_gart_pm_ops, | 431 | .pm = &tegra_gart_pm_ops, |
448 | .of_match_table = of_match_ptr(tegra_gart_of_match), | ||
449 | }, | 432 | }, |
450 | }; | 433 | }; |
451 | 434 | ||
452 | static int tegra_gart_init(void) | 435 | static int __devinit tegra_gart_init(void) |
453 | { | 436 | { |
437 | bus_set_iommu(&platform_bus_type, &gart_iommu_ops); | ||
454 | return platform_driver_register(&tegra_gart_driver); | 438 | return platform_driver_register(&tegra_gart_driver); |
455 | } | 439 | } |
456 | 440 | ||
@@ -461,8 +445,3 @@ static void __exit tegra_gart_exit(void) | |||
461 | 445 | ||
462 | subsys_initcall(tegra_gart_init); | 446 | subsys_initcall(tegra_gart_init); |
463 | module_exit(tegra_gart_exit); | 447 | module_exit(tegra_gart_exit); |
464 | |||
465 | MODULE_DESCRIPTION("IOMMU API for GART in Tegra20"); | ||
466 | MODULE_AUTHOR("Hiroshi DOYU <hdoyu@nvidia.com>"); | ||
467 | MODULE_ALIAS("platform:tegra-gart"); | ||
468 | MODULE_LICENSE("GPL v2"); | ||