Skip to contentSkip to conversation

iommu/exynos: support for device tree

PATCH NAK Cho KyongHo 3 participants 9 messages Mar 14, 2014 – Mar 19, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v11 13/27 iommu/exynos: support for device tree

This commit adds device tree support for System MMU.

---
 drivers/iommu/Kconfig        |    5 ++---
 drivers/iommu/exynos-iommu.c |   21 +++++++++++++++++----
 2 files changed, 19 insertions(+), 7 deletions(-)
drivers/iommu/Kconfig +2 -3
index df56e4c..22af807 100644
@@ -178,16 +178,15 @@ config TEGRA_IOMMU_SMMU
 
 config EXYNOS_IOMMU
 	bool "Exynos IOMMU Support"
-	depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
+	depends on ARCH_EXYNOS
 	select IOMMU_API
+	default n
 	help
 	  Support for the IOMMU(System MMU) of Samsung Exynos application
 	  processor family. This enables H/W multimedia accellerators to see
 	  non-linear physical memory chunks as a linear memory in their
 	  address spaces
 
-	  If unsure, say N here.
-
 config EXYNOS_IOMMU_DEBUG
 	bool "Debugging log for Exynos IOMMU"
 	depends on EXYNOS_IOMMU
drivers/iommu/exynos-iommu.c +17 -4
index 33b424d..34feb04 100644
@@ -26,6 +26,7 @@
 #include <linux/list.h>
 #include <linux/memblock.h>
 #include <linux/export.h>
+#include <linux/of.h>
 
 #include <asm/cacheflush.h>
 #include <asm/pgtable.h>
@@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
 	read_unlock_irqrestore(&data->lock, flags);
 }
 
