All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] iommu/arm-smmu: Add support for adding masters/clocks using generic bindings
@ 2015-07-17 16:53 ` Sricharan R
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel, iommu, will.deacon, devicetree, linux-arm-msm,
	mitchelh
  Cc: sricharan

This series adds support for xlate callback to add master
devices configs using generic bindings and clocks/regulators
required to access smmu.

OF_IOMMU_DECLARE is used to register and probe the smmu controller
devices before the masters are added in of_platform_populate.
Here, we are registering only the smmu driver and iommu_ops. The
smmu device registration is not done in OF_IOMMU_DECLARE to avoid
early smmu probe, because the clocks if any required for the controller
are not yet ready.

So the idea here is to get the right direction in adding this support.

Mitchel Humpherys (2):
  iommu/arm-smmu: add support for specifying clocks
  iommu/arm-smmu: Add support for specifying regulators

Sricharan R (2):
  iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
  iommu/arm-smmu: Add xlate callback for initializing master devices
    from dt

 .../devicetree/bindings/iommu/arm,smmu.txt         |  14 ++
 drivers/iommu/arm-smmu.c                           | 210 +++++++++++++++++++--
 2 files changed, 208 insertions(+), 16 deletions(-)

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 0/4] iommu/arm-smmu: Add support for adding masters/clocks using generic bindings
@ 2015-07-17 16:53 ` Sricharan R
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

This series adds support for xlate callback to add master
devices configs using generic bindings and clocks/regulators
required to access smmu.

OF_IOMMU_DECLARE is used to register and probe the smmu controller
devices before the masters are added in of_platform_populate.
Here, we are registering only the smmu driver and iommu_ops. The
smmu device registration is not done in OF_IOMMU_DECLARE to avoid
early smmu probe, because the clocks if any required for the controller
are not yet ready.

So the idea here is to get the right direction in adding this support.

Mitchel Humpherys (2):
  iommu/arm-smmu: add support for specifying clocks
  iommu/arm-smmu: Add support for specifying regulators

Sricharan R (2):
  iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
  iommu/arm-smmu: Add xlate callback for initializing master devices
    from dt

 .../devicetree/bindings/iommu/arm,smmu.txt         |  14 ++
 drivers/iommu/arm-smmu.c                           | 210 +++++++++++++++++++--
 2 files changed, 208 insertions(+), 16 deletions(-)

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
  2015-07-17 16:53 ` Sricharan R
@ 2015-07-17 16:53   ` Sricharan R
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel, iommu, will.deacon, devicetree, linux-arm-msm,
	mitchelh
  Cc: sricharan

This patch uses IOMMU_OF_DECLARE to register the driver
and the iommu_ops. So when master devices of the iommu are
registered, of_xlate callback can be used to add the master
configurations to the smmu driver.

Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 drivers/iommu/arm-smmu.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index fc13dd5..8c4eb43 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -41,6 +41,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/of_iommu.h>
+#include <linux/of_platform.h>
 
 #include <linux/amba/bus.h>
 
@@ -254,6 +256,8 @@
 #define FSYNR0_WNR			(1 << 4)
 
 static int force_stage;
