linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs
@ 2015-03-12 12:15 Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 01/17] reset: add of_reset_control_get_by_index() Vince Hsu
                   ` (16 more replies)
  0 siblings, 17 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Hi,

This is the v2 of Tegra generic PM domain support. The v1 is the RFC
series[1].

Patch 1 adds the new function of_reset_control_get_by_index().

Patch 2 - 5 add the MC flush operations for Tegra30/Tegra114/Tegra124.

Patch 6 is a PLLD fix for Tegra114.

Patch 7 is based on Thierry's proof-of-concept work and adds necessary
changes to support DT parsing and power sequence.

Patch 8 - 11 add the power domain nodes into DT.

Patch 12 - 17 are the clean up for the legacy powergate API. 

TODO:
* The GR3D is broken on ToT now. Have to verify it with this series after
   we fix it properly.

v2:
* Add support for Tegra30/Tegra114
* Address Alex's comments 

[1] http://www.spinics.net/lists/linux-tegra/msg21012.html

Thanks,
Vince

Thierry Reding (1):
  soc: tegra: pmc: Add generic PM domain support

Vince Hsu (16):
  reset: add of_reset_control_get_by_index()
  memory: tegra: add mc flush support
  memory: tegra: add flush operation for Tegra30 memory clients
  memory: tegra: add flush operation for Tegra114 memory clients
  memory: tegra: add flush operation for Tegra124 memory clients
  clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2
  ARM: tegra: add PM domain device nodes to Tegra30 DT
  ARM: tegra: add PM domain device nodes to Tegra114 DT
  ARM: tegra: add PM domain device nodes to Tegra124 DT
  ARM: tegra: add GPU power supply to Jetson TK1 DT
  drm/tegra: dc: remove the power sequence from driver
  PCI: tegra: remove the power sequence from driver
  ata: ahci_tegra: remove power sequence from driver
  drm/tegra: remove GR3D power sequence from driver
  ARM: tegra: select PM_GENERIC_DOMAINS
  soc/tegra: remove lagacy powergate APIs

 arch/arm/boot/dts/tegra114.dtsi             |  43 +-
 arch/arm/boot/dts/tegra124-jetson-tk1.dts   |   4 +
 arch/arm/boot/dts/tegra124.dtsi             |  86 +++-
 arch/arm/boot/dts/tegra30.dtsi              |  45 +-
 arch/arm/mach-tegra/Kconfig                 |   1 +
 drivers/ata/ahci_tegra.c                    |  11 -
 drivers/clk/tegra/clk-tegra114.c            |   6 +-
 drivers/gpu/drm/tegra/dc.c                  |  46 +-
 drivers/gpu/drm/tegra/gr3d.c                |  32 +-
 drivers/memory/tegra/mc.c                   | 122 ++++++
 drivers/memory/tegra/mc.h                   |   5 +
 drivers/memory/tegra/tegra114.c             | 106 ++++-
 drivers/memory/tegra/tegra124.c             |  38 +-
 drivers/memory/tegra/tegra30.c              |  80 +++-
 drivers/pci/host/pci-tegra.c                |  22 +-
 drivers/reset/core.c                        |  44 +-
 drivers/soc/tegra/pmc.c                     | 657 +++++++++++++++++++++++++---
 include/dt-bindings/power/tegra-powergate.h |  30 ++
 include/linux/reset.h                       |   9 +
 include/soc/tegra/mc.h                      |  46 +-
 include/soc/tegra/pmc.h                     |  22 -
 21 files changed, 1255 insertions(+), 200 deletions(-)
 create mode 100644 include/dt-bindings/power/tegra-powergate.h

-- 
2.1.4


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 01/17] reset: add of_reset_control_get_by_index()
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 15:01   ` Philipp Zabel
  2015-03-12 12:15 ` [PATCH v2 02/17] memory: tegra: add mc flush support Vince Hsu
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Add of_reset_control_get_by_index() to allow the drivers to get reset device
without knowing its name.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>

---
v2: minor changes according to Alex's comments

 drivers/reset/core.c  | 44 +++++++++++++++++++++++++++++---------------
 include/linux/reset.h |  9 +++++++++
 2 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 7955e00d04d4..5e78866acd62 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -140,28 +140,15 @@ int reset_control_status(struct reset_control *rstc)
 }
 EXPORT_SYMBOL_GPL(reset_control_status);
 
-/**
- * of_reset_control_get - Lookup and obtain a reference to a reset controller.
- * @node: device to be reset by the controller
- * @id: reset line name
- *
- * Returns a struct reset_control or IS_ERR() condition containing errno.
- *
- * Use of id names is optional.
- */
-struct reset_control *of_reset_control_get(struct device_node *node,
-					   const char *id)
+struct reset_control *__of_reset_control_get(struct device_node *node,
+						int index)
 {
 	struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER);
 	struct reset_controller_dev *r, *rcdev;
 	struct of_phandle_args args;
-	int index = 0;
 	int rstc_id;
 	int ret;
 
-	if (id)
-		index = of_property_match_string(node,
-						 "reset-names", id);
 	ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
 					 index, &args);
 	if (ret)
@@ -202,6 +189,33 @@ struct reset_control *of_reset_control_get(struct device_node *node,
 
 	return rstc;
 }
+
+struct reset_control *of_reset_control_get_by_index(struct device_node *node,
+					   int index)
+{
+	return __of_reset_control_get(node, index);
+}
+EXPORT_SYMBOL_GPL(of_reset_control_get_by_index);
+
+/**
+ * of_reset_control_get - Lookup and obtain a reference to a reset controller.
+ * @node: device to be reset by the controller
+ * @id: reset line name
+ *
+ * Returns a struct reset_control or IS_ERR() condition containing errno.
+ *
+ * Use of id names is optional.
+ */
+struct reset_control *of_reset_control_get(struct device_node *node,
+					   const char *id)
+{
+	int index = 0;
+
+	if (id)
+		index = of_property_match_string(node,
+						 "reset-names", id);
+	return __of_reset_control_get(node, index);
+}
 EXPORT_SYMBOL_GPL(of_reset_control_get);
 
 /**
diff --git a/include/linux/reset.h b/include/linux/reset.h
index da5602bd77d7..d998df70008d 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -38,6 +38,9 @@ static inline struct reset_control *devm_reset_control_get_optional(
 struct reset_control *of_reset_control_get(struct device_node *node,
 					   const char *id);
 
+struct reset_control *of_reset_control_get_by_index(
+					struct device_node *node, int index);
+
 #else
 
 static inline int reset_control_reset(struct reset_control *rstc)
@@ -92,6 +95,12 @@ static inline struct reset_control *of_reset_control_get(
 	return ERR_PTR(-ENOSYS);
 }
 
+static inline struct reset_control *of_reset_control_get_by_index(
+				struct device_node *node, int index)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
 #endif /* CONFIG_RESET_CONTROLLER */
 
 #endif
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 02/17] memory: tegra: add mc flush support
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 01/17] reset: add of_reset_control_get_by_index() Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 03/17] memory: tegra: add flush operation for Tegra30 memory clients Vince Hsu
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

The flush operation of memory clients is needed for various IP blocks in
the Tegra SoCs to perform a clean reset. Also add a mutex in struct tegra_mc
for mc flush operations.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>

---
v2: make indentition and name changes according to Alex's comments
    add mutex lock in struct tegra_mc for mc flush operations


 drivers/memory/tegra/mc.c       | 122 ++++++++++++++++++++++++++++++++++++++++
 drivers/memory/tegra/tegra114.c |   2 +-
 drivers/memory/tegra/tegra124.c |   2 +-
 drivers/memory/tegra/tegra30.c  |   2 +-
 include/soc/tegra/mc.h          |  46 ++++++++++++++-
 5 files changed, 169 insertions(+), 5 deletions(-)

diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index fe3c44e7e1d1..c78692919e21 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
@@ -62,6 +63,118 @@ static const struct of_device_id tegra_mc_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_mc_of_match);
 
+static struct tegra_mc_swgroup *tegra_mc_get_swgroup(struct tegra_mc *mc,
+					unsigned int swgroup)
+{
+	struct tegra_mc_swgroup *sg;
+
+	list_for_each_entry(sg, &mc->swgroups, head) {
+		if (sg->id == swgroup)
+			return sg;
+	}
+
+	return NULL;
+}
+
+static struct tegra_mc_swgroup *tegra_mc_add_swgroup(struct tegra_mc *mc,
+					unsigned int swgroup)
+{
+	struct tegra_mc_swgroup *sg;
+
+	sg = devm_kzalloc(mc->dev, sizeof(*sg), GFP_KERNEL);
+	if (!sg)
+		return ERR_PTR(-ENOMEM);
+
+	sg->id = swgroup;
+	sg->mc = mc;
+	list_add_tail(&sg->head, &mc->swgroups);
+	INIT_LIST_HEAD(&sg->clients);
+
+	return sg;
+}
+
+struct tegra_mc_swgroup *tegra_mc_find_swgroup(struct device_node *node,
+					int index)
+{
+	struct of_phandle_args args;
+	struct platform_device *pdev;
+	struct tegra_mc *mc;
+	int ret;
+
+	ret = of_parse_phandle_with_fixed_args(node, "nvidia,swgroup",
+				1, index, &args);
+	if (ret)
+		return ERR_PTR(ret);
+
+	pdev = of_find_device_by_node(args.np);
+	if (!pdev)
+		return NULL;
+
+	mc = platform_get_drvdata(pdev);
+	if (!mc)
+		return NULL;
+
+	return tegra_mc_get_swgroup(mc, args.args[0]);
+}
+EXPORT_SYMBOL(tegra_mc_find_swgroup);
+
+static int __tegra_mc_flush_op(struct tegra_mc_swgroup *sg, tegra_mc_op op)
+{
+	struct tegra_mc *mc;
+	const struct tegra_mc_hotreset *client;
+	int i;
+
+	mc = sg->mc;
+	client = mc->soc->hotresets;
+
+	for (i = 0; i < mc->soc->num_hotresets; i++, client++) {
+		if (sg->id == client->swgroup)
+			return op(mc, client);
+	}
+
+	return -EINVAL;
+
+}
+
+#define tegra_mc_flush_op(sg, op)			\
+	((!sg || !sg->mc || !sg->mc->soc->ops ||	\
+		!sg->mc->soc->ops->op) ?		\
+		-EINVAL : __tegra_mc_flush_op(sg, sg->mc->soc->ops->op))
+
+int tegra_mc_flush(struct tegra_mc_swgroup *sg)
+{
+	return tegra_mc_flush_op(sg, flush);
+}
+EXPORT_SYMBOL(tegra_mc_flush);
+
+int tegra_mc_flush_done(struct tegra_mc_swgroup *sg)
+{
+	return tegra_mc_flush_op(sg, flush_done);
+}
+EXPORT_SYMBOL(tegra_mc_flush_done);
+
+static int tegra_mc_build_swgroup(struct tegra_mc *mc)
+{
+	int i;
+
+	for (i = 0; i < mc->soc->num_clients; i++) {
+		struct tegra_mc_swgroup *sg;
+
+		sg = tegra_mc_get_swgroup(mc, mc->soc->clients[i].swgroup);
+
+		if (!sg) {
+			sg = tegra_mc_add_swgroup(mc,
+					mc->soc->clients[i].swgroup);
+			if (IS_ERR(sg))
+				return PTR_ERR(sg);
+		}
+
+		list_add_tail(&mc->soc->clients[i].head, &sg->clients);
+	}
+
+	return 0;
+}
+
 static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)
 {
 	unsigned long long tick;
@@ -229,6 +342,13 @@ static int tegra_mc_probe(struct platform_device *pdev)
 	/* length of MC tick in nanoseconds */
 	mc->tick = 30;
 
+	INIT_LIST_HEAD(&mc->swgroups);
+	err = tegra_mc_build_swgroup(mc);
+	if (err) {
+		dev_err(&pdev->dev, "failed to build swgroup: %d\n", err);
+		return err;
+	}
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	mc->regs = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(mc->regs))
@@ -271,6 +391,8 @@ static int tegra_mc_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	mutex_init(&mc->lock);
+
 	value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
 		MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
 		MC_INT_ARBITRATION_EMEM | MC_INT_SECURITY_VIOLATION |
diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c
index 511e9a25c151..92ab5552fcee 100644
--- a/drivers/memory/tegra/tegra114.c
+++ b/drivers/memory/tegra/tegra114.c
@@ -15,7 +15,7 @@
 
 #include "mc.h"
 
-static const struct tegra_mc_client tegra114_mc_clients[] = {
+static struct tegra_mc_client tegra114_mc_clients[] = {
 	{
 		.id = 0x00,
 		.name = "ptcr",
diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c
index 278d40b854c1..ec25546835fe 100644
--- a/drivers/memory/tegra/tegra124.c
+++ b/drivers/memory/tegra/tegra124.c
@@ -15,7 +15,7 @@
 
 #include "mc.h"
 
-static const struct tegra_mc_client tegra124_mc_clients[] = {
+static struct tegra_mc_client tegra124_mc_clients[] = {
 	{
 		.id = 0x00,
 		.name = "ptcr",
diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c
index 71fe9376fe53..3ed4bf409a72 100644
--- a/drivers/memory/tegra/tegra30.c
+++ b/drivers/memory/tegra/tegra30.c
@@ -15,7 +15,7 @@
 
 #include "mc.h"
 
-static const struct tegra_mc_client tegra30_mc_clients[] = {
+static struct tegra_mc_client tegra30_mc_clients[] = {
 	{
 		.id = 0x00,
 		.name = "ptcr",
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
index 63deb8d9f82a..1edcc0ffeae5 100644
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -37,6 +37,32 @@ struct tegra_mc_client {
 
 	struct tegra_smmu_enable smmu;
 	struct tegra_mc_la la;
+
+	struct list_head head;
+};
+
+struct tegra_mc;
+
+/* hot reset */
+struct tegra_mc_hotreset {
+	unsigned int swgroup;
+	unsigned int ctrl;
+	unsigned int status;
+	unsigned int bit;
+};
+
+struct tegra_mc_swgroup {
+	unsigned int id;
+	struct tegra_mc *mc;
+	struct list_head head;
+	struct list_head clients;
+};
+
+struct tegra_mc_ops {
+	int (*flush)(struct tegra_mc *mc,
+			const struct tegra_mc_hotreset *hotreset);
+	int (*flush_done)(struct tegra_mc *mc,
+			const struct tegra_mc_hotreset *hotreset);
 };
 
 struct tegra_smmu_swgroup {
@@ -64,7 +90,6 @@ struct tegra_smmu_soc {
 	const struct tegra_smmu_ops *ops;
 };
 
-struct tegra_mc;
 struct tegra_smmu;
 
 #ifdef CONFIG_TEGRA_IOMMU_SMMU
@@ -81,9 +106,14 @@ tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
 #endif
 
 struct tegra_mc_soc {
-	const struct tegra_mc_client *clients;
+	struct tegra_mc_client *clients;
 	unsigned int num_clients;
 
+	const struct tegra_mc_hotreset *hotresets;
+	unsigned int num_hotresets;
+
+	const struct tegra_mc_ops *ops;
+
 	const unsigned int *emem_regs;
 	unsigned int num_emem_regs;
 
@@ -102,6 +132,18 @@ struct tegra_mc {
 
 	const struct tegra_mc_soc *soc;
 	unsigned long tick;
+
+	struct list_head swgroups;
+
+	struct mutex lock;
 };
 
+typedef int (*tegra_mc_op)(struct tegra_mc *mc,
+				 const struct tegra_mc_hotreset *hotreset);
+
+struct tegra_mc_swgroup *tegra_mc_find_swgroup(struct device_node *node,
+					int index);
+int tegra_mc_flush(struct tegra_mc_swgroup *sg);
+int tegra_mc_flush_done(struct tegra_mc_swgroup *sg);
+
 #endif /* __SOC_TEGRA_MC_H__ */
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 03/17] memory: tegra: add flush operation for Tegra30 memory clients
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 01/17] reset: add of_reset_control_get_by_index() Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 02/17] memory: tegra: add mc flush support Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 04/17] memory: tegra: add flush operation for Tegra114 " Vince Hsu
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

This patch adds the hot reset register table and flush related callback
functions for Tegra30.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/memory/tegra/tegra30.c | 78 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c
index 3ed4bf409a72..71ed7ee0aace 100644
--- a/drivers/memory/tegra/tegra30.c
+++ b/drivers/memory/tegra/tegra30.c
@@ -6,6 +6,8 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/delay.h>
+#include <linux/device.h>
 #include <linux/of.h>
 #include <linux/mm.h>
 
@@ -936,6 +938,79 @@ static const struct tegra_smmu_swgroup tegra30_swgroups[] = {
 	{ .swgroup = TEGRA_SWGROUP_ISP,  .reg = 0x258 },
 };
 
+static struct tegra_mc_hotreset tegra30_mc_hotreset[] = {
+	{TEGRA_SWGROUP_AFI,        0x200, 0x204,  0},
+	{TEGRA_SWGROUP_AVPC,       0x200, 0x204,  1},
+	{TEGRA_SWGROUP_DC,         0x200, 0x204,  2},
+	{TEGRA_SWGROUP_DCB,        0x200, 0x204,  3},
+	{TEGRA_SWGROUP_EPP,        0x200, 0x204,  4},
+	{TEGRA_SWGROUP_G2,         0x200, 0x204,  5},
+	{TEGRA_SWGROUP_HC,         0x200, 0x204,  6},
+	{TEGRA_SWGROUP_HDA,        0x200, 0x204,  7},
+	{TEGRA_SWGROUP_ISP,        0x200, 0x204,  8},
+	{TEGRA_SWGROUP_MPCORE,     0x200, 0x204,  9},
+	{TEGRA_SWGROUP_MPCORELP,   0x200, 0x204, 10},
+	{TEGRA_SWGROUP_MPE,        0x200, 0x204, 11},
+	{TEGRA_SWGROUP_NV,         0x200, 0x204, 12},
+	{TEGRA_SWGROUP_NV2,        0x200, 0x204, 13},
+	{TEGRA_SWGROUP_PPCS,       0x200, 0x204, 14},
+	{TEGRA_SWGROUP_VDE,        0x200, 0x204, 16},
+	{TEGRA_SWGROUP_VI,         0x200, 0x204, 17},
+};
+
+static int tegra30_mc_flush(struct tegra_mc *mc,
+		const struct tegra_mc_hotreset *hotreset)
+{
+	u32 val;
+
+	if (!mc || !hotreset)
+		return -EINVAL;
+
+	mutex_lock(&mc->lock);
+
+	val = mc_readl(mc, hotreset->ctrl);
+	val |= BIT(hotreset->bit);
+	mc_writel(mc, val, hotreset->ctrl);
+	mc_readl(mc, hotreset->ctrl);
+
+	mutex_unlock(&mc->lock);
+
+	/* poll till the flush is done */
+	do {
+		udelay(10);
+		val = mc_readl(mc, hotreset->status);
+	} while (!(val & BIT(hotreset->bit)));
+
+	dev_dbg(mc->dev, "%s bit %d\n", __func__, hotreset->bit);
+	return 0;
+}
+
+static int tegra30_mc_flush_done(struct tegra_mc *mc,
+		const struct tegra_mc_hotreset *hotreset)
+{
+	u32 val;
+
+	if (!mc || !hotreset)
+		return -EINVAL;
+
+	mutex_lock(&mc->lock);
+
+	val = mc_readl(mc, hotreset->ctrl);
+	val &= ~BIT(hotreset->bit);
+	mc_writel(mc, val, hotreset->ctrl);
+	mc_readl(mc, hotreset->ctrl);
+
+	mutex_unlock(&mc->lock);
+
+	dev_dbg(mc->dev, "%s bit %d\n", __func__, hotreset->bit);
+	return 0;
+}
+
+static const struct tegra_mc_ops tegra30_mc_ops = {
+	.flush = tegra30_mc_flush,
+	.flush_done = tegra30_mc_flush_done,
+};
+
 static void tegra30_flush_dcache(struct page *page, unsigned long offset,
 				 size_t size)
 {
@@ -967,4 +1042,7 @@ const struct tegra_mc_soc tegra30_mc_soc = {
 	.num_address_bits = 32,
 	.atom_size = 16,
 	.smmu = &tegra30_smmu_soc,
+	.hotresets = tegra30_mc_hotreset,
+	.num_hotresets = ARRAY_SIZE(tegra30_mc_hotreset),
+	.ops = &tegra30_mc_ops,
 };
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 04/17] memory: tegra: add flush operation for Tegra114 memory clients
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (2 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 03/17] memory: tegra: add flush operation for Tegra30 memory clients Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 05/17] memory: tegra: add flush operation for Tegra124 " Vince Hsu
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

This patch adds the hot reset register table and flush related callback
functions for Tegra114.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/memory/tegra/mc.h       |   5 ++
 drivers/memory/tegra/tegra114.c | 104 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+)

diff --git a/drivers/memory/tegra/mc.h b/drivers/memory/tegra/mc.h
index d5d21147fc77..2c3b8db04073 100644
--- a/drivers/memory/tegra/mc.h
+++ b/drivers/memory/tegra/mc.h
@@ -25,6 +25,11 @@ static inline void mc_writel(struct tegra_mc *mc, u32 value,
 	writel(value, mc->regs + offset);
 }
 
+int tegra114_mc_flush(struct tegra_mc *mc,
+		const struct tegra_mc_hotreset *hotreset);
+int tegra114_mc_flush_done(struct tegra_mc *mc,
+		const struct tegra_mc_hotreset *hotreset);
+
 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
 extern const struct tegra_mc_soc tegra30_mc_soc;
 #endif
diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c
index 92ab5552fcee..b5040e653aa2 100644
--- a/drivers/memory/tegra/tegra114.c
+++ b/drivers/memory/tegra/tegra114.c
@@ -6,6 +6,8 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/delay.h>
+#include <linux/device.h>
 #include <linux/of.h>
 #include <linux/mm.h>
 
@@ -914,6 +916,105 @@ static const struct tegra_smmu_swgroup tegra114_swgroups[] = {
 	{ .swgroup = TEGRA_SWGROUP_TSEC,      .reg = 0x294 },
 };
 
+static struct tegra_mc_hotreset tegra114_mc_hotreset[] = {
+	{TEGRA_SWGROUP_AVPC,       0x200, 0x204,  1},
+	{TEGRA_SWGROUP_DC,         0x200, 0x204,  2},
+	{TEGRA_SWGROUP_DCB,        0x200, 0x204,  3},
+	{TEGRA_SWGROUP_EPP,        0x200, 0x204,  4},
+	{TEGRA_SWGROUP_G2,         0x200, 0x204,  5},
+	{TEGRA_SWGROUP_HC,         0x200, 0x204,  6},
+	{TEGRA_SWGROUP_HDA,        0x200, 0x204,  7},
+	{TEGRA_SWGROUP_ISP,        0x200, 0x204,  8},
+	{TEGRA_SWGROUP_MPCORE,     0x200, 0x204,  9},
+	{TEGRA_SWGROUP_MPCORELP,   0x200, 0x204, 10},
+	{TEGRA_SWGROUP_MSENC,      0x200, 0x204, 11},
+	{TEGRA_SWGROUP_NV,         0x200, 0x204, 12},
+	{TEGRA_SWGROUP_PPCS,       0x200, 0x204, 14},
+	{TEGRA_SWGROUP_VDE,        0x200, 0x204, 16},
+	{TEGRA_SWGROUP_VI,         0x200, 0x204, 17},
+};
+
+/*
+ * Must be called with mc->lock held
+ */
+static bool tegra114_stable_hotreset_check(struct tegra_mc *mc,
+		u32 reg, u32 *stat)
+{
+	int i;
+	u32 cur_stat;
+	u32 prv_stat;
+
+	/*
+	 * There might be a glitch seen with the status register if we program
+	 * the control register and then read the status register in a short
+	 * window (on the order of 5 cycles) due to a HW bug. So here we poll
+	 * for a stable status read.
+	 */
+	prv_stat = mc_readl(mc, reg);
+	for (i = 0; i < 5; i++) {
+		cur_stat = mc_readl(mc, reg);
+		if (cur_stat != prv_stat)
+			return false;
+	}
+	*stat = cur_stat;
+	return true;
+}
+
+int tegra114_mc_flush(struct tegra_mc *mc,
+		const struct tegra_mc_hotreset *hotreset)
+{
+	u32 val;
+
+	if (!mc || !hotreset)
+		return -EINVAL;
+
+	mutex_lock(&mc->lock);
+
+	val = mc_readl(mc, hotreset->ctrl);
+	val |= BIT(hotreset->bit);
+	mc_writel(mc, val, hotreset->ctrl);
+	mc_readl(mc, hotreset->ctrl);
+
+	/* poll till the flush is done */
+	do {
+		udelay(10);
+		val = 0;
+		if (!tegra114_stable_hotreset_check(mc, hotreset->status, &val))
+			continue;
+	} while (!(val & BIT(hotreset->bit)));
+
+	mutex_unlock(&mc->lock);
+
+	dev_dbg(mc->dev, "%s bit %d\n", __func__, hotreset->bit);
+	return 0;
+}
+
+int tegra114_mc_flush_done(struct tegra_mc *mc,
+		const struct tegra_mc_hotreset *hotreset)
+{
+	u32 val;
+
+	if (!mc || !hotreset)
+		return -EINVAL;
+
+	mutex_lock(&mc->lock);
+
+	val = mc_readl(mc, hotreset->ctrl);
+	val &= ~BIT(hotreset->bit);
+	mc_writel(mc, val, hotreset->ctrl);
+	mc_readl(mc, hotreset->ctrl);
+
+	mutex_unlock(&mc->lock);
+
+	dev_dbg(mc->dev, "%s bit %d\n", __func__, hotreset->bit);
+	return 0;
+}
+
+static const struct tegra_mc_ops tegra114_mc_ops = {
+	.flush = tegra114_mc_flush,
+	.flush_done = tegra114_mc_flush_done,
+};
+
 static void tegra114_flush_dcache(struct page *page, unsigned long offset,
 				  size_t size)
 {
@@ -945,4 +1046,7 @@ const struct tegra_mc_soc tegra114_mc_soc = {
 	.num_address_bits = 32,
 	.atom_size = 32,
 	.smmu = &tegra114_smmu_soc,
+	.hotresets = tegra114_mc_hotreset,
+	.num_hotresets = ARRAY_SIZE(tegra114_mc_hotreset),
+	.ops = &tegra114_mc_ops,
 };
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 05/17] memory: tegra: add flush operation for Tegra124 memory clients
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (3 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 04/17] memory: tegra: add flush operation for Tegra114 " Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 06/17] clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2 Vince Hsu
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

This patch adds the hot reset register table and flush related callback
functions for Tegra124.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>

---
v2: move the drop of tegra124_mc_clients' const to patch #2
    move mc flush operations to tegra114

 drivers/memory/tegra/tegra124.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c
index ec25546835fe..ef74f060e59e 100644
--- a/drivers/memory/tegra/tegra124.c
+++ b/drivers/memory/tegra/tegra124.c
@@ -959,7 +959,40 @@ static const struct tegra_smmu_swgroup tegra124_swgroups[] = {
 	{ .swgroup = TEGRA_SWGROUP_VI,        .reg = 0x280 },
 };
 
+static struct tegra_mc_hotreset tegra124_mc_hotreset[] = {
+	{TEGRA_SWGROUP_AFI,        0x200, 0x204,  0},
+	{TEGRA_SWGROUP_AVPC,       0x200, 0x204,  1},
+	{TEGRA_SWGROUP_DC,         0x200, 0x204,  2},
+	{TEGRA_SWGROUP_DCB,        0x200, 0x204,  3},
+	{TEGRA_SWGROUP_HC,         0x200, 0x204,  6},
+	{TEGRA_SWGROUP_HDA,        0x200, 0x204,  7},
+	{TEGRA_SWGROUP_ISP2,       0x200, 0x204,  8},
+	{TEGRA_SWGROUP_MPCORE,     0x200, 0x204,  9},
+	{TEGRA_SWGROUP_MPCORELP,   0x200, 0x204, 10},
+	{TEGRA_SWGROUP_MSENC,      0x200, 0x204, 11},
+	{TEGRA_SWGROUP_PPCS,       0x200, 0x204, 14},
+	{TEGRA_SWGROUP_SATA,       0x200, 0x204, 15},
+	{TEGRA_SWGROUP_VDE,        0x200, 0x204, 16},
+	{TEGRA_SWGROUP_VI,         0x200, 0x204, 17},
+	{TEGRA_SWGROUP_VIC,        0x200, 0x204, 18},
+	{TEGRA_SWGROUP_XUSB_HOST,  0x200, 0x204, 19},
+	{TEGRA_SWGROUP_XUSB_DEV,   0x200, 0x204, 20},
+	{TEGRA_SWGROUP_TSEC,       0x200, 0x204, 22},
+	{TEGRA_SWGROUP_SDMMC1A,    0x200, 0x204, 29},
+	{TEGRA_SWGROUP_SDMMC2A,    0x200, 0x204, 30},
+	{TEGRA_SWGROUP_SDMMC3A,    0x200, 0x204, 31},
+	{TEGRA_SWGROUP_SDMMC4A,    0x970, 0x974,  0},
+	{TEGRA_SWGROUP_ISP2B,      0x970, 0x974,  1},
+	{TEGRA_SWGROUP_GPU,        0x970, 0x974,  2},
+};
+
 #ifdef CONFIG_ARCH_TEGRA_124_SOC
+
+static const struct tegra_mc_ops tegra124_mc_ops = {
+	.flush = tegra114_mc_flush,
+	.flush_done = tegra114_mc_flush_done,
+};
+
 static void tegra124_flush_dcache(struct page *page, unsigned long offset,
 				  size_t size)
 {
@@ -991,5 +1024,8 @@ const struct tegra_mc_soc tegra124_mc_soc = {
 	.num_address_bits = 34,
 	.atom_size = 32,
 	.smmu = &tegra124_smmu_soc,
+	.hotresets = tegra124_mc_hotreset,
+	.num_hotresets = ARRAY_SIZE(tegra124_mc_hotreset),
+	.ops = &tegra124_mc_ops,
 };
 #endif /* CONFIG_ARCH_TEGRA_124_SOC */
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 06/17] clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (4 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 05/17] memory: tegra: add flush operation for Tegra124 " Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support Vince Hsu
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Tegra114 has a HW bug that the PLLD/PLLD2 lock bit cannot be asserted when
the DIS power domain is during up-powergating process but the clamp to this
domain is not removed yet. That causes a timeout and aborts the power
sequence, although the PLLD/PLLD2 has already locked. To remove the false
alarm, we don't use the lock for PLLD/PLLD2. Just wait 1ms and treat the
clocks as locked.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/clk/tegra/clk-tegra114.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
index d0766423a5d6..e6a480e0dcb6 100644
--- a/drivers/clk/tegra/clk-tegra114.c
+++ b/drivers/clk/tegra/clk-tegra114.c
@@ -456,8 +456,7 @@ static struct tegra_clk_pll_params pll_d_params = {
 	.lock_delay = 1000,
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_d_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON,
 };
 
 static struct tegra_clk_pll_params pll_d2_params = {
@@ -474,8 +473,7 @@ static struct tegra_clk_pll_params pll_d2_params = {
 	.lock_delay = 1000,
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_d_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON,
 };
 
 static struct pdiv_map pllu_p[] = {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (5 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 06/17] clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2 Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-04-06 22:37   ` Kevin Hilman
  2015-03-12 12:15 ` [PATCH v2 08/17] ARM: tegra: add PM domain device nodes to Tegra30 DT Vince Hsu
                   ` (9 subsequent siblings)
  16 siblings, 1 reply; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Thierry Reding, Vince Hsu

