Skip to contentSkip to conversation

Additional iProc GPIO support

PATCH Superseded Ray Jui 3 participants 12 messages Apr 13, 2016 – Apr 29, 2016

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Ray Jui

author
#0 lore raw

cover Additional iProc GPIO support

Add support to the iProc GPIO driver to allow PINCONF functions to be disabled individually. Also add a new compatible string "brcm,iproc-gpio-only" that allows this driver to be used as a pure GPIO driver without any PINCONF functions enabled

Patch series is developed based on Linux v4.6-rc1 and available at:
https://github.com/Broadcom/cygnus-linux/tree/iproc-gpio-v1

Ray Jui (4):
dt-bindings: Update iProc GPIO bindings
pinctrl: iproc: Allow certain PINCONF functions to be disabled
dt-bindings: Update iProc GPIO bindings
pinctrl: iproc: Allow PINCONF to be disabled completely

 .../bindings/pinctrl/brcm,iproc-gpio.txt           |  12 ++-
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c           | 106 +++++++++++++++++++--
 include/dt-bindings/pinctrl/brcm,iproc-gpio.h      |  52 ++++++++++
 3 files changed, 162 insertions(+), 8 deletions(-)
 create mode 100644 include/dt-bindings/pinctrl/brcm,iproc-gpio.h
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH 1/4 dt-bindings: Update iProc GPIO bindings

Update the iProc GPIO binding document to add a new optional property 'brcm,pinconf-func-off' that allows certain PINCONF parameters to be disabled in certain iProc SoCs where these PINCONF functions are not supported

---
 Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt +5 -0
index e427792..ddaa1b0 100644
@@ -37,6 +37,11 @@ Optional properties:
     3  Pin-control base pin offset.
     4. number of gpio pins which are linearly mapped from pin base.
 
+- brcm,pinconf-func-off:
+    Certain iProc SoCs might have some of the PINCONF functions disabled in
+the chip when the iProc GPIO controller is integrated. This optional property
+allows unsupported PINCONF functions to be disabled
+
 Supported generic PINCONF properties in child nodes:
 
 - pins:
Signature · 1 line
2.1.4
author
#2 lore raw

PATCH 2/4 pinctrl: iproc: Allow certain PINCONF functions to be disabled

In reply to Ray Jui

The iProc GPIO controller is shared among multiple iProc based SoCs. In some of these SoCs, certain PINCONF functions are disabled and registers associated with these functions are reserved. This patch adds support to the iProc GPIO/PINCOF driver to allow these unsupported functions to be disabled through device tree property 'brcm,pinconf-func-off'. Without disabling these unsupported PINCONF functions, user can potentially access these functions through sysfs debug entries; as a result, these reserved registers can be accessed

This patch is developed based on the initial work from Yendapally Reddy Dhananjaya <[email protected]> who attempted to disable drive strength configuration for the iProc based NSP chip. In addition, Pramod Kumar <[email protected]> also contributed to make the support more generic across all currently supported PINCONF functions in the iProc GPIO/PINCONF driver

---
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c      | 91 ++++++++++++++++++++++++++-
 include/dt-bindings/pinctrl/brcm,iproc-gpio.h | 52 +++++++++++++++
 2 files changed, 142 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/pinctrl/brcm,iproc-gpio.h
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +90 -1
index d530ab4..12a8922 100644
@@ -34,6 +34,7 @@
 #include <linux/pinctrl/pinconf.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
+#include <dt-bindings/pinctrl/brcm,iproc-gpio.h>
 #include "../pinctrl-utils.h"
 
 #define IPROC_GPIO_DATA_IN_OFFSET   0x00
@@ -78,6 +79,10 @@
  * @num_banks: number of GPIO banks, each bank supports up to 32 GPIOs
  * @pinmux_is_supported: flag to indicate this GPIO controller contains pins
  * that can be individually muxed to GPIO
+ * @pinconf_disable: contains a list of PINCONF parameters that need to be
+ * disabled
+ * @nr_pinconf_disable: total number of PINCONF parameters that need to be
+ * disabled
  * @pctl: pointer to pinctrl_dev
  * @pctldesc: pinctrl descriptor
  */
@@ -94,6 +99,9 @@ struct iproc_gpio {
 
 	bool pinmux_is_supported;
 
+	enum pin_config_param *pinconf_disable;
+	unsigned nr_pinconf_disable;
+
 	struct pinctrl_dev *pctl;
 	struct pinctrl_desc pctldesc;
 };
