All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 1/5] gpio: clean up gpio-ranges documentation
@ 2013-07-15 18:40 ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring
  Cc: Stephen Warren, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Shiraz Hashim,
	Haojian Zhuang, Jingchang Lu,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

This change makes documentation of the the gpio-ranges property shorter
and more succinct, more consistent with the style of the rest of the
document, and not mention Linux-specifics such as the API
pinctrl_request_gpio(); DT binding documents should be OS independant
where at all possible.

This change also removes any mention of the #gpio-range-cells property.
Such properties are useful when one node references a second node, and
that second node dictates the format of the reference. However, that is
not the case here; the definition of gpio-ranges itself always dictates
its format entirely, and hence the value #gpio-range-cells must always
be 3, and hence there is no point requiring any referenced node to
include this property.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Patches 2-6 need to be applied in the same branch, since they all build
upon each-other.
---
 Documentation/devicetree/bindings/gpio/gpio.txt | 48 ++++++++++++-------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index d933af3..b262378 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -75,23 +75,29 @@ Example of two SOC GPIO banks defined as gpio-controller nodes:
 		gpio-controller;
 	};
 
-2.1) gpio-controller and pinctrl subsystem
-------------------------------------------
+2.1) gpio- and pin-controller interaction
+-----------------------------------------
 
-gpio-controller on a SOC might be tightly coupled with the pinctrl
-subsystem, in the sense that the pins can be used by other functions
-together with optional gpio feature.
+Some or all of the GPIOs provided by a GPIO controller may be routed to pins
+on the package via a pin controller. This allows muxing those pins between
+GPIO and other functions.
 
-While the pin allocation is totally managed by the pin ctrl subsystem,
-gpio (under gpiolib) is still maintained by gpio drivers. It may happen
-that different pin ranges in a SoC is managed by different gpio drivers.
+It is useful to represent which GPIOs correspond to which pins on which pin
+controllers. The gpio-ranges property described below represents this, and
+contains information strucutres as follows:
 
-This makes it logical to let gpio drivers announce their pin ranges to
-the pin ctrl subsystem and call 'pinctrl_request_gpio' in order to
-request the corresponding pin before any gpio usage.
+	gpio-range-list ::= <single-gpio-range> [gpio-range-list]
+	single-gpio-range ::=
+			<pinctrl-phandle> <gpio-base> <pinctrl-base> <count>
+	gpio-phandle : phandle to pin controller node.
+	gpio-base : Base GPIO ID in the GPIO controller
+	pinctrl-base : Base pinctrl pin ID in the pin controller
+	count : The number of GPIOs/pins in this range
 
-For this, the gpio controller can use a pinctrl phandle and pins to
-announce the pinrange to the pin ctrl subsystem. For example,
+The "pin controller node" mentioned above must conform to the bindings
+described in ../pinctrl/pinctrl-bindings.txt.
+
+Example:
 
 	qe_pio_e: gpio-controller@1460 {
 		#gpio-cells = <2>;
@@ -99,16 +105,8 @@ announce the pinrange to the pin ctrl subsystem. For example,
 		reg = <0x1460 0x18>;
 		gpio-controller;
 		gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
+	};
 
-    }
-
-where,
-   &pinctrl1 and &pinctrl2 is the phandle to the pinctrl DT node.
-
-   Next values specify the base pin and number of pins for the range
-   handled by 'qe_pio_e' gpio. In the given example from base pin 20 to
-   pin 29 under pinctrl1 with gpio offset 0 and pin 50 to pin 69 under
-   pinctrl2 with gpio offset 10 is handled by this gpio controller.
-
-The pinctrl node must have "#gpio-range-cells" property to show number of
-arguments to pass with phandle from gpio controllers node.
+Here, a single GPIO controller has GPIOs 0..9 routed to pin controller
+pinctrl1's pins 20..29, and GPIOs 10..19 routed to pin controller pinctrl2's
+pins 50..59.
-- 
1.8.1.5

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

* [PATCH V2 1/5] gpio: clean up gpio-ranges documentation
@ 2013-07-15 18:40 ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

This change makes documentation of the the gpio-ranges property shorter
and more succinct, more consistent with the style of the rest of the
document, and not mention Linux-specifics such as the API
pinctrl_request_gpio(); DT binding documents should be OS independant
where at all possible.

This change also removes any mention of the #gpio-range-cells property.
Such properties are useful when one node references a second node, and
that second node dictates the format of the reference. However, that is
not the case here; the definition of gpio-ranges itself always dictates
its format entirely, and hence the value #gpio-range-cells must always
be 3, and hence there is no point requiring any referenced node to
include this property.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Patches 2-6 need to be applied in the same branch, since they all build
upon each-other.
---
 Documentation/devicetree/bindings/gpio/gpio.txt | 48 ++++++++++++-------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index d933af3..b262378 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -75,23 +75,29 @@ Example of two SOC GPIO banks defined as gpio-controller nodes:
 		gpio-controller;
 	};
 
-2.1) gpio-controller and pinctrl subsystem
-------------------------------------------
+2.1) gpio- and pin-controller interaction
+-----------------------------------------
 
-gpio-controller on a SOC might be tightly coupled with the pinctrl
-subsystem, in the sense that the pins can be used by other functions
-together with optional gpio feature.
+Some or all of the GPIOs provided by a GPIO controller may be routed to pins
+on the package via a pin controller. This allows muxing those pins between
+GPIO and other functions.
 
-While the pin allocation is totally managed by the pin ctrl subsystem,
-gpio (under gpiolib) is still maintained by gpio drivers. It may happen
-that different pin ranges in a SoC is managed by different gpio drivers.
+It is useful to represent which GPIOs correspond to which pins on which pin
+controllers. The gpio-ranges property described below represents this, and
+contains information strucutres as follows:
 
-This makes it logical to let gpio drivers announce their pin ranges to
-the pin ctrl subsystem and call 'pinctrl_request_gpio' in order to
-request the corresponding pin before any gpio usage.
+	gpio-range-list ::= <single-gpio-range> [gpio-range-list]
+	single-gpio-range ::=
+			<pinctrl-phandle> <gpio-base> <pinctrl-base> <count>
+	gpio-phandle : phandle to pin controller node.
+	gpio-base : Base GPIO ID in the GPIO controller
+	pinctrl-base : Base pinctrl pin ID in the pin controller
+	count : The number of GPIOs/pins in this range
 
-For this, the gpio controller can use a pinctrl phandle and pins to
-announce the pinrange to the pin ctrl subsystem. For example,
+The "pin controller node" mentioned above must conform to the bindings
+described in ../pinctrl/pinctrl-bindings.txt.
+
+Example:
 
 	qe_pio_e: gpio-controller at 1460 {
 		#gpio-cells = <2>;
@@ -99,16 +105,8 @@ announce the pinrange to the pin ctrl subsystem. For example,
 		reg = <0x1460 0x18>;
 		gpio-controller;
 		gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
+	};
 
-    }
-
-where,
-   &pinctrl1 and &pinctrl2 is the phandle to the pinctrl DT node.
-
-   Next values specify the base pin and number of pins for the range
-   handled by 'qe_pio_e' gpio. In the given example from base pin 20 to
-   pin 29 under pinctrl1 with gpio offset 0 and pin 50 to pin 69 under
-   pinctrl2 with gpio offset 10 is handled by this gpio controller.
-
-The pinctrl node must have "#gpio-range-cells" property to show number of
-arguments to pass with phandle from gpio controllers node.
+Here, a single GPIO controller has GPIOs 0..9 routed to pin controller
+pinctrl1's pins 20..29, and GPIOs 10..19 routed to pin controller pinctrl2's
+pins 50..59.
-- 
1.8.1.5

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