+static bool init_done;
+
 module_param_named(force_stage, force_stage, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(force_stage,
 	"Force SMMU mappings to be installed at a particular stage of translation. A value of '1' or '2' forces the corresponding stage. All other values are ignored (i.e. no stage is forced). Note that selecting a specific stage will disable support for nested translation.");
@@ -1848,20 +1852,8 @@ static struct platform_driver arm_smmu_driver = {
 
 static int __init arm_smmu_init(void)
 {
-	struct device_node *np;
 	int ret;
 
-	/*
-	 * Play nice with systems that don't have an ARM SMMU by checking that
-	 * an ARM SMMU exists in the system before proceeding with the driver
-	 * and IOMMU bus operation registration.
-	 */
-	np = of_find_matching_node(NULL, arm_smmu_of_match);
-	if (!np)
-		return 0;
-
-	of_node_put(np);
-
 	ret = platform_driver_register(&arm_smmu_driver);
 	if (ret)
 		return ret;
@@ -1880,15 +1872,33 @@ static int __init arm_smmu_init(void)
 		bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
 #endif
 
+	init_done = true;
+
 	return 0;
 }
 
+static int __init arm_smmu_of_setup(struct device_node *np)
+{
+
+	if (!init_done)
+		arm_smmu_init();
+
+	of_iommu_set_ops(np, &arm_smmu_ops);
+
+	return 0;
+}
+
+IOMMU_OF_DECLARE(arm_smmu_v1, "arm,smmu-v1", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_v2, "arm,smmu-v2", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_400, "arm,mmu-400", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_401, "arm,mmu-401", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_500, "arm,mmu-500", arm_smmu_of_setup);
+
 static void __exit arm_smmu_exit(void)
 {
 	return platform_driver_unregister(&arm_smmu_driver);
 }
 
-subsys_initcall(arm_smmu_init);
 module_exit(arm_smmu_exit);
 
 MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations");
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
@ 2015-07-17 16:53   ` Sricharan R
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

This patch uses IOMMU_OF_DECLARE to register the driver
and the iommu_ops. So when master devices of the iommu are
registered, of_xlate callback can be used to add the master
configurations to the smmu driver.

Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 drivers/iommu/arm-smmu.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index fc13dd5..8c4eb43 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -41,6 +41,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/of_iommu.h>
+#include <linux/of_platform.h>
 
 #include <linux/amba/bus.h>
 
@@ -254,6 +256,8 @@
 #define FSYNR0_WNR			(1 << 4)
 
 static int force_stage;
+static bool init_done;
+
 module_param_named(force_stage, force_stage, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(force_stage,
 	"Force SMMU mappings to be installed@a particular stage of translation. A value of '1' or '2' forces the corresponding stage. All other values are ignored (i.e. no stage is forced). Note that selecting a specific stage will disable support for nested translation.");
@@ -1848,20 +1852,8 @@ static struct platform_driver arm_smmu_driver = {
 
 static int __init arm_smmu_init(void)
 {
-	struct device_node *np;
 	int ret;
 
-	/*
-	 * Play nice with systems that don't have an ARM SMMU by checking that
-	 * an ARM SMMU exists in the system before proceeding with the driver
-	 * and IOMMU bus operation registration.
-	 */
-	np = of_find_matching_node(NULL, arm_smmu_of_match);
-	if (!np)
-		return 0;
-
-	of_node_put(np);
-
 	ret = platform_driver_register(&arm_smmu_driver);
 	if (ret)
 		return ret;
@@ -1880,15 +1872,33 @@ static int __init arm_smmu_init(void)
 		bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
 #endif
 
+	init_done = true;
+
 	return 0;
 }
 
+static int __init arm_smmu_of_setup(struct device_node *np)
+{
+
+	if (!init_done)
+		arm_smmu_init();
+
+	of_iommu_set_ops(np, &arm_smmu_ops);
+
+	return 0;
+}
+
+IOMMU_OF_DECLARE(arm_smmu_v1, "arm,smmu-v1", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_v2, "arm,smmu-v2", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_400, "arm,mmu-400", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_401, "arm,mmu-401", arm_smmu_of_setup);
+IOMMU_OF_DECLARE(arm_smmu_500, "arm,mmu-500", arm_smmu_of_setup);
+
 static void __exit arm_smmu_exit(void)
 {
 	return platform_driver_unregister(&arm_smmu_driver);
 }
 
-subsys_initcall(arm_smmu_init);
 module_exit(arm_smmu_exit);
 
 MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations");
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 2/4] iommu/arm-smmu: Add xlate callback for initializing master devices from dt
  2015-07-17 16:53 ` Sricharan R
@ 2015-07-17 16:53     ` Sricharan R
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	will.deacon-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	mitchelh-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: sricharan-sgV2jX0FEOL9JmXXK+q4OQ

This adds of_xlate callback to arm-smmu driver. xlate callback
is called during device registration from DT for those master
devices attached to iommus using generic iommu bindings.

Signed-off-by: Sricharan R <sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/iommu/arm-smmu.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 8c4eb43..2cf65ab 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -321,6 +321,7 @@ struct arm_smmu_device {
 	unsigned int			*irqs;
 
 	struct list_head		list;
+	struct device_node		*node;
 	struct rb_root			masters;
 };
 
@@ -1434,6 +1435,38 @@ out_unlock:
 	return ret;
 }
 
+static int arm_smmu_of_xlate(struct device *dev,
+			     struct of_phandle_args *spec)
+{
+	struct arm_smmu_device *smmu;
+	struct arm_smmu_master *master;
+	int streamid;
+
+	spin_lock(&arm_smmu_devices_lock);
+	list_for_each_entry(smmu, &arm_smmu_devices, list) {
+		if (smmu->node == spec->np)
+			break;
+	}
+	spin_unlock(&arm_smmu_devices_lock);
+
+	if (!smmu || (smmu->node != spec->np))
+		return -ENODEV;
+
+	spec->np = dev->of_node;
+
+	master = find_smmu_master(smmu, spec->np);
+	if (!master) {
+		if (register_smmu_master(smmu, smmu->dev, spec))
+			return -ENODEV;
+	} else {
+		streamid = master->cfg.num_streamids;
+		master->cfg.streamids[streamid] = spec->args[0];
+		master->cfg.num_streamids++;
+	}
+
+	return 0;
+}
+
 static struct iommu_ops arm_smmu_ops = {
 	.capable		= arm_smmu_capable,
 	.domain_init		= arm_smmu_domain_init,
@@ -1449,6 +1482,7 @@ static struct iommu_ops arm_smmu_ops = {
 	.domain_get_attr	= arm_smmu_domain_get_attr,
 	.domain_set_attr	= arm_smmu_domain_set_attr,
 	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
+	.of_xlate		= arm_smmu_of_xlate,
 };
 
 static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
@@ -1782,6 +1816,8 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		}
 	}
 
+	smmu->node = dev->of_node;
+
 	INIT_LIST_HEAD(&smmu->list);
 	spin_lock(&arm_smmu_devices_lock);
 	list_add(&smmu->list, &arm_smmu_devices);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [RFC PATCH 2/4] iommu/arm-smmu: Add xlate callback for initializing master devices from dt
@ 2015-07-17 16:53     ` Sricharan R
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

This adds of_xlate callback to arm-smmu driver. xlate callback
is called during device registration from DT for those master
devices attached to iommus using generic iommu bindings.

Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 drivers/iommu/arm-smmu.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 8c4eb43..2cf65ab 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -321,6 +321,7 @@ struct arm_smmu_device {
 	unsigned int			*irqs;
 
 	struct list_head		list;
+	struct device_node		*node;
 	struct rb_root			masters;
 };
 
@@ -1434,6 +1435,38 @@ out_unlock:
 	return ret;
 }
 
+static int arm_smmu_of_xlate(struct device *dev,
+			     struct of_phandle_args *spec)
+{
+	struct arm_smmu_device *smmu;
+	struct arm_smmu_master *master;
+	int streamid;
+
+	spin_lock(&arm_smmu_devices_lock);
+	list_for_each_entry(smmu, &arm_smmu_devices, list) {
+		if (smmu->node == spec->np)
+			break;
+	}
+	spin_unlock(&arm_smmu_devices_lock);
+
+	if (!smmu || (smmu->node != spec->np))
+		return -ENODEV;
+
+	spec->np = dev->of_node;
+
+	master = find_smmu_master(smmu, spec->np);
+	if (!master) {
+		if (register_smmu_master(smmu, smmu->dev, spec))
+			return -ENODEV;
+	} else {
+		streamid = master->cfg.num_streamids;
+		master->cfg.streamids[streamid] = spec->args[0];
+		master->cfg.num_streamids++;
+	}
+
+	return 0;
+}
+
 static struct iommu_ops arm_smmu_ops = {
 	.capable		= arm_smmu_capable,
 	.domain_init		= arm_smmu_domain_init,
@@ -1449,6 +1482,7 @@ static struct iommu_ops arm_smmu_ops = {
 	.domain_get_attr	= arm_smmu_domain_get_attr,
 	.domain_set_attr	= arm_smmu_domain_set_attr,
 	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
+	.of_xlate		= arm_smmu_of_xlate,
 };
 
 static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
@@ -1782,6 +1816,8 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		}
 	}
 