@@ -360,6 +368,65 @@ static int iproc_gpio_get(struct gpio_chip *gc, unsigned gpio)
 	return !!(readl(chip->base + offset) & BIT(shift));
 }
 
+/*
+ * Mapping of the iProc PINCONF parameters to the generic pin configuration
+ * parameters
+ */
+static const enum pin_config_param iproc_pinconf_disable_map[] = {
+	[IPROC_PIN_DRIVE_STRENGTH] = PIN_CONFIG_DRIVE_STRENGTH,
+	[IPROC_PIN_BIAS_DISABLE] = PIN_CONFIG_BIAS_DISABLE,
+	[IPROC_PIN_BIAS_PULL_UP] = PIN_CONFIG_BIAS_PULL_UP,
+	[IPROC_PIN_BIAS_PULL_DOWN] = PIN_CONFIG_BIAS_PULL_DOWN,
+};
+
+static bool iproc_pinconf_param_is_disabled(struct iproc_gpio *chip,
+					    enum pin_config_param param)
+{
+	unsigned i;
+
+	if (!chip->nr_pinconf_disable)
+		return false;
+
+	for (i = 0; i < chip->nr_pinconf_disable; i++)
+		if (chip->pinconf_disable[i] == param)
+			return true;
+
+	return false;
+}
+
+static int iproc_pinconf_disable_map_create(struct iproc_gpio *chip,
+					    unsigned long disable_mask)
+{
+	unsigned int map_size = ARRAY_SIZE(iproc_pinconf_disable_map);
+	unsigned int bit, nbits = 0;
+
+	/* figure out total number of PINCONF parameters to disable */
+	for_each_set_bit(bit, &disable_mask, map_size)
+		nbits++;
+
+	if (!nbits)
+		return 0;
+
+	/*
+	 * Allocate an array to store PINCONF parameters that need to be
+	 * disabled
+	 */
+	chip->pinconf_disable = devm_kcalloc(chip->dev, nbits,
+					     sizeof(*chip->pinconf_disable),
+					     GFP_KERNEL);
+	if (!chip->pinconf_disable)
+		return -ENOMEM;
+
+	chip->nr_pinconf_disable = nbits;
+
+	/* now store these parameters */
+	nbits = 0;
+	for_each_set_bit(bit, &disable_mask, map_size)
+		chip->pinconf_disable[nbits++] = iproc_pinconf_disable_map[bit];
+
+	return 0;
+}
+
 static int iproc_get_groups_count(struct pinctrl_dev *pctldev)
 {
 	return 1;
@@ -500,6 +567,9 @@ static int iproc_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin,
 	bool disable, pull_up;
 	int ret;
 
+	if (iproc_pinconf_param_is_disabled(chip, param))
+		return -ENOTSUPP;
+
 	switch (param) {
 	case PIN_CONFIG_BIAS_DISABLE:
 		iproc_gpio_get_pull(chip, gpio, &disable, &pull_up);
@@ -548,6 +618,10 @@ static int iproc_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
 
 	for (i = 0; i < num_configs; i++) {
 		param = pinconf_to_config_param(configs[i]);
+
+		if (iproc_pinconf_param_is_disabled(chip, param))
+			return -ENOTSUPP;
+
 		arg = pinconf_to_config_argument(configs[i]);
 
 		switch (param) {
@@ -651,7 +725,7 @@ static int iproc_gpio_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct iproc_gpio *chip;
 	struct gpio_chip *gc;
-	u32 ngpios;
+	u32 ngpios, pinconf_disable_mask;
 	int irq, ret;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
@@ -713,6 +787,21 @@ static int iproc_gpio_probe(struct platform_device *pdev)
 		goto err_rm_gpiochip;
 	}
 
+	/*
+	 * Optional DT property to disable unsupported pinconf parameters for
+	 * a particular iProc SoC
+	 */
+	ret = of_property_read_u32(dev->of_node, "brcm,pinconf-func-off",
+				   &pinconf_disable_mask);
+	if (!ret) {
+		ret = iproc_pinconf_disable_map_create(chip,
+						       pinconf_disable_mask);
+		if (ret) {
+			dev_err(dev, "unable to create pinconf disable map\n");
+			goto err_unregister_pinconf;
+		}
+	}
+
 	/* optional GPIO interrupt support */
 	irq = platform_get_irq(pdev, 0);
 	if (irq) {
include/dt-bindings/pinctrl/brcm,iproc-gpio.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.1.4
author
#5 lore raw

PATCH 3/4 dt-bindings: Update iProc GPIO bindings

In reply to Ray Jui

Update the iProc GPIO binding document to introduce a new compatible string "brcm,iproc-gpio-only", that allows the generic pinconf function to be disabled completely

---
 Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt +5 -2
index ddaa1b0..75a4370 100644
@@ -3,8 +3,11 @@ Broadcom iProc GPIO/PINCONF Controller
 Required properties:
 
 - compatible:
-    Must be "brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio",
-    "brcm,cygnus-crmu-gpio" or "brcm,iproc-gpio"
+    For Cygnus, it must be brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio", or
+"brcm,cygnus-crmu-gpio"
+    For non-Cygnus iProc SoCs, it must be either "brcm,iproc-gpio-only" (if
+only GPIO is supported) or "brcm,iproc-gpio" (if both generic pinconf and GPIO
+are supported)
 
 - reg:
     Define the base and range of the I/O address space that contains SoC
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#8 lore raw

PATCH 4/4 pinctrl: iproc: Allow PINCONF to be disabled completely

In reply to Ray Jui

In some of the future iProc based SoCs, pinconf is handled by another block and the iProc GPIO controller is solely used as a GPIO controller. This patch adds support of a new compatible string "brcm,iproc-gpio-only", that is introduced to handle this case, where pinconf functions in this driver are completely disabled

---
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 41 ++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 18 deletions(-)
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +23 -18
index 12a8922..bb5cfd9 100644
@@ -716,7 +716,8 @@ static const struct of_device_id iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,cygnus-asiu-gpio" },
 	{ .compatible = "brcm,cygnus-crmu-gpio" },
 	{ .compatible = "brcm,iproc-gpio" },
-	{ }
+	{ .compatible = "brcm,iproc-gpio-only" },
+	{ /* sentinel */ }
 };
 
 static int iproc_gpio_probe(struct platform_device *pdev)
@@ -781,24 +782,28 @@ static int iproc_gpio_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = iproc_gpio_register_pinconf(chip);
-	if (ret) {
-		dev_err(dev, "unable to register pinconf\n");
-		goto err_rm_gpiochip;
-	}
-
-	/*
-	 * Optional DT property to disable unsupported pinconf parameters for
-	 * a particular iProc SoC
-	 */
-	ret = of_property_read_u32(dev->of_node, "brcm,pinconf-func-off",
-				   &pinconf_disable_mask);
-	if (!ret) {
-		ret = iproc_pinconf_disable_map_create(chip,
-						       pinconf_disable_mask);
+	if (!of_device_is_compatible(dev->of_node, "brcm,iproc-gpio-only")) {
+		ret = iproc_gpio_register_pinconf(chip);
 		if (ret) {
-			dev_err(dev, "unable to create pinconf disable map\n");
-			goto err_unregister_pinconf;
+			dev_err(dev, "unable to register pinconf\n");
+			goto err_rm_gpiochip;
+		}
+
+		/*
+		 * Optional DT property to disable unsupported pinconf
+		 * parameters for a particular iProc SoC
+		 */
+		ret = of_property_read_u32(dev->of_node,
+					   "brcm,pinconf-func-off",
+					   &pinconf_disable_mask);
+		if (!ret) {
+			ret = iproc_pinconf_disable_map_create(chip,
+							 pinconf_disable_mask);
+			if (ret) {
+				dev_err(dev,
+					"unable to create pinconf disable map\n");
+				goto err_unregister_pinconf;
+			}
 		}
 	}
 
Signature · 1 line
2.1.4
maintainer
#6 lore raw

Re: [PATCH 3/4] dt-bindings: Update iProc GPIO bindings

In reply to Ray Jui
Quoted 16 lines · Ray Jui

Update the iProc GPIO binding document to introduce a new compatible string "brcm,iproc-gpio-only", that allows the generic pinconf function to be disabled completely

---
 Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt +0 -0
index ddaa1b0..75a4370 100644

Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt Broadcom iProc GPIO/PINCONF Controller · line 10

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt +5 -2
@@ -3,8 +3,11 @@ Broadcom iProc GPIO/PINCONF Controller
 Required properties:
 
 - compatible:
-    Must be "brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio",
-    "brcm,cygnus-crmu-gpio" or "brcm,iproc-gpio"
+    For Cygnus, it must be brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio", or
+"brcm,cygnus-crmu-gpio"
+    For non-Cygnus iProc SoCs, it must be either "brcm,iproc-gpio-only" (if
+only GPIO is supported) or "brcm,iproc-gpio" (if both generic pinconf and GPIO
+are supported)

No. That's not how compatible strings work. Use SoC specific compatible strings if you need to distinguish this.

Rob

#3 lore raw

Re: [PATCH 2/4] pinctrl: iproc: Allow certain PINCONF functions to be disabled

In reply to Ray Jui
Quoted 4 lines · Ray Jui

The iProc GPIO controller is shared among multiple iProc based SoCs. In some of these SoCs, certain PINCONF functions are disabled and registers associated with these functions are reserved. This patch adds support to the iProc GPIO/PINCOF driver to allow these unsupported functions to be

^PINCONF

Quoted 12 lines

disabled through device tree property 'brcm,pinconf-func-off'. Without disabling these unsupported PINCONF functions, user can potentially access these functions through sysfs debug entries; as a result, these reserved registers can be accessed

This patch is developed based on the initial work from Yendapally Reddy Dhananjaya <[email protected]> who attempted to disable drive strength configuration for the iProc based NSP chip. In addition, Pramod Kumar <[email protected]> also contributed to make the support more generic across all currently supported PINCONF functions in the iProc GPIO/PINCONF driver

Quoted 5 lines

OK I see. Hm I think it is better to use a per-soc compatible string like Rob Herring indicates to determine if we should loose these pin config parameters. Does it seem reasonable to you?

I'm thinking that it is a property of how the hardware was synthesized in that SoC so since it is a different version of the hardware it should have a unique compatible string.

Quoted 7 lines
include/dt-bindings/pinctrl/brcm,iproc-gpio.h new file +7 -0
+/*
+ * Bit position for PINCONF functions to be disabled for a given iProc SoC
+ */
+#define IPROC_PIN_DRIVE_STRENGTH        0
+#define IPROC_PIN_BIAS_DISABLE          1
+#define IPROC_PIN_BIAS_PULL_UP          2
+#define IPROC_PIN_BIAS_PULL_DOWN        3

include/dt-bindings/pinctrl/brcm,iproc-gpio.h line 52

Quoted 10 lines
include/dt-bindings/pinctrl/brcm,iproc-gpio.h new file +10 -0
+
+/*
+ * Bit mask for DT property "brcm,pinconf-func-off"
+ */
+#define IPROC_PIN_OFF_DRIVE_STRENGTH    (1 << IPROC_PIN_DRIVE_STRENGTH)
+#define IPROC_PIN_OFF_BIAS_DISABLE      (1 << IPROC_PIN_BIAS_DISABLE)
+#define IPROC_PIN_OFF_BIAS_PULL_UP      (1 << IPROC_PIN_BIAS_PULL_UP)
+#define IPROC_PIN_OFF_BIAS_PULL_DOWN    (1 << IPROC_PIN_BIAS_PULL_DOWN)
+
+#endif

So this stuff should not be in the device tree, the driver should know, from the compatible string, what config options that are unavailable.

Then if someone tries to use that in the DT, they should get an error code -ENOTSUPP, but AFAICT that is what the patch achieves.

Yours,
Linus Walleij

#9 lore raw

Re: [PATCH 4/4] pinctrl: iproc: Allow PINCONF to be disabled completely

In reply to Ray Jui
Quoted 10 lines · Ray Jui

In some of the future iProc based SoCs, pinconf is handled by another block and the iProc GPIO controller is solely used as a GPIO controller. This patch adds support of a new compatible string "brcm,iproc-gpio-only", that is introduced to handle this case, where pinconf functions in this driver are completely disabled

If this was entirely true, then the driver should end up only executing [devm_]gpiochip_add_data() but that does not seem to be the case.

You are still registering a pin controller, right? Just disabling some of the pin config options. The pin multiplexing is still there, right? Then it is not "solely a GPIO controller". Not at all.

This patch set needs some elaboration I think.

Yours,
Linus Walleij

author
#7 lore raw

Re: [PATCH 3/4] dt-bindings: Update iProc GPIO bindings

In reply to Rob Herring
Quoted 31 lines · Rob Herring
Quoted 16 lines · Ray Jui

Update the iProc GPIO binding document to introduce a new compatible string "brcm,iproc-gpio-only", that allows the generic pinconf function to be disabled completely

---
 Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt +0 -0
index ddaa1b0..75a4370 100644

Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt Broadcom iProc GPIO/PINCONF Controller · line 10

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt +5 -2
@@ -3,8 +3,11 @@ Broadcom iProc GPIO/PINCONF Controller
 Required properties:
 
 - compatible:
-    Must be "brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio",
-    "brcm,cygnus-crmu-gpio" or "brcm,iproc-gpio"
+    For Cygnus, it must be brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio", or
+"brcm,cygnus-crmu-gpio"
+    For non-Cygnus iProc SoCs, it must be either "brcm,iproc-gpio-only" (if
+only GPIO is supported) or "brcm,iproc-gpio" (if both generic pinconf and GPIO
+are supported)

No. That's not how compatible strings work. Use SoC specific compatible strings if you need to distinguish this.

Quoted 2 lines

Rob

Okay. Let me reply this to the email from Linus so we can consolidate all related discussions.

Thanks,

Ray

author
#4 lore raw

Re: [PATCH 2/4] pinctrl: iproc: Allow certain PINCONF functions to be disabled

In reply to Linus Walleij

Hi Linus/Rob,

Quoted 9 lines · Linus Walleij
Quoted 4 lines · Ray Jui

The iProc GPIO controller is shared among multiple iProc based SoCs. In some of these SoCs, certain PINCONF functions are disabled and registers associated with these functions are reserved. This patch adds support to the iProc GPIO/PINCOF driver to allow these unsupported functions to be

^PINCONF

Will fix this. Thanks.

Quoted 18 lines
Quoted 12 lines

disabled through device tree property 'brcm,pinconf-func-off'. Without disabling these unsupported PINCONF functions, user can potentially access these functions through sysfs debug entries; as a result, these reserved registers can be accessed

This patch is developed based on the initial work from Yendapally Reddy Dhananjaya <[email protected]> who attempted to disable drive strength configuration for the iProc based NSP chip. In addition, Pramod Kumar <[email protected]> also contributed to make the support more generic across all currently supported PINCONF functions in the iProc GPIO/PINCONF driver

Quoted 5 lines
Quoted 8 lines

OK I see. Hm I think it is better to use a per-soc compatible string like Rob Herring indicates to determine if we should loose these pin config parameters. Does it seem reasonable to you?

I'm thinking that it is a property of how the hardware was synthesized in that SoC so since it is a different version of the hardware it should have a unique compatible string.

We use the same iProc GPIO controller in various iProc SoCs. Like you said, the same iProc GPIO controller is then synthesized slightly differently in these SoCs:

In NSP, for example, the iProc GPIO controller supports multiple PINCONF functions except drive strength.

In an upcoming iProc chip, the iProc GPIO controller only supports GPIO related operations and all PINCONF related operations are supported by a different HW block.

The use of compatible strings "brcm,iproc-gpio-only" and "brcm,iproc-gpio" models the existing pinctrl-single driver:

Required properties:
- compatible : "pinctrl-single" or "pinconf-single". "pinctrl-single" means that pinconf isn't supported. "pinconf-single" means that generic pinconf is supported.

Note compatible string "brcm,iproc-gpio" was already accepted and merged upstream. I believe the current debate is that you do not think a compatible string of "brcm,iproc-gpio-only" should be introduced to deal with an iProc SoC whose GPIO controller is only used as GPIO controller without PINCONF functions, correct?

If so, may I suggest the following:

1. keep "brcm,iproc-gpio" for full featured iProc GPIO and PINCONF controller
2. Introduce "brcm,iproc-gpio-v2" for NSP, where GPIO and PINCONF functions are supported but drive strength specific PINCONF feature is disabled
3. Introduce "brcm,iproc-gpio-v3" for upcoming iProc SoCs that move the PINCONF support out of this GPIO controller to a completely separate HW block

It's my understanding that the naming of a compatible string is best tight to the name of the underlying HW block that it is dealing with, instead of the name of a SoC where the HW block belongs to. I'm uncertain whether this particular case falls into the same category, where the same GPIO controller is used but synthesized differently across different SoCs.

Please let me know if the above proposed naming is acceptable?

Quoted 12 lines
Quoted 12 lines
include/dt-bindings/pinctrl/brcm,iproc-gpio.h new file +12 -0
+/*
+ * Bit position for PINCONF functions to be disabled for a given iProc SoC
+ */
+#define IPROC_PIN_DRIVE_STRENGTH        0
+#define IPROC_PIN_BIAS_DISABLE          1
+#define IPROC_PIN_BIAS_PULL_UP          2
+#define IPROC_PIN_BIAS_PULL_DOWN        3
+
+/*
+ * Bit mask for DT property "brcm,pinconf-func-off"
+ */
+#define IPROC_PIN_OFF_DRIVE_STRENGTH    (1 << IPROC_PIN_DRIVE_STRENGTH)
Quoted 8 lines

include/dt-bindings/pinctrl/brcm,iproc-gpio.h line 52

Quoted 5 lines
include/dt-bindings/pinctrl/brcm,iproc-gpio.h new file +5 -0
+#define IPROC_PIN_OFF_BIAS_DISABLE      (1 << IPROC_PIN_BIAS_DISABLE)
+#define IPROC_PIN_OFF_BIAS_PULL_UP      (1 << IPROC_PIN_BIAS_PULL_UP)
+#define IPROC_PIN_OFF_BIAS_PULL_DOWN    (1 << IPROC_PIN_BIAS_PULL_DOWN)
+
+#endif

So this stuff should not be in the device tree, the driver should know, from the compatible string, what config options that are unavailable.

Okay.

Quoted 7 lines

Then if someone tries to use that in the DT, they should get an error code -ENOTSUPP, but AFAICT that is what the patch achieves.

Yours,
Linus Walleij

Thanks,

Ray

author
#10 lore raw

Re: [PATCH 4/4] pinctrl: iproc: Allow PINCONF to be disabled completely

In reply to Linus Walleij

Hi Linus,

Quoted 8 lines · Linus Walleij
Quoted 6 lines · Ray Jui

In some of the future iProc based SoCs, pinconf is handled by another block and the iProc GPIO controller is solely used as a GPIO controller. This patch adds support of a new compatible string "brcm,iproc-gpio-only", that is introduced to handle this case, where pinconf functions in this driver are completely disabled

Quoted 7 lines
Quoted 4 lines

If this was entirely true, then the driver should end up only executing [devm_]gpiochip_add_data() but that does not seem to be the case.

Yes, in the case of compatible string "brcm,iproc-gpio-only" is detected, the driver only registers 'gpiochip_add_data'. Please check patch 2/4 of this series, which takes care of it.

Quoted 4 lines

You are still registering a pin controller, right? Just disabling some of the pin config options. The pin multiplexing is still there, right? Then it is not "solely a GPIO controller". Not at all.

This driver does not register itself as a PINCONF driver if "brcm,iproc-gpio-only" compatible string is detected. This is addressed in patch 2/4 of this series.

Pin based IOMUX GPIO override is only activated when 'chip->pinmux_is_supported' is true, and it is only true if the optional DT property "gpio-ranges" is defined.

Quoted 6 lines

This patch set needs some elaboration I think.

Yours,
Linus Walleij

I believe the current issue with this patch series is now only on the naming of the new compatible string "brcm,iproc-gpio-only". Please correct me if I'm wrong.

Thanks,

Ray

#11 lore raw

Re: [PATCH 4/4] pinctrl: iproc: Allow PINCONF to be disabled completely

Quoted 18 lines · Ray Jui
Quoted 17 lines · Linus Walleij
Quoted 12 lines · Ray Jui

In some of the future iProc based SoCs, pinconf is handled by another block and the iProc GPIO controller is solely used as a GPIO controller. This patch adds support of a new compatible string "brcm,iproc-gpio-only",
that is introduced to handle this case, where pinconf functions in this driver are completely disabled

Reviewed-by Yendapally Reddy Dhananjaya Reddy

<[email protected]>

Quoted 6 lines
Quoted 2 lines

If this was entirely true, then the driver should end up only executing [devm_]gpiochip_add_data() but that does not seem to be the case.

Yes, in the case of compatible string "brcm,iproc-gpio-only" is detected, the driver only registers 'gpiochip_add_data'. Please check patch 2/4 of this series, which takes care of it.

OK.

Quoted 11 lines
Quoted 3 lines

You are still registering a pin controller, right? Just disabling some of the pin config options. The pin multiplexing is still there, right? Then it is not "solely a GPIO controller". Not at all.

This driver does not register itself as a PINCONF driver if "brcm,iproc-gpio-only" compatible string is detected. This is addressed in patch 2/4 of this series.

Pin based IOMUX GPIO override is only activated when 'chip->pinmux_is_supported' is true, and it is only true if the optional DT property "gpio-ranges" is defined.

OK.

Quoted 3 lines

I believe the current issue with this patch series is now only on the naming of the new compatible string "brcm,iproc-gpio-only". Please correct me if I'm wrong.

Yeah I think I get it now. The patch set makes sense. Looking forward to the next iteration!

Yours,
Linus Walleij