* [PATCH V2 2/5] of: move documentation of of_parse_phandle_with_args
  2013-07-15 18:40 ` Stephen Warren
@ 2013-07-15 18:40     ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring
  Cc: Stephen Warren, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Shiraz Hashim,
	Haojian Zhuang, Jingchang Lu,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Commit bd69f73 "of: Create function for counting number of phandles in
a property" renamed of_parse_phandle_with_args(), and created a wrapper
function that implemented the original name. However, the documentation
of the original function was not moved, leaving it apparently documenting
the newly renamed function.

Move the documentation so that it is adjacent to the function it
documents.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/of/base.c | 64 +++++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5c54279..23e7073 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1104,38 +1104,6 @@ struct device_node *of_parse_phandle(const struct device_node *np,
 }
 EXPORT_SYMBOL(of_parse_phandle);
 
-/**
- * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
- * @np:		pointer to a device tree node containing a list
- * @list_name:	property name that contains a list
- * @cells_name:	property name that specifies phandles' arguments count
- * @index:	index of a phandle to parse out
- * @out_args:	optional pointer to output arguments structure (will be filled)
- *
- * This function is useful to parse lists of phandles and their arguments.
- * Returns 0 on success and fills out_args, on error returns appropriate
- * errno value.
- *
- * Caller is responsible to call of_node_put() on the returned out_args->node
- * pointer.
- *
- * Example:
- *
- * phandle1: node1 {
- * 	#list-cells = <2>;
- * }
- *
- * phandle2: node2 {
- * 	#list-cells = <1>;
- * }
- *
- * node3 {
- * 	list = <&phandle1 1 2 &phandle2 3>;
- * }
- *
- * To get a device_node of the `node2' node you may call this:
- * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
- */
 static int __of_parse_phandle_with_args(const struct device_node *np,
 					const char *list_name,
 					const char *cells_name, int index,
@@ -1238,6 +1206,38 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
 	return rc;
 }
 
+/**
+ * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
+ * @np:		pointer to a device tree node containing a list
+ * @list_name:	property name that contains a list
+ * @cells_name:	property name that specifies phandles' arguments count
+ * @index:	index of a phandle to parse out
+ * @out_args:	optional pointer to output arguments structure (will be filled)
+ *
+ * This function is useful to parse lists of phandles and their arguments.
+ * Returns 0 on success and fills out_args, on error returns appropriate
+ * errno value.
+ *
+ * Caller is responsible to call of_node_put() on the returned out_args->node
+ * pointer.
+ *
+ * Example:
+ *
+ * phandle1: node1 {
+ * 	#list-cells = <2>;
+ * }
+ *
+ * phandle2: node2 {
+ * 	#list-cells = <1>;
+ * }
+ *
+ * node3 {
+ * 	list = <&phandle1 1 2 &phandle2 3>;
+ * }
+ *
+ * To get a device_node of the `node2' node you may call this:
+ * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
+ */
 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name,
 				const char *cells_name, int index,
 				struct of_phandle_args *out_args)
-- 
1.8.1.5

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

* [PATCH V2 2/5] of: move documentation of of_parse_phandle_with_args
@ 2013-07-15 18:40     ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

Commit bd69f73 "of: Create function for counting number of phandles in
a property" renamed of_parse_phandle_with_args(), and created a wrapper
function that implemented the original name. However, the documentation
of the original function was not moved, leaving it apparently documenting
the newly renamed function.

Move the documentation so that it is adjacent to the function it
documents.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/of/base.c | 64 +++++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5c54279..23e7073 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1104,38 +1104,6 @@ struct device_node *of_parse_phandle(const struct device_node *np,
 }
 EXPORT_SYMBOL(of_parse_phandle);
 
-/**
- * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
- * @np:		pointer to a device tree node containing a list
- * @list_name:	property name that contains a list
- * @cells_name:	property name that specifies phandles' arguments count
- * @index:	index of a phandle to parse out
- * @out_args:	optional pointer to output arguments structure (will be filled)
- *
- * This function is useful to parse lists of phandles and their arguments.
- * Returns 0 on success and fills out_args, on error returns appropriate
- * errno value.
- *
- * Caller is responsible to call of_node_put() on the returned out_args->node
- * pointer.
- *
- * Example:
- *
- * phandle1: node1 {
- * 	#list-cells = <2>;
- * }
- *
- * phandle2: node2 {
- * 	#list-cells = <1>;
- * }
- *
- * node3 {
- * 	list = <&phandle1 1 2 &phandle2 3>;
- * }
- *
- * To get a device_node of the `node2' node you may call this:
- * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
- */
 static int __of_parse_phandle_with_args(const struct device_node *np,
 					const char *list_name,
 					const char *cells_name, int index,
@@ -1238,6 +1206,38 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
 	return rc;
 }
 
+/**
+ * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
+ * @np:		pointer to a device tree node containing a list
+ * @list_name:	property name that contains a list
+ * @cells_name:	property name that specifies phandles' arguments count
+ * @index:	index of a phandle to parse out
+ * @out_args:	optional pointer to output arguments structure (will be filled)
+ *
+ * This function is useful to parse lists of phandles and their arguments.
+ * Returns 0 on success and fills out_args, on error returns appropriate
+ * errno value.
+ *
+ * Caller is responsible to call of_node_put() on the returned out_args->node
+ * pointer.
+ *
+ * Example:
+ *
+ * phandle1: node1 {
+ * 	#list-cells = <2>;
+ * }
+ *
+ * phandle2: node2 {
+ * 	#list-cells = <1>;
+ * }
+ *
+ * node3 {
+ * 	list = <&phandle1 1 2 &phandle2 3>;
+ * }
+ *
+ * To get a device_node of the `node2' node you may call this:
+ * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
+ */
 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name,
 				const char *cells_name, int index,
 				struct of_phandle_args *out_args)
-- 
1.8.1.5

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

