Skip to contentSkip to conversation

AT91 PIO4 push-pull enable

PATCH Applied [email protected] 6 participants 15 messages May 17, 2023 – May 24, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover AT91 PIO4 push-pull enable

From: Ryan Wanner <[email protected]>

This patch set enables push-pull pin configuation for PIO4 IP as well as updating the DT binding.

Removing the integer argument for open-drain allows the driver to process drive configuration from gpiolib as the integer argument is discarded.

Ryan Wanner (3):
pinctrl: at91-pio4: Enable Push-Pull configuration
dt-bindings: pinctrl: at91-pio4: Add push-pull support
ARM: dts: at91: Return to boolean properties

 .../bindings/pinctrl/atmel,at91-pio4-pinctrl.txt  |  3 ++-
 arch/arm/boot/dts/at91-kizbox3-hs.dts             |  2 +-
 arch/arm/boot/dts/at91-kizbox3_common.dtsi        |  2 +-
 drivers/pinctrl/pinctrl-at91-pio4.c               | 15 +++++++++++----
 4 files changed, 15 insertions(+), 7 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/3 pinctrl: at91-pio4: Enable Push-Pull configuration

From: Ryan Wanner <[email protected]>

Enable push-pull configuration. Remove integer value argument from open-drain configuration as it is discarded when pinconf function is called from gpiolib. Add push-pull do debug and get functions.

---
 drivers/pinctrl/pinctrl-at91-pio4.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +11 -4
index 2fe40acb6a3e..3c39d62bbc3c 100644
@@ -762,6 +762,11 @@ static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
 			return -EINVAL;
 		arg = 1;
 		break;
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		if (res & ATMEL_PIO_OPD_MASK)
+			return -EINVAL;
+		arg = 1;
+		break;
 	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 		if (!(res & ATMEL_PIO_SCHMITT_MASK))
 			return -EINVAL;
@@ -827,10 +832,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 			conf &= (~ATMEL_PIO_PUEN_MASK);
 			break;
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
-			if (arg == 0)
-				conf &= (~ATMEL_PIO_OPD_MASK);
-			else
-				conf |= ATMEL_PIO_OPD_MASK;
+			conf |= ATMEL_PIO_OPD_MASK;
+			break;
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
+			conf &= (~ATMEL_PIO_OPD_MASK);
 			break;
 		case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 			if (arg == 0)
@@ -948,6 +953,8 @@ static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
 		seq_printf(s, "%s ", "debounce");
 	if (conf & ATMEL_PIO_OPD_MASK)
 		seq_printf(s, "%s ", "open-drain");
+	if (!(conf & ATMEL_PIO_OPD_MASK))
+		seq_printf(s, "%s ", "push-pull");
 	if (conf & ATMEL_PIO_SCHMITT_MASK)
 		seq_printf(s, "%s ", "schmitt");
 	if (atmel_pioctrl->slew_rate_support && (conf & ATMEL_PIO_SR_MASK))
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/3] pinctrl: at91-pio4: Enable Push-Pull configuration

Quoted 5 lines · On 17.05.2023 14:54, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Enable push-pull configuration. Remove integer value argument from open-drain configuration as it is discarded when pinconf function is called from gpiolib.

AFAICT it is still taken into account when passed tough drive-open-drain DT property but at the moment there are no device trees using this property.

Quoted 39 lines

Add push-pull do debug and get functions.

---
 drivers/pinctrl/pinctrl-at91-pio4.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +9 -4
index 2fe40acb6a3e..3c39d62bbc3c 100644
@@ -762,6 +762,11 @@ static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
 			return -EINVAL;
 		arg = 1;
 		break;
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		if (res & ATMEL_PIO_OPD_MASK)
+			return -EINVAL;
+		arg = 1;
+		break;
 	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 		if (!(res & ATMEL_PIO_SCHMITT_MASK))
 			return -EINVAL;
