summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0020-Add-BMC-running-indicator-LED-control.patch
blob: 768f3adaab8440bf71dad93c9f1f5d0ae1f0123c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From a5e31f9ef7622b001c55f96a98dd18b19976c90c Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Fri, 26 Jun 2020 14:35:47 -0700
Subject: [PATCH] Add BMC running indicator LED control

HBLED cannot be enabled due to a conflict with PWM15 pin and H/W
team is not going to change board layout for supporting HBLED to
keep compatibility between board revisions. Instead, we are going
to use the LED connected to GPIO V5 as BMC running indicator LED.
This commit adds the LED control.

Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
 board/aspeed/ast2600_intel/intel.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c
index 1d650ff959f6..95a90474cbd3 100644
--- a/board/aspeed/ast2600_intel/intel.c
+++ b/board/aspeed/ast2600_intel/intel.c
@@ -194,6 +194,8 @@ static void sgpio_init(void)
 #define GPIO_074		0x074 /* GPIO I/J/K/L Direction */
 #define GPIO_080		0x080 /* GPIO Q/R/S/T Value */
 #define GPIO_084		0x084 /* GPIO Q/R/S/T Direction */
+#define GPIO_088		0x088 /* GPIO U/V/W/X Value */
+#define GPIO_08C		0x08C /* GPIO U/V/W/X Direction */
 
 static void set_gpio_default_state(void)
 {
@@ -270,6 +272,20 @@ void enable_onboard_tpm(void)
 	       AST_GPIO_BASE | GPIO_000);
 }
 
+void bmc_running_indicator(bool on)
+{
+#define GPIO_V5			BIT(13)
+
+	writel(readl(AST_GPIO_BASE | GPIO_08C) | GPIO_V5,
+	       AST_GPIO_BASE | GPIO_08C);
+	if (on)
+		writel(readl(AST_GPIO_BASE | GPIO_088) & ~GPIO_V5,
+		       AST_GPIO_BASE | GPIO_088);
+	else
+		writel(readl(AST_GPIO_BASE | GPIO_088) | GPIO_V5,
+		       AST_GPIO_BASE | GPIO_088);
+}
+
 static void timer_callback(void *cookie)
 {
 	uint timer_nr = (uint)cookie;
@@ -310,6 +326,8 @@ int board_early_init_r(void)
 
 	enable_onboard_tpm();
 
+	bmc_running_indicator(true);
+
 	return 0;
 }
 
-- 
2.17.1