From: Thierry Reding <treding@nvidia.com>

The PM domains are populated from DT, and the PM domain consumer devices are
also bound to their relevant PM domains by DT.

Signed-off-by: Thierry Reding <treding@nvidia.com>
[vinceh: make changes based on Thierry and Peter's suggestions]
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
v2: revise comment in tegra_powergate_remove_clamping()
    address Alex's comments

 drivers/soc/tegra/pmc.c                     | 589 +++++++++++++++++++++++++++-
 include/dt-bindings/power/tegra-powergate.h |  30 ++
 2 files changed, 617 insertions(+), 2 deletions(-)
 create mode 100644 include/dt-bindings/power/tegra-powergate.h

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index c956395cf46f..ed1ce06e3635 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -27,15 +27,20 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/of_platform.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/reboot.h>
+#include <linux/regulator/consumer.h>
 #include <linux/reset.h>
+#include <linux/sched.h>
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
 
 #include <soc/tegra/common.h>
 #include <soc/tegra/fuse.h>
+#include <soc/tegra/mc.h>
 #include <soc/tegra/pmc.h>
 
 #define PMC_CNTRL			0x0
@@ -99,6 +104,30 @@
 
 #define GPU_RG_CNTRL			0x2d4
 
+#define MAX_CLK_NUM		5
+#define MAX_RESET_NUM		5
+#define MAX_SWGROUP_NUM		5
+
+struct tegra_powergate {
+	struct generic_pm_domain base;
+	struct tegra_pmc *pmc;
+	unsigned int id;
+	const char *name;
+	struct list_head head;
+	struct device_node *of_node;
+	struct clk *clk[MAX_CLK_NUM];
+	struct reset_control *reset[MAX_RESET_NUM];
+	struct tegra_mc_swgroup *swgroup[MAX_SWGROUP_NUM];
+	bool is_vdd;
+	struct regulator *vdd;
+};
+
+static inline struct tegra_powergate *
+to_powergate(struct generic_pm_domain *domain)
+{
+	return container_of(domain, struct tegra_powergate, base);
+}
+
 struct tegra_pmc_soc {
 	unsigned int num_powergates;
 	const char *const *powergates;
@@ -107,12 +136,15 @@ struct tegra_pmc_soc {
 
 	bool has_tsense_reset;
 	bool has_gpu_clamps;
+	bool is_legacy_powergate;
 };
 
 /**
  * struct tegra_pmc - NVIDIA Tegra PMC
+ * @dev: pointer to parent device
  * @base: pointer to I/O remapped register region
  * @clk: pointer to pclk clock
+ * @soc: SoC-specific data
  * @rate: currently configured rate of pclk
  * @suspend_mode: lowest suspend mode available
  * @cpu_good_time: CPU power good time (in microseconds)
@@ -126,7 +158,9 @@ struct tegra_pmc_soc {
  * @cpu_pwr_good_en: CPU power good signal is enabled
  * @lp0_vec_phys: physical base address of the LP0 warm boot code
  * @lp0_vec_size: size of the LP0 warm boot code
+ * @powergates: list of power gates
  * @powergates_lock: mutex for power gate register access
+ * @nb: bus notifier for generic power domains
  */
 struct tegra_pmc {
 	struct device *dev;
@@ -150,7 +184,12 @@ struct tegra_pmc {
 	u32 lp0_vec_phys;
 	u32 lp0_vec_size;
 
+	struct tegra_powergate *powergates;
 	struct mutex powergates_lock;
+	struct notifier_block nb;
+
+	struct list_head powergate_list;
+	int power_domain_num;
 };
 
 static struct tegra_pmc *pmc = &(struct tegra_pmc) {
@@ -236,6 +275,8 @@ int tegra_powergate_is_powered(int id)
 /**
  * tegra_powergate_remove_clamping() - remove power clamps for partition
  * @id: partition ID
+ *
+ * TODO: make this function static once we get rid of all outside callers
  */
 int tegra_powergate_remove_clamping(int id)
 {
@@ -256,8 +297,8 @@ int tegra_powergate_remove_clamping(int id)
 	}
 
 	/*
-	 * Tegra 2 has a bug where PCIE and VDE clamping masks are
-	 * swapped relatively to the partition ids
+	 * PCIE and VDE clamping bits are swapped relatively to the partition
+	 * ids
 	 */
 	if (id == TEGRA_POWERGATE_VDEC)
 		mask = (1 << TEGRA_POWERGATE_PCIE);
@@ -373,6 +414,8 @@ int tegra_pmc_cpu_remove_clamping(int cpuid)
 	if (id < 0)
 		return id;
 
+	usleep_range(10, 20);
+
 	return tegra_powergate_remove_clamping(id);
 }
 #endif /* CONFIG_SMP */
@@ -407,6 +450,307 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
 	tegra_pmc_writel(value, 0);
 }
 
+static bool tegra_pmc_powergate_is_powered(struct tegra_powergate *powergate)
+{
+	u32 status = tegra_pmc_readl(PWRGATE_STATUS);
+
+	if (!powergate->is_vdd)
+		return (status & BIT(powergate->id)) != 0;
+
+	if (IS_ERR(powergate->vdd))
+		return false;
+	else
+		return regulator_is_enabled(powergate->vdd);
+}
+
+static int tegra_pmc_powergate_set(struct tegra_powergate *powergate,
+				   bool new_state)
+{
+	u32 status, mask = new_state ? BIT(powergate->id) : 0;
+	bool state = false;
+	unsigned long timeout;
+	int err = -ETIMEDOUT;
+
+
+	mutex_lock(&pmc->powergates_lock);
+
+	/* check the current state of the partition */
+	status = tegra_pmc_readl(PWRGATE_STATUS);
+	state = !!(status & BIT(powergate->id));
+
+	/* nothing to do */
+	if (new_state == state) {
+		mutex_unlock(&pmc->powergates_lock);
+		return 0;
+	}
+
+	/* toggle partition state and wait for state change to finish */
+	tegra_pmc_writel(PWRGATE_TOGGLE_START | powergate->id, PWRGATE_TOGGLE);
+
+	timeout = jiffies + msecs_to_jiffies(50);
+	while (time_before(jiffies, timeout)) {
+		status = tegra_pmc_readl(PWRGATE_STATUS);
+		if ((status & BIT(powergate->id)) == mask) {
+			err = 0;
+			break;
+		}
+
+		usleep_range(10, 20);
+	}
+
+	mutex_unlock(&pmc->powergates_lock);
+
+	return err;
+}
+
+static int tegra_pmc_powergate_enable_clocks(
+		struct tegra_powergate *powergate)
+{
+	int i, err;
+
+	for (i = 0; i < MAX_CLK_NUM; i++) {
+		if (!powergate->clk[i])
+			break;
+
+		err = clk_prepare_enable(powergate->clk[i]);
+		if (err)
+			goto out;
+	}
+
+	return 0;
+
+out:
+	while (i--)
+		clk_disable_unprepare(powergate->clk[i]);
+	return err;
+}
+
+static void tegra_pmc_powergate_disable_clocks(
+		struct tegra_powergate *powergate)
+{
+	int i;
+
+	for (i = 0; i < MAX_CLK_NUM; i++) {
+		if (!powergate->clk[i])
+			break;
+
+		clk_disable_unprepare(powergate->clk[i]);
+	}
+}
+
+static int tegra_pmc_powergate_mc_flush(struct tegra_powergate *powergate)
+{
+	int i, err;
+
+	for (i = 0; i < MAX_SWGROUP_NUM; i++) {
+		if (!powergate->swgroup[i])
+			break;
+
+		err = tegra_mc_flush(powergate->swgroup[i]);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int tegra_pmc_powergate_mc_flush_done(struct tegra_powergate *powergate)
+{
+	int i, err;
+
+	for (i = 0; i < MAX_SWGROUP_NUM; i++) {
+		if (!powergate->swgroup[i])
+			break;
+
+		err = tegra_mc_flush_done(powergate->swgroup[i]);
+		if (err)
+			return err;
+	}
+
+	return 0;
+
+}
+
+static int tegra_pmc_powergate_reset_assert(
+		struct tegra_powergate *powergate)
+{
+	int i, err;
+
+	for (i = 0; i < MAX_RESET_NUM; i++) {
+		if (!powergate->reset[i])
+			break;
+
+		err = reset_control_assert(powergate->reset[i]);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int tegra_pmc_powergate_reset_deassert(
+		struct tegra_powergate *powergate)
+{
+	int i, err;
+
+	for (i = 0; i < MAX_RESET_NUM; i++) {
+		if (!powergate->reset[i])
+			break;
+
+		err = reset_control_deassert(powergate->reset[i]);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int tegra_powergate_get_regulator(struct tegra_powergate *powergate)
+{
+	struct platform_device *pdev;
+
+	if (!powergate->is_vdd)
+		return -EINVAL;
+
+	if (powergate->vdd && !IS_ERR(powergate->vdd))
+		return 0;
+
+	pdev = of_find_device_by_node(powergate->of_node);
+	if (!pdev)
+		return -EINVAL;
+
+	powergate->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
+	if (IS_ERR(powergate->vdd))
+		return -EINVAL;
+
+	return 0;
+}
+
+static int tegra_pmc_powergate_power_on(struct generic_pm_domain *domain)
+{
+	struct tegra_powergate *powergate = to_powergate(domain);
+	struct tegra_pmc *pmc = powergate->pmc;
+	int err;
+
+	dev_dbg(pmc->dev, "> %s(domain=%p)\n", __func__, domain);
+	dev_dbg(pmc->dev, "  name: %s\n", domain->name);
+
+	if (powergate->is_vdd) {
+		err = tegra_powergate_get_regulator(powergate);
+		if (!err)
+			err = regulator_enable(powergate->vdd);
+	} else {
+		err = tegra_pmc_powergate_set(powergate, true);
+	}
+	if (err < 0)
+		goto out;
+	udelay(10);
+
+	if (pmc->soc->is_legacy_powergate) {
+		err = tegra_pmc_powergate_reset_assert(powergate);
+		if (err)
+			goto out;
+		udelay(10);
+	}
+
+	/*
+	 * Some PCIe PLLs depend on external power supplies, and the power
+	 * supplies are enabled in driver. So we don't touch PCIe clocks
+	 * here. Refer to:
+	 * Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt
+	 */
+	if (powergate->id != TEGRA_POWERGATE_PCIE) {
+		err = tegra_pmc_powergate_enable_clocks(powergate);
+		if (err)
+			goto out;
+		udelay(10);
+	}
+
+	err = tegra_powergate_remove_clamping(powergate->id);
+	if (err)
+		goto out;
+	udelay(10);
+
+	err = tegra_pmc_powergate_reset_deassert(powergate);
+	if (err)
+		goto out;
+	udelay(10);
+
+	err = tegra_pmc_powergate_mc_flush_done(powergate);
+	if (err)
+		goto out;
+	udelay(10);
+
+	if (powergate->id != TEGRA_POWERGATE_PCIE)
+		tegra_pmc_powergate_disable_clocks(powergate);
+
+	return 0;
+
+out:
+	dev_dbg(pmc->dev, "< %s() = %d\n", __func__, err);
+	return err;
+}
+
+static int tegra_pmc_powergate_power_off(struct generic_pm_domain *domain)
+{
+	struct tegra_powergate *powergate = to_powergate(domain);
+	struct tegra_pmc *pmc = powergate->pmc;
+	int err;
+
+	dev_dbg(pmc->dev, "> %s(domain=%p)\n", __func__, domain);
+	dev_dbg(pmc->dev, "  name: %s\n", domain->name);
+
+	/* never turn off these partitions */
+	switch (powergate->id) {
+	case TEGRA_POWERGATE_CPU:
+	case TEGRA_POWERGATE_CPU1:
+	case TEGRA_POWERGATE_CPU2:
+	case TEGRA_POWERGATE_CPU3:
+	case TEGRA_POWERGATE_CPU0:
+	case TEGRA_POWERGATE_C0NC:
+	case TEGRA_POWERGATE_IRAM:
+		dev_dbg(pmc->dev, "not disabling always-on partition %s\n",
+			domain->name);
+		err = -EINVAL;
+		goto out;
+	}
+
+	if (!pmc->soc->is_legacy_powergate) {
+		err = tegra_pmc_powergate_enable_clocks(powergate);
+		if (err)
+			goto out;
+		udelay(10);
+
+		err = tegra_pmc_powergate_mc_flush(powergate);
+		if (err)
+			goto out;
+		udelay(10);
+	}
+
+	err = tegra_pmc_powergate_reset_assert(powergate);
+	if (err)
+		goto out;
+	udelay(10);
+
+	if (!pmc->soc->is_legacy_powergate) {
+		tegra_pmc_powergate_disable_clocks(powergate);
+		udelay(10);
+	}
+
+	if (powergate->vdd)
+		err = regulator_disable(powergate->vdd);
+	else
+		err = tegra_pmc_powergate_set(powergate, false);
+	if (err)
+		goto out;
+
+	return 0;
+
+out:
+	dev_dbg(pmc->dev, "< %s() = %d\n", __func__, err);
+	return err;
+}
+
 static int powergate_show(struct seq_file *s, void *data)
 {
 	unsigned int i;
@@ -449,6 +793,234 @@ static int tegra_powergate_debugfs_init(void)
 	return 0;
 }
 
+static struct generic_pm_domain *
+tegra_powergate_of_xlate(struct of_phandle_args *args, void *data)
+{
+	struct tegra_pmc *pmc = data;
+	struct tegra_powergate *powergate;
+
+	dev_dbg(pmc->dev, "> %s(args=%p, data=%p)\n", __func__, args, data);
+
+	list_for_each_entry(powergate, &pmc->powergate_list, head) {
+		if (!powergate->base.name)
+			continue;
+
+		if (powergate->id == args->args[0]) {
+			dev_dbg(pmc->dev, "< %s() = %p\n", __func__, powergate);
+			return &powergate->base;
+		}
+	}
+
+	dev_dbg(pmc->dev, "< %s() = -ENOENT\n", __func__);
+	return ERR_PTR(-ENOENT);
+}
+
+static int tegra_powergate_of_get_clks(struct tegra_powergate *powergate)
+{
+	struct clk *clk;
+	int i, err;
+
+	for (i = 0; i < MAX_CLK_NUM; i++) {
+		clk = of_clk_get(powergate->of_node, i);
+		if (IS_ERR(clk)) {
+			if (PTR_ERR(clk) == -ENOENT)
+				break;
+			else
+				goto err_clks;
+		}
+
+		powergate->clk[i] = clk;
+	}
+
+	return 0;
+
+err_clks:
+	err = PTR_ERR(clk);
+	while (--i >= 0)
+		clk_put(powergate->clk[i]);
+	return err;
+}
+
+static int tegra_powergate_of_get_resets(struct tegra_powergate *powergate)
+{
+	struct reset_control *reset;
+	int i;
+
+	for (i = 0; i < MAX_RESET_NUM; i++) {
+		reset = of_reset_control_get_by_index(powergate->of_node, i);
+		if (IS_ERR(reset)) {
+			if (PTR_ERR(reset) == -ENOENT)
+				break;
+			else
+				return PTR_ERR(reset);
+		}
+
+		powergate->reset[i] = reset;
+	}
+
+	return 0;
+}
+
+static int tegra_powergate_of_get_swgroups(struct tegra_powergate *powergate)
+{
+	struct tegra_mc_swgroup *sg;
+	int i;
+
+	for (i = 0; i < MAX_SWGROUP_NUM; i++) {
+		sg = tegra_mc_find_swgroup(powergate->of_node, i);
+		if (IS_ERR_OR_NULL(sg)) {
+			if (PTR_ERR(sg) == -ENOENT)
+				break;
+			else
+				return -EINVAL;
+		}
+
+		powergate->swgroup[i] = sg;
+	}
+
+	return 0;
+}
+
+static int tegra_pmc_powergate_init_powerdomain(struct tegra_pmc *pmc)
+{
+	struct device_node *np;
+
+	for_each_compatible_node(np, NULL, "nvidia,power-domains") {
+		struct tegra_powergate *powergate;
+		const char *name;
+		int err;
+		u32 id;
+		bool off;
+
+		err = of_property_read_string(np, "name", &name);
+		if (err) {
+			dev_err(pmc->dev, "no significant name for domain\n");
+			return err;
+		}
+
+		err = of_property_read_u32(np, "domain", &id);
+		if (err) {
+			dev_err(pmc->dev, "no powergate ID for domain\n");
+			return err;
+		}
+
+		powergate = devm_kzalloc(pmc->dev, sizeof(*powergate),
+						GFP_KERNEL);
+		if (!powergate) {
+			dev_err(pmc->dev, "failed to allocate memory for domain %s\n",
+					name);
+			return -ENOMEM;
+		}
+
+		if (of_property_read_bool(np, "external-power-rail")) {
+			powergate->is_vdd = true;
+			err = tegra_powergate_get_regulator(powergate);
+			if (err) {
+				/*
+				 * The regulator might not be ready yet, so just
+				 * give a warning instead of failing the whole
+				 * init.
+				 */
+				dev_warn(pmc->dev, "couldn't locate regulator\n");
+			}
+		}
+
+		powergate->of_node = np;
+		powergate->name = name;
+		powergate->id = id;
+		powergate->base.name = kstrdup(powergate->name, GFP_KERNEL);
+		powergate->base.power_off = tegra_pmc_powergate_power_off;
+		powergate->base.power_on = tegra_pmc_powergate_power_on;
+		powergate->pmc = pmc;
+
+		err = tegra_powergate_of_get_clks(powergate);
+		if (err)
+			return err;
+
+		err = tegra_powergate_of_get_resets(powergate);
+		if (err)
+			return err;
+
+		err = tegra_powergate_of_get_swgroups(powergate);
+		if (err)
+			return err;
+
+		list_add_tail(&powergate->head, &pmc->powergate_list);
+
+		if ((powergate->is_vdd && !IS_ERR(powergate->vdd)) ||
+			!powergate->is_vdd)
+			tegra_pmc_powergate_power_off(&powergate->base);
+
+		off = !tegra_pmc_powergate_is_powered(powergate);
+		pm_genpd_init(&powergate->base, NULL, off);
+
+		pmc->power_domain_num++;
+
+		dev_info(pmc->dev, "added power domain %s\n", powergate->name);
+	}
+
+	dev_info(pmc->dev, "%d power domains added\n", pmc->power_domain_num);
+	return 0;
+}
+
+static int tegra_pmc_powergate_init_subdomain(struct tegra_pmc *pmc)
+{
+	struct tegra_powergate *powergate;
+
+	list_for_each_entry(powergate, &pmc->powergate_list, head) {
+		struct device_node *pdn;
+		struct tegra_powergate *parent = NULL;
+		struct tegra_powergate *temp;
+		int err;
+
+		pdn = of_parse_phandle(powergate->of_node, "depend-on", 0);
+		if (!pdn)
+			continue;
+
+		list_for_each_entry(temp, &pmc->powergate_list, head) {
+			if (temp->of_node == pdn) {
+				parent = temp;
+				break;
+			}
+		}
+
+		if (!parent)
+			return -EINVAL;
+
+		err = pm_genpd_add_subdomain_names(parent->name,
+				powergate->name);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int tegra_powergate_init(struct tegra_pmc *pmc)
+{
+	struct device_node *np = pmc->dev->of_node;
+	int err = 0;
+
+	dev_dbg(pmc->dev, "> %s(pmc=%p)\n", __func__, pmc);
+
+	INIT_LIST_HEAD(&pmc->powergate_list);
+	err = tegra_pmc_powergate_init_powerdomain(pmc);
+	if (err)
+		goto out;
+
+	err = tegra_pmc_powergate_init_subdomain(pmc);
+	if (err < 0)
+		return err;
+
+	err = __of_genpd_add_provider(np, tegra_powergate_of_xlate, pmc);
+	if (err < 0)
+		return err;
+
+out:
+	dev_dbg(pmc->dev, "< %s() = %d\n", __func__, err);
+	return err;
+}
+
 static int tegra_io_rail_prepare(int id, unsigned long *request,
 				 unsigned long *status, unsigned int *bit)
 {
@@ -806,6 +1378,8 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
+	dev_dbg(&pdev->dev, "> %s(pdev=%p)\n", __func__, pdev);
+
 	err = tegra_pmc_parse_dt(pmc, pdev->dev.of_node);
 	if (err < 0)
 		return err;
@@ -831,12 +1405,19 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 
 	tegra_pmc_init_tsense_reset(pmc);
 
+	if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) {
+		err = tegra_powergate_init(pmc);
+		if (err < 0)
+			return err;
+	}
+
 	if (IS_ENABLED(CONFIG_DEBUG_FS)) {
 		err = tegra_powergate_debugfs_init();
 		if (err < 0)
 			return err;
 	}
 
+	dev_dbg(&pdev->dev, "< %s()\n", __func__);
 	return 0;
 }
 
@@ -876,6 +1457,7 @@ static const struct tegra_pmc_soc tegra20_pmc_soc = {
 	.cpu_powergates = NULL,
 	.has_tsense_reset = false,
 	.has_gpu_clamps = false,
+	.is_legacy_powergate = true,
 };
 
 static const char * const tegra30_powergates[] = {
@@ -909,6 +1491,7 @@ static const struct tegra_pmc_soc tegra30_pmc_soc = {
 	.cpu_powergates = tegra30_cpu_powergates,
 	.has_tsense_reset = true,
 	.has_gpu_clamps = false,
+	.is_legacy_powergate = true,
 };
 
 static const char * const tegra114_powergates[] = {
@@ -946,6 +1529,7 @@ static const struct tegra_pmc_soc tegra114_pmc_soc = {
 	.cpu_powergates = tegra114_cpu_powergates,
 	.has_tsense_reset = true,
 	.has_gpu_clamps = false,
+	.is_legacy_powergate = false,
 };
 
 static const char * const tegra124_powergates[] = {
@@ -989,6 +1573,7 @@ static const struct tegra_pmc_soc tegra124_pmc_soc = {
 	.cpu_powergates = tegra124_cpu_powergates,
 	.has_tsense_reset = true,
 	.has_gpu_clamps = true,
+	.is_legacy_powergate = false,
 };
 
 static const struct of_device_id tegra_pmc_match[] = {
diff --git a/include/dt-bindings/power/tegra-powergate.h b/include/dt-bindings/power/tegra-powergate.h
new file mode 100644
index 000000000000..b8265167c20e
--- /dev/null
+++ b/include/dt-bindings/power/tegra-powergate.h
@@ -0,0 +1,30 @@
+#ifndef _DT_BINDINGS_POWER_TEGRA_POWERGATE_H
+#define _DT_BINDINGS_POWER_TEGRA_POWERGATE_H
+
+#define TEGRA_POWERGATE_CPU	0
+#define TEGRA_POWERGATE_3D	1
+#define TEGRA_POWERGATE_VENC	2
+#define TEGRA_POWERGATE_PCIE	3
+#define TEGRA_POWERGATE_VDEC	4
+#define TEGRA_POWERGATE_L2	5
+#define TEGRA_POWERGATE_MPE	6
+#define TEGRA_POWERGATE_HEG	7
+#define TEGRA_POWERGATE_SATA	8
+#define TEGRA_POWERGATE_CPU1	9
+#define TEGRA_POWERGATE_CPU2	10
+#define TEGRA_POWERGATE_CPU3	11
+#define TEGRA_POWERGATE_CELP	12
+#define TEGRA_POWERGATE_3D1	13
+#define TEGRA_POWERGATE_CPU0	14
+#define TEGRA_POWERGATE_C0NC	15
+#define TEGRA_POWERGATE_C1NC	16
+#define TEGRA_POWERGATE_SOR	17
+#define TEGRA_POWERGATE_DIS	18
+#define TEGRA_POWERGATE_DISB	19
+#define TEGRA_POWERGATE_XUSBA	20
+#define TEGRA_POWERGATE_XUSBB	21
+#define TEGRA_POWERGATE_XUSBC	22
+#define TEGRA_POWERGATE_VIC	23
+#define TEGRA_POWERGATE_IRAM	24
+
+#endif
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 08/17] ARM: tegra: add PM domain device nodes to Tegra30 DT
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (6 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 09/17] ARM: tegra: add PM domain device nodes to Tegra114 DT Vince Hsu
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Also bind the PM domain provider and consumer together.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 arch/arm/boot/dts/tegra30.dtsi | 45 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index db4810df142c..bec1b17fdcab 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -2,6 +2,7 @@
 #include <dt-bindings/gpio/tegra-gpio.h>
 #include <dt-bindings/memory/tegra30-mc.h>
 #include <dt-bindings/pinctrl/pinctrl-tegra.h>
+#include <dt-bindings/power/tegra-powergate.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
@@ -36,6 +37,7 @@
 			  0x82000000 0 0x20000000 0x20000000 0 0x08000000   /* non-prefetchable memory */
 			  0xc2000000 0 0x28000000 0x28000000 0 0x18000000>; /* prefetchable memory */
 
+		power-domains = <&pmc TEGRA_POWERGATE_PCIE>;
 		clocks = <&tegra_car TEGRA30_CLK_PCIE>,
 			 <&tegra_car TEGRA30_CLK_AFI>,
 			 <&tegra_car TEGRA30_CLK_PLL_E>,
@@ -149,6 +151,14 @@
 		gr3d@54180000 {
 			compatible = "nvidia,tegra30-gr3d";
 			reg = <0x54180000 0x00040000>;
+			/*
+			 * Actually the gr3d has two power domains, but the
+			 * generic power domain doesn't support multiple
+			 * domain provider for one device yet. So we claim
+			 * the gr3d is powered by the domain 3D1 here, and
+			 * let the 3D1 depend on 3D below.
+			 */
+			power-domains = <&pmc TEGRA_POWERGATE_3D1>;
 			clocks = <&tegra_car TEGRA30_CLK_GR3D
 				  &tegra_car TEGRA30_CLK_GR3D2>;
 			clock-names = "3d", "3d2";
@@ -613,11 +623,44 @@
 		status = "disabled";
 	};
 
-	pmc@7000e400 {
+	pmc: pmc@7000e400 {
 		compatible = "nvidia,tegra30-pmc";
 		reg = <0x7000e400 0x400>;
 		clocks = <&tegra_car TEGRA30_CLK_PCLK>, <&clk32k_in>;
 		clock-names = "pclk", "clk32k_in";
+		#power-domain-cells = <1>;
+	};
+
+	gr3dpd: gr3d-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "gr3d-power-domain";
+		domain = <TEGRA_POWERGATE_3D>;
+		clocks = <&tegra_car TEGRA30_CLK_GR3D>;
+		resets = <&tegra_car 24>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_NV>;
+	};
+
+	gr3d2-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "gr3d2-power-domain";
+		domain = <TEGRA_POWERGATE_3D1>;
+		clocks = <&tegra_car TEGRA30_CLK_GR3D2>;
+		resets = <&tegra_car 98>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_NV2>;
+		depend-on = <&gr3dpd>;
+	};
+
+	pcie-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "pcie-power-domain";
+		domain = <TEGRA_POWERGATE_PCIE>;
+		clocks = <&tegra_car TEGRA30_CLK_AFI>,
+			 <&tegra_car TEGRA30_CLK_PCIE>,
+			 <&tegra_car TEGRA30_CLK_CML0>;
+		resets = <&tegra_car 70>,
+			 <&tegra_car 72>,
+			 <&tegra_car 74>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_AFI>;
 	};
 
 	mc: memory-controller@7000f000 {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 09/17] ARM: tegra: add PM domain device nodes to Tegra114 DT
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (7 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 08/17] ARM: tegra: add PM domain device nodes to Tegra30 DT Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 10/17] ARM: tegra: add PM domain device nodes to Tegra124 DT Vince Hsu
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Also bind the PM domain provider and consumer together.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 arch/arm/boot/dts/tegra114.dtsi | 43 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 4296b5398bf5..79e1f5cfa53c 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -2,6 +2,7 @@
 #include <dt-bindings/gpio/tegra-gpio.h>
 #include <dt-bindings/memory/tegra114-mc.h>
 #include <dt-bindings/pinctrl/pinctrl-tegra.h>
+#include <dt-bindings/power/tegra-powergate.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
@@ -36,6 +37,7 @@
 		gr3d@54180000 {
 			compatible = "nvidia,tegra114-gr3d", "nvidia,tegra20-gr3d";
 			reg = <0x54180000 0x00040000>;
+			power-domains = <&pmc TEGRA_POWERGATE_3D>;
 			clocks = <&tegra_car TEGRA114_CLK_GR3D>;
 			resets = <&tegra_car 24>;
 			reset-names = "3d";
@@ -45,6 +47,7 @@
 			compatible = "nvidia,tegra114-dc", "nvidia,tegra20-dc";
 			reg = <0x54200000 0x00040000>;
 			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+			power-domains = <&pmc TEGRA_POWERGATE_DIS>;
 			clocks = <&tegra_car TEGRA114_CLK_DISP1>,
 				 <&tegra_car TEGRA114_CLK_PLL_P>;
 			clock-names = "dc", "parent";
@@ -64,6 +67,7 @@
 			compatible = "nvidia,tegra114-dc", "nvidia,tegra20-dc";
 			reg = <0x54240000 0x00040000>;
 			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+			power-domains = <&pmc TEGRA_POWERGATE_DISB>;
 			clocks = <&tegra_car TEGRA114_CLK_DISP2>,
 				 <&tegra_car TEGRA114_CLK_PLL_P>;
 			clock-names = "dc", "parent";
@@ -487,11 +491,48 @@
 		status = "disabled";
 	};
 
-	pmc@7000e400 {
+	pmc: pmc@7000e400 {
 		compatible = "nvidia,tegra114-pmc";
 		reg = <0x7000e400 0x400>;
 		clocks = <&tegra_car TEGRA114_CLK_PCLK>, <&clk32k_in>;
 		clock-names = "pclk", "clk32k_in";
+		#power-domain-cells = <1>;
+	};
+
+	dcpd: dc-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "dc-power-domain";
+		domain = <TEGRA_POWERGATE_DIS>;
+		clocks = <&tegra_car TEGRA114_CLK_DISP1>,
+			<&tegra_car TEGRA114_CLK_DSIA>,
+			<&tegra_car TEGRA114_CLK_DSIB>,
+			<&tegra_car TEGRA114_CLK_MIPI_CAL>;
+		resets = <&tegra_car 27>,
+			<&tegra_car 48>,
+			<&tegra_car 82>,
+			<&tegra_car 56>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_DC>;
+	};
+
+	dcb-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "dcb-power-domain";
+		domain = <TEGRA_POWERGATE_DISB>;
+		clocks = <&tegra_car TEGRA114_CLK_DISP2>,
+			<&tegra_car TEGRA114_CLK_HDMI>;
+		resets = <&tegra_car 26>,
+			<&tegra_car 51>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_DCB>;
+		depend-on = <&dcpd>;
+	};
+
+	gr3d-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "gr3d-power-domain";
+		domain = <TEGRA_POWERGATE_3D>;
+		clocks = <&tegra_car TEGRA114_CLK_GR3D>;
+		resets = <&tegra_car 24>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_NV>;
 	};
 
 	fuse@7000f800 {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 10/17] ARM: tegra: add PM domain device nodes to Tegra124 DT
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (8 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 09/17] ARM: tegra: add PM domain device nodes to Tegra114 DT Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 11/17] ARM: tegra: add GPU power supply to Jetson TK1 DT Vince Hsu
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Also bind the PM domain provider and consumer together.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 arch/arm/boot/dts/tegra124.dtsi | 86 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
index 4be06c6ea0c8..0ef15136d829 100644
--- a/arch/arm/boot/dts/tegra124.dtsi
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -3,6 +3,7 @@
 #include <dt-bindings/memory/tegra124-mc.h>
 #include <dt-bindings/pinctrl/pinctrl-tegra.h>
 #include <dt-bindings/pinctrl/pinctrl-tegra-xusb.h>
+#include <dt-bindings/power/tegra-powergate.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/thermal/tegra124-soctherm.h>
 
@@ -39,6 +40,8 @@
 			  0x82000000 0 0x13000000 0x0 0x13000000 0 0x0d000000   /* non-prefetchable memory (208 MiB) */
 			  0xc2000000 0 0x20000000 0x0 0x20000000 0 0x20000000>; /* prefetchable memory (512 MiB) */
 
+		power-domains = <&pmc TEGRA_POWERGATE_PCIE>;
+
 		clocks = <&tegra_car TEGRA124_CLK_PCIE>,
 			 <&tegra_car TEGRA124_CLK_AFI>,
 			 <&tegra_car TEGRA124_CLK_PLL_E>,
@@ -98,6 +101,7 @@
 			compatible = "nvidia,tegra124-dc";
 			reg = <0x0 0x54200000 0x0 0x00040000>;
 			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+			power-domains = <&pmc TEGRA_POWERGATE_DIS>;
 			clocks = <&tegra_car TEGRA124_CLK_DISP1>,
 				 <&tegra_car TEGRA124_CLK_PLL_P>;
 			clock-names = "dc", "parent";
@@ -113,6 +117,7 @@
 			compatible = "nvidia,tegra124-dc";
 			reg = <0x0 0x54240000 0x0 0x00040000>;
 			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+			power-domains = <&pmc TEGRA_POWERGATE_DISB>;
 			clocks = <&tegra_car TEGRA124_CLK_DISP2>,
 				 <&tegra_car TEGRA124_CLK_PLL_P>;
 			clock-names = "dc", "parent";
@@ -140,6 +145,7 @@
 			compatible = "nvidia,tegra124-sor";
 			reg = <0x0 0x54540000 0x0 0x00040000>;
 			interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+			power-domains = <&pmc TEGRA_POWERGATE_SOR>;
 			clocks = <&tegra_car TEGRA124_CLK_SOR0>,
 				 <&tegra_car TEGRA124_CLK_PLL_D_OUT0>,
 				 <&tegra_car TEGRA124_CLK_PLL_DP>,
@@ -182,6 +188,7 @@
 		interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-names = "stall", "nonstall";
+		power-domains = <&pmc TEGRA_POWERGATE_3D>;
 		clocks = <&tegra_car TEGRA124_CLK_GPU>,
 			 <&tegra_car TEGRA124_CLK_PLL_P_OUT5>;
 		clock-names = "gpu", "pwr";
@@ -542,11 +549,86 @@
 		clocks = <&tegra_car TEGRA124_CLK_RTC>;
 	};
 
-	pmc@0,7000e400 {
+	pmc: pmc@0,7000e400 {
 		compatible = "nvidia,tegra124-pmc";
 		reg = <0x0 0x7000e400 0x0 0x400>;
 		clocks = <&tegra_car TEGRA124_CLK_PCLK>, <&clk32k_in>;
 		clock-names = "pclk", "clk32k_in";
+		#power-domain-cells = <1>;
+	};
+
+	dcpd: dc-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "dc-power-domain";
+		domain = <TEGRA_POWERGATE_DIS>;
+		clocks = <&tegra_car TEGRA124_CLK_DISP1>;
+		resets = <&tegra_car 27>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_DC>;
+		depend-on = <&sorpd>;
+	};
+
+	dcb-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "dcb-power-domain";
+		domain = <TEGRA_POWERGATE_DISB>;
+		clocks = <&tegra_car TEGRA124_CLK_DISP2>;
+		resets = <&tegra_car 26>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_DCB>;
+		depend-on = <&dcpd>;
+	};
+
+	pcie-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "pcie-power-domain";
+		domain = <TEGRA_POWERGATE_PCIE>;
+		clocks = <&tegra_car TEGRA124_CLK_PCIE>,
+			 <&tegra_car TEGRA124_CLK_AFI>,
+			 <&tegra_car TEGRA124_CLK_CML0>;
+		resets = <&tegra_car 70>,
+			 <&tegra_car 72>,
+			 <&tegra_car 74>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_AFI>;
+	};
+
+	sorpd: sor-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "sor-power-domain";
+		domain = <TEGRA_POWERGATE_SOR>;
+		clocks = <&tegra_car TEGRA124_CLK_SOR0>,
+			 <&tegra_car TEGRA124_CLK_DSIA>,
+			 <&tegra_car TEGRA124_CLK_DSIB>,
+			 <&tegra_car TEGRA124_CLK_HDMI>,
+			 <&tegra_car TEGRA124_CLK_MIPI_CAL>,
+			 <&tegra_car TEGRA124_CLK_DPAUX>;
+		resets = <&tegra_car 182>,
+			<&tegra_car 48>,
+			<&tegra_car 82>,
+			<&tegra_car 51>,
+			<&tegra_car 56>;
+	};
+
+	gpu-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "gpu-power-domain";
+		domain = <TEGRA_POWERGATE_3D>;
+		clocks = <&tegra_car TEGRA124_CLK_GPU>,
+			 <&tegra_car TEGRA124_CLK_PLL_P_OUT5>;
+		resets = <&tegra_car 184>;
+		external-power-rail;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_GPU>;
+	};
+
+	sata-power-domain {
+		compatible = "nvidia,power-domains";
+		name = "sata-power-domain";
+		domain = <TEGRA_POWERGATE_SATA>;
+		clocks = <&tegra_car TEGRA124_CLK_SATA>,
+			<&tegra_car TEGRA124_CLK_SATA_OOB>,
+			<&tegra_car TEGRA124_CLK_CML1>;
+		resets = <&tegra_car 124>,
+			<&tegra_car 123>,
+			<&tegra_car 129>;
+		nvidia,swgroup = <&mc TEGRA_SWGROUP_SATA>;
 	};
 
 	fuse@0,7000f800 {
@@ -588,6 +670,8 @@
 			<&tegra_car 129>;
 		reset-names = "sata", "sata-oob", "sata-cold";
 
+		power-domains = <&pmc TEGRA_POWERGATE_SATA>;
+
 		phys = <&padctl TEGRA_XUSB_PADCTL_SATA>;
 		phy-names = "sata-phy";
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 11/17] ARM: tegra: add GPU power supply to Jetson TK1 DT
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (9 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 10/17] ARM: tegra: add PM domain device nodes to Tegra124 DT Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 12/17] drm/tegra: dc: remove the power sequence from driver Vince Hsu
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