* [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
  2013-07-15 18:40 ` Stephen Warren
@ 2013-07-15 18:40     ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring
  Cc: Stephen Warren, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Shiraz Hashim,
	Haojian Zhuang, Jingchang Lu,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

This is identical to of_parse_phandle_with_args(), except that the
number of argument cells is fixed, rather than being parsed out of the
node referenced by each phandle.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/of/base.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------
 include/linux/of.h | 10 ++++++++
 2 files changed, 68 insertions(+), 9 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 23e7073..ad799d9 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
 
 static int __of_parse_phandle_with_args(const struct device_node *np,
 					const char *list_name,
-					const char *cells_name, int index,
+					const char *cells_name,
+					int cells_count, int index,
 					struct of_phandle_args *out_args)
 {
 	const __be32 *list, *list_end;
@@ -1142,12 +1143,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
 					 np->full_name);
 				goto err;
 			}
-			if (of_property_read_u32(node, cells_name, &count)) {
-				pr_err("%s: could not get %s for %s\n",
-					 np->full_name, cells_name,
-					 node->full_name);
-				goto err;
-			}
+
+			if (cells_name) {
+				if (of_property_read_u32(node, cells_name,
+							 &count)) {
+					pr_err("%s: could not get %s for %s\n",
+						np->full_name, cells_name,
+						node->full_name);
+					goto err;
+				}
+			} else
+				count = cells_count;
 
 			/*
 			 * Make sure that the arguments actually fit in the
@@ -1244,11 +1250,53 @@ int of_parse_phandle_with_args(const struct device_node *np, const char *list_na
 {
 	if (index < 0)
 		return -EINVAL;
-	return __of_parse_phandle_with_args(np, list_name, cells_name, index, out_args);
+	return __of_parse_phandle_with_args(np, list_name, cells_name, 0,
+					    index, out_args);
 }
 EXPORT_SYMBOL(of_parse_phandle_with_args);
 
 /**
+ * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
+ * @np:		pointer to a device tree node containing a list
+ * @list_name:	property name that contains a list
+ * @cells_count: number of argument cells following the phandle
+ * @index:	index of a phandle to parse out
+ * @out_args:	optional pointer to output arguments structure (will be filled)
+ *
+ * This function is useful to parse lists of phandles and their arguments.
+ * Returns 0 on success and fills out_args, on error returns appropriate
+ * errno value.
+ *
+ * Caller is responsible to call of_node_put() on the returned out_args->node
+ * pointer.
+ *
+ * Example:
+ *
+ * phandle1: node1 {
+ * }
+ *
+ * phandle2: node2 {
+ * }
+ *
+ * node3 {
+ * 	list = <&phandle1 0 2 &phandle2 2 3>;
+ * }
+ *
+ * To get a device_node of the `node2' node you may call this:
+ * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args);
+ */
+int of_parse_phandle_with_fixed_args(const struct device_node *np,
+				const char *list_name, int cells_count,
+				int index, struct of_phandle_args *out_args)
+{
+	if (index < 0)
+		return -EINVAL;
+	return __of_parse_phandle_with_args(np, list_name, NULL, cells_count,
+					   index, out_args);
+}
+EXPORT_SYMBOL(of_parse_phandle_with_fixed_args);
+
+/**
  * of_count_phandle_with_args() - Find the number of phandles references in a property
  * @np:		pointer to a device tree node containing a list
  * @list_name:	property name that contains a list
@@ -1266,7 +1314,8 @@ EXPORT_SYMBOL(of_parse_phandle_with_args);
 int of_count_phandle_with_args(const struct device_node *np, const char *list_name,
 				const char *cells_name)
 {
-	return __of_parse_phandle_with_args(np, list_name, cells_name, -1, NULL);
+	return __of_parse_phandle_with_args(np, list_name, cells_name, 0, -1,
+					    NULL);
 }
 EXPORT_SYMBOL(of_count_phandle_with_args);
 
diff --git a/include/linux/of.h b/include/linux/of.h
index 1fd08ca..0c457f5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -280,6 +280,9 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
 extern int of_parse_phandle_with_args(const struct device_node *np,
 	const char *list_name, const char *cells_name, int index,
 	struct of_phandle_args *out_args);
+extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
+	const char *list_name, int cells_count, int index,
+	struct of_phandle_args *out_args);
 extern int of_count_phandle_with_args(const struct device_node *np,
 	const char *list_name, const char *cells_name);
 
@@ -488,6 +491,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
 	return -ENOSYS;
 }
 
+static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
+	const char *list_name, int cells_count, int index,
+	struct of_phandle_args *out_args)
+{
+	return -ENOSYS;
+}
+
 static inline int of_count_phandle_with_args(struct device_node *np,
 					     const char *list_name,
 					     const char *cells_name)
-- 
1.8.1.5

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

* [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
@ 2013-07-15 18:40     ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

This is identical to of_parse_phandle_with_args(), except that the
number of argument cells is fixed, rather than being parsed out of the
node referenced by each phandle.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/of/base.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------
 include/linux/of.h | 10 ++++++++
 2 files changed, 68 insertions(+), 9 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 23e7073..ad799d9 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
 
 static int __of_parse_phandle_with_args(const struct device_node *np,
 					const char *list_name,
-					const char *cells_name, int index,
+					const char *cells_name,
+					int cells_count, int index,
 					struct of_phandle_args *out_args)
 {
 	const __be32 *list, *list_end;
@@ -1142,12 +1143,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
 					 np->full_name);
 				goto err;
 			}
-			if (of_property_read_u32(node, cells_name, &count)) {
-				pr_err("%s: could not get %s for %s\n",
-					 np->full_name, cells_name,
-					 node->full_name);
-				goto err;
-			}
+
+			if (cells_name) {
+				if (of_property_read_u32(node, cells_name,
+							 &count)) {
+					pr_err("%s: could not get %s for %s\n",
+						np->full_name, cells_name,
+						node->full_name);
+					goto err;
+				}
+			} else
+				count = cells_count;
 
 			/*
 			 * Make sure that the arguments actually fit in the
@@ -1244,11 +1250,53 @@ int of_parse_phandle_with_args(const struct device_node *np, const char *list_na
 {
 	if (index < 0)
 		return -EINVAL;
-	return __of_parse_phandle_with_args(np, list_name, cells_name, index, out_args);
+	return __of_parse_phandle_with_args(np, list_name, cells_name, 0,
+					    index, out_args);
 }
 EXPORT_SYMBOL(of_parse_phandle_with_args);
 
 /**
+ * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
+ * @np:		pointer to a device tree node containing a list
+ * @list_name:	property name that contains a list
+ * @cells_count: number of argument cells following the phandle
+ * @index:	index of a phandle to parse out
+ * @out_args:	optional pointer to output arguments structure (will be filled)
+ *
+ * This function is useful to parse lists of phandles and their arguments.
+ * Returns 0 on success and fills out_args, on error returns appropriate
+ * errno value.
+ *
+ * Caller is responsible to call of_node_put() on the returned out_args->node
+ * pointer.
+ *
+ * Example:
+ *
+ * phandle1: node1 {
+ * }
+ *
+ * phandle2: node2 {
+ * }
+ *
+ * node3 {
+ * 	list = <&phandle1 0 2 &phandle2 2 3>;
+ * }
+ *
+ * To get a device_node of the `node2' node you may call this:
+ * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args);
+ */
+int of_parse_phandle_with_fixed_args(const struct device_node *np,
+				const char *list_name, int cells_count,
+				int index, struct of_phandle_args *out_args)
+{
+	if (index < 0)
+		return -EINVAL;
+	return __of_parse_phandle_with_args(np, list_name, NULL, cells_count,
+					   index, out_args);
+}
+EXPORT_SYMBOL(of_parse_phandle_with_fixed_args);
+
+/**
  * of_count_phandle_with_args() - Find the number of phandles references in a property
  * @np:		pointer to a device tree node containing a list
  * @list_name:	property name that contains a list
@@ -1266,7 +1314,8 @@ EXPORT_SYMBOL(of_parse_phandle_with_args);
 int of_count_phandle_with_args(const struct device_node *np, const char *list_name,
 				const char *cells_name)
 {
-	return __of_parse_phandle_with_args(np, list_name, cells_name, -1, NULL);
+	return __of_parse_phandle_with_args(np, list_name, cells_name, 0, -1,
+					    NULL);
 }
 EXPORT_SYMBOL(of_count_phandle_with_args);
 
diff --git a/include/linux/of.h b/include/linux/of.h
index 1fd08ca..0c457f5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -280,6 +280,9 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
 extern int of_parse_phandle_with_args(const struct device_node *np,
 	const char *list_name, const char *cells_name, int index,
 	struct of_phandle_args *out_args);
+extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
+	const char *list_name, int cells_count, int index,
+	struct of_phandle_args *out_args);
 extern int of_count_phandle_with_args(const struct device_node *np,
 	const char *list_name, const char *cells_name);
 
@@ -488,6 +491,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
 	return -ENOSYS;
 }
 
+static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
+	const char *list_name, int cells_count, int index,
+	struct of_phandle_args *out_args)
+{
+	return -ENOSYS;
+}
+
 static inline int of_count_phandle_with_args(struct device_node *np,
 					     const char *list_name,
 					     const char *cells_name)
-- 
1.8.1.5

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

* [PATCH V2 4/5] gpio: implement gpio-ranges binding document fix
  2013-07-15 18:40 ` Stephen Warren
@ 2013-07-15 18:40   ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring
  Cc: Stephen Warren, linux-gpio, devicetree-discuss, Shiraz Hashim,
	Haojian Zhuang, Jingchang Lu, Shawn Guo, linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

Use the new of_parse_phandle_with_fixed_args() to implement the
corrected gpio-ranges DT property definition.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/gpio/gpiolib-of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 665f953..48cda3c 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -194,8 +194,8 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
 		return;
 
 	for (;; index++) {
-		ret = of_parse_phandle_with_args(np, "gpio-ranges",
-				"#gpio-range-cells", index, &pinspec);
+		ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
+				index, &pinspec);
 		if (ret)
 			break;
 
-- 
1.8.1.5

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

* [PATCH V2 4/5] gpio: implement gpio-ranges binding document fix
@ 2013-07-15 18:40   ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

Use the new of_parse_phandle_with_fixed_args() to implement the
corrected gpio-ranges DT property definition.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/gpio/gpiolib-of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 665f953..48cda3c 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -194,8 +194,8 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
 		return;
 
 	for (;; index++) {
-		ret = of_parse_phandle_with_args(np, "gpio-ranges",
-				"#gpio-range-cells", index, &pinspec);
+		ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
+				index, &pinspec);
 		if (ret)
 			break;
 
-- 
1.8.1.5

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-15 18:40 ` Stephen Warren
@ 2013-07-15 18:40     ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring
  Cc: Stephen Warren, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Shiraz Hashim,
	Haojian Zhuang, Jingchang Lu,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

This property is no longer required by the GPIO binding. Remove it.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
This should presumably be applied along with the previous changes

v2: Squash spear and mxc changes into a single patch; there's no
need to keep vf610.dtsi separate now that this series will go into
v3.12 or later, and that file is part of v3.11-rc1.
---
 arch/arm/boot/dts/spear1310.dtsi | 1 -
 arch/arm/boot/dts/spear1340.dtsi | 1 -
 arch/arm/boot/dts/spear310.dtsi  | 1 -
 arch/arm/boot/dts/spear320.dtsi  | 2 --
 arch/arm/boot/dts/vf610.dtsi     | 1 -
 5 files changed, 6 deletions(-)

diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 122ae94..90e99b5 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -89,7 +89,6 @@
 		pinmux: pinmux@e0700000 {
 			compatible = "st,spear1310-pinmux";
 			reg = <0xe0700000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		apb {
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 54d128d..5003013 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -63,7 +63,6 @@
 		pinmux: pinmux@e0700000 {
 			compatible = "st,spear1340-pinmux";
 			reg = <0xe0700000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		pwm: pwm@e0180000 {
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index 9537208..1e1318e 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -25,7 +25,6 @@
 		pinmux: pinmux@b4000000 {
 			compatible = "st,spear310-pinmux";
 			reg = <0xb4000000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		fsmc: flash@44000000 {
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index ffea342..f630d0c 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -1,4 +1,3 @@
-/*
  * DTS file for SPEAr320 SoC
  *
  * Copyright 2012 Viresh Kumar <viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@@ -24,7 +23,6 @@
 		pinmux: pinmux@b3000000 {
 			compatible = "st,spear320-pinmux";
 			reg = <0xb3000000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		clcd@90000000 {
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index e1eb7da..8577780 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -162,7 +162,6 @@
 			iomuxc: iomuxc@40048000 {
 				compatible = "fsl,vf610-iomuxc";
 				reg = <0x40048000 0x1000>;
-				#gpio-range-cells = <3>;
 
 				/* functions and groups pins */
 
