summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0020-Add-BMC-running-indicator-LED-control.patch
blob: a30f7a7b85b69be25b7491b74ed7afc196cd8b56 (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 5029f400e62981278957f62c5f8b4e22c2faecd9 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 e93ef57dabed..565893777ffc 100644
--- a/board/aspeed/ast2600_intel/intel.c
+++ b/board/aspeed/ast2600_intel/intel.c
@@ -192,6 +192,8 @@ static void sgpio_init(void)
 #define GPIO_024		0x024 /* GPIO E/F/G/H Direction */
 #define GPIO_070		0x070 /* GPIO I/J/K/L Value */
 #define GPIO_074		0x074 /* GPIO I/J/K/L 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)
 {
@@ -252,6 +254,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;
@@ -292,6 +308,8 @@ int board_early_init_r(void)
 
 	enable_onboard_tpm();
 
+	bmc_running_indicator(true);
+
 	return 0;
 }
 
-- 
2.7.4