diff options
-rw-r--r-- | arch/arm/mach-omap2/omap-iommu.c | 59 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap44xx.h | 3 |
2 files changed, 57 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); |
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h index b3ef1a7f53cc..bb94a0baee8a 100644 --- a/arch/arm/plat-omap/include/plat/omap44xx.h +++ b/arch/arm/plat-omap/include/plat/omap44xx.h | |||
@@ -48,5 +48,8 @@ | |||
48 | #define OMAP44XX_MAILBOX_BASE (L4_44XX_BASE + 0xF4000) | 48 | #define OMAP44XX_MAILBOX_BASE (L4_44XX_BASE + 0xF4000) |
49 | #define OMAP44XX_HSUSB_OTG_BASE (L4_44XX_BASE + 0xAB000) | 49 | #define OMAP44XX_HSUSB_OTG_BASE (L4_44XX_BASE + 0xAB000) |
50 | 50 | ||
51 | #define OMAP4_MMU1_BASE 0x55082000 | ||
52 | #define OMAP4_MMU2_BASE 0x4A066000 | ||
53 | |||
51 | #endif /* __ASM_ARCH_OMAP44XX_H */ | 54 | #endif /* __ASM_ARCH_OMAP44XX_H */ |
52 | 55 | ||