Re: [PATCH v4] pinctrl: aspeed: Fix ast2500 strap register write logic
From: Andrew Jeffery
Date: Thu Aug 17 2017 - 21:36:38 EST
On Fri, 2017-08-18 at 06:53 +0800, Yong Li wrote:
> On AST2500, the hardware strap register(SCU70) only accepts write â1â,
> to clear it to â0â, must set bits(writeÂÂâ1â) to SCU7C
>
> Signed-off-by: Yong Li <sdliyong@xxxxxxxxx>
Take 2 ;)
Reviewed-by: Andrew Jeffery <andrew@xxxxxxxx>
Tested-by: Andrew Jeffery <andrew@xxxxxxxx>
Cheers,
Andrew
> ---
> Âdrivers/pinctrl/aspeed/pinctrl-aspeed.c | 21 +++++++++++++++++++++
> Âdrivers/pinctrl/aspeed/pinctrl-aspeed.h |ÂÂ1 +
> Â2 files changed, 22 insertions(+)
>
> diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> index a86a4d6..7f13ce8 100644
> --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> @@ -213,6 +213,27 @@ static int aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
> > Â if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP2)
> > Â continue;
> Â
> > + /* 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)) {
> > + 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);
> Â
> diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.h b/drivers/pinctrl/aspeed/pinctrl-aspeed.h
> index fa125db..d4d7f03 100644
> --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.h
> +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.h
> @@ -251,6 +251,7 @@
> Â#define SCU3CÂÂÂÂÂÂÂÂÂÂÂ0x3C /* System Reset Control/Status Register */
> Â#define SCU48ÂÂÂÂÂÂÂÂÂÂÂ0x48 /* MAC Interface Clock Delay Setting */
> Â#define HW_STRAP1ÂÂÂÂÂÂÂ0x70 /* AST2400 strapping is 33 bits, is split */
> +#define HW_REVISION_IDÂÂ0x7C /* Silicon revision ID register */
> Â#define SCU80ÂÂÂÂÂÂÂÂÂÂÂ0x80 /* Multi-function Pin Control #1 */
> Â#define SCU84ÂÂÂÂÂÂÂÂÂÂÂ0x84 /* Multi-function Pin Control #2 */
> Â#define SCU88ÂÂÂÂÂÂÂÂÂÂÂ0x88 /* Multi-function Pin Control #3 */Attachment:
signature.asc
Description: This is a digitally signed message part