All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board: ast-g4: Enable SGPIO in SCU
@ 2021-04-13 16:12 Willy Tu
  2021-05-26 15:51 ` Willy Tu
  0 siblings, 1 reply; 4+ messages in thread
From: Willy Tu @ 2021-04-13 16:12 UTC (permalink / raw)
  To: openbmc; +Cc: Willy Tu, benjaminfair

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


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

end of thread, other threads:[~2021-05-27  3:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 16:12 [PATCH] board: ast-g4: Enable SGPIO in SCU Willy Tu
2021-05-26 15:51 ` Willy Tu
2021-05-27  2:02   ` Joel Stanley
2021-05-27  3:16     ` Willy Tu

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.