+	smmu->node = dev->of_node;
+
 	INIT_LIST_HEAD(&smmu->list);
 	spin_lock(&arm_smmu_devices_lock);
 	list_add(&smmu->list, &arm_smmu_devices);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks
  2015-07-17 16:53 ` Sricharan R
@ 2015-07-17 16:53   ` Sricharan R
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel, iommu, will.deacon, devicetree, linux-arm-msm,
	mitchelh
  Cc: sricharan

From: Mitchel Humpherys <mitchelh@codeaurora.org>

On some platforms with tight power constraints it is polite to only
leave your clocks on for as long as you absolutely need them. Currently
we assume that all clocks necessary for SMMU register access are always
on.

Add some optional device tree properties to specify any clocks that are
necessary for SMMU register access and turn them on and off as needed.

If no clocks are specified in the device tree things continue to work
the way they always have: we assume all necessary clocks are always
turned on. The clocks are turned 'on' during the SMMU device probe
and remains 'on' till the device exists.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 .../devicetree/bindings/iommu/arm,smmu.txt         | 11 +++
 drivers/iommu/arm-smmu.c                           | 86 +++++++++++++++++++++-
 2 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
index 0676050..c2cf4fe 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
@@ -49,6 +49,17 @@ conditions.
                   aliases of secure registers have to be used during
                   SMMU configuration.
 
+- clocks	: List of clocks to be used during SMMU register access. See
+		  Documentation/devicetree/bindings/clock/clock-bindings.txt
+		  for information about the format. For each clock specified
+		  here, there must be a corresponding entery in clock-names
+		  (see below).
+
+- clock-names	: List of clock names corresponding to the clocks specified in
+		  the "clocks" property (above). See
+		  Documentation/devicetree/bindings/clock/clock-bindings.txt
+		  for more info.
+
 Example:
 
         smmu {
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 2cf65ab..80d56f0a 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -323,6 +323,9 @@ struct arm_smmu_device {
 	struct list_head		list;
 	struct device_node		*node;
 	struct rb_root			masters;
+
+	int				num_clocks;
+	struct clk			**clocks;
 };
 
 struct arm_smmu_cfg {
@@ -365,6 +368,31 @@ static struct arm_smmu_option_prop arm_smmu_options[] = {
 	{ 0, NULL},
 };
 
+static int arm_smmu_enable_clocks(struct arm_smmu_device *smmu)
+{
+	int i, ret = 0;
+
+	for (i = 0; i < smmu->num_clocks; ++i) {
+		ret = clk_prepare_enable(smmu->clocks[i]);
+		if (ret) {
+			dev_err(smmu->dev, "Couldn't enable clock #%d\n", i);
+			while (i--)
+				clk_disable_unprepare(smmu->clocks[i]);
+			break;
+		}
+	}
+
+	return ret;
+}
+
+static void arm_smmu_disable_clocks(struct arm_smmu_device *smmu)
+{
+	int i;
+
+	for (i = 0; i < smmu->num_clocks; ++i)
+		clk_disable_unprepare(smmu->clocks[i]);
+}
+
 static void parse_driver_options(struct arm_smmu_device *smmu)
 {
 	int i = 0;
@@ -1555,6 +1583,47 @@ static int arm_smmu_id_size_to_bits(int size)
 	}
 }
 
+static int arm_smmu_init_clocks(struct arm_smmu_device *smmu)
+{
+	const char *cname;
+	struct property *prop;
+	int i;
+	struct device *dev = smmu->dev;
+
+	smmu->num_clocks =
+		of_property_count_strings(dev->of_node, "clock-names");
+
+	if (smmu->num_clocks < 1)
+		return 0;
+
+	smmu->clocks = devm_kzalloc(
+		dev, sizeof(*smmu->clocks) * smmu->num_clocks,
+		GFP_KERNEL);
+
+	if (!smmu->clocks) {
+		dev_err(dev,
+			"Failed to allocate memory for clocks\n");
+		return -ENODEV;
+	}
+
+	i = 0;
+	of_property_for_each_string(dev->of_node, "clock-names",
+				    prop, cname) {
+		struct clk *c = devm_clk_get(dev, cname);
+
+		if (IS_ERR(c)) {
+			dev_err(dev, "Couldn't get clock: %s",
+				cname);
+			return -ENODEV;
+		}
+
+		smmu->clocks[i] = c;
+
+		++i;
+	}
+	return 0;
+}
+
 static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 {
 	unsigned long size;
@@ -1772,9 +1841,15 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		smmu->irqs[i] = irq;
 	}
 
+	err = arm_smmu_init_clocks(smmu);
+	if (err)
+		goto out_put_masters;
+
+	arm_smmu_enable_clocks(smmu);
+
 	err = arm_smmu_device_cfg_probe(smmu);
 	if (err)
-		return err;
+		goto out_disable_clocks;
 
 	i = 0;
 	smmu->masters = RB_ROOT;
@@ -1785,7 +1860,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		if (err) {
 			dev_err(dev, "failed to add master %s\n",
 				masterspec.np->name);
-			goto out_put_masters;
+			goto out_disable_clocks;
 		}
 
 		i++;
@@ -1800,7 +1875,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 			"found only %d context interrupt(s) but %d required\n",
 			smmu->num_context_irqs, smmu->num_context_banks);
 		err = -ENODEV;
