summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0004-Make-sure-debug-uart-is-using-24MHz-clock-source.patch
blob: c438bdcd448eca2403499869a46406fad15b5d40 (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
63
64
65
66
67
68
69
70
71
72
73
From 9efa565f1bc09b1906328b25a01e041ab5024769 Mon Sep 17 00:00:00 2001
From: Yong Li <yong.b.li@linux.intel.com>
Date: Tue, 11 Sep 2018 16:24:06 +0800
Subject: [PATCH] Make sure debug uart is using 24MHz clock source

u-boot defines the uart5(debug console) as 24MHz,
set the SCU14[28] to 0, to make sure the clock source is 24M

Signed-off-by: Yong Li <yong.b.li@linux.intel.com>

---
 arch/arm/include/asm/arch-aspeed/ast_scu.h  | 2 ++
 arch/arm/include/asm/arch-aspeed/platform.h | 1 +
 arch/arm/mach-aspeed/ast-scu.c              | 6 ++++++
 board/aspeed/ast-g5/ast-g5.c                | 8 ++++++++
 4 files changed, 17 insertions(+)

diff --git a/arch/arm/include/asm/arch-aspeed/ast_scu.h b/arch/arm/include/asm/arch-aspeed/ast_scu.h
index dcbc6730d4..06825cebbf 100644
--- a/arch/arm/include/asm/arch-aspeed/ast_scu.h
+++ b/arch/arm/include/asm/arch-aspeed/ast_scu.h
@@ -46,4 +46,6 @@ extern void ast_scu_init_eth(u8 num);
 extern void ast_scu_multi_func_eth(u8 num);
 extern void ast_scu_multi_func_romcs(u8 num);
 
+void ast_config_uart5_clk(void);
+
 #endif
diff --git a/arch/arm/include/asm/arch-aspeed/platform.h b/arch/arm/include/asm/arch-aspeed/platform.h
index 1c02914fcb..92ea33b89a 100644
--- a/arch/arm/include/asm/arch-aspeed/platform.h
+++ b/arch/arm/include/asm/arch-aspeed/platform.h
@@ -27,6 +27,7 @@
 #include <asm/arch/ast2400_platform.h>
 #elif defined(AST_SOC_G5)
 #include <asm/arch/ast_g5_platform.h>
+#define CONFIG_BOARD_EARLY_INIT_F	1	/* Call board_early_init_f */
 #else
 #err "No define for platform.h"
 #endif
diff --git a/arch/arm/mach-aspeed/ast-scu.c b/arch/arm/mach-aspeed/ast-scu.c
index 12de9b8036..fff02dc000 100644
--- a/arch/arm/mach-aspeed/ast-scu.c
+++ b/arch/arm/mach-aspeed/ast-scu.c
@@ -538,3 +538,9 @@ void ast_scu_get_who_init_dram(void)
 		break;
 	}
 }
+
+void ast_config_uart5_clk(void)
+{
+	ast_scu_write(ast_scu_read(AST_SCU_MISC2_CTRL) &
+				~(1 << 28), AST_SCU_MISC2_CTRL);
+}
diff --git a/board/aspeed/ast-g5/ast-g5.c b/board/aspeed/ast-g5/ast-g5.c
index 12496cea09..45353b8f78 100644
--- a/board/aspeed/ast-g5/ast-g5.c
+++ b/board/aspeed/ast-g5/ast-g5.c
@@ -19,6 +19,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int board_early_init_f(void)
+{
+	/* make sure uart5 is using 24MHz clock */
+	ast_config_uart5_clk();
+
+	return 0;
+}
+
 int board_init(void)
 {
 	bool sdmc_unlocked;