Add power supply information which is board dependent for GK20A.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 arch/arm/boot/dts/tegra124-jetson-tk1.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
index dbfaba09703a..7558f9280646 100644
--- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
@@ -1682,6 +1682,10 @@
 		};
 	};
 
+	gpu-power-domain {
+		vdd-supply = <&vdd_gpu>;
+	};
+
 	/* Serial ATA */
 	sata@0,70020000 {
 		status = "okay";
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 12/17] drm/tegra: dc: remove the power sequence from driver
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (10 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 11/17] ARM: tegra: add GPU power supply to Jetson TK1 DT Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 13/17] PCI: tegra: " Vince Hsu
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

We have the generic PM domain support for Tegra SoCs now. So remove the
duplicated power sequence here.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/gpu/drm/tegra/dc.c | 46 +++++++++++-----------------------------------
 1 file changed, 11 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 1a52522f5da7..838bb8634da7 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -28,7 +28,6 @@ struct tegra_dc_soc_info {
 	bool supports_cursor;
 	bool supports_block_linear;
 	unsigned int pitch_align;
-	bool has_powergate;
 };
 
 struct tegra_plane {
@@ -1786,7 +1785,6 @@ static const struct tegra_dc_soc_info tegra20_dc_soc_info = {
 	.supports_cursor = false,
 	.supports_block_linear = false,
 	.pitch_align = 8,
-	.has_powergate = false,
 };
 
 static const struct tegra_dc_soc_info tegra30_dc_soc_info = {
@@ -1795,7 +1793,6 @@ static const struct tegra_dc_soc_info tegra30_dc_soc_info = {
 	.supports_cursor = false,
 	.supports_block_linear = false,
 	.pitch_align = 8,
-	.has_powergate = false,
 };
 
 static const struct tegra_dc_soc_info tegra114_dc_soc_info = {
@@ -1804,7 +1801,6 @@ static const struct tegra_dc_soc_info tegra114_dc_soc_info = {
 	.supports_cursor = false,
 	.supports_block_linear = false,
 	.pitch_align = 64,
-	.has_powergate = true,
 };
 
 static const struct tegra_dc_soc_info tegra124_dc_soc_info = {
@@ -1813,7 +1809,6 @@ static const struct tegra_dc_soc_info tegra124_dc_soc_info = {
 	.supports_cursor = true,
 	.supports_block_linear = true,
 	.pitch_align = 64,
-	.has_powergate = true,
 };
 
 static const struct of_device_id tegra_dc_of_match[] = {
@@ -1906,33 +1901,18 @@ static int tegra_dc_probe(struct platform_device *pdev)
 		return PTR_ERR(dc->rst);
 	}
 
-	if (dc->soc->has_powergate) {
-		if (dc->pipe == 0)
-			dc->powergate = TEGRA_POWERGATE_DIS;
-		else
-			dc->powergate = TEGRA_POWERGATE_DISB;
-
-		err = tegra_powergate_sequence_power_up(dc->powergate, dc->clk,
-							dc->rst);
-		if (err < 0) {
-			dev_err(&pdev->dev, "failed to power partition: %d\n",
-				err);
-			return err;
-		}
-	} else {
-		err = clk_prepare_enable(dc->clk);
-		if (err < 0) {
-			dev_err(&pdev->dev, "failed to enable clock: %d\n",
-				err);
-			return err;
-		}
+	err = clk_prepare_enable(dc->clk);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to enable clock: %d\n",
+			err);
+		return err;
+	}
 
-		err = reset_control_deassert(dc->rst);
-		if (err < 0) {
-			dev_err(&pdev->dev, "failed to deassert reset: %d\n",
-				err);
-			return err;
-		}
+	err = reset_control_deassert(dc->rst);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to deassert reset: %d\n",
+			err);
+		return err;
 	}
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1987,10 +1967,6 @@ static int tegra_dc_remove(struct platform_device *pdev)
 	}
 
 	reset_control_assert(dc->rst);