-		goto out_put_masters;
+		goto out_disable_clocks;
 	}
 
 	for (i = 0; i < smmu->num_global_irqs; ++i) {
@@ -1830,6 +1905,9 @@ out_free_irqs:
 	while (i--)
 		free_irq(smmu->irqs[i], smmu);
 
+out_disable_clocks:
+	arm_smmu_disable_clocks(smmu);
+
 out_put_masters:
 	for (node = rb_first(&smmu->masters); node; node = rb_next(node)) {
 		struct arm_smmu_master *master
@@ -1874,6 +1952,8 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 
 	/* Turn the thing off */
 	writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0);
+	arm_smmu_disable_clocks(smmu);
+
 	return 0;
 }
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks
@ 2015-07-17 16:53   ` Sricharan R
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mitchel Humpherys <mitchelh@codeaurora.org>

On some platforms with tight power constraints it is polite to only
leave your clocks on for as long as you absolutely need them. Currently
we assume that all clocks necessary for SMMU register access are always
on.

Add some optional device tree properties to specify any clocks that are
necessary for SMMU register access and turn them on and off as needed.

If no clocks are specified in the device tree things continue to work
the way they always have: we assume all necessary clocks are always
turned on. The clocks are turned 'on' during the SMMU device probe
and remains 'on' till the device exists.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 .../devicetree/bindings/iommu/arm,smmu.txt         | 11 +++
 drivers/iommu/arm-smmu.c                           | 86 +++++++++++++++++++++-
 2 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
index 0676050..c2cf4fe 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
@@ -49,6 +49,17 @@ conditions.
                   aliases of secure registers have to be used during
                   SMMU configuration.
 
+- clocks	: List of clocks to be used during SMMU register access. See
+		  Documentation/devicetree/bindings/clock/clock-bindings.txt
+		  for information about the format. For each clock specified
+		  here, there must be a corresponding entery in clock-names
+		  (see below).
+
+- clock-names	: List of clock names corresponding to the clocks specified in
+		  the "clocks" property (above). See
+		  Documentation/devicetree/bindings/clock/clock-bindings.txt
+		  for more info.
+
 Example:
 
         smmu {
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 2cf65ab..80d56f0a 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -323,6 +323,9 @@ struct arm_smmu_device {
 	struct list_head		list;
 	struct device_node		*node;
 	struct rb_root			masters;
+
+	int				num_clocks;
+	struct clk			**clocks;
 };
 
 struct arm_smmu_cfg {
@@ -365,6 +368,31 @@ static struct arm_smmu_option_prop arm_smmu_options[] = {
 	{ 0, NULL},
 };
 
+static int arm_smmu_enable_clocks(struct arm_smmu_device *smmu)
+{
+	int i, ret = 0;
+
+	for (i = 0; i < smmu->num_clocks; ++i) {
+		ret = clk_prepare_enable(smmu->clocks[i]);
+		if (ret) {
+			dev_err(smmu->dev, "Couldn't enable clock #%d\n", i);
+			while (i--)
+				clk_disable_unprepare(smmu->clocks[i]);
+			break;
+		}
+	}
+
+	return ret;
+}
+
+static void arm_smmu_disable_clocks(struct arm_smmu_device *smmu)
+{
+	int i;
+
+	for (i = 0; i < smmu->num_clocks; ++i)
+		clk_disable_unprepare(smmu->clocks[i]);
+}
+
 static void parse_driver_options(struct arm_smmu_device *smmu)
 {
 	int i = 0;
@@ -1555,6 +1583,47 @@ static int arm_smmu_id_size_to_bits(int size)
 	}
 }
 
+static int arm_smmu_init_clocks(struct arm_smmu_device *smmu)
+{
+	const char *cname;
+	struct property *prop;
+	int i;
+	struct device *dev = smmu->dev;
+
+	smmu->num_clocks =
+		of_property_count_strings(dev->of_node, "clock-names");
+
+	if (smmu->num_clocks < 1)
+		return 0;
+
+	smmu->clocks = devm_kzalloc(
+		dev, sizeof(*smmu->clocks) * smmu->num_clocks,
+		GFP_KERNEL);
+
+	if (!smmu->clocks) {
+		dev_err(dev,
+			"Failed to allocate memory for clocks\n");
+		return -ENODEV;
+	}
+
+	i = 0;
+	of_property_for_each_string(dev->of_node, "clock-names",
+				    prop, cname) {
+		struct clk *c = devm_clk_get(dev, cname);
+
+		if (IS_ERR(c)) {
+			dev_err(dev, "Couldn't get clock: %s",
+				cname);
+			return -ENODEV;
+		}
+
+		smmu->clocks[i] = c;
+
+		++i;
+	}
+	return 0;
+}
+
 static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 {
 	unsigned long size;
@@ -1772,9 +1841,15 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		smmu->irqs[i] = irq;
 	}
 
+	err = arm_smmu_init_clocks(smmu);
+	if (err)
+		goto out_put_masters;
+
+	arm_smmu_enable_clocks(smmu);
+
 	err = arm_smmu_device_cfg_probe(smmu);
 	if (err)
-		return err;
+		goto out_disable_clocks;
 
 	i = 0;
 	smmu->masters = RB_ROOT;
@@ -1785,7 +1860,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		if (err) {
 			dev_err(dev, "failed to add master %s\n",
 				masterspec.np->name);
-			goto out_put_masters;
+			goto out_disable_clocks;
 		}
 
 		i++;
@@ -1800,7 +1875,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 			"found only %d context interrupt(s) but %d required\n",
 			smmu->num_context_irqs, smmu->num_context_banks);
 		err = -ENODEV;
-		goto out_put_masters;
+		goto out_disable_clocks;
 	}
 
 	for (i = 0; i < smmu->num_global_irqs; ++i) {
@@ -1830,6 +1905,9 @@ out_free_irqs:
 	while (i--)
 		free_irq(smmu->irqs[i], smmu);
 
+out_disable_clocks:
+	arm_smmu_disable_clocks(smmu);
+
 out_put_masters:
 	for (node = rb_first(&smmu->masters); node; node = rb_next(node)) {
 		struct arm_smmu_master *master
@@ -1874,6 +1952,8 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 
 	/* Turn the thing off */
 	writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0);
+	arm_smmu_disable_clocks(smmu);
+
 	return 0;
 }
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators
  2015-07-17 16:53 ` Sricharan R
