diff options
| author | Hari Kanigeri <h-kanigeri2@ti.com> | 2011-05-31 09:24:36 +0100 |
|---|---|---|
| committer | Andy Green <andy.green@linaro.org> | 2011-05-31 11:06:06 +0100 |
| commit | 2ffbd459a42235067a33d125734a3a698d51f954 (patch) | |
| tree | 3ce1c638055a8a32101fefb4d1345a859d15440f /arch | |
| parent | efc9d9f3506a8a4821dd58c4bdb17d08111aac1c (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.c | 31 |
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 925fc2252d3..cbc82818363 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"); |
