ARM: cpu topology: Add debugfs interface for cpu_power
[cmplus.git] / arch / arm / mach-omap2 / omap-iommu.c
blob6965b4da6c0a3b47a40e35040375931a336cb08c
1 /*
2 * omap iommu: omap device registration
4 * Copyright (C) 2008-2009 Nokia Corporation
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
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.
13 #include <linux/platform_device.h>
14 #include <linux/err.h>
16 #include <plat/iommu.h>
17 #include <plat/omap_device.h>
18 #include <plat/omap_hwmod.h>
21 struct iommu_device {
22 resource_size_t base;
23 int irq;
24 struct iommu_platform_data pdata;
25 struct resource res[2];
27 static struct iommu_platform_data *devices_data;
28 static int num_iommu_devices;
30 #ifdef CONFIG_ARCH_OMAP3
31 static struct iommu_platform_data omap3_devices_data[] = {
33 .name = "isp",
34 .oh_name = "isp",
35 .nr_tlb_entries = 8,
36 .da_start = 0x0,
37 .da_end = 0xFFFFF000,
39 #if defined(CONFIG_OMAP_IOMMU_IVA2)
41 .name = "iva2",
42 .oh_name = "dsp",
43 .nr_tlb_entries = 32,
44 .da_start = 0x11000000,
45 .da_end = 0xFFFFF000,
47 #endif
49 #define NR_OMAP3_IOMMU_DEVICES ARRAY_SIZE(omap3_devices_data)
50 #else
51 #define omap3_devices_data NULL
52 #define NR_OMAP3_IOMMU_DEVICES 0
53 #endif
55 #ifdef CONFIG_ARCH_OMAP4
56 static struct iommu_platform_data omap4_devices_data[] = {
58 .name = "ducati",
59 .oh_name = "ipu",
60 .nr_tlb_entries = 32,
61 .da_start = 0x0,
62 .da_end = 0xFFFFF000,
65 .name = "tesla",
66 .oh_name = "dsp",
67 .nr_tlb_entries = 32,
68 .da_start = 0x0,
69 .da_end = 0xFFFFF000,
72 #define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices_data)
73 #else
74 #define omap4_devices_data NULL
75 #define NR_OMAP4_IOMMU_DEVICES 0
76 #endif
78 static struct omap_device_pm_latency omap_iommu_latency[] = {
79 [0] = {
80 .deactivate_func = omap_device_idle_hwmods,
81 .activate_func = omap_device_enable_hwmods,
82 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
86 int iommu_get_plat_data_size(void)
88 return num_iommu_devices;
90 EXPORT_SYMBOL(iommu_get_plat_data_size);
92 struct iommu_platform_data *iommu_get_device_data(void)
94 return devices_data;
97 static int __init omap_iommu_init(void)
99 int i, ohl_cnt;
100 struct omap_hwmod *oh;
101 struct omap_device *od;
102 struct omap_device_pm_latency *ohl;
104 if (cpu_is_omap34xx()) {
105 devices_data = omap3_devices_data;
106 num_iommu_devices = NR_OMAP3_IOMMU_DEVICES;
107 } else if (cpu_is_omap44xx()) {
108 devices_data = omap4_devices_data;
109 num_iommu_devices = NR_OMAP4_IOMMU_DEVICES;
110 } else
111 return -ENODEV;
113 ohl = omap_iommu_latency;
114 ohl_cnt = ARRAY_SIZE(omap_iommu_latency);
116 for (i = 0; i < num_iommu_devices; i++) {
117 struct iommu_platform_data *data = &devices_data[i];
119 oh = omap_hwmod_lookup(data->oh_name);
120 data->io_base = oh->_mpu_rt_va;
121 data->irq = oh->mpu_irqs[0].irq;
123 if (!oh) {
124 pr_err("%s: could not look up %s\n", __func__,
125 data->oh_name);
126 continue;
128 od = omap_device_build("omap-iommu", i, oh,
129 data, sizeof(*data),
130 ohl, ohl_cnt, false);
131 WARN(IS_ERR(od), "Could not build omap_device"
132 "for %s %s\n", "omap-iommu", data->oh_name);
134 return 0;
136 module_init(omap_iommu_init);
138 MODULE_AUTHOR("Hiroshi DOYU");
139 MODULE_AUTHOR("Hari Kanigeri");
140 MODULE_DESCRIPTION("omap iommu: omap device registration");
141 MODULE_LICENSE("GPL v2");