@ 2015-07-17 16:53   ` Sricharan R
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel, iommu, will.deacon, devicetree, linux-arm-msm,
	mitchelh
  Cc: sricharan

From: Mitchel Humpherys <mitchelh@codeaurora.org>

This adds the support to turn on the regulators required
for SMMUs. It is turned on during the SMMU probe and remains
'on' till the device exists.

Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 .../devicetree/bindings/iommu/arm,smmu.txt         |  3 ++
 drivers/iommu/arm-smmu.c                           | 48 +++++++++++++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
index c2cf4fe..433d778 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
@@ -60,6 +60,9 @@ conditions.
 		  Documentation/devicetree/bindings/clock/clock-bindings.txt
 		  for more info.
 
+- vdd-supply    : Phandle of the regulator that should be powered on during
+                  SMMU register access.
+
 Example:
 
         smmu {
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 80d56f0a..c92de50 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -326,6 +326,8 @@ struct arm_smmu_device {
 
 	int				num_clocks;
 	struct clk			**clocks;
+
+	struct regulator		*regulator;
 };
 
 struct arm_smmu_cfg {
@@ -559,6 +561,22 @@ static void __arm_smmu_free_bitmap(unsigned long *map, int idx)
 	clear_bit(idx, map);
 }
 
+static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu)
+{
+	if (!smmu->regulator)
+		return 0;
+
+	return regulator_enable(smmu->regulator);
+}
+
+static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu)
+{
+	if (!smmu->regulator)
+		return 0;
+
+	return regulator_disable(smmu->regulator);
+}
+
 /* Wait for any pending TLB invalidations to complete */
 static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu)
 {
@@ -1583,6 +1601,20 @@ static int arm_smmu_id_size_to_bits(int size)
 	}
 }
 
+static int arm_smmu_init_regulators(struct arm_smmu_device *smmu)
+{
+	struct device *dev = smmu->dev;
+
+	if (!of_get_property(dev->of_node, "vdd-supply", NULL))
+		return 0;
+
+	smmu->regulator = devm_regulator_get(dev, "vdd");
+	if (IS_ERR(smmu->regulator))
+		return PTR_ERR(smmu->regulator);
+
+	return 0;
+}
+
 static int arm_smmu_init_clocks(struct arm_smmu_device *smmu)
 {
 	const char *cname;
@@ -1841,11 +1873,21 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		smmu->irqs[i] = irq;
 	}
 
+	err = arm_smmu_init_regulators(smmu);
+	if (err)
+		goto out_put_masters;
+
 	err = arm_smmu_init_clocks(smmu);
 	if (err)
 		goto out_put_masters;
 
-	arm_smmu_enable_clocks(smmu);
+	err = arm_smmu_enable_regulators(smmu);
+	if (err)
+		goto out_put_masters;
+
+	err = arm_smmu_enable_clocks(smmu);
+	if (err)
+		goto out_disable_regulators;
 
 	err = arm_smmu_device_cfg_probe(smmu);
 	if (err)
@@ -1908,6 +1950,9 @@ out_free_irqs:
 out_disable_clocks:
 	arm_smmu_disable_clocks(smmu);
 
+out_disable_regulators:
+	arm_smmu_disable_regulators(smmu);
+
 out_put_masters:
 	for (node = rb_first(&smmu->masters); node; node = rb_next(node)) {
 		struct arm_smmu_master *master
@@ -1953,6 +1998,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 	/* Turn the thing off */
 	writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0);
 	arm_smmu_disable_clocks(smmu);
+	arm_smmu_disable_regulators(smmu);
 
 	return 0;
 }
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators
@ 2015-07-17 16:53   ` Sricharan R
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan R @ 2015-07-17 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mitchel Humpherys <mitchelh@codeaurora.org>

This adds the support to turn on the regulators required
for SMMUs. It is turned on during the SMMU probe and remains
'on' till the device exists.

Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
 .../devicetree/bindings/iommu/arm,smmu.txt         |  3 ++
 drivers/iommu/arm-smmu.c                           | 48 +++++++++++++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
index c2cf4fe..433d778 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
@@ -60,6 +60,9 @@ conditions.
 		  Documentation/devicetree/bindings/clock/clock-bindings.txt
 		  for more info.
 
+- vdd-supply    : Phandle of the regulator that should be powered on during
+                  SMMU register access.
+
 Example:
 
         smmu {
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 80d56f0a..c92de50 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -326,6 +326,8 @@ struct arm_smmu_device {
 
 	int				num_clocks;
 	struct clk			**clocks;
+
+	struct regulator		*regulator;
 };
 
 struct arm_smmu_cfg {
@@ -559,6 +561,22 @@ static void __arm_smmu_free_bitmap(unsigned long *map, int idx)
 	clear_bit(idx, map);
 }
 
+static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu)
+{
+	if (!smmu->regulator)
+		return 0;
+
+	return regulator_enable(smmu->regulator);
+}
+
+static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu)
+{
+	if (!smmu->regulator)
+		return 0;
+
+	return regulator_disable(smmu->regulator);
+}
+
 /* Wait for any pending TLB invalidations to complete */
 static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu)
 {
@@ -1583,6 +1601,20 @@ static int arm_smmu_id_size_to_bits(int size)
 	}
 }
 
