aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Anna2019-03-04 10:15:55 -0600
committerSuman Anna2019-03-04 10:16:18 -0600
commit08c6fed55d8358f62c1161a0f6281a0cb3fb15f0 (patch)
tree7b8534e5133d5025b4213777480817f89a449ed1
parent06fe96b926cc076c8b3df0ade3e42b67a6390aae (diff)
parentb8ee97c59fb1bfc68e4c4a9ea2eda91dd70ef830 (diff)
downloadremoteproc-08c6fed55d8358f62c1161a0f6281a0cb3fb15f0.tar.gz
remoteproc-08c6fed55d8358f62c1161a0f6281a0cb3fb15f0.tar.xz
remoteproc-08c6fed55d8358f62c1161a0f6281a0cb3fb15f0.zip
Merge branch 'iommu-linux-4.19.y' of git://git.ti.com/rpmsg/iommu into rproc-linux-4.19.y
Merge in the updated iommu feature branch into remoteproc tree to pull in the suspend/resume support in the OMAP IOMMU driver. The following are the main changes: - improvements in the OMAP iommu to perform the enabling & disabling of the IOMMU from within the runtime pm callbacks - system suspend/resume support through late dev_pm_ops - two new API that needs to be invoked from the OMAP remoteproc driver to runtime suspend/resume the IOMMU - locked TLB save & restore logic - add needed pdata quirks to all supported IOMMUs Suspend/resume support in the OMAP mailbox driver is already supported in baseline upstream kernel. * 'iommu-linux-4.19.y' of git://git.ti.com/rpmsg/iommu: iommu/omap: introduce new API for runtime suspend/resume control iommu/omap: Add system suspend/resume support iommu/omap: add logic to save/restore locked TLBs iommu/omap: streamline enable/disable through runtime pm callbacks ARM: OMAP2+: add pdata-quirks for OMAP3 ISP IOMMU ARM: OMAP2+: Add iommu pdata-quirks for DRA7 DSP EDMA MMUs ARM: OMAP2+: plug in device_enable/idle ops for IOMMUs iommu/omap: add pdata ops for omap_device_enable/idle Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c22
-rw-r--r--drivers/iommu/omap-iommu.c280
-rw-r--r--drivers/iommu/omap-iommu.h3
-rw-r--r--include/linux/omap-iommu.h15
-rw-r--r--include/linux/platform_data/iommu-omap.h2
5 files changed, 281 insertions, 41 deletions
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 2271add0a661..9b6aec1fef88 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -104,6 +104,13 @@ static struct iommu_platform_data omap3_iommu_pdata = {
104 .reset_name = "mmu", 104 .reset_name = "mmu",
105 .assert_reset = omap_device_assert_hardreset, 105 .assert_reset = omap_device_assert_hardreset,
106 .deassert_reset = omap_device_deassert_hardreset, 106 .deassert_reset = omap_device_deassert_hardreset,
107 .device_enable = omap_device_enable,
108 .device_idle = omap_device_idle,
109};
110
111static struct iommu_platform_data omap3_iommu_isp_pdata = {
112 .device_enable = omap_device_enable,
113 .device_idle = omap_device_idle,
107}; 114};
108 115
109static int omap3_sbc_t3730_twl_callback(struct device *dev, 116static int omap3_sbc_t3730_twl_callback(struct device *dev,
@@ -438,6 +445,8 @@ static struct iommu_platform_data omap4_iommu_pdata = {
438 .reset_name = "mmu_cache", 445 .reset_name = "mmu_cache",
439 .assert_reset = omap_device_assert_hardreset, 446 .assert_reset = omap_device_assert_hardreset,
440 .deassert_reset = omap_device_deassert_hardreset, 447 .deassert_reset = omap_device_deassert_hardreset,
448 .device_enable = omap_device_enable,
449 .device_idle = omap_device_idle,
441}; 450};
442#endif 451#endif
443 452
@@ -466,9 +475,16 @@ static struct iommu_platform_data dra7_ipu1_dsp_iommu_pdata = {
466 .reset_name = "mmu_cache", 475 .reset_name = "mmu_cache",
467 .assert_reset = omap_device_assert_hardreset, 476 .assert_reset = omap_device_assert_hardreset,
468 .deassert_reset = omap_device_deassert_hardreset, 477 .deassert_reset = omap_device_deassert_hardreset,
478 .device_enable = omap_device_enable,
479 .device_idle = omap_device_idle,
469 .set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint, 480 .set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint,
470}; 481};
471 482
483static struct iommu_platform_data dra7_dsp_mmu_edma_pdata = {
484 .device_enable = omap_device_enable,
485 .device_idle = omap_device_idle,
486};
487
472static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1; 488static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1;
473static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2; 489static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2;
474static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3; 490static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3;
@@ -585,6 +601,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {
585#ifdef CONFIG_ARCH_OMAP3 601#ifdef CONFIG_ARCH_OMAP3
586 OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu", 602 OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
587 &omap3_iommu_pdata), 603 &omap3_iommu_pdata),
604 OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu",
605 &omap3_iommu_isp_pdata),
588 OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000, 606 OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000,
589 "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]), 607 "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
590 OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000, 608 OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000,
@@ -644,6 +662,10 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {
644 &dra7_ipu1_dsp_iommu_pdata), 662 &dra7_ipu1_dsp_iommu_pdata),
645 OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41501000, "41501000.mmu", 663 OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41501000, "41501000.mmu",
646 &dra7_ipu1_dsp_iommu_pdata), 664 &dra7_ipu1_dsp_iommu_pdata),
665 OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x40d02000, "40d02000.mmu",
666 &dra7_dsp_mmu_edma_pdata),
667 OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41502000, "41502000.mmu",
668 &dra7_dsp_mmu_edma_pdata),
647 OF_DEV_AUXDATA("ti,dra7-iommu", 0x55082000, "55082000.mmu", 669 OF_DEV_AUXDATA("ti,dra7-iommu", 0x55082000, "55082000.mmu",
648 &omap4_iommu_pdata), 670 &omap4_iommu_pdata),
649 OF_DEV_AUXDATA("ti,dra7-iommu", 0x58882000, "58882000.mmu", 671 OF_DEV_AUXDATA("ti,dra7-iommu", 0x58882000, "58882000.mmu",
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index f623f76378a0..c69d86900520 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -69,6 +69,9 @@ static struct omap_iommu_domain *to_omap_domain(struct iommu_domain *dom)
69/** 69/**
70 * omap_iommu_save_ctx - Save registers for pm off-mode support 70 * omap_iommu_save_ctx - Save registers for pm off-mode support
71 * @dev: client device 71 * @dev: client device
72 *
73 * This should be treated as an deprecated API. It is preserved only
74 * to maintain existing functionality for OMAP3 ISP driver.
72 **/ 75 **/
73void omap_iommu_save_ctx(struct device *dev) 76void omap_iommu_save_ctx(struct device *dev)
74{ 77{
@@ -96,6 +99,9 @@ EXPORT_SYMBOL_GPL(omap_iommu_save_ctx);
96/** 99/**
97 * omap_iommu_restore_ctx - Restore registers for pm off-mode support 100 * omap_iommu_restore_ctx - Restore registers for pm off-mode support
98 * @dev: client device 101 * @dev: client device
102 *
103 * This should be treated as an deprecated API. It is preserved only
104 * to maintain existing functionality for OMAP3 ISP driver.
99 **/ 105 **/
100void omap_iommu_restore_ctx(struct device *dev) 106void omap_iommu_restore_ctx(struct device *dev)
101{ 107{
@@ -190,53 +196,18 @@ static void omap2_iommu_disable(struct omap_iommu *obj)
190 196
191static int iommu_enable(struct omap_iommu *obj) 197static int iommu_enable(struct omap_iommu *obj)
192{ 198{
193 int err; 199 int ret;
194 struct platform_device *pdev = to_platform_device(obj->dev);
195 struct iommu_platform_data *pdata = dev_get_platdata(&pdev->dev);
196
197 if (pdata && pdata->set_pwrdm_constraint) {
198 err = pdata->set_pwrdm_constraint(pdev, true, &obj->pwrst);
199 if (err) {
200 dev_warn(obj->dev, "pwrdm_constraint failed to be set, status = %d\n",
201 err);
202 }
203 }
204
205 if (pdata && pdata->deassert_reset) {
206 err = pdata->deassert_reset(pdev, pdata->reset_name);
207 if (err) {
208 dev_err(obj->dev, "deassert_reset failed: %d\n", err);
209 return err;
210 }
211 }
212
213 pm_runtime_get_sync(obj->dev);
214 200
215 err = omap2_iommu_enable(obj); 201 ret = pm_runtime_get_sync(obj->dev);
202 if (ret < 0)
203 pm_runtime_put_noidle(obj->dev);
216 204
217 return err; 205 return ret < 0 ? ret : 0;
218} 206}
219 207
220static void iommu_disable(struct omap_iommu *obj) 208static void iommu_disable(struct omap_iommu *obj)
221{ 209{
222 struct platform_device *pdev = to_platform_device(obj->dev);
223 struct iommu_platform_data *pdata = dev_get_platdata(&pdev->dev);
224 int ret;
225
226 omap2_iommu_disable(obj);
227
228 pm_runtime_put_sync(obj->dev); 210 pm_runtime_put_sync(obj->dev);
229
230 if (pdata && pdata->assert_reset)
231 pdata->assert_reset(pdev, pdata->reset_name);
232
233 if (pdata && pdata->set_pwrdm_constraint) {
234 ret = pdata->set_pwrdm_constraint(pdev, false, &obj->pwrst);
235 if (ret) {
236 dev_warn(obj->dev, "pwrdm_constraint failed to be reset, status = %d\n",
237 ret);
238 }
239 }
240} 211}
241 212
242/* 213/*
@@ -922,15 +893,219 @@ static void omap_iommu_detach(struct omap_iommu *obj)
922 893
923 dma_unmap_single(obj->dev, obj->pd_dma, IOPGD_TABLE_SIZE, 894 dma_unmap_single(obj->dev, obj->pd_dma, IOPGD_TABLE_SIZE,
924 DMA_TO_DEVICE); 895 DMA_TO_DEVICE);
925 iommu_disable(obj);
926 obj->pd_dma = 0; 896 obj->pd_dma = 0;
927 obj->iopgd = NULL; 897 obj->iopgd = NULL;
898 iommu_disable(obj);
928 899
929 spin_unlock(&obj->iommu_lock); 900 spin_unlock(&obj->iommu_lock);
930 901
931 dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name); 902 dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name);
932} 903}
933 904
905static void omap_iommu_save_tlb_entries(struct omap_iommu *obj)
906{
907 struct iotlb_lock lock;
908 struct cr_regs cr;
909 struct cr_regs *tmp;
910 int i;
911
912 /* check if there are any locked tlbs to save */
913 iotlb_lock_get(obj, &lock);
914 obj->num_cr_ctx = lock.base;
915 if (!obj->num_cr_ctx)
916 return;
917
918 tmp = obj->cr_ctx;
919 for_each_iotlb_cr(obj, obj->num_cr_ctx, i, cr)
920 *tmp++ = cr;
921}
922
923static void omap_iommu_restore_tlb_entries(struct omap_iommu *obj)
924{
925 struct iotlb_lock l;
926 struct cr_regs *tmp;
927 int i;
928
929 /* no locked tlbs to restore */
930 if (!obj->num_cr_ctx)
931 return;
932
933 l.base = 0;
934 tmp = obj->cr_ctx;
935 for (i = 0; i < obj->num_cr_ctx; i++, tmp++) {
936 l.vict = i;
937 iotlb_lock_set(obj, &l);
938 iotlb_load_cr(obj, tmp);
939 }
940 l.base = obj->num_cr_ctx;
941 l.vict = i;
942 iotlb_lock_set(obj, &l);
943}
944
945/**
946 * omap_iommu_domain_deactivate - deactivate attached iommu devices
947 * @domain: iommu domain attached to the target iommu device
948 *
949 * This API allows the client devices of IOMMU devices to suspend
950 * the IOMMUs they control at runtime, after they are idled and
951 * suspended all activity. System Suspend will leverage the PM
952 * driver late callbacks.
953 **/
954int omap_iommu_domain_deactivate(struct iommu_domain *domain)
955{
956 struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
957 struct omap_iommu_device *iommu;
958 struct omap_iommu *oiommu;
959 int i;
960
961 if (!omap_domain->dev)
962 return 0;
963
964 iommu = omap_domain->iommus;
965 iommu += (omap_domain->num_iommus - 1);
966 for (i = 0; i < omap_domain->num_iommus; i++, iommu--) {
967 oiommu = iommu->iommu_dev;
968 pm_runtime_put_sync(oiommu->dev);
969 }
970
971 return 0;
972}
973EXPORT_SYMBOL_GPL(omap_iommu_domain_deactivate);
974
975/**
976 * omap_iommu_domain_activate - activate attached iommu devices
977 * @domain: iommu domain attached to the target iommu device
978 *
979 * This API allows the client devices of IOMMU devices to resume the
980 * IOMMUs they control at runtime, before they can resume operations.
981 * System Resume will leverage the PM driver late callbacks.
982 **/
983int omap_iommu_domain_activate(struct iommu_domain *domain)
984{
985 struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
986 struct omap_iommu_device *iommu;
987 struct omap_iommu *oiommu;
988 int i;
989
990 if (!omap_domain->dev)
991 return 0;
992
993 iommu = omap_domain->iommus;
994 for (i = 0; i < omap_domain->num_iommus; i++, iommu++) {
995 oiommu = iommu->iommu_dev;
996 pm_runtime_get_sync(oiommu->dev);
997 }
998
999 return 0;
1000}
1001EXPORT_SYMBOL_GPL(omap_iommu_domain_activate);
1002
1003/**
1004 * omap_iommu_runtime_suspend - disable an iommu device
1005 * @dev: iommu device
1006 *
1007 * This function performs all that is necessary to disable an
1008 * IOMMU device, either during final detachment from a client
1009 * device, or during system/runtime suspend of the device. This
1010 * includes programming all the appropriate IOMMU registers, and
1011 * managing the associated omap_hwmod's state and the device's
1012 * reset line. This function also saves the context of any
1013 * locked TLBs if suspending.
1014 **/
1015static int omap_iommu_runtime_suspend(struct device *dev)
1016{
1017 struct platform_device *pdev = to_platform_device(dev);
1018 struct iommu_platform_data *pdata = dev_get_platdata(dev);
1019 struct omap_iommu *obj = to_iommu(dev);
1020 int ret;
1021
1022 /* save the TLBs only during suspend, and not for power down */
1023 if (obj->domain && obj->iopgd)
1024 omap_iommu_save_tlb_entries(obj);
1025
1026 omap2_iommu_disable(obj);
1027
1028 if (pdata && pdata->device_idle)
1029 pdata->device_idle(pdev);
1030
1031 if (pdata && pdata->assert_reset)
1032 pdata->assert_reset(pdev, pdata->reset_name);
1033
1034 if (pdata && pdata->set_pwrdm_constraint) {
1035 ret = pdata->set_pwrdm_constraint(pdev, false, &obj->pwrst);
1036 if (ret) {
1037 dev_warn(obj->dev, "pwrdm_constraint failed to be reset, status = %d\n",
1038 ret);
1039 }
1040 }
1041
1042 return 0;
1043}
1044
1045/**
1046 * omap_iommu_runtime_resume - enable an iommu device
1047 * @dev: iommu device
1048 *
1049 * This function performs all that is necessary to enable an
1050 * IOMMU device, either during initial attachment to a client
1051 * device, or during system/runtime resume of the device. This
1052 * includes programming all the appropriate IOMMU registers, and
1053 * managing the associated omap_hwmod's state and the device's
1054 * reset line. The function also restores any locked TLBs if
1055 * resuming after a suspend.
1056 **/
1057static int omap_iommu_runtime_resume(struct device *dev)
1058{
1059 struct platform_device *pdev = to_platform_device(dev);
1060 struct iommu_platform_data *pdata = dev_get_platdata(dev);
1061 struct omap_iommu *obj = to_iommu(dev);
1062 int ret = 0;
1063
1064 if (pdata && pdata->set_pwrdm_constraint) {
1065 ret = pdata->set_pwrdm_constraint(pdev, true, &obj->pwrst);
1066 if (ret) {
1067 dev_warn(obj->dev, "pwrdm_constraint failed to be set, status = %d\n",
1068 ret);
1069 }
1070 }
1071
1072 if (pdata && pdata->deassert_reset) {
1073 ret = pdata->deassert_reset(pdev, pdata->reset_name);
1074 if (ret) {
1075 dev_err(dev, "deassert_reset failed: %d\n", ret);
1076 return ret;
1077 }
1078 }
1079
1080 if (pdata && pdata->device_enable)
1081 pdata->device_enable(pdev);
1082
1083 /* restore the TLBs only during resume, and not for power up */
1084 if (obj->domain)
1085 omap_iommu_restore_tlb_entries(obj);
1086
1087 ret = omap2_iommu_enable(obj);
1088
1089 return ret;
1090}
1091
1092/**
1093 * omap_iommu_suspend_prepare - prepare() dev_pm_ops implementation
1094 * @dev: iommu device
1095 *
1096 * This function performs the necessary checks to determine if the IOMMU
1097 * device needs suspending or not. The function checks if the runtime_pm
1098 * status of the device is suspended, and returns 1 in that case. This
1099 * results in the PM core to skip invoking any of the Sleep PM callbacks
1100 * (suspend, suspend_late, resume, resume_early etc).
1101 */
1102static int omap_iommu_prepare(struct device *dev)
1103{
1104 if (pm_runtime_status_suspended(dev))
1105 return 1;
1106 return 0;
1107}
1108
934static bool omap_iommu_can_register(struct platform_device *pdev) 1109static bool omap_iommu_can_register(struct platform_device *pdev)
935{ 1110{
936 struct device_node *np = pdev->dev.of_node; 1111 struct device_node *np = pdev->dev.of_node;
@@ -1005,6 +1180,15 @@ static int omap_iommu_probe(struct platform_device *pdev)
1005 if (!obj) 1180 if (!obj)
1006 return -ENOMEM; 1181 return -ENOMEM;
1007 1182
1183 /*
1184 * self-manage the ordering dependencies between omap_device_enable/idle
1185 * and omap_device_assert/deassert_hardreset API
1186 */
1187 if (pdev->dev.pm_domain) {
1188 dev_dbg(&pdev->dev, "device pm_domain is being reset\n");
1189 pdev->dev.pm_domain = NULL;
1190 }
1191
1008 obj->name = dev_name(&pdev->dev); 1192 obj->name = dev_name(&pdev->dev);
1009 obj->nr_tlb_entries = 32; 1193 obj->nr_tlb_entries = 32;
1010 err = of_property_read_u32(of, "ti,#tlb-entries", &obj->nr_tlb_entries); 1194 err = of_property_read_u32(of, "ti,#tlb-entries", &obj->nr_tlb_entries);
@@ -1017,6 +1201,11 @@ static int omap_iommu_probe(struct platform_device *pdev)
1017 1201
1018 obj->dev = &pdev->dev; 1202 obj->dev = &pdev->dev;
1019 obj->ctx = (void *)obj + sizeof(*obj); 1203 obj->ctx = (void *)obj + sizeof(*obj);
1204 obj->cr_ctx = devm_kzalloc(&pdev->dev,
1205 sizeof(*obj->cr_ctx) * obj->nr_tlb_entries,
1206 GFP_KERNEL);
1207 if (!obj->cr_ctx)
1208 return -ENOMEM;
1020 1209
1021 spin_lock_init(&obj->iommu_lock); 1210 spin_lock_init(&obj->iommu_lock);
1022 spin_lock_init(&obj->page_table_lock); 1211 spin_lock_init(&obj->page_table_lock);
@@ -1093,6 +1282,14 @@ static int omap_iommu_remove(struct platform_device *pdev)
1093 return 0; 1282 return 0;
1094} 1283}
1095 1284
1285static const struct dev_pm_ops omap_iommu_pm_ops = {
1286 .prepare = omap_iommu_prepare,
1287 SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
1288 pm_runtime_force_resume)
1289 SET_RUNTIME_PM_OPS(omap_iommu_runtime_suspend,
1290 omap_iommu_runtime_resume, NULL)
1291};
1292
1096static const struct of_device_id omap_iommu_of_match[] = { 1293static const struct of_device_id omap_iommu_of_match[] = {
1097 { .compatible = "ti,omap2-iommu" }, 1294 { .compatible = "ti,omap2-iommu" },
1098 { .compatible = "ti,omap4-iommu" }, 1295 { .compatible = "ti,omap4-iommu" },
@@ -1106,6 +1303,7 @@ static struct platform_driver omap_iommu_driver = {
1106 .remove = omap_iommu_remove, 1303 .remove = omap_iommu_remove,
1107 .driver = { 1304 .driver = {
1108 .name = "omap-iommu", 1305 .name = "omap-iommu",
1306 .pm = &omap_iommu_pm_ops,
1109 .of_match_table = of_match_ptr(omap_iommu_of_match), 1307 .of_match_table = of_match_ptr(omap_iommu_of_match),
1110 }, 1308 },
1111}; 1309};
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index 7766d5a4f3f1..ca07fbf287d0 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -76,6 +76,9 @@ struct omap_iommu {
76 76
77 void *ctx; /* iommu context: registres saved area */ 77 void *ctx; /* iommu context: registres saved area */
78 78
79 struct cr_regs *cr_ctx;
80 u32 num_cr_ctx;
81
79 int has_bus_err_back; 82 int has_bus_err_back;
80 u32 id; 83 u32 id;
81 84
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
index ce1b7c6283ee..5b66325bc63c 100644
--- a/include/linux/omap-iommu.h
+++ b/include/linux/omap-iommu.h
@@ -13,12 +13,27 @@
13#ifndef _OMAP_IOMMU_H_ 13#ifndef _OMAP_IOMMU_H_
14#define _OMAP_IOMMU_H_ 14#define _OMAP_IOMMU_H_
15 15
16struct iommu_domain;
17
16#ifdef CONFIG_OMAP_IOMMU 18#ifdef CONFIG_OMAP_IOMMU
17extern void omap_iommu_save_ctx(struct device *dev); 19extern void omap_iommu_save_ctx(struct device *dev);
18extern void omap_iommu_restore_ctx(struct device *dev); 20extern void omap_iommu_restore_ctx(struct device *dev);
21
22int omap_iommu_domain_deactivate(struct iommu_domain *domain);
23int omap_iommu_domain_activate(struct iommu_domain *domain);
19#else 24#else
20static inline void omap_iommu_save_ctx(struct device *dev) {} 25static inline void omap_iommu_save_ctx(struct device *dev) {}
21static inline void omap_iommu_restore_ctx(struct device *dev) {} 26static inline void omap_iommu_restore_ctx(struct device *dev) {}
27
28static inline int omap_iommu_domain_deactivate(struct iommu_domain *domain)
29{
30 return -ENOTSUP;
31}
32
33static inline int omap_iommu_domain_activate(struct iommu_domain *domain)
34{
35 return -ENOTSUP;
36}
22#endif 37#endif
23 38
24#endif 39#endif
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h
index 1a0aa46a5ad6..6669dc9394da 100644
--- a/include/linux/platform_data/iommu-omap.h
+++ b/include/linux/platform_data/iommu-omap.h
@@ -16,6 +16,8 @@ struct iommu_platform_data {
16 const char *reset_name; 16 const char *reset_name;
17 int (*assert_reset)(struct platform_device *pdev, const char *name); 17 int (*assert_reset)(struct platform_device *pdev, const char *name);
18 int (*deassert_reset)(struct platform_device *pdev, const char *name); 18 int (*deassert_reset)(struct platform_device *pdev, const char *name);
19 int (*device_enable)(struct platform_device *pdev);
20 int (*device_idle)(struct platform_device *pdev);
19 int (*set_pwrdm_constraint)(struct platform_device *pdev, bool request, 21 int (*set_pwrdm_constraint)(struct platform_device *pdev, bool request,
20 u8 *pwrst); 22 u8 *pwrst);
21}; 23};