@@ -827,10 +832,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 			conf &= (~ATMEL_PIO_PUEN_MASK);
 			break;
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
-			if (arg == 0)
-				conf &= (~ATMEL_PIO_OPD_MASK);
-			else
-				conf |= ATMEL_PIO_OPD_MASK;
+			conf |= ATMEL_PIO_OPD_MASK;
+			break;
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
+			conf &= (~ATMEL_PIO_OPD_MASK);
 			break;
 		case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 			if (arg == 0)

drivers/pinctrl/pinctrl-at91-pio4.c static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev, · line 956

Quoted 4 lines
drivers/pinctrl/pinctrl-at91-pio4.c +1 -0
@@ -948,6 +953,8 @@ static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
 		seq_printf(s, "%s ", "debounce");
 	if (conf & ATMEL_PIO_OPD_MASK)
 		seq_printf(s, "%s ", "open-drain");
+	if (!(conf & ATMEL_PIO_OPD_MASK))

else would fit better here.

Quoted 4 lines
drivers/pinctrl/pinctrl-at91-pio4.c +1 -0
+		seq_printf(s, "%s ", "push-pull");
 	if (conf & ATMEL_PIO_SCHMITT_MASK)
 		seq_printf(s, "%s ", "schmitt");
 	if (atmel_pioctrl->slew_rate_support && (conf & ATMEL_PIO_SR_MASK))
#3 lore raw

Re: [PATCH 1/3] pinctrl: at91-pio4: Enable Push-Pull configuration

Quoted 9 lines · On 18.05.2023 08:40, Claudiu Beznea - M18063 wrote:
Quoted 5 lines · On 17.05.2023 14:54, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Enable push-pull configuration. Remove integer value argument from open-drain configuration as it is discarded when pinconf function is called from gpiolib.

AFAICT it is still taken into account when passed tough drive-open-drain DT property but at the moment there are no device trees using this property.

ah, ignore this as I've just saw your question about this here:
https://lore.kernel.org/all/[email protected]/

Quoted 52 lines
Quoted 40 lines

Add push-pull do debug and get functions.

---
 drivers/pinctrl/pinctrl-at91-pio4.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +9 -4
index 2fe40acb6a3e..3c39d62bbc3c 100644
@@ -762,6 +762,11 @@ static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
 			return -EINVAL;
 		arg = 1;
 		break;
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		if (res & ATMEL_PIO_OPD_MASK)
+			return -EINVAL;
+		arg = 1;
+		break;
 	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 		if (!(res & ATMEL_PIO_SCHMITT_MASK))
 			return -EINVAL;
@@ -827,10 +832,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 			conf &= (~ATMEL_PIO_PUEN_MASK);
 			break;
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
-			if (arg == 0)
-				conf &= (~ATMEL_PIO_OPD_MASK);
-			else
-				conf |= ATMEL_PIO_OPD_MASK;
+			conf |= ATMEL_PIO_OPD_MASK;
+			break;
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
+			conf &= (~ATMEL_PIO_OPD_MASK);
 			break;
 		case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 			if (arg == 0)

drivers/pinctrl/pinctrl-at91-pio4.c static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev, · line 956

Quoted 4 lines
drivers/pinctrl/pinctrl-at91-pio4.c +1 -0
@@ -948,6 +953,8 @@ static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
 		seq_printf(s, "%s ", "debounce");
 	if (conf & ATMEL_PIO_OPD_MASK)
 		seq_printf(s, "%s ", "open-drain");
+	if (!(conf & ATMEL_PIO_OPD_MASK))

else would fit better here.

Quoted 4 lines
drivers/pinctrl/pinctrl-at91-pio4.c +1 -0
+		seq_printf(s, "%s ", "push-pull");
 	if (conf & ATMEL_PIO_SCHMITT_MASK)
 		seq_printf(s, "%s ", "schmitt");
 	if (atmel_pioctrl->slew_rate_support && (conf & ATMEL_PIO_SR_MASK))