+static int arm_smmu_init_regulators(struct arm_smmu_device *smmu)
+{
+	struct device *dev = smmu->dev;
+
+	if (!of_get_property(dev->of_node, "vdd-supply", NULL))
+		return 0;
+
+	smmu->regulator = devm_regulator_get(dev, "vdd");
+	if (IS_ERR(smmu->regulator))
+		return PTR_ERR(smmu->regulator);
+
+	return 0;
+}
+
 static int arm_smmu_init_clocks(struct arm_smmu_device *smmu)
 {
 	const char *cname;
@@ -1841,11 +1873,21 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 		smmu->irqs[i] = irq;
 	}
 
+	err = arm_smmu_init_regulators(smmu);
+	if (err)
+		goto out_put_masters;
+
 	err = arm_smmu_init_clocks(smmu);
 	if (err)
 		goto out_put_masters;
 
-	arm_smmu_enable_clocks(smmu);
+	err = arm_smmu_enable_regulators(smmu);
+	if (err)
+		goto out_put_masters;
+
+	err = arm_smmu_enable_clocks(smmu);
+	if (err)
+		goto out_disable_regulators;
 
 	err = arm_smmu_device_cfg_probe(smmu);
 	if (err)
@@ -1908,6 +1950,9 @@ out_free_irqs:
 out_disable_clocks:
 	arm_smmu_disable_clocks(smmu);
 
+out_disable_regulators:
+	arm_smmu_disable_regulators(smmu);
+
 out_put_masters:
 	for (node = rb_first(&smmu->masters); node; node = rb_next(node)) {
 		struct arm_smmu_master *master
@@ -1953,6 +1998,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 	/* Turn the thing off */
 	writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0);
 	arm_smmu_disable_clocks(smmu);
+	arm_smmu_disable_regulators(smmu);
 
 	return 0;
 }
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks
  2015-07-17 16:53   ` Sricharan R
@ 2015-07-21 15:01       ` Will Deacon
  -1 siblings, 0 replies; 22+ messages in thread
From: Will Deacon @ 2015-07-21 15:01 UTC (permalink / raw)
  To: Sricharan R
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	mitchelh-sgV2jX0FEOL9JmXXK+q4OQ

On Fri, Jul 17, 2015 at 05:53:24PM +0100, Sricharan R wrote:
> From: Mitchel Humpherys <mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> 
> On some platforms with tight power constraints it is polite to only
> leave your clocks on for as long as you absolutely need them. Currently
> we assume that all clocks necessary for SMMU register access are always
> on.

You've borrowed this commit message from Mitch's previous version of
this patch, but now you leave the clocks enabled most of the time so it
doesn't make much sense anymore.

Anyway, I'm OK with this kind of clock management in the driver, but I
think that anything more fine-grained needs to be designed into the IOMMU
core.

Will
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks
@ 2015-07-21 15:01       ` Will Deacon
  0 siblings, 0 replies; 22+ messages in thread
From: Will Deacon @ 2015-07-21 15:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 17, 2015 at 05:53:24PM +0100, Sricharan R wrote:
> From: Mitchel Humpherys <mitchelh@codeaurora.org>
> 
> On some platforms with tight power constraints it is polite to only
> leave your clocks on for as long as you absolutely need them. Currently
> we assume that all clocks necessary for SMMU register access are always
> on.

You've borrowed this commit message from Mitch's previous version of
this patch, but now you leave the clocks enabled most of the time so it
doesn't make much sense anymore.

Anyway, I'm OK with this kind of clock management in the driver, but I
think that anything more fine-grained needs to be designed into the IOMMU
core.

Will

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

* Re: [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
  2015-07-17 16:53   ` Sricharan R
@ 2015-07-21 15:03       ` Will Deacon
  -1 siblings, 0 replies; 22+ messages in thread
From: Will Deacon @ 2015-07-21 15:03 UTC (permalink / raw)
  To: Sricharan R
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[adding Robin]

On Fri, Jul 17, 2015 at 05:53:22PM +0100, Sricharan R wrote:
> This patch uses IOMMU_OF_DECLARE to register the driver
> and the iommu_ops. So when master devices of the iommu are
> registered, of_xlate callback can be used to add the master
> configurations to the smmu driver.

I'd really prefer to do this on top of Laurent's series reworking some of
the of_xlate code and I think Robin [CC'd] is working on that. That will
also pave the way for specifying per-master SMR configuration in the
device-tree.

Will

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

* [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
@ 2015-07-21 15:03       ` Will Deacon
  0 siblings, 0 replies; 22+ messages in thread
From: Will Deacon @ 2015-07-21 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

[adding Robin]

On Fri, Jul 17, 2015 at 05:53:22PM +0100, Sricharan R wrote:
> This patch uses IOMMU_OF_DECLARE to register the driver
> and the iommu_ops. So when master devices of the iommu are
> registered, of_xlate callback can be used to add the master
> configurations to the smmu driver.

