summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed/0001-board-aspeed-Add-Mux-for-yosemitev2.patch
blob: 9f2799f684565cc16e8bf3fb642240ab5ea6940b (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
From f09b84e61569f2b991cc3e257c34517a222922d3 Mon Sep 17 00:00:00 2001
From: Logananth Sundararaj <logananth.s@hcl.com>
Date: Fri, 3 Dec 2021 15:21:50 +0530
Subject: [PATCH] board-aspeed-Add-Mux-for-yosemitev2

Signed-off-by: Logananth Sundararaj <logananth.s@hcl.com>
---
 arch/arm/mach-aspeed/platform_g5.S | 191 ++++++++++++++++++++++++-----
 1 file changed, 162 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-aspeed/platform_g5.S b/arch/arm/mach-aspeed/platform_g5.S
index 2ac1ca4721..e1c17ae4a3 100644
--- a/arch/arm/mach-aspeed/platform_g5.S
+++ b/arch/arm/mach-aspeed/platform_g5.S
@@ -302,6 +302,156 @@ TIME_TABLE_DDR4_1600:
     ldr   r2, =0x00000800
     .endm

+    .macro console_bmc
+    ldr r0, =0x1e780024
+ldr r1, [r0]
+orr r1, r1, #0xF
+str r1, [r0]
+
+ldr r0, =0x1e780020
+ldr r1, [r0]
+and r1, r1, #0xFFFFFFF0
+orr r1, r1, #0xC
+str r1, [r0]
+.endm
+
+.macro console_sel
+
+  // Disable SoL UARTs[1-4]
+  ldr r0, =0x1e6e2080
+  ldr r1, [r0]
+  ldr r2, =0xBFBFFFFF
+  and r1, r1, r2
+  str r1, [r0]
+
+  ldr r0, =0x1e6e2084
+  ldr r1, [r0]
+  and r1, r1, r2
+  str r1, [r0]
+  // Enable GPIOE[0-3] Tolerant
+  ldr r0, =0x1e78003c
+  ldr r1, [r0]
+  orr r1, r1, #0xF
+  str r1, [r0]
+
+  // Read debug card present
+  ldr r2, =0x1e780080
+  ldr r0, [r2]
+  and r0, r0, #0x00000800
+  ldr r1, =0x0800
+  cmp r0, r1
+  bne dbg_card_pres\@
+  console_bmc
+  b case_end\@
+
+dbg_card_pres\@:
+  // Read key position
+  ldr r2, =0x1e7801e0
+  ldr r0, [r2]
+  bic r1, r0, #0xFF0FFFFF
+  mov r0, r1, lsr #20
+  //Test for position#1
+  ldr r1, =0x00
+  cmp r0, r1
+  bne case_pos2\@
+ console_bmc
+  b case_end\@
+case_pos2\@:
+  //Test for position#2
+  ldr r1, =0x01
+  cmp r0, r1
+  bne case_pos3\@
+ console_bmc
+  b case_end\@
+case_pos3\@:
+ //Test for position#3
+  ldr r1, =0x02
+  cmp r0, r1
+  bne case_pos4\@
+  console_bmc
+  b case_end\@
+case_pos4\@:
+//Test for position#4
+  ldr r1, =0x03
+  cmp r0, r1
+  bne case_pos5\@
+  console_bmc
+  b case_end\@
+case_pos5\@:
+  //Test for position#5
+  ldr r1, =0x04
+  cmp r0, r1
+  bne case_pos6\@
+  console_bmc
+  b case_end\@
+case_pos6\@:
+  //Test for position#6
+  ldr r1, =0x05
+  cmp r0, r1
+  bne case_pos7\@
+  console_bmc
+  b case_end\@
+case_pos7\@:
+ //Test for position#7
+   ldr r1, =0x06
+   cmp r0, r1
+   bne case_pos8\@
+   console_bmc
+   b case_end\@
+case_pos8\@:
+  //Test for position#8
+   ldr r1, =0x07
+   cmp r0, r1
+   bne case_pos9\@
+   console_bmc
+   b case_end\@
+case_pos9\@:
+    //Test for position#9
+   ldr r1, =0x08
+   cmp r0, r1
+   bne case_pos10\@
+   console_bmc
+   b case_end\@
+case_pos10\@:
+   //Test for position#10
+   ldr r1, =0x09
+   cmp r0, r1
+   bne case_end\@
+   console_bmc
+   b case_end\@
+case_end\@:
+.endm
+
+    .macro uart_console_setup
+    console_sel
+    /* setup UART console */
+    ldr   r0, =0x1E78400C
+    mov   r1, #0x83
+    str   r1, [r0]
+
+    ldr   r0, =0x1e6e202c
+    ldr   r2, [r0]
+    mov   r2, r2, lsr #12
+    tst   r2, #0x01
+    ldr   r0, =0x1E784000
+    moveq r1, #0x1A                              @ Baudrate 57600
+    movne r1, #0x02                              @ Baudrate 57600, div13
+
+    str   r1, [r0]
+
+    ldr   r0, =0x1E784004
+    mov   r1, #0x00
+    str   r1, [r0]
+
+    ldr   r0, =0x1E78400C
+    mov   r1, #0x03
+    str   r1, [r0]
+
+    ldr   r0, =0x1E784008
+    mov   r1, #0x07
+    str   r1, [r0]
+    .endm
+
     .macro print_hex_char
     and   r1, r1, #0xF
     cmp   r1, #9
@@ -324,6 +474,16 @@ init_dram:
     /********************************************
        Initial Reset Procedure : Begin
      *******************************************/
+    /* save into SRAM */
+    ldr r0, =0x1e720200 /* vbs.uboot_exec_address */
+    str r4, [r0]
+
+    uart_console_setup
+
+    ldr   r0, =0x1E720204
+    mov   r1, #0x0
+    str   r1, [r0]
+
     /* Clear AHB bus lock condition */
     ldr   r0, =0x1e600000
     ldr   r1, =0xAEED1A03
@@ -793,6 +953,8 @@ wait_ddr_reset:
     clear_delay_timer
     /* end delay 10ms */

+    uart_console_setup
+
 /* Debug - UART console message */
 #ifdef CONFIG_DRAM_UART_TO_UART1
     ldr   r0, =0x1e78909c                        @ route UART5 to UART Port1, 2016.08.29
@@ -806,35 +968,6 @@ wait_ddr_reset:
     str   r1, [r0]
 #endif

-    ldr   r0, =0x1e78400c
-    mov   r1, #0x83
-    str   r1, [r0]
-
-    ldr   r0, =0x1e6e202c
-    ldr   r2, [r0]
-    mov   r2, r2, lsr #12
-    tst   r2, #0x01
-    ldr   r0, =0x1e784000
-    moveq r1, #0x0D                              @ Baudrate 115200
-    movne r1, #0x01                              @ Baudrate 115200, div13
-#ifdef CONFIG_DRAM_UART_38400
-    moveq r1, #0x27                              @ Baudrate 38400
-    movne r1, #0x03                              @ Baudrate 38400 , div13
-#endif
-    str   r1, [r0]
-
-    ldr   r0, =0x1e784004
-    mov   r1, #0x00
-    str   r1, [r0]
-
-    ldr   r0, =0x1e78400c
-    mov   r1, #0x03
-    str   r1, [r0]
-
-    ldr   r0, =0x1e784008
-    mov   r1, #0x07
-    str   r1, [r0]
-
     ldr   r0, =0x1e784000
     mov   r1, #0x0D                              @ '\r'
     str   r1, [r0]
--
2.17.1