Vijay Khemka | 42a32b7 | 2019-12-01 19:33:29 -0800 | [diff] [blame] | 1 | From c2e01a4cc220b9a1c1a6bb52e5f58bcc8d2edc55 Mon Sep 17 00:00:00 2001 |
| 2 | From: manikandan-e <manikandan.hcl.ers.epl@gmail.com> |
| 3 | Date: Wed, 30 Oct 2019 19:43:51 +0530 |
| 4 | Subject: [PATCH 2/2] board-aspeed-Add-Mux-for-yosemitev2 |
| 5 | |
| 6 | Signed-off-by: manikandan-e <manikandan.hcl.ers.epl@gmail.com> |
| 7 | |
| 8 | --- |
| 9 | arch/arm/mach-aspeed/platform_g5.S | 213 +++++++++++++++++++++++++++++++------ |
| 10 | 1 file changed, 183 insertions(+), 30 deletions(-) |
| 11 | |
| 12 | diff --git a/arch/arm/mach-aspeed/platform_g5.S b/arch/arm/mach-aspeed/platform_g5.S |
| 13 | index 2ac1ca4..c3ce077 100644 |
| 14 | --- a/arch/arm/mach-aspeed/platform_g5.S |
| 15 | +++ b/arch/arm/mach-aspeed/platform_g5.S |
| 16 | @@ -302,6 +302,156 @@ TIME_TABLE_DDR4_1600: |
| 17 | ldr r2, =0x00000800 |
| 18 | .endm |
| 19 | |
| 20 | + .macro console_bmc |
| 21 | + ldr r0, =0x1e780024 |
| 22 | +ldr r1, [r0] |
| 23 | +orr r1, r1, #0xF |
| 24 | +str r1, [r0] |
| 25 | + |
| 26 | +ldr r0, =0x1e780020 |
| 27 | +ldr r1, [r0] |
| 28 | +and r1, r1, #0xFFFFFFF0 |
| 29 | +orr r1, r1, #0xC |
| 30 | +str r1, [r0] |
| 31 | +.endm |
| 32 | + |
| 33 | +.macro console_sel |
| 34 | + |
| 35 | + // Disable SoL UARTs[1-4] |
| 36 | + ldr r0, =0x1e6e2080 |
| 37 | + ldr r1, [r0] |
| 38 | + ldr r2, =0xBFBFFFFF |
| 39 | + and r1, r1, r2 |
| 40 | + str r1, [r0] |
| 41 | + |
| 42 | + ldr r0, =0x1e6e2084 |
| 43 | + ldr r1, [r0] |
| 44 | + and r1, r1, r2 |
| 45 | + str r1, [r0] |
| 46 | + // Enable GPIOE[0-3] Tolerant |
| 47 | + ldr r0, =0x1e78003c |
| 48 | + ldr r1, [r0] |
| 49 | + orr r1, r1, #0xF |
| 50 | + str r1, [r0] |
| 51 | + |
| 52 | + // Read debug card present |
| 53 | + ldr r2, =0x1e780080 |
| 54 | + ldr r0, [r2] |
| 55 | + and r0, r0, #0x00000800 |
| 56 | + ldr r1, =0x0800 |
| 57 | + cmp r0, r1 |
| 58 | + bne dbg_card_pres\@ |
| 59 | + console_bmc |
| 60 | + b case_end\@ |
| 61 | + |
| 62 | +dbg_card_pres\@: |
| 63 | + // Read key position |
| 64 | + ldr r2, =0x1e7801e0 |
| 65 | + ldr r0, [r2] |
| 66 | + bic r1, r0, #0xFF0FFFFF |
| 67 | + mov r0, r1, lsr #20 |
| 68 | + //Test for position#1 |
| 69 | + ldr r1, =0x00 |
| 70 | + cmp r0, r1 |
| 71 | + bne case_pos2\@ |
| 72 | + console_bmc |
| 73 | + b case_end\@ |
| 74 | +case_pos2\@: |
| 75 | + //Test for position#2 |
| 76 | + ldr r1, =0x01 |
| 77 | + cmp r0, r1 |
| 78 | + bne case_pos3\@ |
| 79 | + console_bmc |
| 80 | + b case_end\@ |
| 81 | +case_pos3\@: |
| 82 | + //Test for position#3 |
| 83 | + ldr r1, =0x02 |
| 84 | + cmp r0, r1 |
| 85 | + bne case_pos4\@ |
| 86 | + console_bmc |
| 87 | + b case_end\@ |
| 88 | +case_pos4\@: |
| 89 | +//Test for position#4 |
| 90 | + ldr r1, =0x03 |
| 91 | + cmp r0, r1 |
| 92 | + bne case_pos5\@ |
| 93 | + console_bmc |
| 94 | + b case_end\@ |
| 95 | +case_pos5\@: |
| 96 | + //Test for position#5 |
| 97 | + ldr r1, =0x04 |
| 98 | + cmp r0, r1 |
| 99 | + bne case_pos6\@ |
| 100 | + console_bmc |
| 101 | + b case_end\@ |
| 102 | +case_pos6\@: |
| 103 | + //Test for position#6 |
| 104 | + ldr r1, =0x05 |
| 105 | + cmp r0, r1 |
| 106 | + bne case_pos7\@ |
| 107 | + console_bmc |
| 108 | + b case_end\@ |
| 109 | +case_pos7\@: |
| 110 | + //Test for position#7 |
| 111 | + ldr r1, =0x06 |
| 112 | + cmp r0, r1 |
| 113 | + bne case_pos8\@ |
| 114 | + console_bmc |
| 115 | + b case_end\@ |
| 116 | +case_pos8\@: |
| 117 | + //Test for position#8 |
| 118 | + ldr r1, =0x07 |
| 119 | + cmp r0, r1 |
| 120 | + bne case_pos9\@ |
| 121 | + console_bmc |
| 122 | + b case_end\@ |
| 123 | +case_pos9\@: |
| 124 | + //Test for position#9 |
| 125 | + ldr r1, =0x08 |
| 126 | + cmp r0, r1 |
| 127 | + bne case_pos10\@ |
| 128 | + console_bmc |
| 129 | + b case_end\@ |
| 130 | +case_pos10\@: |
| 131 | + //Test for position#10 |
| 132 | + ldr r1, =0x09 |
| 133 | + cmp r0, r1 |
| 134 | + bne case_end\@ |
| 135 | + console_bmc |
| 136 | + b case_end\@ |
| 137 | +case_end\@: |
| 138 | +.endm |
| 139 | + |
| 140 | + .macro uart_console_setup |
| 141 | + console_sel |
| 142 | + /* setup UART console */ |
| 143 | + ldr r0, =0x1E78400C |
| 144 | + mov r1, #0x83 |
| 145 | + str r1, [r0] |
| 146 | + |
| 147 | + ldr r0, =0x1e6e202c |
| 148 | + ldr r2, [r0] |
| 149 | + mov r2, r2, lsr #12 |
| 150 | + tst r2, #0x01 |
| 151 | + ldr r0, =0x1E784000 |
| 152 | + moveq r1, #0x0D @ Baudrate 115200 |
| 153 | + movne r1, #0x01 @ Baudrate 115200, div13 |
| 154 | + |
| 155 | + str r1, [r0] |
| 156 | + |
| 157 | + ldr r0, =0x1E784004 |
| 158 | + mov r1, #0x00 |
| 159 | + str r1, [r0] |
| 160 | + |
| 161 | + ldr r0, =0x1E78400C |
| 162 | + mov r1, #0x03 |
| 163 | + str r1, [r0] |
| 164 | + |
| 165 | + ldr r0, =0x1E784008 |
| 166 | + mov r1, #0x07 |
| 167 | + str r1, [r0] |
| 168 | + .endm |
| 169 | + |
| 170 | .macro print_hex_char |
| 171 | and r1, r1, #0xF |
| 172 | cmp r1, #9 |
| 173 | @@ -324,6 +474,36 @@ init_dram: |
| 174 | /******************************************** |
| 175 | Initial Reset Procedure : Begin |
| 176 | *******************************************/ |
| 177 | + /* save into SRAM */ |
| 178 | + ldr r0, =0x1e720200 /* vbs.uboot_exec_address */ |
| 179 | + str r4, [r0] |
| 180 | + |
| 181 | + uart_console_setup |
| 182 | + |
| 183 | + /* Debug - UART console message */ |
| 184 | + ldr r0, =0x1E784000 |
| 185 | + mov r1, #0x0D @ '\r' |
| 186 | + str r1, [r0] |
| 187 | + mov r1, #0x0A @ '\n' |
| 188 | + str r1, [r0] |
| 189 | + mov r1, #0x54 @ 'S' |
| 190 | + str r1, [r0] |
| 191 | + mov r1, #0x50 @ 'P' |
| 192 | + str r1, [r0] |
| 193 | + mov r1, #0x4C @ 'L' |
| 194 | + str r1, [r0] |
| 195 | + mov r1, #0x0D @ '\r' |
| 196 | + str r1, [r0] |
| 197 | + mov r1, #0x0A @ '\n' |
| 198 | + str r1, [r0] |
| 199 | + /* End Debug - UART console message */ |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + ldr r0, =0x1E720204 |
| 204 | + mov r1, #0x0 |
| 205 | + str r1, [r0] |
| 206 | + |
| 207 | /* Clear AHB bus lock condition */ |
| 208 | ldr r0, =0x1e600000 |
| 209 | ldr r1, =0xAEED1A03 |
| 210 | @@ -793,7 +973,9 @@ wait_ddr_reset: |
| 211 | clear_delay_timer |
| 212 | /* end delay 10ms */ |
| 213 | |
| 214 | -/* Debug - UART console message */ |
| 215 | + uart_console_setup |
| 216 | + |
| 217 | + /* Debug - UART console message */ |
| 218 | #ifdef CONFIG_DRAM_UART_TO_UART1 |
| 219 | ldr r0, =0x1e78909c @ route UART5 to UART Port1, 2016.08.29 |
| 220 | ldr r1, =0x10000004 |
| 221 | @@ -806,35 +988,6 @@ wait_ddr_reset: |
| 222 | str r1, [r0] |
| 223 | #endif |
| 224 | |
| 225 | - ldr r0, =0x1e78400c |
| 226 | - mov r1, #0x83 |
| 227 | - str r1, [r0] |
| 228 | - |
| 229 | - ldr r0, =0x1e6e202c |
| 230 | - ldr r2, [r0] |
| 231 | - mov r2, r2, lsr #12 |
| 232 | - tst r2, #0x01 |
| 233 | - ldr r0, =0x1e784000 |
| 234 | - moveq r1, #0x0D @ Baudrate 115200 |
| 235 | - movne r1, #0x01 @ Baudrate 115200, div13 |
| 236 | -#ifdef CONFIG_DRAM_UART_38400 |
| 237 | - moveq r1, #0x27 @ Baudrate 38400 |
| 238 | - movne r1, #0x03 @ Baudrate 38400 , div13 |
| 239 | -#endif |
| 240 | - str r1, [r0] |
| 241 | - |
| 242 | - ldr r0, =0x1e784004 |
| 243 | - mov r1, #0x00 |
| 244 | - str r1, [r0] |
| 245 | - |
| 246 | - ldr r0, =0x1e78400c |
| 247 | - mov r1, #0x03 |
| 248 | - str r1, [r0] |
| 249 | - |
| 250 | - ldr r0, =0x1e784008 |
| 251 | - mov r1, #0x07 |
| 252 | - str r1, [r0] |
| 253 | - |
| 254 | ldr r0, =0x1e784000 |
| 255 | mov r1, #0x0D @ '\r' |
| 256 | str r1, [r0] |
| 257 | -- |
| 258 | 2.7.4 |
| 259 | |