All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs
@ 2015-05-25 20:39 Martin Blumenstingl
  2015-05-25 20:39 ` [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper Martin Blumenstingl
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Martin Blumenstingl @ 2015-05-25 20:39 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Grant Likely, John Crispin,
	Martin Blumenstingl

0x3 only masks two bits, but three bits have to be allowed. This fixes
GPHY0 LED2 (which is the highest bit of phy2) on my board.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/gpio/gpio-stp-xway.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 202361e..6d4148f 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -58,7 +58,7 @@
 #define XWAY_STP_ADSL_MASK	0x3
 
 /* 2 groups of 3 bits can be driven by the phys */
-#define XWAY_STP_PHY_MASK	0x3
+#define XWAY_STP_PHY_MASK	0x7
 #define XWAY_STP_PHY1_SHIFT	27
 #define XWAY_STP_PHY2_SHIFT	15
 
-- 
2.4.1


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

* [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper
  2015-05-25 20:39 [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs Martin Blumenstingl
@ 2015-05-25 20:39 ` Martin Blumenstingl
  2015-05-26  6:56   ` John Crispin
  2015-05-26  6:54 ` [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs John Crispin
  2015-06-01 14:44 ` Linus Walleij
  2 siblings, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2015-05-25 20:39 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Grant Likely, John Crispin,
	Martin Blumenstingl

This removes some redundant code but does have any functional impact.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/gpio/gpio-stp-xway.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 6d4148f..81bdbe7 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -200,7 +200,7 @@ static int xway_stp_hw_init(struct xway_stp *chip)
 static int xway_stp_probe(struct platform_device *pdev)
 {
 	struct resource *res;
-	const __be32 *shadow, *groups, *dsl, *phy;
+	u32 shadow, groups, dsl, phy;
 	struct xway_stp *chip;
 	struct clk *clk;
 	int ret = 0;
@@ -223,33 +223,28 @@ static int xway_stp_probe(struct platform_device *pdev)
 	chip->gc.owner = THIS_MODULE;
 
 	/* store the shadow value if one was passed by the devicetree */
-	shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL);
-	if (shadow)
-		chip->shadow = be32_to_cpu(*shadow);
+	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
+		chip->shadow = shadow;
 
 	/* find out which gpio groups should be enabled */
-	groups = of_get_property(pdev->dev.of_node, "lantiq,groups", NULL);
-	if (groups)
-		chip->groups = be32_to_cpu(*groups) & XWAY_STP_GROUP_MASK;
+	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,groups", &groups))
+		chip->groups = groups & XWAY_STP_GROUP_MASK;
 	else
 		chip->groups = XWAY_STP_GROUP0;
 	chip->gc.ngpio = fls(chip->groups) * 8;
 
 	/* find out which gpios are controlled by the dsl core */
-	dsl = of_get_property(pdev->dev.of_node, "lantiq,dsl", NULL);
-	if (dsl)
-		chip->dsl = be32_to_cpu(*dsl) & XWAY_STP_ADSL_MASK;
+	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,dsl", &dsl))
+		chip->dsl = dsl & XWAY_STP_ADSL_MASK;
 
 	/* find out which gpios are controlled by the phys */
 	if (of_machine_is_compatible("lantiq,ar9") ||
 			of_machine_is_compatible("lantiq,gr9") ||
 			of_machine_is_compatible("lantiq,vr9")) {
-		phy = of_get_property(pdev->dev.of_node, "lantiq,phy1", NULL);
-		if (phy)
-			chip->phy1 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
-		phy = of_get_property(pdev->dev.of_node, "lantiq,phy2", NULL);
-		if (phy)
-			chip->phy2 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
+		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy1", &phy))
+			chip->phy1 = phy & XWAY_STP_PHY_MASK;
+		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy2", &phy))
+			chip->phy2 = phy & XWAY_STP_PHY_MASK;
 	}
 
 	/* check which edge trigger we should use, default to a falling edge */
-- 
2.4.1


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

* Re: [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs
  2015-05-25 20:39 [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs Martin Blumenstingl
  2015-05-25 20:39 ` [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper Martin Blumenstingl
@ 2015-05-26  6:54 ` John Crispin
  2015-06-01 14:44 ` Linus Walleij
  2 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2015-05-26  6:54 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Grant Likely



On 25/05/2015 22:39, Martin Blumenstingl wrote:
> 0x3 only masks two bits, but three bits have to be allowed. This fixes
> GPHY0 LED2 (which is the highest bit of phy2) on my board.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Acked-by: John Crispin <blogic@openwrt.org>

> ---
>  drivers/gpio/gpio-stp-xway.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
> index 202361e..6d4148f 100644
> --- a/drivers/gpio/gpio-stp-xway.c
> +++ b/drivers/gpio/gpio-stp-xway.c
> @@ -58,7 +58,7 @@
>  #define XWAY_STP_ADSL_MASK	0x3
>  
>  /* 2 groups of 3 bits can be driven by the phys */
> -#define XWAY_STP_PHY_MASK	0x3
> +#define XWAY_STP_PHY_MASK	0x7
>  #define XWAY_STP_PHY1_SHIFT	27
>  #define XWAY_STP_PHY2_SHIFT	15
>  
> 

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

* Re: [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper
  2015-05-25 20:39 ` [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper Martin Blumenstingl
@ 2015-05-26  6:56   ` John Crispin
  2015-05-26 21:12     ` [PATCHv2 " Martin Blumenstingl
  0 siblings, 1 reply; 7+ messages in thread
From: John Crispin @ 2015-05-26  6:56 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Grant Likely



On 25/05/2015 22:39, Martin Blumenstingl wrote:
> This removes some redundant code but does have any functional impact.

-EPARSE, i assume you mean "... that does not have ..."

please fix the description and resend. the actual patch is fine

	John

> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  drivers/gpio/gpio-stp-xway.c | 27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
> index 6d4148f..81bdbe7 100644
> --- a/drivers/gpio/gpio-stp-xway.c
> +++ b/drivers/gpio/gpio-stp-xway.c
> @@ -200,7 +200,7 @@ static int xway_stp_hw_init(struct xway_stp *chip)
>  static int xway_stp_probe(struct platform_device *pdev)
>  {
>  	struct resource *res;
> -	const __be32 *shadow, *groups, *dsl, *phy;
> +	u32 shadow, groups, dsl, phy;
>  	struct xway_stp *chip;
>  	struct clk *clk;
>  	int ret = 0;
> @@ -223,33 +223,28 @@ static int xway_stp_probe(struct platform_device *pdev)
>  	chip->gc.owner = THIS_MODULE;
>  
>  	/* store the shadow value if one was passed by the devicetree */
> -	shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL);
> -	if (shadow)
> -		chip->shadow = be32_to_cpu(*shadow);
> +	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
> +		chip->shadow = shadow;
>  
>  	/* find out which gpio groups should be enabled */
> -	groups = of_get_property(pdev->dev.of_node, "lantiq,groups", NULL);
> -	if (groups)
> -		chip->groups = be32_to_cpu(*groups) & XWAY_STP_GROUP_MASK;
> +	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,groups", &groups))
> +		chip->groups = groups & XWAY_STP_GROUP_MASK;
>  	else
>  		chip->groups = XWAY_STP_GROUP0;
>  	chip->gc.ngpio = fls(chip->groups) * 8;
>  
>  	/* find out which gpios are controlled by the dsl core */
> -	dsl = of_get_property(pdev->dev.of_node, "lantiq,dsl", NULL);
> -	if (dsl)
> -		chip->dsl = be32_to_cpu(*dsl) & XWAY_STP_ADSL_MASK;
> +	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,dsl", &dsl))
> +		chip->dsl = dsl & XWAY_STP_ADSL_MASK;
>  
>  	/* find out which gpios are controlled by the phys */
>  	if (of_machine_is_compatible("lantiq,ar9") ||
>  			of_machine_is_compatible("lantiq,gr9") ||
>  			of_machine_is_compatible("lantiq,vr9")) {
> -		phy = of_get_property(pdev->dev.of_node, "lantiq,phy1", NULL);
> -		if (phy)
> -			chip->phy1 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
> -		phy = of_get_property(pdev->dev.of_node, "lantiq,phy2", NULL);
> -		if (phy)
> -			chip->phy2 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
> +		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy1", &phy))
> +			chip->phy1 = phy & XWAY_STP_PHY_MASK;
> +		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy2", &phy))
> +			chip->phy2 = phy & XWAY_STP_PHY_MASK;
>  	}
>  
>  	/* check which edge trigger we should use, default to a falling edge */
> 

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

* [PATCHv2 2/2] gpio-stp-xway: Use the of_property_read_u32 helper
  2015-05-26  6:56   ` John Crispin
@ 2015-05-26 21:12     ` Martin Blumenstingl
  2015-06-01 14:59       ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2015-05-26 21:12 UTC (permalink / raw)
  To: linux-gpio
  Cc: John Crispin, Linus Walleij, Alexandre Courbot, Grant Likely,
	Martin Blumenstingl

This removes some redundant code but does not have any functional impact.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
v2: Fixed patch description

 drivers/gpio/gpio-stp-xway.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 6d4148f..81bdbe7 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -200,7 +200,7 @@ static int xway_stp_hw_init(struct xway_stp *chip)
 static int xway_stp_probe(struct platform_device *pdev)
 {
 	struct resource *res;
-	const __be32 *shadow, *groups, *dsl, *phy;
+	u32 shadow, groups, dsl, phy;
 	struct xway_stp *chip;
 	struct clk *clk;
 	int ret = 0;
@@ -223,33 +223,28 @@ static int xway_stp_probe(struct platform_device *pdev)
 	chip->gc.owner = THIS_MODULE;
 
 	/* store the shadow value if one was passed by the devicetree */
-	shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL);
-	if (shadow)
-		chip->shadow = be32_to_cpu(*shadow);
+	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
+		chip->shadow = shadow;
 
 	/* find out which gpio groups should be enabled */
-	groups = of_get_property(pdev->dev.of_node, "lantiq,groups", NULL);
-	if (groups)
-		chip->groups = be32_to_cpu(*groups) & XWAY_STP_GROUP_MASK;
+	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,groups", &groups))
+		chip->groups = groups & XWAY_STP_GROUP_MASK;
 	else
 		chip->groups = XWAY_STP_GROUP0;
 	chip->gc.ngpio = fls(chip->groups) * 8;
 
 	/* find out which gpios are controlled by the dsl core */
-	dsl = of_get_property(pdev->dev.of_node, "lantiq,dsl", NULL);
-	if (dsl)
-		chip->dsl = be32_to_cpu(*dsl) & XWAY_STP_ADSL_MASK;
+	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,dsl", &dsl))
+		chip->dsl = dsl & XWAY_STP_ADSL_MASK;
 
 	/* find out which gpios are controlled by the phys */
 	if (of_machine_is_compatible("lantiq,ar9") ||
 			of_machine_is_compatible("lantiq,gr9") ||
 			of_machine_is_compatible("lantiq,vr9")) {
-		phy = of_get_property(pdev->dev.of_node, "lantiq,phy1", NULL);
-		if (phy)
-			chip->phy1 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
-		phy = of_get_property(pdev->dev.of_node, "lantiq,phy2", NULL);
-		if (phy)
-			chip->phy2 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
+		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy1", &phy))
+			chip->phy1 = phy & XWAY_STP_PHY_MASK;
+		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy2", &phy))
+			chip->phy2 = phy & XWAY_STP_PHY_MASK;
 	}
 
 	/* check which edge trigger we should use, default to a falling edge */
-- 
2.4.1


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

* Re: [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs
  2015-05-25 20:39 [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs Martin Blumenstingl
  2015-05-25 20:39 ` [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper Martin Blumenstingl
  2015-05-26  6:54 ` [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs John Crispin
@ 2015-06-01 14:44 ` Linus Walleij
  2 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2015-06-01 14:44 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-gpio, Alexandre Courbot, Grant Likely, John Crispin

On Mon, May 25, 2015 at 10:39 PM, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:

> 0x3 only masks two bits, but three bits have to be allowed. This fixes
> GPHY0 LED2 (which is the highest bit of phy2) on my board.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Patch applied with John's ACK.

Yours,
Linus Walleij

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

* Re: [PATCHv2 2/2] gpio-stp-xway: Use the of_property_read_u32 helper
  2015-05-26 21:12     ` [PATCHv2 " Martin Blumenstingl
@ 2015-06-01 14:59       ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2015-06-01 14:59 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-gpio, John Crispin, Alexandre Courbot, Grant Likely

On Tue, May 26, 2015 at 11:12 PM, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:

> This removes some redundant code but does not have any functional impact.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> v2: Fixed patch description

This v2 patch applied.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-06-01 14:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-25 20:39 [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs Martin Blumenstingl
2015-05-25 20:39 ` [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper Martin Blumenstingl
2015-05-26  6:56   ` John Crispin
2015-05-26 21:12     ` [PATCHv2 " Martin Blumenstingl
2015-06-01 14:59       ` Linus Walleij
2015-05-26  6:54 ` [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs John Crispin
2015-06-01 14:44 ` Linus Walleij

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.