-
-	if (dc->soc->has_powergate)
-		tegra_powergate_power_off(dc->powergate);
-
 	clk_disable_unprepare(dc->clk);
 
 	return 0;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 13/17] PCI: tegra: remove the power sequence from driver
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (11 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 12/17] drm/tegra: dc: remove the power sequence from driver Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 14/17] ata: ahci_tegra: remove " Vince Hsu
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

We have the generic PM domain support for Tegra SoCs now. So remove the
duplicated power sequence here.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
v2: enable pex clock when powering on

 drivers/pci/host/pci-tegra.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 00e92720d7f7..b1e2794d6dfa 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -931,12 +931,6 @@ static void tegra_pcie_power_off(struct tegra_pcie *pcie)
 	if (err < 0)
 		dev_warn(pcie->dev, "failed to power off PHY: %d\n", err);
 
-	reset_control_assert(pcie->pcie_xrst);
-	reset_control_assert(pcie->afi_rst);
-	reset_control_assert(pcie->pex_rst);
-
-	tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
-
 	err = regulator_bulk_disable(pcie->num_supplies, pcie->supplies);
 	if (err < 0)
 		dev_warn(pcie->dev, "failed to disable regulators: %d\n", err);
@@ -947,27 +941,17 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
 	const struct tegra_pcie_soc_data *soc = pcie->soc_data;
 	int err;
 
