Skip to contentSkip to conversation

Exynos: fix SYSMMU driver to work with power domains

PATCH New Marek Szyprowski 6 participants 13 messages Apr 11, 2012 – May 11, 2012

Subsystems (5)
lore
Share & tools
lore

Marek Szyprowski

author maintainer
#0 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

Hi!

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

[1] https://lkml.org/lkml/2012/3/15/51

Best regards
Marek Szyprowski
Samsung Poland R&D Center

Patch summary:

Marek Szyprowski (2):
iommu/exynos: fix runtime pm support
ARM: Exynos4: update SYSMMU setup code for gen_pd power domain driver

 arch/arm/mach-exynos/dev-sysmmu.c |    6 +++++-
 arch/arm/mach-exynos/pm_domains.c |   13 +++++++++++++
 drivers/iommu/exynos-iommu.c      |   20 ++++++++++++++++++--
 3 files changed, 36 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.1.569.g6f426
author maintainer
#1 lore raw

PATCH 1/2 iommu/exynos: fix runtime pm support

Fix registration to runtime pw and add missing resume callback.

---
 drivers/iommu/exynos-iommu.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
drivers/iommu/exynos-iommu.c +18 -2
index b8daf7c..eef924d 100644
@@ -651,8 +651,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
 
 	__set_fault_handler(data, &default_fault_handler);
 
-	if (dev->parent)
-		pm_runtime_enable(dev);
+	pm_runtime_enable(dev);
 
 	dev_dbg(dev, "(%s) Initialized\n", data->dbgname);
 	return 0;
@@ -674,11 +673,28 @@ err_alloc:
 	return ret;
 }
 
+static int exynos_pm_resume(struct device *dev)
+{
+	struct sysmmu_drvdata *data;
+
+	data = dev_get_drvdata(dev);
+
+	if (is_sysmmu_active(data))
+		__exynos_sysmmu_enable(data, data->pgtable, NULL);
+
+	return 0;
+}
+
+const struct dev_pm_ops exynos_pm_ops = {
+	.resume = &exynos_pm_resume,
+};
+
 static struct platform_driver exynos_sysmmu_driver = {
 	.probe		= exynos_sysmmu_probe,
 	.driver		= {
 		.owner		= THIS_MODULE,
 		.name		= "exynos-sysmmu",
+		.pm		= &exynos_pm_ops,
 	}
 };
 
Signature · 1 line
1.7.1.569.g6f426
#2 lore raw

PATCH 1/2 iommu/exynos: fix runtime pm support

Hello.

Quoted 12 lines · Marek Szyprowski

Fix registration to runtime pw and add missing resume callback.

---
 drivers/iommu/exynos-iommu.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
drivers/iommu/exynos-iommu.c +0 -0
index b8daf7c..eef924d 100644

[...]

drivers/iommu/exynos-iommu.c err_alloc: · line 680

Quoted 9 lines
drivers/iommu/exynos-iommu.c +5 -0
@@ -674,11 +673,28 @@ err_alloc:
 	return ret;
 }
 
+static int exynos_pm_resume(struct device *dev)
+{
+	struct sysmmu_drvdata *data;
+
+	data = dev_get_drvdata(dev);

Why not do it right in the initializer?

WBR, Sergei

#3 lore raw

PATCH 1/2 iommu/exynos: fix runtime pm support

In reply to Marek Szyprowski
Quoted 41 lines · Marek Szyprowski

Fix registration to runtime pw and add missing resume callback.

---
  drivers/iommu/exynos-iommu.c |   20 ++++++++++++++++++--
  1 files changed, 18 insertions(+), 2 deletions(-)
drivers/iommu/exynos-iommu.c +16 -2
index b8daf7c..eef924d 100644
@@ -651,8 +651,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
 
  	__set_fault_handler(data,&default_fault_handler);
 
-	if (dev->parent)
-		pm_runtime_enable(dev);
+	pm_runtime_enable(dev);
 
  	dev_dbg(dev, "(%s) Initialized\n", data->dbgname);
  	return 0;
@@ -674,11 +673,28 @@ err_alloc:
  	return ret;
  }
 
