mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: aspeed: Rework strap register write logic for the AST2500
@ 2017-08-23 13:41 Andrew Jeffery
  2017-08-30  1:38 ` Andrew Jeffery
  2017-08-31 11:40 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Jeffery @ 2017-08-23 13:41 UTC (permalink / raw)
  To: linux-gpio; +Cc: Andrew Jeffery, linus.walleij, joel, linux-kernel, Yong Li

Yong Li found that writes to the AST2500 strapping register were not
properly supported by the Aspeed pinctrl core and provided a patch to
rectify the problem. Several revisions of the patch were posted and
ultimately v4 should have been applied, however some unfortunate
liberal application of tags on my part lead to confusion between v3[1]
and v4[2].

Generate the diff between v3 and v4 to apply as a fixup patch.

[1] http://patchwork.ozlabs.org/patch/801662/
[2] http://patchwork.ozlabs.org/patch/802946/

Cc: Yong Li <sdliyong@gmail.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 drivers/pinctrl/aspeed/pinctrl-aspeed.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
index f2d5133f6993..7f13ce8450a3 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
@@ -183,7 +183,6 @@ static int aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
 {
 	int ret;
 	int i;
-	unsigned int rev_id;
 
 	for (i = 0; i < expr->ndescs; i++) {
 		const struct aspeed_sig_desc *desc = &expr->descs[i];
@@ -216,20 +215,27 @@ static int aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
 
 		/* On AST2500, Set bits in SCU7C are cleared from SCU70 */
 		if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1) {
+			unsigned int rev_id;
+
 			ret = regmap_read(maps[ASPEED_IP_SCU],
 				HW_REVISION_ID, &rev_id);
 			if (ret < 0)
 				return ret;
 
-			if (0x04 == ((rev_id >> 24) & 0xff))
-				ret = regmap_write(maps[desc->ip],
-					HW_REVISION_ID, (~val & desc->mask));
-			else
-				ret = regmap_update_bits(maps[desc->ip],
-					desc->reg, desc->mask, val);
-		} else
-			ret = regmap_update_bits(maps[desc->ip], desc->reg,
-				desc->mask, val);
+			if (0x04 == (rev_id >> 24)) {
+				u32 value = ~val & desc->mask;
+
+				if (value) {
+					ret = regmap_write(maps[desc->ip],
+						HW_REVISION_ID, value);
+					if (ret < 0)
+						return ret;
+				}
+			}
+		}
+
+		ret = regmap_update_bits(maps[desc->ip], desc->reg,
+					 desc->mask, val);
 
 		if (ret)
 			return ret;
-- 
2.11.0

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

* Re: [PATCH] pinctrl: aspeed: Rework strap register write logic for the AST2500
  2017-08-23 13:41 [PATCH] pinctrl: aspeed: Rework strap register write logic for the AST2500 Andrew Jeffery
@ 2017-08-30  1:38 ` Andrew Jeffery
  2017-08-31 11:40 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jeffery @ 2017-08-30  1:38 UTC (permalink / raw)
  To: linux-gpio; +Cc: linus.walleij, joel, linux-kernel, Yong Li

[-- Attachment #1: Type: text/plain, Size: 2735 bytes --]

Hi Linus,

On Wed, 2017-08-23 at 23:11 +0930, Andrew Jeffery wrote:
> Yong Li found that writes to the AST2500 strapping register were not
> properly supported by the Aspeed pinctrl core and provided a patch to
> rectify the problem. Several revisions of the patch were posted and
> ultimately v4 should have been applied, however some unfortunate
> liberal application of tags on my part lead to confusion between v3[1]
> and v4[2].
> 
> Generate the diff between v3 and v4 to apply as a fixup patch.
> 
> [1] http://patchwork.ozlabs.org/patch/801662/
> [2] http://patchwork.ozlabs.org/patch/802946/
> 
> > Cc: Yong Li <sdliyong@gmail.com>
> > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

Just wondering if you're going to pick this up? It's a fix for "1865af212dfa
pinctrl: aspeed: Fix ast2500 strap register write logic" in pinctrl/devel and
pinctrl/for-next.

Cheers,

Andrew

> ---
>  drivers/pinctrl/aspeed/pinctrl-aspeed.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> index f2d5133f6993..7f13ce8450a3 100644
> --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> @@ -183,7 +183,6 @@ static int aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
>  {
> >  	int ret;
> >  	int i;
> > -	unsigned int rev_id;
>  
> >  	for (i = 0; i < expr->ndescs; i++) {
> >  		const struct aspeed_sig_desc *desc = &expr->descs[i];
> @@ -216,20 +215,27 @@ static int aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
>  
> >  		/* On AST2500, Set bits in SCU7C are cleared from SCU70 */
> >  		if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1) {
> > +			unsigned int rev_id;
> +
> >  			ret = regmap_read(maps[ASPEED_IP_SCU],
> >  				HW_REVISION_ID, &rev_id);
> >  			if (ret < 0)
> >  				return ret;
>  
> > -			if (0x04 == ((rev_id >> 24) & 0xff))
> > -				ret = regmap_write(maps[desc->ip],
> > -					HW_REVISION_ID, (~val & desc->mask));
> > -			else
> > -				ret = regmap_update_bits(maps[desc->ip],
> > -					desc->reg, desc->mask, val);
> > -		} else
> > -			ret = regmap_update_bits(maps[desc->ip], desc->reg,
> > -				desc->mask, val);
> > +			if (0x04 == (rev_id >> 24)) {
> > +				u32 value = ~val & desc->mask;
> +
> > +				if (value) {
> > +					ret = regmap_write(maps[desc->ip],
> > +						HW_REVISION_ID, value);
> > +					if (ret < 0)
> > +						return ret;
> > +				}
> > +			}
> > +		}
> +
> > +		ret = regmap_update_bits(maps[desc->ip], desc->reg,
> > +					 desc->mask, val);
>  
> >  		if (ret)
> >  			return ret;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH] pinctrl: aspeed: Rework strap register write logic for the AST2500
  2017-08-23 13:41 [PATCH] pinctrl: aspeed: Rework strap register write logic for the AST2500 Andrew Jeffery
  2017-08-30  1:38 ` Andrew Jeffery
@ 2017-08-31 11:40 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-08-31 11:40 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: linux-gpio, Joel Stanley, linux-kernel, Yong Li

On Wed, Aug 23, 2017 at 3:41 PM, Andrew Jeffery <andrew@aj.id.au> wrote:

> Yong Li found that writes to the AST2500 strapping register were not
> properly supported by the Aspeed pinctrl core and provided a patch to
> rectify the problem. Several revisions of the patch were posted and
> ultimately v4 should have been applied, however some unfortunate
> liberal application of tags on my part lead to confusion between v3[1]
> and v4[2].
>
> Generate the diff between v3 and v4 to apply as a fixup patch.
>
> [1] http://patchwork.ozlabs.org/patch/801662/
> [2] http://patchwork.ozlabs.org/patch/802946/
>
> Cc: Yong Li <sdliyong@gmail.com>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

Patch applied.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-08-31 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 13:41 [PATCH] pinctrl: aspeed: Rework strap register write logic for the AST2500 Andrew Jeffery
2017-08-30  1:38 ` Andrew Jeffery
2017-08-31 11:40 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®