msm: iommu: Add ref-counting to attach and detach

Add ref-counting of attaching and detaching to support
sharing of context banks between multiple clients.

Change-Id: I778ad88b9c2608433c694497b8d13f6dfdd10d02
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/arch/arm/mach-msm/include/mach/iommu.h b/arch/arm/mach-msm/include/mach/iommu.h
index 8ebd0cf..8b39e34 100644
--- a/arch/arm/mach-msm/include/mach/iommu.h
+++ b/arch/arm/mach-msm/include/mach/iommu.h
@@ -130,6 +130,7 @@
  * @secure_context	true if this is a secure context programmed by
 			the secure environment, false otherwise
  * @asid		ASID used with this context.
+ * @attach_count	Number of time this context has been attached.
  *
  * A msm_iommu_ctx_drvdata holds the driver data for a single context bank
  * within each IOMMU hardware instance
@@ -144,6 +145,7 @@
 	unsigned int nsid;
 	unsigned int secure_context;
 	int asid;
+	int attach_count;
 };
 
 /*