]> code.ossystems Code Review - openembedded-core.git/blob
2954c478723e60c7245a0140d429314cec21ce0b
[openembedded-core.git] /
1 From 6a84082597dd322713c5d5951530e3eecb878ad4 Mon Sep 17 00:00:00 2001
2 From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
3 Date: Wed, 28 Jan 2009 21:32:04 +0200
4 Subject: [PATCH] omap iommu: omap3 iommu device registration
5
6 Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 ---
8  arch/arm/mach-omap2/omap3-iommu.c |  104 +++++++++++++++++++++++++++++++++++++
9  1 files changed, 104 insertions(+), 0 deletions(-)
10  create mode 100644 arch/arm/mach-omap2/omap3-iommu.c
11
12 diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c
13 new file mode 100644
14 index 0000000..97481cc
15 --- /dev/null
16 +++ b/arch/arm/mach-omap2/omap3-iommu.c
17 @@ -0,0 +1,104 @@
18 +/*
19 + * omap iommu: omap3 device registration
20 + *
21 + * Copyright (C) 2008-2009 Nokia Corporation
22 + *
23 + * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
24 + *
25 + * This program is free software; you can redistribute it and/or modify
26 + * it under the terms of the GNU General Public License version 2 as
27 + * published by the Free Software Foundation.
28 + */
29 +
30 +#include <linux/platform_device.h>
31 +#include <linux/io.h>
32 +
33 +#include <mach/iommu.h>
34 +
35 +#define OMAP3_MMU1_BASE        0x480bd400
36 +#define OMAP3_MMU2_BASE        0x5d000000
37 +#define OMAP3_MMU1_IRQ 24
38 +#define OMAP3_MMU2_IRQ 28
39 +
40 +static struct resource omap3_iommu_res[] = {
41 +       { /* Camera ISP MMU */
42 +               .start          = OMAP3_MMU1_BASE,
43 +               .end            = OMAP3_MMU1_BASE + MMU_REG_SIZE - 1,
44 +               .flags          = IORESOURCE_MEM,
45 +       },
46 +       {
47 +               .start          = OMAP3_MMU1_IRQ,
48 +               .flags          = IORESOURCE_IRQ,
49 +       },
50 +       { /* IVA2.2 MMU */
51 +               .start          = OMAP3_MMU2_BASE,
52 +               .end            = OMAP3_MMU2_BASE + MMU_REG_SIZE - 1,
53 +               .flags          = IORESOURCE_MEM,
54 +       },
55 +       {
56 +               .start          = OMAP3_MMU2_IRQ,
57 +               .flags          = IORESOURCE_IRQ,
58 +       },
59 +};
60 +#define NR_IOMMU_RES (ARRAY_SIZE(omap3_iommu_res) / 2)
61 +
62 +static const struct iommu_platform_data omap3_iommu_pdata[] __initconst = {
63 +       {
64 +               .name = "isp",
65 +               .nr_tlb_entries = 8,
66 +               .clk_name = "cam_ick",
67 +       },
68 +       {
69 +               .name = "iva2",
70 +               .nr_tlb_entries = 32,
71 +               .clk_name = "iva2_ck",
72 +       },
73 +};
74 +#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata)
75 +
76 +static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
77 +
78 +static int __init omap3_iommu_init(void)
79 +{
80 +       int i, err;
81 +
82 +       for (i = 0; i < NR_IOMMU_DEVICES; i++) {
83 +               struct platform_device *pdev;
84 +
85 +               pdev = platform_device_alloc("omap-iommu", i + 1);
86 +               if (!pdev)
87 +                       goto err_out;
88 +               err = platform_device_add_resources(pdev,
89 +                                   &omap3_iommu_res[2 * i], NR_IOMMU_RES);
90 +               if (err)
91 +                       goto err_out;
92 +               err = platform_device_add_data(pdev, &omap3_iommu_pdata[i],
93 +                                              sizeof(omap3_iommu_pdata[0]));
94 +               if (err)
95 +                       goto err_out;
96 +               err = platform_device_add(pdev);
97 +               if (err)
98 +                       goto err_out;
99 +               omap3_iommu_pdev[i] = pdev;
100 +       }
101 +       return 0;
102 +
103 +err_out:
104 +       while (i--)
105 +               platform_device_put(omap3_iommu_pdev[i]);
106 +       return err;
107 +}
108 +module_init(omap3_iommu_init);
109 +
110 +static void __exit omap3_iommu_exit(void)
111 +{
112 +       int i;
113 +
114 +       for (i = 0; i < NR_IOMMU_DEVICES; i++)
115 +               platform_device_unregister(omap3_iommu_pdev[i]);
116 +}
117 +module_exit(omap3_iommu_exit);
118 +
119 +MODULE_AUTHOR("Hiroshi DOYU");
120 +MODULE_DESCRIPTION("omap iommu: omap3 device registration");
121 +MODULE_LICENSE("GPL v2");
122 -- 
123 1.5.6.5
124