All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag
@ 2021-06-23 14:20 Eugen Hristev
  2021-06-23 14:20 ` [PATCH 2/2] ARM: dts: at91: fix the GPIO polarity for onewire Eugen Hristev
  2021-07-06 12:18 ` [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag Eugen.Hristev
  0 siblings, 2 replies; 3+ messages in thread
From: Eugen Hristev @ 2021-06-23 14:20 UTC (permalink / raw)
  To: u-boot; +Cc: Eugen Hristev

gpio_request_by_name should be called with proper flags.
The 0 value flag is invalid, and causes bad initialization of the gpio.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/w1/w1-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c
index 3b0ead6f6d..9346f810ce 100644
--- a/drivers/w1/w1-gpio.c
+++ b/drivers/w1/w1-gpio.c
@@ -156,7 +156,7 @@ static int w1_gpio_of_to_plat(struct udevice *dev)
 	struct w1_gpio_pdata *pdata = dev_get_plat(dev);
 	int ret;
 
-	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, 0);
+	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, GPIOD_IS_IN);
 	if (ret < 0)
 		printf("Error claiming GPIO %d\n", ret);
 
-- 
2.25.1


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

* [PATCH 2/2] ARM: dts: at91: fix the GPIO polarity for onewire
  2021-06-23 14:20 [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag Eugen Hristev
@ 2021-06-23 14:20 ` Eugen Hristev
  2021-07-06 12:18 ` [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag Eugen.Hristev
  1 sibling, 0 replies; 3+ messages in thread
From: Eugen Hristev @ 2021-06-23 14:20 UTC (permalink / raw)
  To: u-boot; +Cc: Eugen Hristev

The GPIO polarity for onewire must be GPIO_ACTIVE_HIGH.
On previous versions this used to work as it looks like the right flag values
are being passed since :
https://lists.denx.de/pipermail/u-boot/2020-April/407195.html

And that series broke the old functionality for onewire nodes.
Some boards had the correct value for the polarity, but it wasn't clear
so I replaced it with the right macro for the flag, instead of an empty value.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 arch/arm/dts/at91-sama5d27_som1_ek.dts   | 3 ++-
 arch/arm/dts/at91-sama5d27_wlsom1_ek.dts | 3 ++-
 arch/arm/dts/at91-sama5d2_ptc_ek.dts     | 2 +-
 arch/arm/dts/at91-sama5d2_xplained.dts   | 3 ++-
 arch/arm/dts/at91-sama5d3_xplained.dts   | 2 +-
 arch/arm/dts/at91-sama5d4_xplained.dts   | 2 +-
 arch/arm/dts/sam9x60ek.dts               | 2 +-
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/at91-sama5d27_som1_ek.dts b/arch/arm/dts/at91-sama5d27_som1_ek.dts
index 4cd6db66fe..ee851a1bef 100644
--- a/arch/arm/dts/at91-sama5d27_som1_ek.dts
+++ b/arch/arm/dts/at91-sama5d27_som1_ek.dts
@@ -43,6 +43,7 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "sama5d27_som1.dtsi"
 
 / {
@@ -55,7 +56,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioA 17 0>;
+		gpios = <&pioA 17 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
diff --git a/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts b/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts
index ab23f5c209..f3f6942143 100644
--- a/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts
+++ b/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts
@@ -7,6 +7,7 @@
  * Author: Nicolas Ferre <nicolas.ferre@microcihp.com>
  */
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "sama5d27_wlsom1.dtsi"
 
 / {
@@ -18,7 +19,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioA PIN_PC9 0>;
+		gpios = <&pioA PIN_PC9 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
diff --git a/arch/arm/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/dts/at91-sama5d2_ptc_ek.dts
index 068a117585..cd3711a02a 100644
--- a/arch/arm/dts/at91-sama5d2_ptc_ek.dts
+++ b/arch/arm/dts/at91-sama5d2_ptc_ek.dts
@@ -57,7 +57,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioA PIN_PB31 0>;
+		gpios = <&pioA PIN_PB31 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
diff --git a/arch/arm/dts/at91-sama5d2_xplained.dts b/arch/arm/dts/at91-sama5d2_xplained.dts
index 7f0d1696ba..b733c4d4ce 100644
--- a/arch/arm/dts/at91-sama5d2_xplained.dts
+++ b/arch/arm/dts/at91-sama5d2_xplained.dts
@@ -1,4 +1,5 @@
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "sama5d2.dtsi"
 #include "sama5d2-pinfunc.h"
 
@@ -12,7 +13,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioA PIN_PB0 0>;
+		gpios = <&pioA PIN_PB0 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
diff --git a/arch/arm/dts/at91-sama5d3_xplained.dts b/arch/arm/dts/at91-sama5d3_xplained.dts
index 20fba5f067..fc508002a7 100644
--- a/arch/arm/dts/at91-sama5d3_xplained.dts
+++ b/arch/arm/dts/at91-sama5d3_xplained.dts
@@ -37,7 +37,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioE 23 GPIO_ACTIVE_LOW>;
+		gpios = <&pioE 23 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
diff --git a/arch/arm/dts/at91-sama5d4_xplained.dts b/arch/arm/dts/at91-sama5d4_xplained.dts
index 7da5086865..74959253dc 100644
--- a/arch/arm/dts/at91-sama5d4_xplained.dts
+++ b/arch/arm/dts/at91-sama5d4_xplained.dts
@@ -59,7 +59,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioE 15 GPIO_ACTIVE_LOW>;
+		gpios = <&pioE 15 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
diff --git a/arch/arm/dts/sam9x60ek.dts b/arch/arm/dts/sam9x60ek.dts
index 96914b3ea2..77edd593b4 100644
--- a/arch/arm/dts/sam9x60ek.dts
+++ b/arch/arm/dts/sam9x60ek.dts
@@ -29,7 +29,7 @@
 	};
 
 	onewire_tm: onewire {
-		gpios = <&pioD 14 0>;
+		gpios = <&pioD 14 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_onewire_tm_default>;
 		status = "okay";
-- 
2.25.1


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

* Re: [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag
  2021-06-23 14:20 [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag Eugen Hristev
  2021-06-23 14:20 ` [PATCH 2/2] ARM: dts: at91: fix the GPIO polarity for onewire Eugen Hristev
@ 2021-07-06 12:18 ` Eugen.Hristev
  1 sibling, 0 replies; 3+ messages in thread
From: Eugen.Hristev @ 2021-07-06 12:18 UTC (permalink / raw)
  To: u-boot

On 6/23/21 5:20 PM, Eugen Hristev wrote:
> gpio_request_by_name should be called with proper flags.
> The 0 value flag is invalid, and causes bad initialization of the gpio.
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---
>   drivers/w1/w1-gpio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c
> index 3b0ead6f6d..9346f810ce 100644
> --- a/drivers/w1/w1-gpio.c
> +++ b/drivers/w1/w1-gpio.c
> @@ -156,7 +156,7 @@ static int w1_gpio_of_to_plat(struct udevice *dev)
>   	struct w1_gpio_pdata *pdata = dev_get_plat(dev);
>   	int ret;
>   
> -	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, 0);
> +	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, GPIOD_IS_IN);
>   	if (ret < 0)
>   		printf("Error claiming GPIO %d\n", ret);
>   
> 

Applied both to u-boot-atmel/master

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

end of thread, other threads:[~2021-07-06 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 14:20 [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag Eugen Hristev
2021-06-23 14:20 ` [PATCH 2/2] ARM: dts: at91: fix the GPIO polarity for onewire Eugen Hristev
2021-07-06 12:18 ` [PATCH 1/2] w1: w1-gpio: claim the gpio with correct initial flag Eugen.Hristev

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.