-- 
1.8.1.5

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-15 18:40     ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 18:40 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

This property is no longer required by the GPIO binding. Remove it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
This should presumably be applied along with the previous changes

v2: Squash spear and mxc changes into a single patch; there's no
need to keep vf610.dtsi separate now that this series will go into
v3.12 or later, and that file is part of v3.11-rc1.
---
 arch/arm/boot/dts/spear1310.dtsi | 1 -
 arch/arm/boot/dts/spear1340.dtsi | 1 -
 arch/arm/boot/dts/spear310.dtsi  | 1 -
 arch/arm/boot/dts/spear320.dtsi  | 2 --
 arch/arm/boot/dts/vf610.dtsi     | 1 -
 5 files changed, 6 deletions(-)

diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 122ae94..90e99b5 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -89,7 +89,6 @@
 		pinmux: pinmux at e0700000 {
 			compatible = "st,spear1310-pinmux";
 			reg = <0xe0700000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		apb {
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 54d128d..5003013 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -63,7 +63,6 @@
 		pinmux: pinmux at e0700000 {
 			compatible = "st,spear1340-pinmux";
 			reg = <0xe0700000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		pwm: pwm at e0180000 {
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index 9537208..1e1318e 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -25,7 +25,6 @@
 		pinmux: pinmux at b4000000 {
 			compatible = "st,spear310-pinmux";
 			reg = <0xb4000000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		fsmc: flash at 44000000 {
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index ffea342..f630d0c 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -1,4 +1,3 @@
-/*
  * DTS file for SPEAr320 SoC
  *
  * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
@@ -24,7 +23,6 @@
 		pinmux: pinmux at b3000000 {
 			compatible = "st,spear320-pinmux";
 			reg = <0xb3000000 0x1000>;
-			#gpio-range-cells = <3>;
 		};
 
 		clcd at 90000000 {
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index e1eb7da..8577780 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -162,7 +162,6 @@
 			iomuxc: iomuxc at 40048000 {
 				compatible = "fsl,vf610-iomuxc";
 				reg = <0x40048000 0x1000>;
-				#gpio-range-cells = <3>;
 
 				/* functions and groups pins */
 
-- 
1.8.1.5

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

* Re: [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
  2013-07-15 18:40     ` Stephen Warren
@ 2013-07-15 18:59       ` Sergei Shtylyov
  -1 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2013-07-15 18:59 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Stephen Warren, Shiraz Hashim, Linus Walleij, Rob Herring,
	linux-gpio, Haojian Zhuang, Jingchang Lu, Shawn Guo,
	devicetree-discuss, linux-arm-kernel

On 07/15/2013 10:40 PM, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>

> This is identical to of_parse_phandle_with_args(), except that the
> number of argument cells is fixed, rather than being parsed out of the
> node referenced by each phandle.

> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>   drivers/of/base.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------
>   include/linux/of.h | 10 ++++++++
>   2 files changed, 68 insertions(+), 9 deletions(-)

> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 23e7073..ad799d9 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
>
>   static int __of_parse_phandle_with_args(const struct device_node *np,
>   					const char *list_name,
> -					const char *cells_name, int index,
> +					const char *cells_name,
> +					int cells_count, int index,

    The correct grammar would be 'cell_name' and 'cell_count' I think.

>   					struct of_phandle_args *out_args)
>   {
>   	const __be32 *list, *list_end;
> @@ -1142,12 +1143,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
>   					 np->full_name);
>   				goto err;
>   			}
> -			if (of_property_read_u32(node, cells_name, &count)) {
> -				pr_err("%s: could not get %s for %s\n",
> -					 np->full_name, cells_name,
> -					 node->full_name);
> -				goto err;
> -			}
> +
> +			if (cells_name) {
> +				if (of_property_read_u32(node, cells_name,
> +							 &count)) {
> +					pr_err("%s: could not get %s for %s\n",
> +						np->full_name, cells_name,
> +						node->full_name);
> +					goto err;
> +				}
> +			} else
> +				count = cells_count;

    According to Documentation/CodingStyle chapter 3, both arms of the 
*if* statment should have {} if oe arm has it.

WBR, Sergei

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

* [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
@ 2013-07-15 18:59       ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2013-07-15 18:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/15/2013 10:40 PM, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>

> This is identical to of_parse_phandle_with_args(), except that the
> number of argument cells is fixed, rather than being parsed out of the
> node referenced by each phandle.

> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>   drivers/of/base.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------
>   include/linux/of.h | 10 ++++++++
>   2 files changed, 68 insertions(+), 9 deletions(-)

> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 23e7073..ad799d9 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
>
>   static int __of_parse_phandle_with_args(const struct device_node *np,
>   					const char *list_name,
> -					const char *cells_name, int index,
> +					const char *cells_name,
> +					int cells_count, int index,

    The correct grammar would be 'cell_name' and 'cell_count' I think.

>   					struct of_phandle_args *out_args)
>   {
>   	const __be32 *list, *list_end;
> @@ -1142,12 +1143,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
>   					 np->full_name);
>   				goto err;
>   			}
> -			if (of_property_read_u32(node, cells_name, &count)) {
> -				pr_err("%s: could not get %s for %s\n",
> -					 np->full_name, cells_name,
> -					 node->full_name);
> -				goto err;
> -			}
> +
> +			if (cells_name) {
> +				if (of_property_read_u32(node, cells_name,
> +							 &count)) {
> +					pr_err("%s: could not get %s for %s\n",
> +						np->full_name, cells_name,
> +						node->full_name);
> +					goto err;
> +				}
> +			} else
> +				count = cells_count;

    According to Documentation/CodingStyle chapter 3, both arms of the 
*if* statment should have {} if oe arm has it.

WBR, Sergei

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

* Re: [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-15 18:40     ` Stephen Warren
@ 2013-07-15 19:34         ` Rob Herring
  -1 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2013-07-15 19:34 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Stephen Warren, Shiraz Hashim, Rob Herring,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 07/15/2013 01:40 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> This property is no longer required by the GPIO binding. Remove it.

Won't this break compatibility with older kernel? It is one thing to
deprecate, but removal is another. If the relevant maintainers don't
care, then I guess it is fine.

> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Acked-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> This should presumably be applied along with the previous changes

The rest looks fine to me. I can take this series, but would actually
prefer that this patch go separately to arm-soc.

Rob

> 
> v2: Squash spear and mxc changes into a single patch; there's no
> need to keep vf610.dtsi separate now that this series will go into
> v3.12 or later, and that file is part of v3.11-rc1.
> ---
>  arch/arm/boot/dts/spear1310.dtsi | 1 -
>  arch/arm/boot/dts/spear1340.dtsi | 1 -
>  arch/arm/boot/dts/spear310.dtsi  | 1 -
>  arch/arm/boot/dts/spear320.dtsi  | 2 --
>  arch/arm/boot/dts/vf610.dtsi     | 1 -
>  5 files changed, 6 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
> index 122ae94..90e99b5 100644
> --- a/arch/arm/boot/dts/spear1310.dtsi
> +++ b/arch/arm/boot/dts/spear1310.dtsi
> @@ -89,7 +89,6 @@
>  		pinmux: pinmux@e0700000 {
>  			compatible = "st,spear1310-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		apb {
> diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
> index 54d128d..5003013 100644
> --- a/arch/arm/boot/dts/spear1340.dtsi
> +++ b/arch/arm/boot/dts/spear1340.dtsi
> @@ -63,7 +63,6 @@
>  		pinmux: pinmux@e0700000 {
>  			compatible = "st,spear1340-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		pwm: pwm@e0180000 {
> diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
> index 9537208..1e1318e 100644
> --- a/arch/arm/boot/dts/spear310.dtsi
> +++ b/arch/arm/boot/dts/spear310.dtsi
> @@ -25,7 +25,6 @@
>  		pinmux: pinmux@b4000000 {
>  			compatible = "st,spear310-pinmux";
>  			reg = <0xb4000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		fsmc: flash@44000000 {
> diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
> index ffea342..f630d0c 100644
> --- a/arch/arm/boot/dts/spear320.dtsi
> +++ b/arch/arm/boot/dts/spear320.dtsi
> @@ -1,4 +1,3 @@
> -/*
>   * DTS file for SPEAr320 SoC
>   *
>   * Copyright 2012 Viresh Kumar <viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> @@ -24,7 +23,6 @@
>  		pinmux: pinmux@b3000000 {
>  			compatible = "st,spear320-pinmux";
>  			reg = <0xb3000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		clcd@90000000 {
> diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
> index e1eb7da..8577780 100644
> --- a/arch/arm/boot/dts/vf610.dtsi
> +++ b/arch/arm/boot/dts/vf610.dtsi
> @@ -162,7 +162,6 @@
>  			iomuxc: iomuxc@40048000 {
>  				compatible = "fsl,vf610-iomuxc";
>  				reg = <0x40048000 0x1000>;
> -				#gpio-range-cells = <3>;
>  
>  				/* functions and groups pins */
>  
> 

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-15 19:34         ` Rob Herring
  0 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2013-07-15 19:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/15/2013 01:40 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> This property is no longer required by the GPIO binding. Remove it.

Won't this break compatibility with older kernel? It is one thing to
deprecate, but removal is another. If the relevant maintainers don't
care, then I guess it is fine.

> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> This should presumably be applied along with the previous changes

The rest looks fine to me. I can take this series, but would actually
prefer that this patch go separately to arm-soc.

Rob

> 
> v2: Squash spear and mxc changes into a single patch; there's no
> need to keep vf610.dtsi separate now that this series will go into
> v3.12 or later, and that file is part of v3.11-rc1.
> ---
>  arch/arm/boot/dts/spear1310.dtsi | 1 -
>  arch/arm/boot/dts/spear1340.dtsi | 1 -
>  arch/arm/boot/dts/spear310.dtsi  | 1 -
>  arch/arm/boot/dts/spear320.dtsi  | 2 --
>  arch/arm/boot/dts/vf610.dtsi     | 1 -
>  5 files changed, 6 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
> index 122ae94..90e99b5 100644
> --- a/arch/arm/boot/dts/spear1310.dtsi
> +++ b/arch/arm/boot/dts/spear1310.dtsi
> @@ -89,7 +89,6 @@
>  		pinmux: pinmux at e0700000 {
>  			compatible = "st,spear1310-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		apb {
> diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
> index 54d128d..5003013 100644
> --- a/arch/arm/boot/dts/spear1340.dtsi
> +++ b/arch/arm/boot/dts/spear1340.dtsi
> @@ -63,7 +63,6 @@
>  		pinmux: pinmux at e0700000 {
>  			compatible = "st,spear1340-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		pwm: pwm at e0180000 {
> diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
> index 9537208..1e1318e 100644
> --- a/arch/arm/boot/dts/spear310.dtsi
> +++ b/arch/arm/boot/dts/spear310.dtsi
> @@ -25,7 +25,6 @@
>  		pinmux: pinmux at b4000000 {
>  			compatible = "st,spear310-pinmux";
>  			reg = <0xb4000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		fsmc: flash at 44000000 {
> diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
> index ffea342..f630d0c 100644
> --- a/arch/arm/boot/dts/spear320.dtsi
> +++ b/arch/arm/boot/dts/spear320.dtsi
> @@ -1,4 +1,3 @@
> -/*
>   * DTS file for SPEAr320 SoC
>   *
>   * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
> @@ -24,7 +23,6 @@
>  		pinmux: pinmux at b3000000 {
>  			compatible = "st,spear320-pinmux";
>  			reg = <0xb3000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
>  
>  		clcd at 90000000 {
> diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
> index e1eb7da..8577780 100644
> --- a/arch/arm/boot/dts/vf610.dtsi
> +++ b/arch/arm/boot/dts/vf610.dtsi
> @@ -162,7 +162,6 @@
>  			iomuxc: iomuxc at 40048000 {
>  				compatible = "fsl,vf610-iomuxc";
>  				reg = <0x40048000 0x1000>;
> -				#gpio-range-cells = <3>;
>  
>  				/* functions and groups pins */
>  
> 

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

* Re: [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-15 19:34         ` Rob Herring
@ 2013-07-15 23:02             ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 23:02 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Warren, Shiraz Hashim, Rob Herring,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 07/15/2013 01:34 PM, Rob Herring wrote:
> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>
>> This property is no longer required by the GPIO binding. Remove it.
> 
> Won't this break compatibility with older kernel? It is one thing to
> deprecate, but removal is another. If the relevant maintainers don't
> care, then I guess it is fine.

Yes.

I had originally hoped this could sneak in late for 3.11, but I suppose
it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
protect.

Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-15 23:02             ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 23:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/15/2013 01:34 PM, Rob Herring wrote:
> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> This property is no longer required by the GPIO binding. Remove it.
> 
> Won't this break compatibility with older kernel? It is one thing to
> deprecate, but removal is another. If the relevant maintainers don't
> care, then I guess it is fine.

Yes.

I had originally hoped this could sneak in late for 3.11, but I suppose
it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
protect.

Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.

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

* Re: [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
  2013-07-15 18:59       ` Sergei Shtylyov
@ 2013-07-15 23:06           ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 23:06 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Stephen Warren, Shiraz Hashim, Rob Herring,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 07/15/2013 12:59 PM, Sergei Shtylyov wrote:
> On 07/15/2013 10:40 PM, Stephen Warren wrote:
> 
>> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
>> This is identical to of_parse_phandle_with_args(), except that the
>> number of argument cells is fixed, rather than being parsed out of the
>> node referenced by each phandle.

>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index 23e7073..ad799d9 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
>>
>>   static int __of_parse_phandle_with_args(const struct device_node *np,
>>                       const char *list_name,
>> -                    const char *cells_name, int index,
>> +                    const char *cells_name,
>> +                    int cells_count, int index,
> 
>    The correct grammar would be 'cell_name' and 'cell_count' I think.

I guess I can see the argument for cell_count, but "cells_name" is named
based on the DT property named "gpio-cells", so "cells" seems correct
here (and is a pre-existing issue anyway).

I'll fix up cell_count and the brace issue locally, but hold off reposting.

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

* [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args
@ 2013-07-15 23:06           ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-15 23:06 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/15/2013 12:59 PM, Sergei Shtylyov wrote:
> On 07/15/2013 10:40 PM, Stephen Warren wrote:
> 
>> From: Stephen Warren <swarren@nvidia.com>
> 
>> This is identical to of_parse_phandle_with_args(), except that the
>> number of argument cells is fixed, rather than being parsed out of the
>> node referenced by each phandle.

>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index 23e7073..ad799d9 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -1106,7 +1106,8 @@ EXPORT_SYMBOL(of_parse_phandle);
>>
>>   static int __of_parse_phandle_with_args(const struct device_node *np,
>>                       const char *list_name,
>> -                    const char *cells_name, int index,
>> +                    const char *cells_name,
>> +                    int cells_count, int index,
> 
>    The correct grammar would be 'cell_name' and 'cell_count' I think.

I guess I can see the argument for cell_count, but "cells_name" is named
based on the DT property named "gpio-cells", so "cells" seems correct
here (and is a pre-existing issue anyway).

I'll fix up cell_count and the brace issue locally, but hold off reposting.

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

* Re: [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-15 23:02             ` Stephen Warren
@ 2013-07-16 23:30                 ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-16 23:30 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Warren, Shiraz Hashim, Rob Herring,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 07/15/2013 05:02 PM, Stephen Warren wrote:
> On 07/15/2013 01:34 PM, Rob Herring wrote:
>> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>>> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>
>>> This property is no longer required by the GPIO binding. Remove it.
>>
>> Won't this break compatibility with older kernel? It is one thing to
>> deprecate, but removal is another. If the relevant maintainers don't
>> care, then I guess it is fine.
> 
> Yes.
> 
> I had originally hoped this could sneak in late for 3.11, but I suppose
> it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
> protect.
> 
> Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.

One more thought here:

I know DT bindings are supposed to evolve so that a new kernel will
support arbitrary old DTs. I'll call that backwards-compatibility for
the DT parsing code.

However, this situation is the reverse; this patch would prevent a new
DT running on an older kernel. I'll call that forwards-compatibility.
I'm not sure if the intent is to support this or not? It's certainly the
first I explicitly thought about compatibility in this direction...

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-16 23:30                 ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-16 23:30 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/15/2013 05:02 PM, Stephen Warren wrote:
> On 07/15/2013 01:34 PM, Rob Herring wrote:
>> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> This property is no longer required by the GPIO binding. Remove it.
>>
>> Won't this break compatibility with older kernel? It is one thing to
>> deprecate, but removal is another. If the relevant maintainers don't
>> care, then I guess it is fine.
> 
> Yes.
> 
> I had originally hoped this could sneak in late for 3.11, but I suppose
> it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
> protect.
> 
> Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.

One more thought here:

I know DT bindings are supposed to evolve so that a new kernel will
support arbitrary old DTs. I'll call that backwards-compatibility for
the DT parsing code.

However, this situation is the reverse; this patch would prevent a new
DT running on an older kernel. I'll call that forwards-compatibility.
I'm not sure if the intent is to support this or not? It's certainly the
first I explicitly thought about compatibility in this direction...

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

* Re: [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-16 23:30                 ` Stephen Warren
@ 2013-07-17  1:50                     ` Rob Herring
  -1 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2013-07-17  1:50 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Stephen Warren, Shiraz Hashim, Rob Herring,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Jul 16, 2013 at 6:30 PM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> On 07/15/2013 05:02 PM, Stephen Warren wrote:
>> On 07/15/2013 01:34 PM, Rob Herring wrote:
>>> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>>>> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>
>>>> This property is no longer required by the GPIO binding. Remove it.
>>>
>>> Won't this break compatibility with older kernel? It is one thing to
>>> deprecate, but removal is another. If the relevant maintainers don't
>>> care, then I guess it is fine.
>>
>> Yes.
>>
>> I had originally hoped this could sneak in late for 3.11, but I suppose
>> it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
>> protect.
>>
>> Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.
>
> One more thought here:
>
> I know DT bindings are supposed to evolve so that a new kernel will
> support arbitrary old DTs. I'll call that backwards-compatibility for
> the DT parsing code.

That is the more common case.

> However, this situation is the reverse; this patch would prevent a new
> DT running on an older kernel. I'll call that forwards-compatibility.
> I'm not sure if the intent is to support this or not? It's certainly the
> first I explicitly thought about compatibility in this direction...

So you would be okay if your computer stopped booting a kernel after a
BIOS update? It's the same deal. It's both forwards and backwards
compatibility that is needed.

Rob

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-17  1:50                     ` Rob Herring
  0 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2013-07-17  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 16, 2013 at 6:30 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 07/15/2013 05:02 PM, Stephen Warren wrote:
>> On 07/15/2013 01:34 PM, Rob Herring wrote:
>>> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>
>>>> This property is no longer required by the GPIO binding. Remove it.
>>>
>>> Won't this break compatibility with older kernel? It is one thing to
>>> deprecate, but removal is another. If the relevant maintainers don't
>>> care, then I guess it is fine.
>>
>> Yes.
>>
>> I had originally hoped this could sneak in late for 3.11, but I suppose
>> it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
>> protect.
>>
>> Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.
>
> One more thought here:
>
> I know DT bindings are supposed to evolve so that a new kernel will
> support arbitrary old DTs. I'll call that backwards-compatibility for
> the DT parsing code.

That is the more common case.

> However, this situation is the reverse; this patch would prevent a new
> DT running on an older kernel. I'll call that forwards-compatibility.
> I'm not sure if the intent is to support this or not? It's certainly the
> first I explicitly thought about compatibility in this direction...

So you would be okay if your computer stopped booting a kernel after a
BIOS update? It's the same deal. It's both forwards and backwards
compatibility that is needed.

Rob

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

* Re: [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-17  1:50                     ` Rob Herring
@ 2013-07-17  2:58                         ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-17  2:58 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Warren, Shiraz Hashim, Rob Herring,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 07/16/2013 07:50 PM, Rob Herring wrote:
> On Tue, Jul 16, 2013 at 6:30 PM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
>> On 07/15/2013 05:02 PM, Stephen Warren wrote:
>>> On 07/15/2013 01:34 PM, Rob Herring wrote:
>>>> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>>>>> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>>
>>>>> This property is no longer required by the GPIO binding. Remove it.
>>>>
>>>> Won't this break compatibility with older kernel? It is one thing to
>>>> deprecate, but removal is another. If the relevant maintainers don't
>>>> care, then I guess it is fine.
>>>
>>> Yes.
>>>
>>> I had originally hoped this could sneak in late for 3.11, but I suppose
>>> it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
>>> protect.
>>>
>>> Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.
>>
>> One more thought here:
>>
>> I know DT bindings are supposed to evolve so that a new kernel will
>> support arbitrary old DTs. I'll call that backwards-compatibility for
>> the DT parsing code.
> 
> That is the more common case.
> 
>> However, this situation is the reverse; this patch would prevent a new
>> DT running on an older kernel. I'll call that forwards-compatibility.
>> I'm not sure if the intent is to support this or not? It's certainly the
>> first I explicitly thought about compatibility in this direction...
> 
> So you would be okay if your computer stopped booting a kernel after a
> BIOS update? It's the same deal. It's both forwards and backwards
> compatibility that is needed.

I would strongly hope the BIOS/bootloader/... would have nothing to do
with the DT content. There's a reason that Grant asserted early on that
DTBs shouldn't be part of the BIOS/bootloader, but rather stored
separately, so the DTB could be updated without updating firmware, just
like the kernel. And I see no real problem with a new DTB requiring a
new kernel or even vice-versa to be honest.

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-17  2:58                         ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-17  2:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/16/2013 07:50 PM, Rob Herring wrote:
> On Tue, Jul 16, 2013 at 6:30 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 07/15/2013 05:02 PM, Stephen Warren wrote:
>>> On 07/15/2013 01:34 PM, Rob Herring wrote:
>>>> On 07/15/2013 01:40 PM, Stephen Warren wrote:
>>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>>
>>>>> This property is no longer required by the GPIO binding. Remove it.
>>>>
>>>> Won't this break compatibility with older kernel? It is one thing to
>>>> deprecate, but removal is another. If the relevant maintainers don't
>>>> care, then I guess it is fine.
>>>
>>> Yes.
>>>
>>> I had originally hoped this could sneak in late for 3.11, but I suppose
>>> it's too late now. vf610.dtsi is a new file in 3.11 so has no legacy to
>>> protect.
>>>
>>> Admittedly, the #gpio-cells property was added into the SPEAr files in 3.10.
>>
>> One more thought here:
>>
>> I know DT bindings are supposed to evolve so that a new kernel will
>> support arbitrary old DTs. I'll call that backwards-compatibility for
>> the DT parsing code.
> 
> That is the more common case.
> 
>> However, this situation is the reverse; this patch would prevent a new
>> DT running on an older kernel. I'll call that forwards-compatibility.
>> I'm not sure if the intent is to support this or not? It's certainly the
>> first I explicitly thought about compatibility in this direction...
> 
> So you would be okay if your computer stopped booting a kernel after a
> BIOS update? It's the same deal. It's both forwards and backwards
> compatibility that is needed.

I would strongly hope the BIOS/bootloader/... would have nothing to do
with the DT content. There's a reason that Grant asserted early on that
DTBs shouldn't be part of the BIOS/bootloader, but rather stored
separately, so the DTB could be updated without updating firmware, just
like the kernel. And I see no real problem with a new DTB requiring a
new kernel or even vice-versa to be honest.

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

* Re: [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
  2013-07-15 18:40     ` Stephen Warren
@ 2013-07-18  1:35         ` Laurent Pinchart
  -1 siblings, 0 replies; 30+ messages in thread
From: Laurent Pinchart @ 2013-07-18  1:35 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Stephen Warren, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	Simon Horman, Haojian Zhuang, Jingchang Lu,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Shiraz Hashim

Hi Stephen,

On Monday 15 July 2013 12:40:29 Stephen Warren wrote:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> This property is no longer required by the GPIO binding. Remove it.
> 
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Acked-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> This should presumably be applied along with the previous changes

The mach-shmobile tree includes patches for v3.12 that will add the #gpio-
ranges-cells to several .dtsi files. I can get that fixed locally (most 
probably through a rebase), could you please ping me when this series will be 
accepted for upstream merge ?

> v2: Squash spear and mxc changes into a single patch; there's no
> need to keep vf610.dtsi separate now that this series will go into
> v3.12 or later, and that file is part of v3.11-rc1.
> ---
>  arch/arm/boot/dts/spear1310.dtsi | 1 -
>  arch/arm/boot/dts/spear1340.dtsi | 1 -
>  arch/arm/boot/dts/spear310.dtsi  | 1 -
>  arch/arm/boot/dts/spear320.dtsi  | 2 --
>  arch/arm/boot/dts/vf610.dtsi     | 1 -
>  5 files changed, 6 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/spear1310.dtsi
> b/arch/arm/boot/dts/spear1310.dtsi index 122ae94..90e99b5 100644
> --- a/arch/arm/boot/dts/spear1310.dtsi
> +++ b/arch/arm/boot/dts/spear1310.dtsi
> @@ -89,7 +89,6 @@
>  		pinmux: pinmux@e0700000 {
>  			compatible = "st,spear1310-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		apb {
> diff --git a/arch/arm/boot/dts/spear1340.dtsi
> b/arch/arm/boot/dts/spear1340.dtsi index 54d128d..5003013 100644
> --- a/arch/arm/boot/dts/spear1340.dtsi
> +++ b/arch/arm/boot/dts/spear1340.dtsi
> @@ -63,7 +63,6 @@
>  		pinmux: pinmux@e0700000 {
>  			compatible = "st,spear1340-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		pwm: pwm@e0180000 {
> diff --git a/arch/arm/boot/dts/spear310.dtsi
> b/arch/arm/boot/dts/spear310.dtsi index 9537208..1e1318e 100644
> --- a/arch/arm/boot/dts/spear310.dtsi
> +++ b/arch/arm/boot/dts/spear310.dtsi
> @@ -25,7 +25,6 @@
>  		pinmux: pinmux@b4000000 {
>  			compatible = "st,spear310-pinmux";
>  			reg = <0xb4000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		fsmc: flash@44000000 {
> diff --git a/arch/arm/boot/dts/spear320.dtsi
> b/arch/arm/boot/dts/spear320.dtsi index ffea342..f630d0c 100644
> --- a/arch/arm/boot/dts/spear320.dtsi
> +++ b/arch/arm/boot/dts/spear320.dtsi
> @@ -1,4 +1,3 @@
> -/*
>   * DTS file for SPEAr320 SoC
>   *
>   * Copyright 2012 Viresh Kumar <viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> @@ -24,7 +23,6 @@
>  		pinmux: pinmux@b3000000 {
>  			compatible = "st,spear320-pinmux";
>  			reg = <0xb3000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		clcd@90000000 {
> diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
> index e1eb7da..8577780 100644
> --- a/arch/arm/boot/dts/vf610.dtsi
> +++ b/arch/arm/boot/dts/vf610.dtsi
> @@ -162,7 +162,6 @@
>  			iomuxc: iomuxc@40048000 {
>  				compatible = "fsl,vf610-iomuxc";
>  				reg = <0x40048000 0x1000>;
> -				#gpio-range-cells = <3>;
> 
>  				/* functions and groups pins */
-- 
Regards,

Laurent Pinchart

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

* [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property
@ 2013-07-18  1:35         ` Laurent Pinchart
  0 siblings, 0 replies; 30+ messages in thread
From: Laurent Pinchart @ 2013-07-18  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen,

On Monday 15 July 2013 12:40:29 Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> This property is no longer required by the GPIO binding. Remove it.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> This should presumably be applied along with the previous changes

The mach-shmobile tree includes patches for v3.12 that will add the #gpio-
ranges-cells to several .dtsi files. I can get that fixed locally (most 
probably through a rebase), could you please ping me when this series will be 
accepted for upstream merge ?

> v2: Squash spear and mxc changes into a single patch; there's no
> need to keep vf610.dtsi separate now that this series will go into
> v3.12 or later, and that file is part of v3.11-rc1.
> ---
>  arch/arm/boot/dts/spear1310.dtsi | 1 -
>  arch/arm/boot/dts/spear1340.dtsi | 1 -
>  arch/arm/boot/dts/spear310.dtsi  | 1 -
>  arch/arm/boot/dts/spear320.dtsi  | 2 --
>  arch/arm/boot/dts/vf610.dtsi     | 1 -
>  5 files changed, 6 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/spear1310.dtsi
> b/arch/arm/boot/dts/spear1310.dtsi index 122ae94..90e99b5 100644
> --- a/arch/arm/boot/dts/spear1310.dtsi
> +++ b/arch/arm/boot/dts/spear1310.dtsi
> @@ -89,7 +89,6 @@
>  		pinmux: pinmux at e0700000 {
>  			compatible = "st,spear1310-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		apb {
> diff --git a/arch/arm/boot/dts/spear1340.dtsi
> b/arch/arm/boot/dts/spear1340.dtsi index 54d128d..5003013 100644
> --- a/arch/arm/boot/dts/spear1340.dtsi
> +++ b/arch/arm/boot/dts/spear1340.dtsi
> @@ -63,7 +63,6 @@
>  		pinmux: pinmux at e0700000 {
>  			compatible = "st,spear1340-pinmux";
>  			reg = <0xe0700000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		pwm: pwm at e0180000 {
> diff --git a/arch/arm/boot/dts/spear310.dtsi
> b/arch/arm/boot/dts/spear310.dtsi index 9537208..1e1318e 100644
> --- a/arch/arm/boot/dts/spear310.dtsi
> +++ b/arch/arm/boot/dts/spear310.dtsi
> @@ -25,7 +25,6 @@
>  		pinmux: pinmux at b4000000 {
>  			compatible = "st,spear310-pinmux";
>  			reg = <0xb4000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		fsmc: flash at 44000000 {
> diff --git a/arch/arm/boot/dts/spear320.dtsi
> b/arch/arm/boot/dts/spear320.dtsi index ffea342..f630d0c 100644
> --- a/arch/arm/boot/dts/spear320.dtsi
> +++ b/arch/arm/boot/dts/spear320.dtsi
> @@ -1,4 +1,3 @@
> -/*
>   * DTS file for SPEAr320 SoC
>   *
>   * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
> @@ -24,7 +23,6 @@
>  		pinmux: pinmux at b3000000 {
>  			compatible = "st,spear320-pinmux";
>  			reg = <0xb3000000 0x1000>;
> -			#gpio-range-cells = <3>;
>  		};
> 
>  		clcd at 90000000 {
> diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
> index e1eb7da..8577780 100644
> --- a/arch/arm/boot/dts/vf610.dtsi
> +++ b/arch/arm/boot/dts/vf610.dtsi
> @@ -162,7 +162,6 @@
>  			iomuxc: iomuxc at 40048000 {
>  				compatible = "fsl,vf610-iomuxc";
>  				reg = <0x40048000 0x1000>;
> -				#gpio-range-cells = <3>;
> 
>  				/* functions and groups pins */
-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH V2 1/5] gpio: clean up gpio-ranges documentation
  2013-07-15 18:40 ` Stephen Warren
@ 2013-07-22 22:31   ` Linus Walleij
  -1 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2013-07-22 22:31 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Stephen Warren, linux-gpio, devicetree-discuss, Rob Herring,
	Shiraz Hashim, Haojian Zhuang, Jingchang Lu, Shawn Guo,
	linux-arm-kernel

On Mon, Jul 15, 2013 at 8:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:

> This change makes documentation of the the gpio-ranges property shorter
> and more succinct, more consistent with the style of the rest of the
> document, and not mention Linux-specifics such as the API
> pinctrl_request_gpio(); DT binding documents should be OS independant
> where at all possible.

This is all good.

> This change also removes any mention of the #gpio-range-cells property.
> Such properties are useful when one node references a second node, and
> that second node dictates the format of the reference. However, that is
> not the case here; the definition of gpio-ranges itself always dictates
> its format entirely, and hence the value #gpio-range-cells must always
> be 3, and hence there is no point requiring any referenced node to
> include this property.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Can this mention the newly introduced Backus-Naur Form
description of the ranges.

> ---
> Patches 2-6 need to be applied in the same branch, since they all build
> upon each-other.
> ---

Still waiting for the OF maintainers to ACK so can't apply this. :-(

> +It is useful to represent which GPIOs correspond to which pins on which pin
> +controllers. The gpio-ranges property described below represents this, and
> +contains information strucutres as follows:

speling of strucutres

Should you mention that this is given in BNF?
Or is that implicit for all bindings?

>
> -This makes it logical to let gpio drivers announce their pin ranges to
> -the pin ctrl subsystem and call 'pinctrl_request_gpio' in order to
> -request the corresponding pin before any gpio usage.
> +       gpio-range-list ::= <single-gpio-range> [gpio-range-list]
> +       single-gpio-range ::=
> +                       <pinctrl-phandle> <gpio-base> <pinctrl-base> <count>
> +       gpio-phandle : phandle to pin controller node.
> +       gpio-base : Base GPIO ID in the GPIO controller
> +       pinctrl-base : Base pinctrl pin ID in the pin controller
> +       count : The number of GPIOs/pins in this range

Yours,
Linus Walleij

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

* [PATCH V2 1/5] gpio: clean up gpio-ranges documentation
@ 2013-07-22 22:31   ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2013-07-22 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 15, 2013 at 8:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:

> This change makes documentation of the the gpio-ranges property shorter
> and more succinct, more consistent with the style of the rest of the
> document, and not mention Linux-specifics such as the API
> pinctrl_request_gpio(); DT binding documents should be OS independant
> where at all possible.

This is all good.

> This change also removes any mention of the #gpio-range-cells property.
> Such properties are useful when one node references a second node, and
> that second node dictates the format of the reference. However, that is
> not the case here; the definition of gpio-ranges itself always dictates
> its format entirely, and hence the value #gpio-range-cells must always
> be 3, and hence there is no point requiring any referenced node to
> include this property.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Can this mention the newly introduced Backus-Naur Form
description of the ranges.

> ---
> Patches 2-6 need to be applied in the same branch, since they all build
> upon each-other.
> ---

Still waiting for the OF maintainers to ACK so can't apply this. :-(

> +It is useful to represent which GPIOs correspond to which pins on which pin
> +controllers. The gpio-ranges property described below represents this, and
> +contains information strucutres as follows:

speling of strucutres

Should you mention that this is given in BNF?
Or is that implicit for all bindings?

>
> -This makes it logical to let gpio drivers announce their pin ranges to
> -the pin ctrl subsystem and call 'pinctrl_request_gpio' in order to
> -request the corresponding pin before any gpio usage.
> +       gpio-range-list ::= <single-gpio-range> [gpio-range-list]
> +       single-gpio-range ::=
> +                       <pinctrl-phandle> <gpio-base> <pinctrl-base> <count>
> +       gpio-phandle : phandle to pin controller node.
> +       gpio-base : Base GPIO ID in the GPIO controller
> +       pinctrl-base : Base pinctrl pin ID in the pin controller
> +       count : The number of GPIOs/pins in this range

Yours,
Linus Walleij

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

* Re: [PATCH V2 1/5] gpio: clean up gpio-ranges documentation
  2013-07-22 22:31   ` Linus Walleij
@ 2013-07-23 16:14     ` Stephen Warren
  -1 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-23 16:14 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Stephen Warren, linux-gpio, devicetree-discuss, Rob Herring,
	Shiraz Hashim, Haojian Zhuang, Jingchang Lu, Shawn Guo,
	linux-arm-kernel

On 07/22/2013 03:31 PM, Linus Walleij wrote:
> On Mon, Jul 15, 2013 at 8:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> 
>> This change makes documentation of the the gpio-ranges property shorter
>> and more succinct, more consistent with the style of the rest of the
>> document, and not mention Linux-specifics such as the API
>> pinctrl_request_gpio(); DT binding documents should be OS independant
>> where at all possible.
>>
>> This change also removes any mention of the #gpio-range-cells property.
>> Such properties are useful when one node references a second node, and
>> that second node dictates the format of the reference. However, that is
>> not the case here; the definition of gpio-ranges itself always dictates
>> its format entirely, and hence the value #gpio-range-cells must always
>> be 3, and hence there is no point requiring any referenced node to
>> include this property.

>> +It is useful to represent which GPIOs correspond to which pins on which pin
>> +controllers. The gpio-ranges property described below represents this, and
>> +contains information strucutres as follows:
> 
> speling of strucutres
> 
> Should you mention that this is given in BNF?
> Or is that implicit for all bindings?

The rest of the document already has a couple of other sections written
that way, so explicitly mentioning BNF seems like a logically unrelated
patch to fix a separate issue in the document. I didn't actually check
whether the syntax used here is strictly BNF either:-) Either way
though, I think it's easy enough to read the BNF without having to
explicitly know it's BNF or anything in-particular, so I'd err on the
side of not bothering to mention that myself...

I'll fix the other issues you mentioned locally, and wait for an ack for
drivers/of before reposting.

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

* [PATCH V2 1/5] gpio: clean up gpio-ranges documentation
@ 2013-07-23 16:14     ` Stephen Warren
  0 siblings, 0 replies; 30+ messages in thread
From: Stephen Warren @ 2013-07-23 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/22/2013 03:31 PM, Linus Walleij wrote:
> On Mon, Jul 15, 2013 at 8:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> 
>> This change makes documentation of the the gpio-ranges property shorter
>> and more succinct, more consistent with the style of the rest of the
>> document, and not mention Linux-specifics such as the API
>> pinctrl_request_gpio(); DT binding documents should be OS independant
>> where at all possible.
>>
>> This change also removes any mention of the #gpio-range-cells property.
>> Such properties are useful when one node references a second node, and
>> that second node dictates the format of the reference. However, that is
>> not the case here; the definition of gpio-ranges itself always dictates
>> its format entirely, and hence the value #gpio-range-cells must always
>> be 3, and hence there is no point requiring any referenced node to
>> include this property.

>> +It is useful to represent which GPIOs correspond to which pins on which pin
>> +controllers. The gpio-ranges property described below represents this, and
>> +contains information strucutres as follows:
> 
> speling of strucutres
> 
> Should you mention that this is given in BNF?
> Or is that implicit for all bindings?

The rest of the document already has a couple of other sections written
that way, so explicitly mentioning BNF seems like a logically unrelated
patch to fix a separate issue in the document. I didn't actually check
whether the syntax used here is strictly BNF either:-) Either way
though, I think it's easy enough to read the BNF without having to
explicitly know it's BNF or anything in-particular, so I'd err on the
side of not bothering to mention that myself...

I'll fix the other issues you mentioned locally, and wait for an ack for
drivers/of before reposting.

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

end of thread, other threads:[~2013-07-23 16:14 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15 18:40 [PATCH V2 1/5] gpio: clean up gpio-ranges documentation Stephen Warren
2013-07-15 18:40 ` Stephen Warren
     [not found] ` <1373913629-32179-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-07-15 18:40   ` [PATCH V2 2/5] of: move documentation of of_parse_phandle_with_args Stephen Warren
2013-07-15 18:40     ` Stephen Warren
2013-07-15 18:40   ` [PATCH V2 3/5] of: introduce of_parse_phandle_with_fixed_args Stephen Warren
2013-07-15 18:40     ` Stephen Warren
2013-07-15 18:59     ` Sergei Shtylyov
2013-07-15 18:59       ` Sergei Shtylyov
     [not found]       ` <51E44688.3050805-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2013-07-15 23:06         ` Stephen Warren
2013-07-15 23:06           ` Stephen Warren
2013-07-15 18:40   ` [PATCH V2 5/5] ARM: remove #gpio-ranges-cells property Stephen Warren
2013-07-15 18:40     ` Stephen Warren
     [not found]     ` <1373913629-32179-5-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-07-15 19:34       ` Rob Herring
2013-07-15 19:34         ` Rob Herring
     [not found]         ` <51E44ED9.9020807-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-15 23:02           ` Stephen Warren
2013-07-15 23:02             ` Stephen Warren
     [not found]             ` <51E47F85.4050905-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-07-16 23:30               ` Stephen Warren
2013-07-16 23:30                 ` Stephen Warren
     [not found]                 ` <51E5D78F.8060400-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-07-17  1:50                   ` Rob Herring
2013-07-17  1:50                     ` Rob Herring
     [not found]                     ` <CAL_JsqJ7CYUieGbvAZtQDEYsUKdM3yYBHSu871jUqOLeASc08g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-17  2:58                       ` Stephen Warren
2013-07-17  2:58                         ` Stephen Warren
2013-07-18  1:35       ` Laurent Pinchart
2013-07-18  1:35         ` Laurent Pinchart
2013-07-15 18:40 ` [PATCH V2 4/5] gpio: implement gpio-ranges binding document fix Stephen Warren
2013-07-15 18:40   ` Stephen Warren
2013-07-22 22:31 ` [PATCH V2 1/5] gpio: clean up gpio-ranges documentation Linus Walleij
2013-07-22 22:31   ` Linus Walleij
2013-07-23 16:14   ` Stephen Warren
2013-07-23 16:14     ` Stephen Warren

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.