diff options
author | Kanigeri, Hari <h-kanigeri2@ti.com> | 2010-04-22 19:26:09 -0400 |
---|---|---|
committer | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2010-05-14 03:23:28 -0400 |
commit | f779f9235f5fcaa887747ee13195efd81d09acce (patch) | |
tree | 49ac494b13ed662571234fe4a9a209d192b35e58 /arch/arm/mach-omap2 | |
parent | 44da397fadf19928838aaa58317a5827dd6c1ec6 (diff) |
omap iommu: support for OMAP4
This patch provides the iommu support for OMAP4 co-processors.
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')
-rw-r--r-- | arch/arm/mach-omap2/omap-iommu.c | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c index 416a65d5c4a9..eb9bee73e0cb 100644 --- a/arch/arm/mach-omap2/omap-iommu.c +++ b/arch/arm/mach-omap2/omap-iommu.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | 14 | ||
15 | #include <plat/iommu.h> | 15 | #include <plat/iommu.h> |
16 | #include <plat/irqs.h> | ||
16 | 17 | ||
17 | struct iommu_device { | 18 | struct iommu_device { |
18 | resource_size_t base; | 19 | resource_size_t base; |
@@ -20,9 +21,11 @@ struct iommu_device { | |||
20 | struct iommu_platform_data pdata; | 21 | struct iommu_platform_data pdata; |
21 | struct resource res[2]; | 22 | struct resource res[2]; |
22 | }; | 23 | }; |
24 | static struct iommu_device *devices; | ||
25 | static int num_iommu_devices; | ||
23 | 26 | ||
24 | #ifdef CONFIG_ARCH_OMAP3 | 27 | #ifdef CONFIG_ARCH_OMAP3 |
25 | static struct iommu_device devices[] = { | 28 | static struct iommu_device omap3_devices[] = { |
26 | { | 29 | { |
27 | .base = 0x480bd400, | 30 | .base = 0x480bd400, |
28 | .irq = 24, | 31 | .irq = 24, |
@@ -44,11 +47,46 @@ static struct iommu_device devices[] = { | |||
44 | }, | 47 | }, |
45 | #endif | 48 | #endif |
46 | }; | 49 | }; |
50 | #define NR_OMAP3_IOMMU_DEVICES ARRAY_SIZE(omap3_devices) | ||
51 | static struct platform_device *omap3_iommu_pdev[NR_OMAP3_IOMMU_DEVICES]; | ||
52 | #else | ||
53 | #define omap3_devices NULL | ||
54 | #define NR_OMAP3_IOMMU_DEVICES 0 | ||
55 | #define omap3_iommu_pdev NULL | ||
47 | #endif | 56 | #endif |
48 | 57 | ||
49 | #define NR_IOMMU_DEVICES ARRAY_SIZE(devices) | 58 | #ifdef CONFIG_ARCH_OMAP4 |
59 | static struct iommu_device omap4_devices[] = { | ||
60 | { | ||
61 | .base = OMAP4_MMU1_BASE, | ||
62 | .irq = INT_44XX_DUCATI_MMU_IRQ, | ||
63 | .pdata = { | ||
64 | .name = "ducati", | ||
65 | .nr_tlb_entries = 32, | ||
66 | .clk_name = "ducati_ick", | ||
67 | }, | ||
68 | }, | ||
69 | #if defined(CONFIG_MPU_TESLA_IOMMU) | ||
70 | { | ||
71 | .base = OMAP4_MMU2_BASE, | ||
72 | .irq = INT_44XX_DSP_MMU, | ||
73 | .pdata = { | ||
74 | .name = "tesla", | ||
75 | .nr_tlb_entries = 32, | ||
76 | .clk_name = "tesla_ick", | ||
77 | }, | ||
78 | }, | ||
79 | #endif | ||
80 | }; | ||
81 | #define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices) | ||
82 | static struct platform_device *omap4_iommu_pdev[NR_OMAP4_IOMMU_DEVICES]; | ||
83 | #else | ||
84 | #define omap4_devices NULL | ||
85 | #define NR_OMAP4_IOMMU_DEVICES 0 | ||
86 | #define omap4_iommu_pdev NULL | ||
87 | #endif | ||
50 | 88 | ||
51 | static struct platform_device *omap_iommu_pdev[NR_IOMMU_DEVICES]; | 89 | static struct platform_device **omap_iommu_pdev; |
52 | 90 | ||
53 | static int __init omap_iommu_init(void) | 91 | static int __init omap_iommu_init(void) |
54 | { | 92 | { |
@@ -58,7 +96,18 @@ static int __init omap_iommu_init(void) | |||
58 | { .flags = IORESOURCE_IRQ }, | 96 | { .flags = IORESOURCE_IRQ }, |
59 | }; | 97 | }; |
60 | 98 | ||
61 | for (i = 0; i < NR_IOMMU_DEVICES; i++) { | 99 | if (cpu_is_omap34xx()) { |
100 | devices = omap3_devices; | ||
101 | omap_iommu_pdev = omap3_iommu_pdev; | ||
102 | num_iommu_devices = NR_OMAP3_IOMMU_DEVICES; | ||
103 | } else if (cpu_is_omap44xx()) { | ||
104 | devices = omap4_devices; | ||
105 | omap_iommu_pdev = omap4_iommu_pdev; | ||
106 | num_iommu_devices = NR_OMAP4_IOMMU_DEVICES; | ||
107 | } else | ||
108 | return -ENODEV; | ||
109 | |||
110 | for (i = 0; i < num_iommu_devices; i++) { | ||
62 | struct platform_device *pdev; | 111 | struct platform_device *pdev; |
63 | const struct iommu_device *d = &devices[i]; | 112 | const struct iommu_device *d = &devices[i]; |
64 | 113 | ||
@@ -98,7 +147,7 @@ static void __exit omap_iommu_exit(void) | |||
98 | { | 147 | { |
99 | int i; | 148 | int i; |
100 | 149 | ||
101 | for (i = 0; i < NR_IOMMU_DEVICES; i++) | 150 | for (i = 0; i < num_iommu_devices; i++) |
102 | platform_device_unregister(omap_iommu_pdev[i]); | 151 | platform_device_unregister(omap_iommu_pdev[i]); |
103 | } | 152 | } |
104 | module_exit(omap_iommu_exit); | 153 | module_exit(omap_iommu_exit); |