-	reset_control_assert(pcie->pcie_xrst);
-	reset_control_assert(pcie->afi_rst);
-	reset_control_assert(pcie->pex_rst);
-
-	tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
-
 	/* enable regulators */
 	err = regulator_bulk_enable(pcie->num_supplies, pcie->supplies);
 	if (err < 0)
 		dev_err(pcie->dev, "failed to enable regulators: %d\n", err);
 
-	err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE,
-						pcie->pex_clk,
-						pcie->pex_rst);
-	if (err) {
-		dev_err(pcie->dev, "powerup sequence failed: %d\n", err);
+	err = clk_prepare_enable(pcie->pex_clk);
+	if (err < 0) {
+		dev_err(pcie->dev, "failed to enable PEX clock: %d\n", err);
 		return err;
 	}
 
-	reset_control_deassert(pcie->afi_rst);
-
 	err = clk_prepare_enable(pcie->afi_clk);
 	if (err < 0) {
 		dev_err(pcie->dev, "failed to enable AFI clock: %d\n", err);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 14/17] ata: ahci_tegra: remove power sequence from driver
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (12 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 13/17] PCI: tegra: " Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:19   ` Tejun Heo
  2015-03-12 12:15 ` [PATCH v2 15/17] drm/tegra: remove GR3D " Vince Hsu
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

We have the generic PM domain support for Tegra SoCs now. So remove the
duplicated sequence here.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/ata/ahci_tegra.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index 3a62eb246d80..8151587ddb70 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -120,12 +120,6 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
 	if (ret)
 		return ret;
 
-	ret = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_SATA,
-						tegra->sata_clk,
-						tegra->sata_rst);
-	if (ret)
-		goto disable_regulators;
-
 	reset_control_assert(tegra->sata_oob_rst);
 	reset_control_assert(tegra->sata_cold_rst);
 
@@ -140,10 +134,6 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
 
 disable_power:
 	clk_disable_unprepare(tegra->sata_clk);
-
-	tegra_powergate_power_off(TEGRA_POWERGATE_SATA);
-
-disable_regulators:
 	regulator_bulk_disable(ARRAY_SIZE(tegra->supplies), tegra->supplies);
 
 	return ret;
@@ -160,7 +150,6 @@ static void tegra_ahci_power_off(struct ahci_host_priv *hpriv)
 	reset_control_assert(tegra->sata_cold_rst);
 
 	clk_disable_unprepare(tegra->sata_clk);
-	tegra_powergate_power_off(TEGRA_POWERGATE_SATA);
 
 	regulator_bulk_disable(ARRAY_SIZE(tegra->supplies), tegra->supplies);
 }
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 15/17] drm/tegra: remove GR3D power sequence from driver
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (13 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 14/17] ata: ahci_tegra: remove " Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 16/17] ARM: tegra: select PM_GENERIC_DOMAINS Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs Vince Hsu
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

We have the generic PM domain support for Tegra SoCs now. So remove the
duplicated power sequence here.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/gpu/drm/tegra/gr3d.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
index 0b3f2b977ba0..fd8642cdc42f 100644
--- a/drivers/gpu/drm/tegra/gr3d.c
+++ b/drivers/gpu/drm/tegra/gr3d.c
@@ -281,21 +281,17 @@ static int gr3d_probe(struct platform_device *pdev)
 		}
 	}
 
-	err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk,
-						gr3d->rst);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to power up 3D unit\n");
+	err = clk_prepare_enable(gr3d->clk);
+	if (err) {
+		dev_err(&pdev->dev, "failed to enable clk\n");
 		return err;
 	}
 
 	if (gr3d->clk_secondary) {
-		err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D1,
-							gr3d->clk_secondary,
-							gr3d->rst_secondary);
-		if (err < 0) {
-			dev_err(&pdev->dev,
-				"failed to power up secondary 3D unit\n");
-			return err;
+		err = clk_prepare_enable(gr3d->clk_secondary);
+		if (err) {
+			dev_err(&pdev->dev, "failed to enable secondary clk\n");
+			goto err_clk_sec;
 		}
 	}
 
@@ -313,7 +309,7 @@ static int gr3d_probe(struct platform_device *pdev)
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register host1x client: %d\n",
 			err);
-		return err;
+		goto err_host1x;
 	}
 
 	/* initialize address register map */
@@ -323,6 +319,13 @@ static int gr3d_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, gr3d);
 
 	return 0;
+
+err_clk_sec:
+	clk_disable_unprepare(gr3d->clk);
+err_host1x:
+	clk_disable_unprepare(gr3d->clk_secondary);
+
+	return err;
 }
 
 static int gr3d_remove(struct platform_device *pdev)
@@ -337,12 +340,9 @@ static int gr3d_remove(struct platform_device *pdev)
 		return err;
 	}
 
-	if (gr3d->clk_secondary) {
-		tegra_powergate_power_off(TEGRA_POWERGATE_3D1);
+	if (gr3d->clk_secondary)
 		clk_disable_unprepare(gr3d->clk_secondary);
-	}
 
-	tegra_powergate_power_off(TEGRA_POWERGATE_3D);
 	clk_disable_unprepare(gr3d->clk);
 
 	return 0;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 16/17] ARM: tegra: select PM_GENERIC_DOMAINS
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (14 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 15/17] drm/tegra: remove GR3D " Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:15 ` [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs Vince Hsu
  16 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

We have added generic power domain support for Tegra SoCs. So now the option
PM_GENERIC_DOMAINS must be enabled by default to have proper power sequence.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 arch/arm/mach-tegra/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 5d1a318f1302..193d5b2da8ba 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -8,6 +8,7 @@ menuconfig ARCH_TEGRA
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
 	select PINCTRL
+	select PM_GENERIC_DOMAINS if PM
 	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 	select SOC_BUS
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs
  2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
                   ` (15 preceding siblings ...)
  2015-03-12 12:15 ` [PATCH v2 16/17] ARM: tegra: select PM_GENERIC_DOMAINS Vince Hsu
@ 2015-03-12 12:15 ` Vince Hsu
  2015-03-12 12:45   ` Thierry Reding
  16 siblings, 1 reply; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:15 UTC (permalink / raw)
  To: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon
  Cc: linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar, Vince Hsu

We switch to generic power domain now. So remove the legacy functions.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
 include/soc/tegra/pmc.h | 22 ----------------
 2 files changed, 90 deletions(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index ed1ce06e3635..2fc32f688493 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -233,31 +233,6 @@ static int tegra_powergate_set(int id, bool new_state)
 }
 
 /**
- * tegra_powergate_power_on() - power on partition
- * @id: partition ID
- */
-int tegra_powergate_power_on(int id)
-{
-	if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates)
-		return -EINVAL;
-
-	return tegra_powergate_set(id, true);
-}
-
-/**
- * tegra_powergate_power_off() - power off partition
- * @id: partition ID
- */
-int tegra_powergate_power_off(int id)
-{
-	if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates)
-		return -EINVAL;
-
-	return tegra_powergate_set(id, false);
-}
-EXPORT_SYMBOL(tegra_powergate_power_off);
-
-/**
  * tegra_powergate_is_powered() - check if partition is powered
  * @id: partition ID
  */