+static int exynos_pm_resume(struct device *dev)
+{
+	struct sysmmu_drvdata *data;
+
+	data = dev_get_drvdata(dev);
+
+	if (is_sysmmu_active(data))
+		__exynos_sysmmu_enable(data, data->pgtable, NULL);
+
+	return 0;
+}
+
+const struct dev_pm_ops exynos_pm_ops = {
+	.resume =&exynos_pm_resume,
+};

drivers/iommu/exynos-iommu.c err_alloc: · line 700

Quoted 10 lines
drivers/iommu/exynos-iommu.c +2 -0
+
  static struct platform_driver exynos_sysmmu_driver = {
  	.probe		= exynos_sysmmu_probe,
  	.driver		= {
  		.owner		= THIS_MODULE,
  		.name		= "exynos-sysmmu",
+		.pm		=&exynos_pm_ops,
  	}
  };
 

Joerg,

This patch is needed to correct run-time pm for EXYNOS SoCs with System MMU after KyongHo's iommu/exynos patch. So if you're ok on this, let me apply this in samsung tree.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

author maintainer
#4 lore raw

PATCH 2/2 ARM: Exynos4: update SYSMMU setup code for gen_pd power domain driver

In reply to Marek Szyprowski

SYSMMU platform devices must be registered before setting up power domains to let power domain driver to correctly register also SYSMMU controller devices. This patch also registers SYSMMU controller devices to respective power domains.

---
 arch/arm/mach-exynos/dev-sysmmu.c |    6 +++++-
 arch/arm/mach-exynos/pm_domains.c |   13 +++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/dev-sysmmu.c +5 -1
index c5b1ea3..3544638 100644
@@ -271,4 +271,8 @@ static int __init init_sysmmu_platform_device(void)
 
 	return 0;
 }
-arch_initcall(init_sysmmu_platform_device);
+/*
+ * SYSMMU platform devices must be registered before power domains
+ * see pm_domain.c, which use arch_initcall()
+ */
+core_initcall(init_sysmmu_platform_device);
arch/arm/mach-exynos/pm_domains.c +13 -0
index 13b3068..51a028d 100644
@@ -21,6 +21,7 @@
 #include <linux/of_address.h>
 
 #include <mach/regs-pmu.h>
+#include <mach/sysmmu.h>
 #include <plat/devs.h>
 
 /*
@@ -155,6 +156,18 @@ static __init int exynos4_pm_init_power_domain(void)
 		pm_genpd_init(&exynos4_pm_domains[idx]->pd, NULL,
 				exynos4_pm_domains[idx]->is_off);
 
+#ifdef CONFIG_EXYNOS_DEV_SYSMMU
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(fimc0), &exynos4_pd_cam);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(fimc1), &exynos4_pd_cam);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(fimc2), &exynos4_pd_cam);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(fimc3), &exynos4_pd_cam);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(jpeg), &exynos4_pd_cam);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(mfc_l), &exynos4_pd_mfc);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(mfc_r), &exynos4_pd_mfc);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(fimd0), &exynos4_pd_lcd0);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(rot), &exynos4_pd_lcd0);
+	exynos_pm_add_dev_to_genpd(&SYSMMU_PLATDEV(tv), &exynos4_pd_tv);
+#endif
 #ifdef CONFIG_S5P_DEV_FIMD0
 	exynos_pm_add_dev_to_genpd(&s5p_device_fimd0, &exynos4_pd_lcd0);
 #endif
Signature · 1 line
1.7.1.569.g6f426
#5 lore raw

PATCH 2/2 ARM: Exynos4: update SYSMMU setup code for gen_pd power domain driver

Quoted 17 lines · Marek Szyprowski

SYSMMU platform devices must be registered before setting up power domains to let power domain driver to correctly register also SYSMMU controller devices. This patch also registers SYSMMU controller devices to respective power domains.

---
?arch/arm/mach-exynos/dev-sysmmu.c | ? ?6 +++++- ?arch/arm/mach-exynos/pm_domains.c | ? 13 +++++++++++++ ?2 files changed, 18 insertions(+), 1 deletions(-)

arch/arm/mach-exynos/dev-sysmmu.c +0 -0
index c5b1ea3..3544638 100644

arch/arm/mach-exynos/dev-sysmmu.c static int __init init_sysmmu_platform_device(void) · line 278

Quoted 9 lines
arch/arm/mach-exynos/dev-sysmmu.c +5 -1
@@ -271,4 +271,8 @@ static int __init init_sysmmu_platform_device(void)
 
 ? ? ? ?return 0;
 ?}
-arch_initcall(init_sysmmu_platform_device);
+/*
+ * SYSMMU platform devices must be registered before power domains
+ * see pm_domain.c, which use arch_initcall()
+ */
+core_initcall(init_sysmmu_platform_device);

