aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap3-iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/omap3-iommu.c')
-rw-r--r--arch/arm/mach-omap2/omap3-iommu.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c
new file mode 100644
index 000000000000..194189c746c2
--- /dev/null
+++ b/arch/arm/mach-omap2/omap3-iommu.c
@@ -0,0 +1,105 @@
1/*
2 * omap iommu: omap3 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 <mach/iommu.h>
16
17#define OMAP3_MMU1_BASE 0x480bd400
18#define OMAP3_MMU2_BASE 0x5d000000
19#define OMAP3_MMU1_IRQ 24
20#define OMAP3_MMU2_IRQ 28
21
22
23static unsigned long iommu_base[] __initdata = {
24 OMAP3_MMU1_BASE,
25 OMAP3_MMU2_BASE,
26};
27
28static int iommu_irq[] __initdata = {
29 OMAP3_MMU1_IRQ,
30 OMAP3_MMU2_IRQ,
31};
32
33static const struct iommu_platform_data omap3_iommu_pdata[] __initconst = {
34 {
35 .name = "isp",
36 .nr_tlb_entries = 8,
37 .clk_name = "cam_ick",
38 },
39#if defined(CONFIG_MPU_BRIDGE_IOMMU)
40 {
41 .name = "iva2",
42 .nr_tlb_entries = 32,
43 .clk_name = "iva2_ck",
44 },
45#endif
46};
47#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata)
48
49static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
50
51static int __init omap3_iommu_init(void)
52{
53 int i, err;
54
55 for (i = 0; i < NR_IOMMU_DEVICES; i++) {
56 struct platform_device *pdev;
57 struct resource res[2];
58
59 pdev = platform_device_alloc("omap-iommu", i);
60 if (!pdev) {
61 err = -ENOMEM;
62 goto err_out;
63 }
64
65 memset(res, 0, sizeof(res));
66 res[0].start = iommu_base[i];
67 res[0].end = iommu_base[i] + MMU_REG_SIZE - 1;
68 res[0].flags = IORESOURCE_MEM;
69 res[1].start = res[1].end = iommu_irq[i];
70 res[1].flags = IORESOURCE_IRQ;
71
72 err = platform_device_add_resources(pdev, res,
73 ARRAY_SIZE(res));
74 if (err)
75 goto err_out;
76 err = platform_device_add_data(pdev, &omap3_iommu_pdata[i],
77 sizeof(omap3_iommu_pdata[0]));
78 if (err)
79 goto err_out;
80 err = platform_device_add(pdev);
81 if (err)
82 goto err_out;
83 omap3_iommu_pdev[i] = pdev;
84 }
85 return 0;
86
87err_out:
88 while (i--)
89 platform_device_put(omap3_iommu_pdev[i]);
90 return err;
91}
92module_init(omap3_iommu_init);
93
94static void __exit omap3_iommu_exit(void)
95{
96 int i;
97
98 for (i = 0; i < NR_IOMMU_DEVICES; i++)
99 platform_device_unregister(omap3_iommu_pdev[i]);
100}
101module_exit(omap3_iommu_exit);
102
103MODULE_AUTHOR("Hiroshi DOYU");
104MODULE_DESCRIPTION("omap iommu: omap3 device registration");
105MODULE_LICENSE("GPL v2");