diff mbox series

board: ast-g4: Enable SGPIO in SCU

Message ID 20210413161238.2816187-1-wltu@google.com
State New
Headers show
Series board: ast-g4: Enable SGPIO in SCU | expand

Commit Message

Willy Tu April 13, 2021, 4:12 p.m. UTC
Add option to enable register for SGPIO in SCU
for ast-g4.

Signed-off-by: Willy Tu <wltu@google.com>
---
 board/aspeed/ast-g4/Kconfig  |  4 ++++
 board/aspeed/ast-g4/ast-g4.c | 13 +++++++++++++
 2 files changed, 17 insertions(+)

--
2.31.1.295.g9ea45b61b8-goog

Comments

Willy Tu May 26, 2021, 3:51 p.m. UTC | #1
ping.

I also missed the branch for this patch, but this should be in
the v2016.07-aspeed-openbmc u-boot branch.

On Tue, Apr 13, 2021 at 9:12 AM Willy Tu <wltu@google.com> wrote:

> Add option to enable register for SGPIO in SCU
> for ast-g4.
>
> Signed-off-by: Willy Tu <wltu@google.com>
> ---
>  board/aspeed/ast-g4/Kconfig  |  4 ++++
>  board/aspeed/ast-g4/ast-g4.c | 13 +++++++++++++
>  2 files changed, 17 insertions(+)
>
> diff --git a/board/aspeed/ast-g4/Kconfig b/board/aspeed/ast-g4/Kconfig
> index 2bec9a733a..e78030ae34 100644
> --- a/board/aspeed/ast-g4/Kconfig
> +++ b/board/aspeed/ast-g4/Kconfig
> @@ -19,4 +19,8 @@ config SYS_CONFIG_NAME
>         default "ast-g4-phy" if ASPEED_NET_PHY
>         default "ast-g4-ncsi" if ASPEED_NET_NCSI
>
> +config ENABLE_SGPIO
> +    tristate "Enable SGPIO in SCU"
> +       default n
> +
>  endif
> diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
> index 656495307b..e2463d4524 100644
> --- a/board/aspeed/ast-g4/ast-g4.c
> +++ b/board/aspeed/ast-g4/ast-g4.c
> @@ -22,6 +22,19 @@ int board_init(void)
>         /* address of boot parameters */
>         gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>         gd->flags = 0;
> +
> +#ifdef CONFIG_ENABLE_SGPIO
> +       /* Unlock SCU */
> +       writel(SCU_PROTECT_UNLOCK, AST_SCU_BASE);
> +
> +       /* Enable SGPIO Master */
> +       u32 reg = readl(AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
> +       reg |= (SCU_FUN_PIN_SGPMI |
> +                       SCU_FUN_PIN_SGPMO |
> +                       SCU_FUN_PIN_SGPMLD |
> +                       SCU_FUN_PIN_SGPMCK);
> +       writel(reg, AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
> +#endif
>         return 0;
>  }
>
> --
> 2.31.1.295.g9ea45b61b8-goog
>
>
Joel Stanley May 27, 2021, 2:02 a.m. UTC | #2
On Wed, 26 May 2021 at 15:51, Willy Tu <wltu@google.com> wrote:
>
> ping.
>
> I also missed the branch for this patch, but this should be in the v2016.07-aspeed-openbmc u-boot branch.
>
> On Tue, Apr 13, 2021 at 9:12 AM Willy Tu <wltu@google.com> wrote:
>>
>> Add option to enable register for SGPIO in SCU
>> for ast-g4.
>>
>> Signed-off-by: Willy Tu <wltu@google.com>

I've applied this, but I strongly encourage you to move to a newer
branch. The 2019.04 branch is based off the latest aspeed SDK which
claims support for the ast2400.

>> ---
>>  board/aspeed/ast-g4/Kconfig  |  4 ++++
>>  board/aspeed/ast-g4/ast-g4.c | 13 +++++++++++++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/board/aspeed/ast-g4/Kconfig b/board/aspeed/ast-g4/Kconfig
>> index 2bec9a733a..e78030ae34 100644
>> --- a/board/aspeed/ast-g4/Kconfig
>> +++ b/board/aspeed/ast-g4/Kconfig
>> @@ -19,4 +19,8 @@ config SYS_CONFIG_NAME
>>         default "ast-g4-phy" if ASPEED_NET_PHY
>>         default "ast-g4-ncsi" if ASPEED_NET_NCSI
>>
>> +config ENABLE_SGPIO
>> +    tristate "Enable SGPIO in SCU"
>> +       default n
>> +
>>  endif
>> diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
>> index 656495307b..e2463d4524 100644
>> --- a/board/aspeed/ast-g4/ast-g4.c
>> +++ b/board/aspeed/ast-g4/ast-g4.c
>> @@ -22,6 +22,19 @@ int board_init(void)
>>         /* address of boot parameters */
>>         gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>>         gd->flags = 0;
>> +
>> +#ifdef CONFIG_ENABLE_SGPIO
>> +       /* Unlock SCU */
>> +       writel(SCU_PROTECT_UNLOCK, AST_SCU_BASE);
>> +
>> +       /* Enable SGPIO Master */
>> +       u32 reg = readl(AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
>> +       reg |= (SCU_FUN_PIN_SGPMI |
>> +                       SCU_FUN_PIN_SGPMO |
>> +                       SCU_FUN_PIN_SGPMLD |
>> +                       SCU_FUN_PIN_SGPMCK);
>> +       writel(reg, AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
>> +#endif
>>         return 0;
>>  }
>>
>> --
>> 2.31.1.295.g9ea45b61b8-goog
>>
Willy Tu May 27, 2021, 3:16 a.m. UTC | #3
Thanks!

We have an old system using this branch and we don't plan on migrating the
u-boot version for it. We don't have any system that is using aspeed other
than this one.

Wily Tu

On Wed, May 26, 2021 at 7:03 PM Joel Stanley <joel@jms.id.au> wrote:

> On Wed, 26 May 2021 at 15:51, Willy Tu <wltu@google.com> wrote:
> >
> > ping.
> >
> > I also missed the branch for this patch, but this should be in the
> v2016.07-aspeed-openbmc u-boot branch.
> >
> > On Tue, Apr 13, 2021 at 9:12 AM Willy Tu <wltu@google.com> wrote:
> >>
> >> Add option to enable register for SGPIO in SCU
> >> for ast-g4.
> >>
> >> Signed-off-by: Willy Tu <wltu@google.com>
>
> I've applied this, but I strongly encourage you to move to a newer
> branch. The 2019.04 branch is based off the latest aspeed SDK which
> claims support for the ast2400.
>
> >> ---
> >>  board/aspeed/ast-g4/Kconfig  |  4 ++++
> >>  board/aspeed/ast-g4/ast-g4.c | 13 +++++++++++++
> >>  2 files changed, 17 insertions(+)
> >>
> >> diff --git a/board/aspeed/ast-g4/Kconfig b/board/aspeed/ast-g4/Kconfig
> >> index 2bec9a733a..e78030ae34 100644
> >> --- a/board/aspeed/ast-g4/Kconfig
> >> +++ b/board/aspeed/ast-g4/Kconfig
> >> @@ -19,4 +19,8 @@ config SYS_CONFIG_NAME
> >>         default "ast-g4-phy" if ASPEED_NET_PHY
> >>         default "ast-g4-ncsi" if ASPEED_NET_NCSI
> >>
> >> +config ENABLE_SGPIO
> >> +    tristate "Enable SGPIO in SCU"
> >> +       default n
> >> +
> >>  endif
> >> diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
> >> index 656495307b..e2463d4524 100644
> >> --- a/board/aspeed/ast-g4/ast-g4.c
> >> +++ b/board/aspeed/ast-g4/ast-g4.c
> >> @@ -22,6 +22,19 @@ int board_init(void)
> >>         /* address of boot parameters */
> >>         gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
> >>         gd->flags = 0;
> >> +
> >> +#ifdef CONFIG_ENABLE_SGPIO
> >> +       /* Unlock SCU */
> >> +       writel(SCU_PROTECT_UNLOCK, AST_SCU_BASE);
> >> +
> >> +       /* Enable SGPIO Master */
> >> +       u32 reg = readl(AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
> >> +       reg |= (SCU_FUN_PIN_SGPMI |
> >> +                       SCU_FUN_PIN_SGPMO |
> >> +                       SCU_FUN_PIN_SGPMLD |
> >> +                       SCU_FUN_PIN_SGPMCK);
> >> +       writel(reg, AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
> >> +#endif
> >>         return 0;
> >>  }
> >>
> >> --
> >> 2.31.1.295.g9ea45b61b8-goog
> >>
>
diff mbox series

Patch

diff --git a/board/aspeed/ast-g4/Kconfig b/board/aspeed/ast-g4/Kconfig
index 2bec9a733a..e78030ae34 100644
--- a/board/aspeed/ast-g4/Kconfig
+++ b/board/aspeed/ast-g4/Kconfig
@@ -19,4 +19,8 @@  config SYS_CONFIG_NAME
 	default "ast-g4-phy" if ASPEED_NET_PHY
 	default "ast-g4-ncsi" if ASPEED_NET_NCSI

+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+	default n
+
 endif
diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
index 656495307b..e2463d4524 100644
--- a/board/aspeed/ast-g4/ast-g4.c
+++ b/board/aspeed/ast-g4/ast-g4.c
@@ -22,6 +22,19 @@  int board_init(void)
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 	gd->flags = 0;
+
+#ifdef CONFIG_ENABLE_SGPIO
+	/* Unlock SCU */
+	writel(SCU_PROTECT_UNLOCK, AST_SCU_BASE);
+
+	/* Enable SGPIO Master */
+	u32 reg = readl(AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
+	reg |= (SCU_FUN_PIN_SGPMI |
+			SCU_FUN_PIN_SGPMO |
+			SCU_FUN_PIN_SGPMLD |
+			SCU_FUN_PIN_SGPMCK);
+	writel(reg, AST_SCU_BASE + AST_SCU_FUN_PIN_CTRL2);
+#endif
 	return 0;
 }