aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>2009-01-28 14:32:04 -0500
committerHiroshi DOYU <Hiroshi.DOYU@nokia.com>2009-05-19 01:23:37 -0400
commit066aa9c1e3d0af52619fe26f05810990ff381d8c (patch)
tree8379ecb12988e2dd9b9bf34205552225af2b4bb1 /arch/arm/mach-omap2
parent2bcb573343dbd7d913cb62b81463960644a3737f (diff)
omap iommu: omap3 iommu device registration
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/omap3-iommu.c103
1 files changed, 103 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..91ee38a485a4
--- /dev/null
+++ b/arch/arm/mach-omap2/omap3-iommu.c
@@ -0,0 +1,103 @@
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 {
40 .name = "iva2",
41 .nr_tlb_entries = 32,
42 .clk_name = "iva2_ck",
43 },
44};
45#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata)
46
47static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
48
49static int __init omap3_iommu_init(void)
50{
51 int i, err;
52
53 for (i = 0; i < NR_IOMMU_DEVICES; i++) {
54 struct platform_device *pdev;
55 struct resource res[2];
56
57 pdev = platform_device_alloc("omap-iommu", i);
58 if (!pdev) {
59 err = -ENOMEM;
60 goto err_out;
61 }
62
63 memset(res, 0, sizeof(res));
64 res[0].start = iommu_base[i];
65 res[0].end = iommu_base[i] + MMU_REG_SIZE - 1;
66 res[0].flags = IORESOURCE_MEM;
67 res[1].start = res[1].end = iommu_irq[i];
68 res[1].flags = IORESOURCE_IRQ;
69
70 err = platform_device_add_resources(pdev, res,
71 ARRAY_SIZE(res));
72 if (err)
73 goto err_out;
74 err = platform_device_add_data(pdev, &omap3_iommu_pdata[i],
75 sizeof(omap3_iommu_pdata[0]));
76 if (err)
77 goto err_out;
78 err = platform_device_add(pdev);
79 if (err)
80 goto err_out;
81 omap3_iommu_pdev[i] = pdev;
82 }
83 return 0;
84
85err_out:
86 while (i--)
87 platform_device_put(omap3_iommu_pdev[i]);
88 return err;
89}
90module_init(omap3_iommu_init);
91
92static void __exit omap3_iommu_exit(void)
93{
94 int i;
95
96 for (i = 0; i < NR_IOMMU_DEVICES; i++)
97 platform_device_unregister(omap3_iommu_pdev[i]);
98}
99module_exit(omap3_iommu_exit);
100
101MODULE_AUTHOR("Hiroshi DOYU");
102MODULE_DESCRIPTION("omap iommu: omap3 device registration");
103MODULE_LICENSE("GPL v2");