I don't understand why init_sysmmu_platform_device() must be called before exynos4_pm_init_power_domain()?

Other devices also added by an arch_initcall() function which calls mdesc->init_machine().
I also was unable to find any reason to add devices before registering the devices
to pm domain.

Regards,

KyongHo.

author maintainer
#6 lore raw

PATCH 2/2 ARM: Exynos4: update SYSMMU setup code for gen_pd power domain driver

Hi,

Quoted 31 lines · KyongHo Cho
Quoted 17 lines · Marek Szyprowski

SYSMMU platform devices must be registered before setting up power domains to let power domain driver to correctly register also SYSMMU controller devices. This patch also registers SYSMMU controller devices to respective power domains.

---
?arch/arm/mach-exynos/dev-sysmmu.c | ? ?6 +++++- ?arch/arm/mach-exynos/pm_domains.c | ? 13 +++++++++++++ ?2 files changed, 18 insertions(+), 1 deletions(-)

arch/arm/mach-exynos/dev-sysmmu.c +0 -0
index c5b1ea3..3544638 100644

arch/arm/mach-exynos/dev-sysmmu.c static int __init init_sysmmu_platform_device(void) · line 278

Quoted 9 lines
arch/arm/mach-exynos/dev-sysmmu.c +5 -1
@@ -271,4 +271,8 @@ static int __init init_sysmmu_platform_device(void)
 
 ? ? ? ?return 0;
 ?}
-arch_initcall(init_sysmmu_platform_device);
+/*
+ * SYSMMU platform devices must be registered before power domains
+ * see pm_domain.c, which use arch_initcall()
+ */
+core_initcall(init_sysmmu_platform_device);

I don't understand why init_sysmmu_platform_device() must be called before exynos4_pm_init_power_domain()?

Quoted 4 lines

Other devices also added by an arch_initcall() function which calls mdesc->init_machine().
I also was unable to find any reason to add devices before registering the devices to pm domain.

mdesc->init_machine is called before exynos4_pm_init_power_domain() from arch/arm/mach-exynos/pm_domain.c, although both are started from arch_initcall. In this case the order of linking defines the order of calls.

exynos4_pm_init_power_domain() calls exynos_pm_add_dev_to_genpd() which in turn checks for pdev->dev.bus. All devices which have not been registered yet on the bus are simply skipped.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#7 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

In reply to Marek Szyprowski
Quoted 6 lines · Marek Szyprowski

Hi!

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

Thanks, Marek.

Your way of power gating is right
and I will look into the changed runtime PM scheme in Exynos tree.

Quoted 1 line

[1] https://lkml.org/lkml/2012/3/15/51

Regards,

KyongHo

#8 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

Quoted 4 lines · KyongHo Cho
Quoted 2 lines · Marek Szyprowski