-static int exynos_sysmmu_probe(struct platform_device *pdev)
+static int __init exynos_sysmmu_probe(struct platform_device *pdev)
 {
 	int irq, ret;
 	struct device *dev = &pdev->dev;
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static struct platform_driver exynos_sysmmu_driver = {
-	.probe		= exynos_sysmmu_probe,
-	.driver		= {
+#ifdef CONFIG_OF
+static struct of_device_id sysmmu_of_match[] __initconst = {
+	{ .compatible	= "samsung,sysmmu-v1", },
+	{ .compatible	= "samsung,sysmmu-v2", },
+	{ .compatible	= "samsung,sysmmu-v3.1", },
+	{ .compatible	= "samsung,sysmmu-v3.2", },
+	{ .compatible	= "samsung,sysmmu-v3.3", },
+	{ },
+};
+#endif
+
+static struct platform_driver exynos_sysmmu_driver __refdata = {
+	.probe	= exynos_sysmmu_probe,
+	.driver	= {
 		.owner		= THIS_MODULE,
 		.name		= "exynos-sysmmu",
+		.of_match_table	= of_match_ptr(sysmmu_of_match),
 	}
 };
 
Signature · 1 line
1.7.9.5
#1 lore raw

Hi KyongHo,

Quoted 13 lines · Cho KyongHo

This commit adds device tree support for System MMU.

---
  drivers/iommu/Kconfig        |    5 ++---
  drivers/iommu/exynos-iommu.c |   21 +++++++++++++++++----
  2 files changed, 19 insertions(+), 7 deletions(-)
drivers/iommu/Kconfig +0 -0
index df56e4c..22af807 100644

drivers/iommu/Kconfig config TEGRA_IOMMU_SMMU · line 185

Quoted 9 lines
drivers/iommu/Kconfig +2 -1
@@ -178,16 +178,15 @@ config TEGRA_IOMMU_SMMU
 
  config EXYNOS_IOMMU
  	bool "Exynos IOMMU Support"
-	depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
+	depends on ARCH_EXYNOS
  	select IOMMU_API
+	default n
  	help
  	  Support for the IOMMU(System MMU) of Samsung Exynos application

nit: There should be a white space before the opening parenthesis.

drivers/iommu/Kconfig config TEGRA_IOMMU_SMMU · line 186

Quoted 1 line
drivers/iommu/Kconfig +0 -0
  	  processor family. This enables H/W multimedia accellerators to see

typo: s/accellerators/accelerators/

Quoted 33 lines
drivers/iommu/Kconfig +0 -2
  	  non-linear physical memory chunks as a linear memory in their
  	  address spaces
 
-	  If unsure, say N here.
-
  config EXYNOS_IOMMU_DEBUG
  	bool "Debugging log for Exynos IOMMU"
  	depends on EXYNOS_IOMMU
drivers/iommu/exynos-iommu.c +2 -1
index 33b424d..34feb04 100644
@@ -26,6 +26,7 @@
  #include <linux/list.h>
  #include <linux/memblock.h>
  #include <linux/export.h>
+#include <linux/of.h>
 
  #include <asm/cacheflush.h>
  #include <asm/pgtable.h>
@@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
  	read_unlock_irqrestore(&data->lock, flags);
  }
 
-static int exynos_sysmmu_probe(struct platform_device *pdev)
+static int __init exynos_sysmmu_probe(struct platform_device *pdev)
  {
  	int irq, ret;
  	struct device *dev = &pdev->dev;
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
  	return 0;
  }
 

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 567

Quoted 10 lines
drivers/iommu/exynos-iommu.c +7 -3
-static struct platform_driver exynos_sysmmu_driver = {
-	.probe		= exynos_sysmmu_probe,
-	.driver		= {
+#ifdef CONFIG_OF
+static struct of_device_id sysmmu_of_match[] __initconst = {
+	{ .compatible	= "samsung,sysmmu-v1", },
+	{ .compatible	= "samsung,sysmmu-v2", },
+	{ .compatible	= "samsung,sysmmu-v3.1", },
+	{ .compatible	= "samsung,sysmmu-v3.2", },
+	{ .compatible	= "samsung,sysmmu-v3.3", },

Do you need all these compatible strings? I mean, are there any implementation differences that can't be identified by reading IP registers, such as REG_MMU_VERSION?

Best regards,
Tomasz

#2 lore raw
Quoted 17 lines · Tomasz Figa

Hi KyongHo,

Quoted 14 lines · Cho KyongHo

This commit adds device tree support for System MMU.

---
  drivers/iommu/Kconfig        |    5 ++---
  drivers/iommu/exynos-iommu.c |   21 +++++++++++++++++----
  2 files changed, 19 insertions(+), 7 deletions(-)
drivers/iommu/Kconfig +0 -0
index df56e4c..22af807 100644
@@ -178,16 +178,15 @@ config TEGRA_IOMMU_SMMU
 
Quoted 11 lines

drivers/iommu/Kconfig config TEGRA_IOMMU_SMMU · line 185

Quoted 8 lines
drivers/iommu/Kconfig +2 -1
  config EXYNOS_IOMMU
  	bool "Exynos IOMMU Support"
-	depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
+	depends on ARCH_EXYNOS
  	select IOMMU_API
+	default n
  	help
  	  Support for the IOMMU(System MMU) of Samsung Exynos application

nit: There should be a white space before the opening parenthesis.

Ok. :)

Quoted 4 lines

drivers/iommu/Kconfig config TEGRA_IOMMU_SMMU · line 186

Quoted 1 line
drivers/iommu/Kconfig +0 -0
  	  processor family. This enables H/W multimedia accellerators to see

typo: s/accellerators/accelerators/

Ok.

Quoted 33 lines
Quoted 33 lines
drivers/iommu/Kconfig +0 -2
  	  non-linear physical memory chunks as a linear memory in their
  	  address spaces
 
-	  If unsure, say N here.
-
  config EXYNOS_IOMMU_DEBUG
  	bool "Debugging log for Exynos IOMMU"
  	depends on EXYNOS_IOMMU
drivers/iommu/exynos-iommu.c +2 -1
index 33b424d..34feb04 100644
@@ -26,6 +26,7 @@
  #include <linux/list.h>
  #include <linux/memblock.h>
  #include <linux/export.h>
+#include <linux/of.h>
 
  #include <asm/cacheflush.h>
  #include <asm/pgtable.h>
@@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
  	read_unlock_irqrestore(&data->lock, flags);
  }
 
-static int exynos_sysmmu_probe(struct platform_device *pdev)
+static int __init exynos_sysmmu_probe(struct platform_device *pdev)
  {
  	int irq, ret;
  	struct device *dev = &pdev->dev;
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
  	return 0;
  }
 
Quoted 15 lines

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 567

Quoted 10 lines
drivers/iommu/exynos-iommu.c +7 -3
-static struct platform_driver exynos_sysmmu_driver = {
-	.probe		= exynos_sysmmu_probe,
-	.driver		= {
+#ifdef CONFIG_OF
+static struct of_device_id sysmmu_of_match[] __initconst = {
+	{ .compatible	= "samsung,sysmmu-v1", },
+	{ .compatible	= "samsung,sysmmu-v2", },
+	{ .compatible	= "samsung,sysmmu-v3.1", },
+	{ .compatible	= "samsung,sysmmu-v3.2", },
+	{ .compatible	= "samsung,sysmmu-v3.3", },

Do you need all these compatible strings? I mean, are there any implementation differences that can't be identified by reading IP registers, such as REG_MMU_VERSION?

Unfortunately, there is a SoC which overrides REG_MMU_VERSION with a value for RTL designers and it is not related to System MMU versions.

Thank you.

KyongHo

#3 lore raw
Quoted 21 lines · Cho KyongHo
Quoted 4 lines · Tomasz Figa
Quoted 4 lines
drivers/iommu/exynos-iommu.c +0 -0
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
   	return 0;
   }
 
Quoted 15 lines

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 567

Quoted 10 lines
drivers/iommu/exynos-iommu.c +7 -3
-static struct platform_driver exynos_sysmmu_driver = {
-	.probe		= exynos_sysmmu_probe,
-	.driver		= {
+#ifdef CONFIG_OF
+static struct of_device_id sysmmu_of_match[] __initconst = {
+	{ .compatible	= "samsung,sysmmu-v1", },
+	{ .compatible	= "samsung,sysmmu-v2", },
+	{ .compatible	= "samsung,sysmmu-v3.1", },
+	{ .compatible	= "samsung,sysmmu-v3.2", },
+	{ .compatible	= "samsung,sysmmu-v3.3", },

Do you need all these compatible strings? I mean, are there any implementation differences that can't be identified by reading IP registers, such as REG_MMU_VERSION?

Quoted 3 lines

Unfortunately, there is a SoC which overrides REG_MMU_VERSION with a value for RTL designers and it is not related to System MMU versions.

OK.

What about having a generic compatible string for Samsung SysMMU then, but an additional property that can override the version to account for such brokenness? If not provided, the version would be read from REG_MMU_VERSION.

Best regards,
Tomasz

#4 lore raw
Quoted 26 lines · Tomasz Figa
Quoted 21 lines · Cho KyongHo
Quoted 4 lines · Tomasz Figa
Quoted 4 lines
drivers/iommu/exynos-iommu.c +0 -0
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
   	return 0;
   }
 
Quoted 15 lines

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 567

Quoted 10 lines
drivers/iommu/exynos-iommu.c +7 -3
-static struct platform_driver exynos_sysmmu_driver = {
-	.probe		= exynos_sysmmu_probe,
-	.driver		= {
+#ifdef CONFIG_OF
+static struct of_device_id sysmmu_of_match[] __initconst = {
+	{ .compatible	= "samsung,sysmmu-v1", },
+	{ .compatible	= "samsung,sysmmu-v2", },
+	{ .compatible	= "samsung,sysmmu-v3.1", },
+	{ .compatible	= "samsung,sysmmu-v3.2", },
+	{ .compatible	= "samsung,sysmmu-v3.3", },

Do you need all these compatible strings? I mean, are there any implementation differences that can't be identified by reading IP registers, such as REG_MMU_VERSION?

Quoted 3 lines

Unfortunately, there is a SoC which overrides REG_MMU_VERSION with a value for RTL designers and it is not related to System MMU versions.

Quoted 7 lines

OK.

What about having a generic compatible string for Samsung SysMMU then, but an additional property that can override the version to account for such brokenness? If not provided, the version would be read from REG_MMU_VERSION.

Yes it is one of possible idea.
Let me think what better way is.

Thank you.

KyongHo

#5 lore raw
In reply to Cho KyongHo

Hi KyongHo,

Quoted 13 lines · Cho KyongHo

This commit adds device tree support for System MMU.

---
 drivers/iommu/Kconfig        |    5 ++---
 drivers/iommu/exynos-iommu.c |   21 +++++++++++++++++----
 2 files changed, 19 insertions(+), 7 deletions(-)
drivers/iommu/Kconfig +0 -0
index df56e4c..22af807 100644

drivers/iommu/Kconfig config TEGRA_IOMMU_SMMU · line 183

Quoted 7 lines
drivers/iommu/Kconfig +2 -1
@@ -178,16 +178,15 @@ config TEGRA_IOMMU_SMMU
 
 config EXYNOS_IOMMU
        bool "Exynos IOMMU Support"
-       depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
+       depends on ARCH_EXYNOS
        select IOMMU_API
+       default n

This is not needed as it is the default choice.

Quoted 33 lines
drivers/iommu/Kconfig +0 -2
        help
          Support for the IOMMU(System MMU) of Samsung Exynos application
          processor family. This enables H/W multimedia accellerators to see
          non-linear physical memory chunks as a linear memory in their
          address spaces
 
-         If unsure, say N here.
-
 config EXYNOS_IOMMU_DEBUG
        bool "Debugging log for Exynos IOMMU"
        depends on EXYNOS_IOMMU
drivers/iommu/exynos-iommu.c +2 -1
index 33b424d..34feb04 100644
@@ -26,6 +26,7 @@
 #include <linux/list.h>
 #include <linux/memblock.h>
 #include <linux/export.h>
+#include <linux/of.h>
 
 #include <asm/cacheflush.h>
 #include <asm/pgtable.h>
@@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
        read_unlock_irqrestore(&data->lock, flags);
 }
 
-static int exynos_sysmmu_probe(struct platform_device *pdev)
+static int __init exynos_sysmmu_probe(struct platform_device *pdev)
 {
        int irq, ret;
        struct device *dev = &pdev->dev;

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 561

Quoted 7 lines
drivers/iommu/exynos-iommu.c +1 -3
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
        return 0;
 }
 
-static struct platform_driver exynos_sysmmu_driver = {
-       .probe          = exynos_sysmmu_probe,
-       .driver         = {
+#ifdef CONFIG_OF

This is not needed as Exynos is DT only platform.

Quoted 6 lines
drivers/iommu/exynos-iommu.c +6 -0
+static struct of_device_id sysmmu_of_match[] __initconst = {
+       { .compatible   = "samsung,sysmmu-v1", },
+       { .compatible   = "samsung,sysmmu-v2", },
+       { .compatible   = "samsung,sysmmu-v3.1", },
+       { .compatible   = "samsung,sysmmu-v3.2", },
+       { .compatible   = "samsung,sysmmu-v3.3", },

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 577

Quoted 10 lines
drivers/iommu/exynos-iommu.c +8 -0
+       { },
+};
+#endif
+
+static struct platform_driver exynos_sysmmu_driver __refdata = {
+       .probe  = exynos_sysmmu_probe,
+       .driver = {
                .owner          = THIS_MODULE,
                .name           = "exynos-sysmmu",
+               .of_match_table = of_match_ptr(sysmmu_of_match),

of_match_ptr is not needed for the same reason as above.

Signature · 2 lines
With warm regards,
Sachin
#6 lore raw
Quoted 17 lines · Sachin Kamat

Hi KyongHo,

Quoted 14 lines · Cho KyongHo

This commit adds device tree support for System MMU.

---
 drivers/iommu/Kconfig        |    5 ++---
 drivers/iommu/exynos-iommu.c |   21 +++++++++++++++++----
 2 files changed, 19 insertions(+), 7 deletions(-)
drivers/iommu/Kconfig +0 -0
index df56e4c..22af807 100644
@@ -178,16 +178,15 @@ config TEGRA_IOMMU_SMMU
 
Quoted 9 lines

drivers/iommu/Kconfig config TEGRA_IOMMU_SMMU · line 183

Quoted 6 lines
drivers/iommu/Kconfig +2 -1
 config EXYNOS_IOMMU
        bool "Exynos IOMMU Support"
-       depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
+       depends on ARCH_EXYNOS
        select IOMMU_API
+       default n

This is not needed as it is the default choice.

OK.

Quoted 36 lines
Quoted 36 lines
drivers/iommu/Kconfig +0 -2
        help
          Support for the IOMMU(System MMU) of Samsung Exynos application
          processor family. This enables H/W multimedia accellerators to see
          non-linear physical memory chunks as a linear memory in their
          address spaces
 
-         If unsure, say N here.
-
 config EXYNOS_IOMMU_DEBUG
        bool "Debugging log for Exynos IOMMU"
        depends on EXYNOS_IOMMU
drivers/iommu/exynos-iommu.c +2 -1
index 33b424d..34feb04 100644
@@ -26,6 +26,7 @@
 #include <linux/list.h>
 #include <linux/memblock.h>
 #include <linux/export.h>
+#include <linux/of.h>
 
 #include <asm/cacheflush.h>
 #include <asm/pgtable.h>
@@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
        read_unlock_irqrestore(&data->lock, flags);
 }
 
-static int exynos_sysmmu_probe(struct platform_device *pdev)
+static int __init exynos_sysmmu_probe(struct platform_device *pdev)
 {
        int irq, ret;
        struct device *dev = &pdev->dev;
@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
        return 0;
 }
 
Quoted 7 lines

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 561

Quoted 4 lines
drivers/iommu/exynos-iommu.c +1 -3
-static struct platform_driver exynos_sysmmu_driver = {
-       .probe          = exynos_sysmmu_probe,
-       .driver         = {
+#ifdef CONFIG_OF

This is not needed as Exynos is DT only platform.

Yes, but I hesitate to remove that.

Quoted 10 lines
Quoted 10 lines
drivers/iommu/exynos-iommu.c +10 -0
+static struct of_device_id sysmmu_of_match[] __initconst = {
+       { .compatible   = "samsung,sysmmu-v1", },
+       { .compatible   = "samsung,sysmmu-v2", },
+       { .compatible   = "samsung,sysmmu-v3.1", },
+       { .compatible   = "samsung,sysmmu-v3.2", },
+       { .compatible   = "samsung,sysmmu-v3.3", },
+       { },
+};
+#endif
+
Quoted 9 lines

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 577

Quoted 6 lines
drivers/iommu/exynos-iommu.c +4 -0
+static struct platform_driver exynos_sysmmu_driver __refdata = {
+       .probe  = exynos_sysmmu_probe,
+       .driver = {
                .owner          = THIS_MODULE,
                .name           = "exynos-sysmmu",
+               .of_match_table = of_match_ptr(sysmmu_of_match),

of_match_ptr is not needed for the same reason as above.

Ditto.

Thanks.

KyongHo

#7 lore raw
Quoted 5 lines · Cho KyongHo
Quoted 4 lines · Sachin Kamat

Hi KyongHo,

Quoted 1 line · Cho KyongHo
Quoted 8 lines
Quoted 7 lines

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 561

Quoted 4 lines
drivers/iommu/exynos-iommu.c +1 -3
-static struct platform_driver exynos_sysmmu_driver = {
-       .probe          = exynos_sysmmu_probe,
-       .driver         = {
+#ifdef CONFIG_OF

This is not needed as Exynos is DT only platform.

Yes, but I hesitate to remove that.

What is the reason for your hesitation? :)

Signature · 2 lines
With warm regards,
Sachin
#8 lore raw
Quoted 13 lines · Sachin Kamat
Quoted 12 lines · Cho KyongHo
Quoted 11 lines · Sachin Kamat

Hi KyongHo,

drivers/iommu/exynos-iommu.c static int exynos_sysmmu_probe(struct platform_device *pdev) · line 561

Quoted 5 lines · Cho KyongHo
drivers/iommu/exynos-iommu.c +1 -3
-static struct platform_driver exynos_sysmmu_driver = {
-       .probe          = exynos_sysmmu_probe,
-       .driver         = {
+#ifdef CONFIG_OF

This is not needed as Exynos is DT only platform.

Quoted 4 lines
Quoted 1 line

Yes, but I hesitate to remove that.

What is the reason for your hesitation? :)

Actually, no reason because you mentioned that Exynos is DT only platofrm.

I will remove that.

Thank you.

KyongHo