aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm+renesas@opensource.se>2017-10-16 08:30:50 -0400
committerAlex Williamson <alex.williamson@redhat.com>2017-11-06 12:29:39 -0500
commit58b8e8bf409236cdea379b8a3ab5d7b85a003d22 (patch)
treea3e29b043783b6e0acf0d1bf0cc618def1d91322
parentc295f504fb5a38abbb4094e687ee333a75613a0c (diff)
iommu/ipmmu-vmsa: Hook up r8a7795 DT matching code
Tie in r8a7795 features and update the IOMMU_OF_DECLARE compat string to include the updated compat string. Signed-off-by: Magnus Damm <damm+renesas@opensource.se> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--drivers/iommu/ipmmu-vmsa.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 65ad6910cb70..8dce3a9de9d8 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -25,6 +25,7 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/sizes.h> 26#include <linux/sizes.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/sys_soc.h>
28 29
29#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) 30#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
30#include <asm/dma-iommu.h> 31#include <asm/dma-iommu.h>
@@ -749,9 +750,24 @@ static int ipmmu_init_platform_device(struct device *dev,
749 return 0; 750 return 0;
750} 751}
751 752
753static bool ipmmu_slave_whitelist(struct device *dev)
754{
755 /* By default, do not allow use of IPMMU */
756 return false;
757}
758
759static const struct soc_device_attribute soc_r8a7795[] = {
760 { .soc_id = "r8a7795", },
761 { /* sentinel */ }
762};
763
752static int ipmmu_of_xlate(struct device *dev, 764static int ipmmu_of_xlate(struct device *dev,
753 struct of_phandle_args *spec) 765 struct of_phandle_args *spec)
754{ 766{
767 /* For R-Car Gen3 use a white list to opt-in slave devices */
768 if (soc_device_match(soc_r8a7795) && !ipmmu_slave_whitelist(dev))
769 return -ENODEV;
770
755 iommu_fwspec_add_ids(dev, spec->args, 1); 771 iommu_fwspec_add_ids(dev, spec->args, 1);
756 772
757 /* Initialize once - xlate() will call multiple times */ 773 /* Initialize once - xlate() will call multiple times */
@@ -903,11 +919,22 @@ static const struct ipmmu_features ipmmu_features_default = {
903 .twobit_imttbcr_sl0 = false, 919 .twobit_imttbcr_sl0 = false,
904}; 920};
905 921
922static const struct ipmmu_features ipmmu_features_r8a7795 = {
923 .use_ns_alias_offset = false,
924 .has_cache_leaf_nodes = true,
925 .number_of_contexts = 8,
926 .setup_imbuscr = false,
927 .twobit_imttbcr_sl0 = true,
928};
929
906static const struct of_device_id ipmmu_of_ids[] = { 930static const struct of_device_id ipmmu_of_ids[] = {
907 { 931 {
908 .compatible = "renesas,ipmmu-vmsa", 932 .compatible = "renesas,ipmmu-vmsa",
909 .data = &ipmmu_features_default, 933 .data = &ipmmu_features_default,
910 }, { 934 }, {
935 .compatible = "renesas,ipmmu-r8a7795",
936 .data = &ipmmu_features_r8a7795,
937 }, {
911 /* Terminator */ 938 /* Terminator */
912 }, 939 },
913}; 940};
@@ -1090,6 +1117,8 @@ static int __init ipmmu_vmsa_iommu_of_setup(struct device_node *np)
1090 1117
1091IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa", 1118IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa",
1092 ipmmu_vmsa_iommu_of_setup); 1119 ipmmu_vmsa_iommu_of_setup);
1120IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
1121 ipmmu_vmsa_iommu_of_setup);
1093#endif 1122#endif
1094 1123
1095MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU"); 1124MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");