maintainer Acked-by on v1 1/3
#4 lore raw

Re: [PATCH 1/3] pinctrl: at91-pio4: Enable Push-Pull configuration

In reply to [email protected]
Quoted 7 lines · On 17/05/2023 at 13:54, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Enable push-pull configuration. Remove integer value argument from open-drain configuration as it is discarded when pinconf function is called from gpiolib. Add push-pull do debug and get functions.

Looks good to me:

Thanks,
Nicolas

Quoted 44 lines
---
  drivers/pinctrl/pinctrl-at91-pio4.c | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +11 -4
index 2fe40acb6a3e..3c39d62bbc3c 100644
@@ -762,6 +762,11 @@ static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
  			return -EINVAL;
  		arg = 1;
  		break;
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		if (res & ATMEL_PIO_OPD_MASK)
+			return -EINVAL;
+		arg = 1;
+		break;
  	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  		if (!(res & ATMEL_PIO_SCHMITT_MASK))
  			return -EINVAL;
@@ -827,10 +832,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
  			conf &= (~ATMEL_PIO_PUEN_MASK);
  			break;
  		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
-			if (arg == 0)
-				conf &= (~ATMEL_PIO_OPD_MASK);
-			else
-				conf |= ATMEL_PIO_OPD_MASK;
+			conf |= ATMEL_PIO_OPD_MASK;
+			break;
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
+			conf &= (~ATMEL_PIO_OPD_MASK);
  			break;
  		case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  			if (arg == 0)
@@ -948,6 +953,8 @@ static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
  		seq_printf(s, "%s ", "debounce");
  	if (conf & ATMEL_PIO_OPD_MASK)
  		seq_printf(s, "%s ", "open-drain");
+	if (!(conf & ATMEL_PIO_OPD_MASK))
+		seq_printf(s, "%s ", "push-pull");
  	if (conf & ATMEL_PIO_SCHMITT_MASK)
  		seq_printf(s, "%s ", "schmitt");
  	if (atmel_pioctrl->slew_rate_support && (conf & ATMEL_PIO_SR_MASK))
Signature · 1 line
Nicolas Ferre
#5 lore raw

Re: [PATCH 1/3] pinctrl: at91-pio4: Enable Push-Pull configuration

In reply to [email protected]

Wed, May 17, 2023 at 01:54:04PM +0200, [email protected] kirjoitti:

Quoted 5 lines

From: Ryan Wanner <[email protected]>

Enable push-pull configuration. Remove integer value argument from open-drain configuration as it is discarded when pinconf function is called from gpiolib. Add push-pull do debug and get functions.

Right, thank you for fixing this!
Other comments below.

...

drivers/pinctrl/pinctrl-at91-pio4.c static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, · line 838

Quoted 2 lines
drivers/pinctrl/pinctrl-at91-pio4.c +2 -0
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
+			conf &= (~ATMEL_PIO_OPD_MASK);

Parentheses are redundant.

Quoted 1 line

break;

...

drivers/pinctrl/pinctrl-at91-pio4.c static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev, · line 957

Quoted 4 lines
drivers/pinctrl/pinctrl-at91-pio4.c +2 -0
 	if (conf & ATMEL_PIO_OPD_MASK)
 		seq_printf(s, "%s ", "open-drain");
+	if (!(conf & ATMEL_PIO_OPD_MASK))
+		seq_printf(s, "%s ", "push-pull");

As commented already by others, the else would be better.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

Re: [PATCH 1/3] pinctrl: at91-pio4: Enable Push-Pull configuration

In reply to [email protected]
Quoted 7 lines · On Wed, May 17, 2023 at 1:54 PM <[email protected]> wrote:

From: Ryan Wanner <[email protected]>