@@ -313,49 +288,6 @@ int tegra_powergate_remove_clamping(int id)
 }
 EXPORT_SYMBOL(tegra_powergate_remove_clamping);
 
-/**
- * tegra_powergate_sequence_power_up() - power up partition
- * @id: partition ID
- * @clk: clock for partition
- * @rst: reset for partition
- *
- * Must be called with clk disabled, and returns with clk enabled.
- */
-int tegra_powergate_sequence_power_up(int id, struct clk *clk,
-				      struct reset_control *rst)
-{
-	int ret;
-
-	reset_control_assert(rst);
-
-	ret = tegra_powergate_power_on(id);
-	if (ret)
-		goto err_power;
-
-	ret = clk_prepare_enable(clk);
-	if (ret)
-		goto err_clk;
-
-	usleep_range(10, 20);
-
-	ret = tegra_powergate_remove_clamping(id);
-	if (ret)
-		goto err_clamp;
-
-	usleep_range(10, 20);
-	reset_control_deassert(rst);
-
-	return 0;
-
-err_clamp:
-	clk_disable_unprepare(clk);
-err_clk:
-	tegra_powergate_power_off(id);
-err_power:
-	return ret;
-}
-EXPORT_SYMBOL(tegra_powergate_sequence_power_up);
-
 #ifdef CONFIG_SMP
 /**
  * tegra_get_cpu_powergate_id() - convert from CPU ID to partition ID
diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
index 65a93273e72f..8a4092d1d818 100644
--- a/include/soc/tegra/pmc.h
+++ b/include/soc/tegra/pmc.h
@@ -106,14 +106,8 @@ int tegra_pmc_cpu_remove_clamping(int cpuid);
 
 #ifdef CONFIG_ARCH_TEGRA
 int tegra_powergate_is_powered(int id);
-int tegra_powergate_power_on(int id);
-int tegra_powergate_power_off(int id);
 int tegra_powergate_remove_clamping(int id);
 
-/* Must be called with clk disabled, and returns with clk enabled */
-int tegra_powergate_sequence_power_up(int id, struct clk *clk,
-				      struct reset_control *rst);
-
 int tegra_io_rail_power_on(int id);
 int tegra_io_rail_power_off(int id);
 #else