Hi!

Quoted 9 lines
Quoted 4 lines

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

Thanks, Marek.

Your way of power gating is right
and I will look into the changed runtime PM scheme in Exynos tree.

KyongHo,

Do you want to upstream this series with your previous sysmmu (cleanup and moving) patches?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#9 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

Quoted 13 lines · Kukjin Kim
Quoted 12 lines · KyongHo Cho
Quoted 7 lines · On Wed, Apr 11, 2012 at 11:34 PM, Marek Szyprowski <[email protected]>…

Hi!

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

Thanks, Marek.

Quoted 8 lines
Quoted 3 lines

Your way of power gating is right
and I will look into the changed runtime PM scheme in Exynos tree.

KyongHo,

Do you want to upstream this series with your previous sysmmu (cleanup and moving) patches?

Yes I hope so.
Marek's patch corrects run-time power management in Exynos4 with System MMU.

Thank you.

KyongHo

#10 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

Quoted 17 lines · KyongHo Cho
Quoted 16 lines · Kukjin Kim
Quoted 15 lines · KyongHo Cho
Quoted 7 lines · Marek Szyprowski

Hi!

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

Thanks, Marek.

Your way of power gating is right
and I will look into the changed runtime PM scheme in Exynos tree.

Quoted 8 lines
Quoted 5 lines

KyongHo,

Do you want to upstream this series with your previous sysmmu (cleanup and moving) patches?

Yes I hope so.
Marek's patch corrects run-time power management in Exynos4 with System MMU.

Hi,

Next time, if you give Acked-By or Reviewed_by, then it's more helpful to determine to merge or not.

Thank you,
Kyungmin Park

Quoted 10 lines

Thank you.

KyongHo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

Quoted 24 lines · Kyungmin Park
Quoted 23 lines · KyongHo Cho
Quoted 21 lines · Kukjin Kim
Quoted 6 lines · KyongHo Cho
Quoted 3 lines · On Wed, Apr 11, 2012 at 11:34 PM, Marek Szyprowski <[email protected]>…

Hi!

Quoted 9 lines
Quoted 4 lines

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

Thanks, Marek.

Your way of power gating is right
and I will look into the changed runtime PM scheme in Exynos tree.

KyongHo,

Do you want to upstream this series with your previous sysmmu (cleanup and moving) patches?

Quoted 8 lines
Quoted 2 lines

Yes I hope so.
Marek's patch corrects run-time power management in Exynos4 with System MMU.

Hi,

Next time, if you give Acked-By or Reviewed_by, then it's more helpful to determine to merge or not.

I did not Ack it since he did not CC me.
But, as you mentioned, I need to add my Reviewed-by after reviewing it.

Thank you.

KyongHo.

#12 lore raw

cover Exynos: fix SYSMMU driver to work with power domains

In reply to Marek Szyprowski

Hello Marek,

I have tested these patches on origen 3.4-rc2 with sysmmu_v12, and they work great ! Thank you for sharing them.

Regards,
Subash

Quoted 24 lines · Marek Szyprowski

Hi!

These two patches fixes operation of the SYSMMU driver (v12 version [1]) with the new power domain driver based on generic power domains and runtime pw, which has been merged to Linux kernel v3.4-rc1.

[1] https://lkml.org/lkml/2012/3/15/51

Best regards
Marek Szyprowski
Samsung Poland R&D Center

Patch summary:

Marek Szyprowski (2):
iommu/exynos: fix runtime pm support
ARM: Exynos4: update SYSMMU setup code for gen_pd power domain driver

  arch/arm/mach-exynos/dev-sysmmu.c |    6 +++++-
  arch/arm/mach-exynos/pm_domains.c |   13 +++++++++++++
  drivers/iommu/exynos-iommu.c      |   20 ++++++++++++++++++--
  3 files changed, 36 insertions(+), 3 deletions(-)