I'd really prefer to do this on top of Laurent's series reworking some of
the of_xlate code and I think Robin [CC'd] is working on that. That will
also pave the way for specifying per-master SMR configuration in the
device-tree.

Will

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

* Re: [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators
  2015-07-17 16:53   ` Sricharan R
@ 2015-07-21 18:17       ` Stephen Boyd
  -1 siblings, 0 replies; 22+ messages in thread
From: Stephen Boyd @ 2015-07-21 18:17 UTC (permalink / raw)
  To: Sricharan R
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, will.deacon-5wv7dgnIgG8,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 07/17/2015 09:53 AM, Sricharan R wrote:
> From: Mitchel Humpherys <mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
>
> This adds the support to turn on the regulators required
> for SMMUs. It is turned on during the SMMU probe and remains
> 'on' till the device exists.

The device always exists. Until the driver is removed perhaps?

>
> Signed-off-by: Sricharan R <sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

We won't be using regulators. We'll be using power domains instead so 
please rewrite this patch accordingly.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators
@ 2015-07-21 18:17       ` Stephen Boyd
  0 siblings, 0 replies; 22+ messages in thread
From: Stephen Boyd @ 2015-07-21 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/17/2015 09:53 AM, Sricharan R wrote:
> From: Mitchel Humpherys <mitchelh@codeaurora.org>
>
> This adds the support to turn on the regulators required
> for SMMUs. It is turned on during the SMMU probe and remains
> 'on' till the device exists.

The device always exists. Until the driver is removed perhaps?

>
> Signed-off-by: Sricharan R <sricharan@codeaurora.org>

We won't be using regulators. We'll be using power domains instead so 
please rewrite this patch accordingly.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* RE: [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
  2015-07-21 15:03       ` Will Deacon
@ 2015-07-22 11:08         ` Sricharan
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan @ 2015-07-22 11:08 UTC (permalink / raw)
  To: 'Will Deacon'
  Cc: linux-arm-kernel, iommu, devicetree, linux-arm-msm, mitchelh,
	robin.murphy

Hi Will,

> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@arm.com]
> Sent: Tuesday, July 21, 2015 8:33 PM
> To: Sricharan R
> Cc: linux-arm-kernel@lists.infradead.org;
iommu@lists.linux-foundation.org;
> devicetree@vger.kernel.org; linux-arm-msm@vger.kernel.org;
> mitchelh@codeaurora.org; robin.murphy@arm.com
> Subject: Re: [RFC PATCH 1/4] iommu/arm-smmu: Init driver using
> IOMMU_OF_DECLARE
> 
> [adding Robin]
> 
> On Fri, Jul 17, 2015 at 05:53:22PM +0100, Sricharan R wrote:
> > This patch uses IOMMU_OF_DECLARE to register the driver and the
> > iommu_ops. So when master devices of the iommu are registered,
> > of_xlate callback can be used to add the master configurations to the
> > smmu driver.
> 
> I'd really prefer to do this on top of Laurent's series reworking some of
the
> of_xlate code and I think Robin [CC'd] is working on that. That will also
pave
> the way for specifying per-master SMR configuration in the device-tree.

     Ok, understand it. By Rebasing on Laurent's series this patch should
not
     be needed at all, dependencies with clock devices should also be
solved.
     I will rebase this series over there.

Regards,
 Sricharan

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

* [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE
@ 2015-07-22 11:08         ` Sricharan
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan @ 2015-07-22 11:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Will,

> -----Original Message-----
> From: Will Deacon [mailto:will.deacon at arm.com]
> Sent: Tuesday, July 21, 2015 8:33 PM
> To: Sricharan R
> Cc: linux-arm-kernel at lists.infradead.org;
iommu at lists.linux-foundation.org;
> devicetree at vger.kernel.org; linux-arm-msm at vger.kernel.org;
> mitchelh at codeaurora.org; robin.murphy at arm.com
> Subject: Re: [RFC PATCH 1/4] iommu/arm-smmu: Init driver using
> IOMMU_OF_DECLARE
> 
> [adding Robin]
> 
> On Fri, Jul 17, 2015 at 05:53:22PM +0100, Sricharan R wrote:
> > This patch uses IOMMU_OF_DECLARE to register the driver and the
> > iommu_ops. So when master devices of the iommu are registered,
> > of_xlate callback can be used to add the master configurations to the
> > smmu driver.
> 
> I'd really prefer to do this on top of Laurent's series reworking some of
the
> of_xlate code and I think Robin [CC'd] is working on that. That will also
pave
> the way for specifying per-master SMR configuration in the device-tree.

     Ok, understand it. By Rebasing on Laurent's series this patch should
not
     be needed at all, dependencies with clock devices should also be
solved.
     I will rebase this series over there.

Regards,
 Sricharan

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

* RE: [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks
  2015-07-21 15:01       ` Will Deacon
@ 2015-07-24 12:26           ` Sricharan
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan @ 2015-07-24 12:26 UTC (permalink / raw)
  To: 'Will Deacon'
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	mitchelh-sgV2jX0FEOL9JmXXK+q4OQ

Hi Will,

> -----Original Message-----
> From: linux-arm-msm-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-arm-msm-
> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Will Deacon
> Sent: Tuesday, July 21, 2015 8:31 PM
> To: Sricharan R
> Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org;
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org;
> devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
> mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
> Subject: Re: [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying
> clocks
> 
> On Fri, Jul 17, 2015 at 05:53:24PM +0100, Sricharan R wrote:
> > From: Mitchel Humpherys <mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> >
> > On some platforms with tight power constraints it is polite to only
> > leave your clocks on for as long as you absolutely need them.
> > Currently we assume that all clocks necessary for SMMU register access
> > are always on.
> 
> You've borrowed this commit message from Mitch's previous version of this
> patch, but now you leave the clocks enabled most of the time so it doesn't
> make much sense anymore.
> 
 Sorry, I should have changed that to make it clear.

> Anyway, I'm OK with this kind of clock management in the driver, but I
think
> that anything more fine-grained needs to be designed into the IOMMU core.
> 
  Ok. Tried this to get the right direction.
 I will  check for the power savings and if there are not much then I would
use
 the above approach.

Regards,
  Sricharan

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks
@ 2015-07-24 12:26           ` Sricharan
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan @ 2015-07-24 12:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Will,

> -----Original Message-----
> From: linux-arm-msm-owner at vger.kernel.org [mailto:linux-arm-msm-
> owner at vger.kernel.org] On Behalf Of Will Deacon
> Sent: Tuesday, July 21, 2015 8:31 PM
> To: Sricharan R
> Cc: linux-arm-kernel at lists.infradead.org;
iommu at lists.linux-foundation.org;
> devicetree at vger.kernel.org; linux-arm-msm at vger.kernel.org;
> mitchelh at codeaurora.org
> Subject: Re: [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying
> clocks
> 
> On Fri, Jul 17, 2015 at 05:53:24PM +0100, Sricharan R wrote:
> > From: Mitchel Humpherys <mitchelh@codeaurora.org>
> >
> > On some platforms with tight power constraints it is polite to only
> > leave your clocks on for as long as you absolutely need them.
> > Currently we assume that all clocks necessary for SMMU register access
> > are always on.
> 
> You've borrowed this commit message from Mitch's previous version of this
> patch, but now you leave the clocks enabled most of the time so it doesn't
> make much sense anymore.
> 
 Sorry, I should have changed that to make it clear.

> Anyway, I'm OK with this kind of clock management in the driver, but I
think
> that anything more fine-grained needs to be designed into the IOMMU core.
> 
  Ok. Tried this to get the right direction.
 I will  check for the power savings and if there are not much then I would
use
 the above approach.

Regards,
  Sricharan

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

* RE: [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators
  2015-07-21 18:17       ` Stephen Boyd
@ 2015-07-24 12:28         ` Sricharan
  -1 siblings, 0 replies; 22+ messages in thread
From: Sricharan @ 2015-07-24 12:28 UTC (permalink / raw)
  To: 'Stephen Boyd'
  Cc: devicetree, linux-arm-msm, will.deacon, iommu, mitchelh,
	linux-arm-kernel

Hi Stephen,

> -----Original Message-----
> From: linux-arm-kernel [mailto:linux-arm-kernel-
> bounces@lists.infradead.org] On Behalf Of Stephen Boyd
> Sent: Tuesday, July 21, 2015 11:48 PM
> To: Sricharan R
> Cc: devicetree@vger.kernel.org; linux-arm-msm@vger.kernel.org;
> will.deacon@arm.com; iommu@lists.linux-foundation.org;
> mitchelh@codeaurora.org; linux-arm-kernel@lists.infradead.org
> Subject: Re: [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying
> regulators
> 
> On 07/17/2015 09:53 AM, Sricharan R wrote:
> > From: Mitchel Humpherys <mitchelh@codeaurora.org>
> >
> > This adds the support to turn on the regulators required for SMMUs. It
> > is turned on during the SMMU probe and remains 'on' till the device
> > exists.
> 
> The device always exists. Until the driver is removed perhaps?
> 
  Till the device exists.

> >
> > Signed-off-by: Sricharan R <sricharan@codeaurora.org>
> 
> We won't be using regulators. We'll be using power domains instead so
> please rewrite this patch accordingly.
> 
 Ok. Thanks for the direction.

Regards,
 Sricharan

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

* [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators
@ 2015-07-24 12:28         ` Sricharan
  0 siblings, 0 replies; 22+ messages in thread
From: Sricharan @ 2015-07-24 12:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen,

> -----Original Message-----
> From: linux-arm-kernel [mailto:linux-arm-kernel-
> bounces at lists.infradead.org] On Behalf Of Stephen Boyd
> Sent: Tuesday, July 21, 2015 11:48 PM
> To: Sricharan R
> Cc: devicetree at vger.kernel.org; linux-arm-msm at vger.kernel.org;
> will.deacon at arm.com; iommu at lists.linux-foundation.org;
> mitchelh at codeaurora.org; linux-arm-kernel at lists.infradead.org
> Subject: Re: [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying
> regulators
> 
> On 07/17/2015 09:53 AM, Sricharan R wrote:
> > From: Mitchel Humpherys <mitchelh@codeaurora.org>
> >
> > This adds the support to turn on the regulators required for SMMUs. It
> > is turned on during the SMMU probe and remains 'on' till the device
> > exists.
> 
> The device always exists. Until the driver is removed perhaps?
> 
  Till the device exists.

> >
> > Signed-off-by: Sricharan R <sricharan@codeaurora.org>
> 
> We won't be using regulators. We'll be using power domains instead so
> please rewrite this patch accordingly.
> 
 Ok. Thanks for the direction.

Regards,
 Sricharan

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

end of thread, other threads:[~2015-07-24 12:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17 16:53 [RFC PATCH 0/4] iommu/arm-smmu: Add support for adding masters/clocks using generic bindings Sricharan R
2015-07-17 16:53 ` Sricharan R
2015-07-17 16:53 ` [RFC PATCH 1/4] iommu/arm-smmu: Init driver using IOMMU_OF_DECLARE Sricharan R
2015-07-17 16:53   ` Sricharan R
     [not found]   ` <1437152005-25092-2-git-send-email-sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-07-21 15:03     ` Will Deacon
2015-07-21 15:03       ` Will Deacon
2015-07-22 11:08       ` Sricharan
2015-07-22 11:08         ` Sricharan
     [not found] ` <1437152005-25092-1-git-send-email-sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-07-17 16:53   ` [RFC PATCH 2/4] iommu/arm-smmu: Add xlate callback for initializing master devices from dt Sricharan R
2015-07-17 16:53     ` Sricharan R
2015-07-17 16:53 ` [RFC PATCH 3/4] iommu/arm-smmu: Add support for specifying clocks Sricharan R
2015-07-17 16:53   ` Sricharan R
     [not found]   ` <1437152005-25092-4-git-send-email-sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-07-21 15:01     ` Will Deacon
2015-07-21 15:01       ` Will Deacon
     [not found]       ` <20150721150122.GH31095-5wv7dgnIgG8@public.gmane.org>
2015-07-24 12:26         ` Sricharan
2015-07-24 12:26           ` Sricharan
2015-07-17 16:53 ` [RFC PATCH 4/4] iommu/arm-smmu: Add support for specifying regulators Sricharan R
2015-07-17 16:53   ` Sricharan R
     [not found]   ` <1437152005-25092-5-git-send-email-sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-07-21 18:17     ` Stephen Boyd
2015-07-21 18:17       ` Stephen Boyd
2015-07-24 12:28       ` Sricharan
2015-07-24 12:28         ` Sricharan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.