summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Honza <honza@ti.com>2011-10-25 10:51:44 +0800
committerAndy Green <andy.green@linaro.org>2011-10-25 10:51:44 +0800
commitee4fea9e4a7308aa7d2472639be454290c7f8d0f (patch)
treec71195ae0de62ae00bc9d769987c1eeb3a12fda1
parent566e164f34b1c48e71244043024bf48f8a963c62 (diff)
syslink: iommu: provide new api to return a device
The ipu device is missing from the omap_ipupm_data. This results in a null device pointer being used when applying constraints. This change provides an api which can be used to return a device when queried by name. This is to support initializing omap_ipupm_data with a device. Change-Id: I490e61db6361652aa0fd63ba51e98af937eb800e Signed-off-by: Bryan Honza <honza@ti.com>
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c23
-rw-r--r--arch/arm/plat-omap/include/plat/iommu.h3
2 files changed, 24 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index a98b5350366..091f369059c 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -17,6 +17,7 @@
#include <plat/omap_device.h>
#include <plat/omap_hwmod.h>
+static struct platform_device **omap_iommu_pdev;
struct iommu_device {
resource_size_t base;
@@ -74,14 +75,32 @@ 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];
+
+struct device *omap_iommu_get_dev(char *dev_name)
+{
+ int i;
+ struct platform_device *pdev;
+ struct device *dev = NULL;
+ struct iommu_platform_data *pdata;
+
+ for (i = 0; i < NR_OMAP4_IOMMU_DEVICES; i++) {
+ pdev = omap_iommu_pdev[i];
+ pdata = pdev->dev.platform_data;
+ if (!strcmp(pdata->oh_name, dev_name))
+ dev = &pdev->dev;
+ }
+ WARN_ONCE(!dev, "omap_iommu_get_dev: NULL dev\n");
+
+ return dev;
+}
+EXPORT_SYMBOL(omap_iommu_get_dev);
+
#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,
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
index a03823a81ac..8018d28826d 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -13,6 +13,7 @@
#ifndef __MACH_IOMMU_H
#define __MACH_IOMMU_H
+#include <linux/device.h>
#include <linux/list.h>
struct iotlb_entry {
@@ -204,4 +205,6 @@ extern int foreach_iommu_device(void *data,
extern ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len);
extern size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t len);
extern int iommu_get_plat_data_size(void);
+extern struct device *omap_iommu_get_dev(char *dev_name);
+
#endif /* __MACH_IOMMU_H */