@@ -122,27 +116,11 @@ static inline int tegra_powergate_is_powered(int id)
 	return -ENOSYS;
 }
 
-static inline int tegra_powergate_power_on(int id)
-{
-	return -ENOSYS;
-}
-
-static inline int tegra_powergate_power_off(int id)
-{
-	return -ENOSYS;
-}
-
 static inline int tegra_powergate_remove_clamping(int id)
 {
 	return -ENOSYS;
 }
 
-static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
-						    struct reset_control *rst)
-{
-	return -ENOSYS;
-}
-
 static inline int tegra_io_rail_power_on(int id)
 {
 	return -ENOSYS;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 14/17] ata: ahci_tegra: remove power sequence from driver
  2015-03-12 12:15 ` [PATCH v2 14/17] ata: ahci_tegra: remove " Vince Hsu
@ 2015-03-12 12:19   ` Tejun Heo
  2015-03-12 12:23     ` Vince Hsu
  0 siblings, 1 reply; 28+ messages in thread
From: Tejun Heo @ 2015-03-12 12:19 UTC (permalink / raw)
  To: Vince Hsu
  Cc: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

On Thu, Mar 12, 2015 at 08:15:15PM +0800, Vince Hsu wrote:
> We have the generic PM domain support for Tegra SoCs now. So remove the
> duplicated sequence here.
> 
> Signed-off-by: Vince Hsu <vinceh@nvidia.com>

Can you please repost this patch w/ Hans de Goede
<hdegoede@redhat.com> cc'd?  Just reposting the patch as a reply to
itself w/ the cc added should do.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 14/17] ata: ahci_tegra: remove power sequence from driver
  2015-03-12 12:19   ` Tejun Heo
@ 2015-03-12 12:23     ` Vince Hsu
  2015-03-12 12:33       ` Hans de Goede
  0 siblings, 1 reply; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 12:23 UTC (permalink / raw)
  To: Tejun Heo
  Cc: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar, hdegoede

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Cc'd Hans.

Thanks,
Vince

On 03/12/2015 08:19 PM, Tejun Heo wrote:
> On Thu, Mar 12, 2015 at 08:15:15PM +0800, Vince Hsu wrote:
>> We have the generic PM domain support for Tegra SoCs now. So remove the
>> duplicated sequence here.
>>
>> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> Can you please repost this patch w/ Hans de Goede
> <hdegoede@redhat.com> cc'd?  Just reposting the patch as a reply to
> itself w/ the cc added should do.
>
> Thanks.
>


[-- Attachment #2: 0014-ata-ahci_tegra-remove-power-sequence-from-driver.patch --]
[-- Type: text/x-patch, Size: 1619 bytes --]

>From afff7ff2011f2c3f159726ffddeaeec8f62f013e Mon Sep 17 00:00:00 2001
From: Vince Hsu <vinceh@nvidia.com>
Date: Wed, 14 Jan 2015 11:01:06 +0800
Subject: [PATCH v2 14/17] ata: ahci_tegra: remove power sequence from driver
X-NVConfidentiality: public

We have the generic PM domain support for Tegra SoCs now. So remove the
duplicated sequence here.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/ata/ahci_tegra.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index 3a62eb246d80..8151587ddb70 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -120,12 +120,6 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
 	if (ret)
 		return ret;
 
-	ret = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_SATA,
-						tegra->sata_clk,
-						tegra->sata_rst);
-	if (ret)
-		goto disable_regulators;
-
 	reset_control_assert(tegra->sata_oob_rst);
 	reset_control_assert(tegra->sata_cold_rst);
 
@@ -140,10 +134,6 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
 
 disable_power:
 	clk_disable_unprepare(tegra->sata_clk);
-
-	tegra_powergate_power_off(TEGRA_POWERGATE_SATA);
-
-disable_regulators:
 	regulator_bulk_disable(ARRAY_SIZE(tegra->supplies), tegra->supplies);
 
 	return ret;
@@ -160,7 +150,6 @@ static void tegra_ahci_power_off(struct ahci_host_priv *hpriv)
 	reset_control_assert(tegra->sata_cold_rst);
 
 	clk_disable_unprepare(tegra->sata_clk);
-	tegra_powergate_power_off(TEGRA_POWERGATE_SATA);
 
 	regulator_bulk_disable(ARRAY_SIZE(tegra->supplies), tegra->supplies);
 }
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 14/17] ata: ahci_tegra: remove power sequence from driver
  2015-03-12 12:23     ` Vince Hsu
@ 2015-03-12 12:33       ` Hans de Goede
  0 siblings, 0 replies; 28+ messages in thread
From: Hans de Goede @ 2015-03-12 12:33 UTC (permalink / raw)
  To: Vince Hsu, Tejun Heo
  Cc: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

Hi,

On 12-03-15 13:23, Vince Hsu wrote:
> Cc'd Hans.
>
> Thanks,
> Vince
>
> On 03/12/2015 08:19 PM, Tejun Heo wrote:
>> On Thu, Mar 12, 2015 at 08:15:15PM +0800, Vince Hsu wrote:
>>> We have the generic PM domain support for Tegra SoCs now. So remove the
>>> duplicated sequence here.
>>>
>>> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
>> Can you please repost this patch w/ Hans de Goede
>> <hdegoede@redhat.com> cc'd?  Just reposting the patch as a reply to
>> itself w/ the cc added should do.
>>
>> Thanks.
>>

Patch looks good to me:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs
  2015-03-12 12:15 ` [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs Vince Hsu
@ 2015-03-12 12:45   ` Thierry Reding
  2015-03-12 13:11     ` Vince Hsu
  2015-03-12 16:18     ` Peter De Schrijver
  0 siblings, 2 replies; 28+ messages in thread
From: Thierry Reding @ 2015-03-12 12:45 UTC (permalink / raw)
  To: Vince Hsu
  Cc: pdeschrijver, swarren, gnurou, jroedel, p.zabel, mturquette,
	pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

[-- Attachment #1: Type: text/plain, Size: 901 bytes --]

On Thu, Mar 12, 2015 at 08:15:18PM +0800, Vince Hsu wrote:
> We switch to generic power domain now. So remove the legacy functions.
> 
> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> ---
>  drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
>  include/soc/tegra/pmc.h | 22 ----------------
>  2 files changed, 90 deletions(-)

I don't think we can do this. What if somebody updates their kernel but
not the DTB? In that case they'll end up with drivers that don't enable
power partitions but at the same time the powergate driver won't enable
them either because it is missing the corresponding nodes in the DTB.

What we'll have to do is probably keep the code that enables the power
partitions and make it conditional on the power domains somehow. Is
there a way to determine at runtime whether a device has been attached
to a power domain?

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs
  2015-03-12 12:45   ` Thierry Reding
@ 2015-03-12 13:11     ` Vince Hsu
  2015-03-12 16:18     ` Peter De Schrijver
  1 sibling, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-12 13:11 UTC (permalink / raw)
  To: Thierry Reding
  Cc: pdeschrijver, swarren, gnurou, jroedel, p.zabel, mturquette,
	pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

Hi,

On 03/12/2015 08:45 PM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Thu, Mar 12, 2015 at 08:15:18PM +0800, Vince Hsu wrote:
>> We switch to generic power domain now. So remove the legacy functions.
>>
>> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
>> ---
>>   drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
>>   include/soc/tegra/pmc.h | 22 ----------------
>>   2 files changed, 90 deletions(-)
> I don't think we can do this. What if somebody updates their kernel but
> not the DTB? In that case they'll end up with drivers that don't enable
> power partitions but at the same time the powergate driver won't enable
> them either because it is missing the corresponding nodes in the DTB.
You're right.

>
> What we'll have to do is probably keep the code that enables the power
> partitions and make it conditional on the power domains somehow. Is
> there a way to determine at runtime whether a device has been attached
> to a power domain?
>
Yes, we can check if a power domain is bound to the GPD by DT in the 
legacy powergate code.

Thanks,
Vince

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 01/17] reset: add of_reset_control_get_by_index()
  2015-03-12 12:15 ` [PATCH v2 01/17] reset: add of_reset_control_get_by_index() Vince Hsu
@ 2015-03-12 15:01   ` Philipp Zabel
  2015-03-13  3:04     ` Vince Hsu
  0 siblings, 1 reply; 28+ messages in thread
From: Philipp Zabel @ 2015-03-12 15:01 UTC (permalink / raw)
  To: Vince Hsu
  Cc: thierry.reding, pdeschrijver, swarren, gnurou, jroedel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

Hi Vince,

Am Donnerstag, den 12.03.2015, 20:15 +0800 schrieb Vince Hsu:
> Add of_reset_control_get_by_index() to allow the drivers to get reset device
> without knowing its name.

I see this is useful in the case of PM domain drivers that just need to
trigger a list of resets in whatever order.

> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> 
> ---
> v2: minor changes according to Alex's comments
> 
>  drivers/reset/core.c  | 44 +++++++++++++++++++++++++++++---------------
>  include/linux/reset.h |  9 +++++++++
>  2 files changed, 38 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 7955e00d04d4..5e78866acd62 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -140,28 +140,15 @@ int reset_control_status(struct reset_control *rstc)
>  }
>  EXPORT_SYMBOL_GPL(reset_control_status);
>  
> -/**
> - * of_reset_control_get - Lookup and obtain a reference to a reset controller.
> - * @node: device to be reset by the controller
> - * @id: reset line name
> - *
> - * Returns a struct reset_control or IS_ERR() condition containing errno.
> - *
> - * Use of id names is optional.
> - */
> -struct reset_control *of_reset_control_get(struct device_node *node,
> -					   const char *id)
> +struct reset_control *__of_reset_control_get(struct device_node *node,
> +						int index)

static

>  {
>  	struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER);
>  	struct reset_controller_dev *r, *rcdev;
>  	struct of_phandle_args args;
> -	int index = 0;
>  	int rstc_id;
>  	int ret;
>  
> -	if (id)
> -		index = of_property_match_string(node,
> -						 "reset-names", id);
>  	ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
>  					 index, &args);
>  	if (ret)
> @@ -202,6 +189,33 @@ struct reset_control *of_reset_control_get(struct device_node *node,
>  
>  	return rstc;
>  }
> +
> +struct reset_control *of_reset_control_get_by_index(struct device_node *node,
> +					   int index)
> +{
> +	return __of_reset_control_get(node, index);
> +}
> +EXPORT_SYMBOL_GPL(of_reset_control_get_by_index);

This function is missing a kerneldoc comment, and please add a note that
this is only to be used if the order of the resets doesn't matter.

Actually, I see no reason not to just merge __of_reset_control_get into
of_reset_control_get_by_index and then just call that from
of_reset_control_get.

> +/**
> + * of_reset_control_get - Lookup and obtain a reference to a reset controller.
> + * @node: device to be reset by the controller
> + * @id: reset line name
> + *
> + * Returns a struct reset_control or IS_ERR() condition containing errno.
> + *
> + * Use of id names is optional.
> + */
> +struct reset_control *of_reset_control_get(struct device_node *node,
> +					   const char *id)
> +{
> +	int index = 0;
> +
> +	if (id)
> +		index = of_property_match_string(node,
> +						 "reset-names", id);
> +	return __of_reset_control_get(node, index);
> +}
>  EXPORT_SYMBOL_GPL(of_reset_control_get);
[...]

regards
Philipp


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs
  2015-03-12 12:45   ` Thierry Reding
  2015-03-12 13:11     ` Vince Hsu
@ 2015-03-12 16:18     ` Peter De Schrijver
  1 sibling, 0 replies; 28+ messages in thread
From: Peter De Schrijver @ 2015-03-12 16:18 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Vince Hsu, swarren, gnurou, jroedel, p.zabel, mturquette,
	pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

On Thu, Mar 12, 2015 at 01:45:02PM +0100, Thierry Reding wrote:
> * PGP Signed by an unknown key
> 
> On Thu, Mar 12, 2015 at 08:15:18PM +0800, Vince Hsu wrote:
> > We switch to generic power domain now. So remove the legacy functions.
> > 
> > Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> > ---
> >  drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
> >  include/soc/tegra/pmc.h | 22 ----------------
> >  2 files changed, 90 deletions(-)
> 
> I don't think we can do this. What if somebody updates their kernel but
> not the DTB? In that case they'll end up with drivers that don't enable
> power partitions but at the same time the powergate driver won't enable
> them either because it is missing the corresponding nodes in the DTB.
> 
> What we'll have to do is probably keep the code that enables the power
> partitions and make it conditional on the power domains somehow. Is
> there a way to determine at runtime whether a device has been attached
> to a power domain?

Or use DT overlays to 'load' a hardcoded overlay for the specific SoC?

Cheers,

Peter.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 01/17] reset: add of_reset_control_get_by_index()
  2015-03-12 15:01   ` Philipp Zabel