Enable push-pull configuration. Remove integer value argument from open-drain configuration as it is discarded when pinconf function is called from gpiolib. Add push-pull do debug and get functions.

I fixed up the two style issues pointed out by Andy and applied. No need to resend.

Yours,
Linus Walleij

#7 lore raw

PATCH 2/3 dt-bindings: pinctrl: at91-pio4: Add push-pull support

In reply to [email protected]

From: Ryan Wanner <[email protected]>

Add generic push-pull support for pio4 driver.

---
 .../devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt +2 -1
index e2b861ce16d8..774c3c269c40 100644
@@ -37,7 +37,8 @@ right representation of the pin.
 Optional properties:
 - GENERIC_PINCONFIG: generic pinconfig options to use:
 	- bias-disable, bias-pull-down, bias-pull-up, drive-open-drain,
-	  input-schmitt-enable, input-debounce, output-low, output-high.
+	 drive-push-pull input-schmitt-enable, input-debounce, output-low,
+	 output-high.
 	- for microchip,sama7g5-pinctrl only:
 		- slew-rate: 0 - disabled, 1 - enabled (default)
 - atmel,drive-strength: 0 or 1 for low drive, 2 for medium drive and 3 for
Signature · 1 line
2.39.2
Acked-by
#9 lore raw

Re: [PATCH 2/3] dt-bindings: pinctrl: at91-pio4: Add push-pull support

Quoted 8 lines · Conor Dooley
Quoted 5 lines · On Wed, May 17, 2023 at 01:54:05PM +0200, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Add generic push-pull support for pio4 driver.

Whoops, incorrect vim macro, should have been:

maintainer Acked-by on v1 2/3
#10 lore raw

Re: [PATCH 2/3] dt-bindings: pinctrl: at91-pio4: Add push-pull support

In reply to [email protected]
Quoted 5 lines · On 17/05/2023 at 13:54, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Add generic push-pull support for pio4 driver.

Quoted 18 lines
---
  .../devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt    | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt +2 -1
index e2b861ce16d8..774c3c269c40 100644
@@ -37,7 +37,8 @@ right representation of the pin.
  Optional properties:
  - GENERIC_PINCONFIG: generic pinconfig options to use:
  	- bias-disable, bias-pull-down, bias-pull-up, drive-open-drain,
-	  input-schmitt-enable, input-debounce, output-low, output-high.
+	 drive-push-pull input-schmitt-enable, input-debounce, output-low,
+	 output-high.
  	- for microchip,sama7g5-pinctrl only:
  		- slew-rate: 0 - disabled, 1 - enabled (default)
  - atmel,drive-strength: 0 or 1 for low drive, 2 for medium drive and 3 for
Signature · 1 line
Nicolas Ferre
#12 lore raw

PATCH 3/3 ARM: dts: at91: Return to boolean properties

In reply to [email protected]

From: Ryan Wanner <[email protected]>

Returning back to commit 0dc23d1a8e17
("arm: dts: at91: Fix boolean properties with values") as pinctrl driver no longer expects an integer value and expects a simple boolean property.

---
 arch/arm/boot/dts/at91-kizbox3-hs.dts      | 2 +-
 arch/arm/boot/dts/at91-kizbox3_common.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91-kizbox3-hs.dts +1 -1
