summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHari Kanigeri <h-kanigeri2@ti.com>2010-08-10 18:00:02 -0500
committerBryan Wu <bryan.wu@canonical.com>2010-08-26 21:45:49 +0800
commitabab956284cd8b83dc1910d30480bdf2369e7804 (patch)
treeabeb2796183aee48a6445fdc1cbac1138727aac3 /arch
parent43798b5788127f9e23ba3c3c64bc12cee53fa9f6 (diff)
omap:iommu-use platform device for iovmm
use platform device instead of omap device for iovmm. Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index 548a9611a2bf..170537f1a9cb 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -12,7 +12,7 @@
#include <linux/platform_device.h>
#include <linux/err.h>
-
+#include <linux/slab.h>
#include <plat/iommu.h>
#include <plat/omap_device.h>
#include <plat/omap_hwmod.h>
@@ -43,9 +43,11 @@ static struct iommu_platform_data omap3_devices_data[] = {
#endif
};
#define NR_OMAP3_IOMMU_DEVICES ARRAY_SIZE(omap3_devices_data)
+static struct platform_device *omap3_iommu_pdev[NR_OMAP3_IOMMU_DEVICES];
#else
#define omap3_devices_data NULL
#define NR_OMAP3_IOMMU_DEVICES 0
+#define omap3_iommu_pdev NULL
#endif
#ifdef CONFIG_ARCH_OMAP4
@@ -62,11 +64,15 @@ static struct iommu_platform_data omap4_devices_data[] = {
},
};
#define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices_data)
+static struct platform_device *omap4_iommu_pdev[NR_OMAP4_IOMMU_DEVICES];
#else
#define omap4_devices_data NULL
#define NR_OMAP4_IOMMU_DEVICES 0
+#define omap4_iommu_pdev NULL
#endif
+static struct platform_device **omap_iommu_pdev;
+
static struct omap_device_pm_latency omap_iommu_latency[] = {
[0] = {
.deactivate_func = omap_device_idle_hwmods,
@@ -92,13 +98,16 @@ static int __init omap_iommu_init(void)
struct omap_hwmod *oh;
struct omap_device *od;
struct omap_device_pm_latency *ohl;
+ struct platform_device *pdev;
if (cpu_is_omap34xx()) {
devices_data = omap3_devices_data;
num_iommu_devices = NR_OMAP3_IOMMU_DEVICES;
+ omap_iommu_pdev = omap3_iommu_pdev;
} else if (cpu_is_omap44xx()) {
devices_data = omap4_devices_data;
num_iommu_devices = NR_OMAP4_IOMMU_DEVICES;
+ omap_iommu_pdev = omap4_iommu_pdev;
} else
return -ENODEV;
@@ -122,16 +131,26 @@ static int __init omap_iommu_init(void)
ohl, ohl_cnt, false);
WARN(IS_ERR(od), "Could not build omap_device"
"for %s %s\n", "omap-iommu", data->oh_name);
- od = omap_device_build("omap-iovmm", i, oh,
- data, sizeof(*data),
- ohl, ohl_cnt, false);
- WARN(IS_ERR(od), "Could not build omap_device"
- "for %s %s\n", "omap-iovmm", data->oh_name);
+
+ pdev = platform_device_alloc("omap-iovmm", i);
+ if (pdev) {
+ platform_device_add_data(pdev, data, sizeof(*data));
+ platform_device_add(pdev);
+ }
+ omap_iommu_pdev[i] = pdev;
}
return 0;
}
module_init(omap_iommu_init);
+static void __exit omap_iommu_exit(void)
+{
+ int i;
+ for (i = 0; i < num_iommu_devices; i++)
+ platform_device_unregister(omap_iommu_pdev[i]);
+}
+module_exit(omap_iommu_exit);
+
MODULE_AUTHOR("Hiroshi DOYU");
MODULE_AUTHOR("Hari Kanigeri");
MODULE_DESCRIPTION("omap iommu: omap device registration");