@ 2015-03-13  3:04     ` Vince Hsu
  0 siblings, 0 replies; 28+ messages in thread
From: Vince Hsu @ 2015-03-13  3:04 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: thierry.reding, pdeschrijver, swarren, gnurou, jroedel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar

Hi Philipp,

On 03/12/2015 11:01 PM, Philipp Zabel wrote:
> Hi Vince,
>
> Am Donnerstag, den 12.03.2015, 20:15 +0800 schrieb Vince Hsu:
>> Add of_reset_control_get_by_index() to allow the drivers to get reset device
>> without knowing its name.
> I see this is useful in the case of PM domain drivers that just need to
> trigger a list of resets in whatever order.
Yep.

>
>> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
>>
>> ---
>> v2: minor changes according to Alex's comments
>>
>>   drivers/reset/core.c  | 44 +++++++++++++++++++++++++++++---------------
>>   include/linux/reset.h |  9 +++++++++
>>   2 files changed, 38 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
>> index 7955e00d04d4..5e78866acd62 100644
>> --- a/drivers/reset/core.c
>> +++ b/drivers/reset/core.c
>> @@ -140,28 +140,15 @@ int reset_control_status(struct reset_control *rstc)
>>   }
>>   EXPORT_SYMBOL_GPL(reset_control_status);
>>   
>> -/**
>> - * of_reset_control_get - Lookup and obtain a reference to a reset controller.
>> - * @node: device to be reset by the controller
>> - * @id: reset line name
>> - *
>> - * Returns a struct reset_control or IS_ERR() condition containing errno.
>> - *
>> - * Use of id names is optional.
>> - */
>> -struct reset_control *of_reset_control_get(struct device_node *node,
>> -					   const char *id)
>> +struct reset_control *__of_reset_control_get(struct device_node *node,
>> +						int index)
> static
Will merge to of_reset_control_get_by_index.

>
>>   {
>>   	struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER);
>>   	struct reset_controller_dev *r, *rcdev;
>>   	struct of_phandle_args args;
>> -	int index = 0;
>>   	int rstc_id;
>>   	int ret;
>>   
>> -	if (id)
>> -		index = of_property_match_string(node,
>> -						 "reset-names", id);
>>   	ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
>>   					 index, &args);
>>   	if (ret)
>> @@ -202,6 +189,33 @@ struct reset_control *of_reset_control_get(struct device_node *node,
>>   
>>   	return rstc;
>>   }
>> +
>> +struct reset_control *of_reset_control_get_by_index(struct device_node *node,
>> +					   int index)
>> +{
>> +	return __of_reset_control_get(node, index);
>> +}
>> +EXPORT_SYMBOL_GPL(of_reset_control_get_by_index);
> This function is missing a kerneldoc comment, and please add a note that
> this is only to be used if the order of the resets doesn't matter.
Will add comment.

>
> Actually, I see no reason not to just merge __of_reset_control_get into
> of_reset_control_get_by_index and then just call that from
> of_reset_control_get.
Indeed. Will fix.

Thanks for the review. :)
Vince

>
>> +/**
>> + * of_reset_control_get - Lookup and obtain a reference to a reset controller.
>> + * @node: device to be reset by the controller
>> + * @id: reset line name
>> + *
>> + * Returns a struct reset_control or IS_ERR() condition containing errno.
>> + *
>> + * Use of id names is optional.
>> + */
>> +struct reset_control *of_reset_control_get(struct device_node *node,
>> +					   const char *id)
>> +{
>> +	int index = 0;
>> +
>> +	if (id)
>> +		index = of_property_match_string(node,
>> +						 "reset-names", id);
>> +	return __of_reset_control_get(node, index);
>> +}
>>   EXPORT_SYMBOL_GPL(of_reset_control_get);
> [...]
>
> regards
> Philipp
>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support
  2015-03-12 12:15 ` [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support Vince Hsu
@ 2015-04-06 22:37   ` Kevin Hilman
  2015-04-08  8:06     ` Thierry Reding
  0 siblings, 1 reply; 28+ messages in thread
From: Kevin Hilman @ 2015-04-06 22:37 UTC (permalink / raw)
  To: Vince Hsu
  Cc: thierry.reding, pdeschrijver, swarren, gnurou, jroedel, p.zabel,
	mturquette, pgaikwad, sboyd, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, tbergstrom, airlied, bhelgaas, tj,
	arnd, robh, will.deacon, linux-tegra, linux-kernel, devicetree,
	linux-arm-kernel, linux-pm, rjw, viresh.kumar, Thierry Reding

Hi Vince,

Vince Hsu <vinceh@nvidia.com> writes:

> From: Thierry Reding <treding@nvidia.com>
>
> The PM domains are populated from DT, and the PM domain consumer devices are
> also bound to their relevant PM domains by DT.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> [vinceh: make changes based on Thierry and Peter's suggestions]
> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> ---
> v2: revise comment in tegra_powergate_remove_clamping()
>     address Alex's comments

Sorry for the late review..., somehow I just noticed this while
reviewing some other PM domain support.

It's nice to see this migrating to PM domains.  Some comments below...

[...]

>  /**
>   * struct tegra_pmc - NVIDIA Tegra PMC
> + * @dev: pointer to parent device
>   * @base: pointer to I/O remapped register region
>   * @clk: pointer to pclk clock
> + * @soc: SoC-specific data
>   * @rate: currently configured rate of pclk
>   * @suspend_mode: lowest suspend mode available
>   * @cpu_good_time: CPU power good time (in microseconds)
> @@ -126,7 +158,9 @@ struct tegra_pmc_soc {
>   * @cpu_pwr_good_en: CPU power good signal is enabled
>   * @lp0_vec_phys: physical base address of the LP0 warm boot code
>   * @lp0_vec_size: size of the LP0 warm boot code
> + * @powergates: list of power gates
>   * @powergates_lock: mutex for power gate register access
> + * @nb: bus notifier for generic power domains
>   */
>  struct tegra_pmc {
>  	struct device *dev;
> @@ -150,7 +184,12 @@ struct tegra_pmc {
>  	u32 lp0_vec_phys;
>  	u32 lp0_vec_size;
>  
> +	struct tegra_powergate *powergates;
>  	struct mutex powergates_lock;
> +	struct notifier_block nb;

I don't see these notifiers used anywhere in this series.  What is the
intended use here?   There have been some other discussions about how to
do this more generically for  PM domains[1], so I'd prefer not to see this
in SoC specific PM domains.  In this case, it appears unused, so should
be fine to drop (for now.)

[...]

> +static int tegra_pmc_powergate_power_off(struct generic_pm_domain *domain)
> +{
> +	struct tegra_powergate *powergate = to_powergate(domain);
> +	struct tegra_pmc *pmc = powergate->pmc;
> +	int err;
> +
> +	dev_dbg(pmc->dev, "> %s(domain=%p)\n", __func__, domain);
> +	dev_dbg(pmc->dev, "  name: %s\n", domain->name);
> +
> +	/* never turn off these partitions */
> +	switch (powergate->id) {
> +	case TEGRA_POWERGATE_CPU:
> +	case TEGRA_POWERGATE_CPU1:
> +	case TEGRA_POWERGATE_CPU2:
> +	case TEGRA_POWERGATE_CPU3:
> +	case TEGRA_POWERGATE_CPU0:
> +	case TEGRA_POWERGATE_C0NC:
> +	case TEGRA_POWERGATE_IRAM:
> +		dev_dbg(pmc->dev, "not disabling always-on partition %s\n",
> +			domain->name);
> +		err = -EINVAL;
> +		goto out;
> +	}

You're re-inventing the per-device QoS flag: PM_QOS_FLAG_NO_POWER_OFF
which could be used here to prevent ->power_off from ever being called.

Alternately, if this really a static configuraion, why even register the
->power_off hook for these domains in the first place?

[...]

> +static int tegra_pmc_powergate_init_subdomain(struct tegra_pmc *pmc)
> +{
> +	struct tegra_powergate *powergate;
> +
> +	list_for_each_entry(powergate, &pmc->powergate_list, head) {
> +		struct device_node *pdn;
> +		struct tegra_powergate *parent = NULL;
> +		struct tegra_powergate *temp;
> +		int err;
> +
> +		pdn = of_parse_phandle(powergate->of_node, "depend-on", 0);
> +		if (!pdn)
> +			continue;

I'm not really following the need for the "depend-on" property here.

Looking at the example .dtsi files in this series, it seems to me what
is being described is nested hardware power domains, which genpd already
supports.  Any reason you're not using that build-in support?

[...]

> @@ -831,12 +1405,19 @@ static int tegra_pmc_probe(struct platform_device *pdev)
>  
>  	tegra_pmc_init_tsense_reset(pmc);
>  
> +	if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) {
> +		err = tegra_powergate_init(pmc);
> +		if (err < 0)
> +			return err;
> +	}

On many SoCs there's some special handling for the !CONFIG_PM case here
such that all the PM domains are enabled by default in case they are not
enabled by the bootloader.

>  	if (IS_ENABLED(CONFIG_DEBUG_FS)) {
>  		err = tegra_powergate_debugfs_init();
>  		if (err < 0)
>  			return err;
>  	}
>  
> +	dev_dbg(&pdev->dev, "< %s()\n", __func__);
>  	return 0;
>  }

Kevin

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/299345.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support
  2015-04-06 22:37   ` Kevin Hilman
@ 2015-04-08  8:06     ` Thierry Reding
  0 siblings, 0 replies; 28+ messages in thread
From: Thierry Reding @ 2015-04-08  8:06 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Vince Hsu, thierry.reding, pdeschrijver, swarren, gnurou,
	jroedel, p.zabel, mturquette, pgaikwad, sboyd, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	tbergstrom, airlied, bhelgaas, tj, arnd, robh, will.deacon,
	linux-tegra, linux-kernel, devicetree, linux-arm-kernel,
	linux-pm, rjw, viresh.kumar

[-- Attachment #1: Type: text/plain, Size: 2764 bytes --]

On Mon, Apr 06, 2015 at 03:37:37PM -0700, Kevin Hilman wrote:
> Hi Vince,
> 
> Vince Hsu <vinceh@nvidia.com> writes:
[...]
> > +static int tegra_pmc_powergate_power_off(struct generic_pm_domain *domain)
> > +{
> > +	struct tegra_powergate *powergate = to_powergate(domain);
> > +	struct tegra_pmc *pmc = powergate->pmc;
> > +	int err;
> > +
> > +	dev_dbg(pmc->dev, "> %s(domain=%p)\n", __func__, domain);
> > +	dev_dbg(pmc->dev, "  name: %s\n", domain->name);
> > +
> > +	/* never turn off these partitions */
> > +	switch (powergate->id) {
> > +	case TEGRA_POWERGATE_CPU:
> > +	case TEGRA_POWERGATE_CPU1:
> > +	case TEGRA_POWERGATE_CPU2:
> > +	case TEGRA_POWERGATE_CPU3:
> > +	case TEGRA_POWERGATE_CPU0:
> > +	case TEGRA_POWERGATE_C0NC:
> > +	case TEGRA_POWERGATE_IRAM:
> > +		dev_dbg(pmc->dev, "not disabling always-on partition %s\n",
> > +			domain->name);
> > +		err = -EINVAL;
> > +		goto out;
> > +	}
> 
> You're re-inventing the per-device QoS flag: PM_QOS_FLAG_NO_POWER_OFF
> which could be used here to prevent ->power_off from ever being called.
> 
> Alternately, if this really a static configuraion, why even register the
> ->power_off hook for these domains in the first place?

This isn't really a static configuration. The problem here is that there
is code elsewhere to deal with these domains. The CPU power partitions
for example are dealt with in the cpuidle code (or PSCI firmware). What
complicates this even further is that we have an existing custom API for
enabling/disabling power partitions (cpuidle uses that API).

Although, thinking about it some more, it seems that for the purposes of
power domains perhaps we should just not consider these power partitions
at all (i.e. not even register them).

[...]
> > @@ -831,12 +1405,19 @@ static int tegra_pmc_probe(struct platform_device *pdev)
> >  
> >  	tegra_pmc_init_tsense_reset(pmc);
> >  
> > +	if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) {
> > +		err = tegra_powergate_init(pmc);
> > +		if (err < 0)
> > +			return err;
> > +	}
> 
> On many SoCs there's some special handling for the !CONFIG_PM case here
> such that all the PM domains are enabled by default in case they are not
> enabled by the bootloader.

Yeah, I think we'll need something like that for backwards-compatibility
with the old API. Converting to power domains should be done in the same
step as stubbing out the old API, and then to prevent devices using some
old DTBs to fail we'd need to enable all domains that are currently
controlled by existing drivers using the custom API.

So we don't only need this fallback for !PM_GENERIC_DOMAINS but also for
cases where we detect a DTB that's missing the nodes to describe the
domains.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2015-04-08  8:07 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 12:15 [PATCH v2 00/17] Add generic PM domain support for Tegra SoCs Vince Hsu
2015-03-12 12:15 ` [PATCH v2 01/17] reset: add of_reset_control_get_by_index() Vince Hsu
2015-03-12 15:01   ` Philipp Zabel
2015-03-13  3:04     ` Vince Hsu
2015-03-12 12:15 ` [PATCH v2 02/17] memory: tegra: add mc flush support Vince Hsu
2015-03-12 12:15 ` [PATCH v2 03/17] memory: tegra: add flush operation for Tegra30 memory clients Vince Hsu
2015-03-12 12:15 ` [PATCH v2 04/17] memory: tegra: add flush operation for Tegra114 " Vince Hsu
2015-03-12 12:15 ` [PATCH v2 05/17] memory: tegra: add flush operation for Tegra124 " Vince Hsu
2015-03-12 12:15 ` [PATCH v2 06/17] clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2 Vince Hsu
2015-03-12 12:15 ` [PATCH v2 07/17] soc: tegra: pmc: Add generic PM domain support Vince Hsu
2015-04-06 22:37   ` Kevin Hilman
2015-04-08  8:06     ` Thierry Reding
2015-03-12 12:15 ` [PATCH v2 08/17] ARM: tegra: add PM domain device nodes to Tegra30 DT Vince Hsu
2015-03-12 12:15 ` [PATCH v2 09/17] ARM: tegra: add PM domain device nodes to Tegra114 DT Vince Hsu
2015-03-12 12:15 ` [PATCH v2 10/17] ARM: tegra: add PM domain device nodes to Tegra124 DT Vince Hsu
2015-03-12 12:15 ` [PATCH v2 11/17] ARM: tegra: add GPU power supply to Jetson TK1 DT Vince Hsu
2015-03-12 12:15 ` [PATCH v2 12/17] drm/tegra: dc: remove the power sequence from driver Vince Hsu
2015-03-12 12:15 ` [PATCH v2 13/17] PCI: tegra: " Vince Hsu
2015-03-12 12:15 ` [PATCH v2 14/17] ata: ahci_tegra: remove " Vince Hsu
2015-03-12 12:19   ` Tejun Heo
2015-03-12 12:23     ` Vince Hsu
2015-03-12 12:33       ` Hans de Goede
2015-03-12 12:15 ` [PATCH v2 15/17] drm/tegra: remove GR3D " Vince Hsu
2015-03-12 12:15 ` [PATCH v2 16/17] ARM: tegra: select PM_GENERIC_DOMAINS Vince Hsu
2015-03-12 12:15 ` [PATCH v2 17/17] soc/tegra: remove lagacy powergate APIs Vince Hsu
2015-03-12 12:45   ` Thierry Reding
2015-03-12 13:11     ` Vince Hsu
2015-03-12 16:18     ` Peter De Schrijver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).