diff options
author | Kanigeri, Hari <h-kanigeri2@ti.com> | 2010-04-22 19:26:08 -0400 |
---|---|---|
committer | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2010-05-14 03:23:19 -0400 |
commit | 44da397fadf19928838aaa58317a5827dd6c1ec6 (patch) | |
tree | a08d8779267a3359f1cdd0f65e9a96d5abe17345 /arch/arm/mach-omap2/omap-iommu.c | |
parent | b57f95a38233a2e73b679bea4a5453a1cc2a1cc9 (diff) |
omap iommu: renamed omap3-iommu to omap-iommu
This patch includes changes to omap3-iommu.c file to make it generic
for all OMAPs. Renamed omap3-iommu.c to omap-iommu.c
[Hiroshi DOYU: Remove unnecessary "iommu-y" in Makefile]
Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com>
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap-iommu.c')
-rw-r--r-- | arch/arm/mach-omap2/omap-iommu.c | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c new file mode 100644 index 000000000000..416a65d5c4a9 --- /dev/null +++ b/arch/arm/mach-omap2/omap-iommu.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * omap iommu: omap device registration | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/platform_device.h> | ||
14 | |||
15 | #include <plat/iommu.h> | ||
16 | |||
17 | struct iommu_device { | ||
18 | resource_size_t base; | ||
19 | int irq; | ||
20 | struct iommu_platform_data pdata; | ||
21 | struct resource res[2]; | ||
22 | }; | ||
23 | |||
24 | #ifdef CONFIG_ARCH_OMAP3 | ||
25 | static struct iommu_device devices[] = { | ||
26 | { | ||
27 | .base = 0x480bd400, | ||
28 | .irq = 24, | ||
29 | .pdata = { | ||
30 | .name = "isp", | ||
31 | .nr_tlb_entries = 8, | ||
32 | .clk_name = "cam_ick", | ||
33 | }, | ||
34 | }, | ||
35 | #if defined(CONFIG_MPU_BRIDGE_IOMMU) | ||
36 | { | ||
37 | .base = 0x5d000000, | ||
38 | .irq = 28, | ||
39 | .pdata = { | ||
40 | .name = "iva2", | ||
41 | .nr_tlb_entries = 32, | ||
42 | .clk_name = "iva2_ck", | ||
43 | }, | ||
44 | }, | ||
45 | #endif | ||
46 | }; | ||
47 | #endif | ||
48 | |||
49 | #define NR_IOMMU_DEVICES ARRAY_SIZE(devices) | ||
50 | |||
51 | static struct platform_device *omap_iommu_pdev[NR_IOMMU_DEVICES]; | ||
52 | |||
53 | static int __init omap_iommu_init(void) | ||
54 | { | ||
55 | int i, err; | ||
56 | struct resource res[] = { | ||
57 | { .flags = IORESOURCE_MEM }, | ||
58 | { .flags = IORESOURCE_IRQ }, | ||
59 | }; | ||
60 | |||
61 | for (i = 0; i < NR_IOMMU_DEVICES; i++) { | ||
62 | struct platform_device *pdev; | ||
63 | const struct iommu_device *d = &devices[i]; | ||
64 | |||
65 | pdev = platform_device_alloc("omap-iommu", i); | ||
66 | if (!pdev) { | ||
67 | err = -ENOMEM; | ||
68 | goto err_out; | ||
69 | } | ||
70 | |||
71 | res[0].start = d->base; | ||
72 | res[0].end = d->base + MMU_REG_SIZE - 1; | ||
73 | res[1].start = res[1].end = d->irq; | ||
74 | |||
75 | err = platform_device_add_resources(pdev, res, | ||
76 | ARRAY_SIZE(res)); | ||
77 | if (err) | ||
78 | goto err_out; | ||
79 | err = platform_device_add_data(pdev, &d->pdata, | ||
80 | sizeof(d->pdata)); | ||
81 | if (err) | ||
82 | goto err_out; | ||
83 | err = platform_device_add(pdev); | ||
84 | if (err) | ||
85 | goto err_out; | ||
86 | omap_iommu_pdev[i] = pdev; | ||
87 | } | ||
88 | return 0; | ||
89 | |||
90 | err_out: | ||
91 | while (i--) | ||
92 | platform_device_put(omap_iommu_pdev[i]); | ||
93 | return err; | ||
94 | } | ||
95 | module_init(omap_iommu_init); | ||
96 | |||
97 | static void __exit omap_iommu_exit(void) | ||
98 | { | ||
99 | int i; | ||
100 | |||
101 | for (i = 0; i < NR_IOMMU_DEVICES; i++) | ||
102 | platform_device_unregister(omap_iommu_pdev[i]); | ||
103 | } | ||
104 | module_exit(omap_iommu_exit); | ||
105 | |||
106 | MODULE_AUTHOR("Hiroshi DOYU"); | ||
107 | MODULE_DESCRIPTION("omap iommu: omap device registration"); | ||
108 | MODULE_LICENSE("GPL v2"); | ||