index 7075df6549e9..fec7269088d1 100644
@@ -225,7 +225,7 @@ pinctrl_pio_zbe_rst: gpio_zbe_rst {
 		pinctrl_pio_io_reset: gpio_io_reset {
 			pinmux = <PIN_PB30__GPIO>;
 			bias-disable;
-			drive-open-drain = <1>;
+			drive-open-drain;
 			output-low;
 		};
 		pinctrl_pio_input: gpio_input {
arch/arm/boot/dts/at91-kizbox3_common.dtsi +1 -1
index abe27adfa4d6..465664628419 100644
@@ -211,7 +211,7 @@ pinctrl_flx4_default: flx4_i2c6_default {
 		pinmux = <PIN_PD12__FLEXCOM4_IO0>, //DATA
 		<PIN_PD13__FLEXCOM4_IO1>; //CLK
 		bias-disable;
-		drive-open-drain = <1>;
+		drive-open-drain;
 	};
 
 	pinctrl_pwm0 {
Signature · 1 line
2.39.2
maintainer Acked-by on v1 3/3
#13 lore raw

Re: [PATCH 3/3] ARM: dts: at91: Return to boolean properties

Quoted 7 lines · On 17/05/2023 at 13:54, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Returning back to commit 0dc23d1a8e17
("arm: dts: at91: Fix boolean properties with values") as pinctrl driver no longer expects an integer value and expects a simple boolean property.

Okay:

Thanks for fixing this as well. Best regards,
Nicolas

Quoted 31 lines
---
  arch/arm/boot/dts/at91-kizbox3-hs.dts      | 2 +-
  arch/arm/boot/dts/at91-kizbox3_common.dtsi | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91-kizbox3-hs.dts +1 -1
index 7075df6549e9..fec7269088d1 100644
@@ -225,7 +225,7 @@ pinctrl_pio_zbe_rst: gpio_zbe_rst {
  		pinctrl_pio_io_reset: gpio_io_reset {
  			pinmux = <PIN_PB30__GPIO>;
  			bias-disable;
-			drive-open-drain = <1>;
+			drive-open-drain;
  			output-low;
  		};
  		pinctrl_pio_input: gpio_input {
arch/arm/boot/dts/at91-kizbox3_common.dtsi +1 -1
index abe27adfa4d6..465664628419 100644
@@ -211,7 +211,7 @@ pinctrl_flx4_default: flx4_i2c6_default {
  		pinmux = <PIN_PD12__FLEXCOM4_IO0>, //DATA
  		<PIN_PD13__FLEXCOM4_IO1>; //CLK
  		bias-disable;
-		drive-open-drain = <1>;
+		drive-open-drain;
  	};
 
  	pinctrl_pwm0 {
Signature · 1 line
Nicolas Ferre
#14 lore raw

Re: [PATCH 3/3] ARM: dts: at91: Return to boolean properties

Quoted 11 lines · Nicolas Ferre
Quoted 7 lines · On 17/05/2023 at 13:54, [email protected] wrote:

From: Ryan Wanner <[email protected]>

Returning back to commit 0dc23d1a8e17
("arm: dts: at91: Fix boolean properties with values") as pinctrl driver no longer expects an integer value and expects a simple boolean property.

Okay:

Applied to at91-dt, thanks!

Quoted 37 lines

Thanks for fixing this as well. Best regards,
  Nicolas

Quoted 32 lines

---
  arch/arm/boot/dts/at91-kizbox3-hs.dts      | 2 +- arch/arm/boot/dts/at91-kizbox3_common.dtsi | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91-kizbox3-hs.dts +1 -1
index 7075df6549e9..fec7269088d1 100644
@@ -225,7 +225,7 @@ pinctrl_pio_zbe_rst: gpio_zbe_rst {
           pinctrl_pio_io_reset: gpio_io_reset {
               pinmux = <PIN_PB30__GPIO>;
               bias-disable;
-            drive-open-drain = <1>;
+            drive-open-drain;
               output-low;
           };
           pinctrl_pio_input: gpio_input {
arch/arm/boot/dts/at91-kizbox3_common.dtsi +0 -0
index abe27adfa4d6..465664628419 100644
@@ -211,7 +211,7 @@ pinctrl_flx4_default: flx4_i2c6_default {

          pinmux = <PIN_PD12__FLEXCOM4_IO0>, //DATA <PIN_PD13__FLEXCOM4_IO1>; //CLK bias-disable;
-        drive-open-drain = <1>;
+        drive-open-drain;
      };
        pinctrl_pwm0 {