| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2010,2011 Google, Inc. |
|---|
| 3 | 4 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. |
|---|
| .. | .. |
|---|
| 10 | 11 | * |
|---|
| 11 | 12 | * Portions based on mach-omap2's debug-macro.S |
|---|
| 12 | 13 | * Copyright (C) 1994-1999 Russell King |
|---|
| 13 | | - * |
|---|
| 14 | | - * This software is licensed under the terms of the GNU General Public |
|---|
| 15 | | - * License version 2, as published by the Free Software Foundation, and |
|---|
| 16 | | - * may be copied, distributed, and modified under those terms. |
|---|
| 17 | | - * |
|---|
| 18 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 19 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 21 | | - * GNU General Public License for more details. |
|---|
| 22 | | - * |
|---|
| 23 | 14 | */ |
|---|
| 24 | 15 | |
|---|
| 25 | 16 | #include <linux/serial_reg.h> |
|---|
| .. | .. |
|---|
| 158 | 149 | |
|---|
| 159 | 150 | .align |
|---|
| 160 | 151 | 99: .word . |
|---|
| 152 | +#if defined(ZIMAGE) |
|---|
| 153 | + .word . + 4 |
|---|
| 154 | +/* |
|---|
| 155 | + * Storage for the state maintained by the macro. |
|---|
| 156 | + * |
|---|
| 157 | + * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c. |
|---|
| 158 | + * That's because this header is included from multiple files, and we only |
|---|
| 159 | + * want a single copy of the data. In particular, the UART probing code above |
|---|
| 160 | + * assumes it's running using physical addresses. This is true when this file |
|---|
| 161 | + * is included from head.o, but not when included from debug.o. So we need |
|---|
| 162 | + * to share the probe results between the two copies, rather than having |
|---|
| 163 | + * to re-run the probing again later. |
|---|
| 164 | + * |
|---|
| 165 | + * In the decompressor, we put the storage right here, since common.c |
|---|
| 166 | + * isn't included in the decompressor build. This storage data gets put in |
|---|
| 167 | + * .text even though it's really data, since .data is discarded from the |
|---|
| 168 | + * decompressor. Luckily, .text is writeable in the decompressor, unless |
|---|
| 169 | + * CONFIG_ZBOOT_ROM. That dependency is handled in arch/arm/Kconfig.debug. |
|---|
| 170 | + */ |
|---|
| 171 | + /* Debug UART initialization required */ |
|---|
| 172 | + .word 1 |
|---|
| 173 | + /* Debug UART physical address */ |
|---|
| 174 | + .word 0 |
|---|
| 175 | + /* Debug UART virtual address */ |
|---|
| 176 | + .word 0 |
|---|
| 177 | +#else |
|---|
| 161 | 178 | .word tegra_uart_config |
|---|
| 179 | +#endif |
|---|
| 162 | 180 | .ltorg |
|---|
| 163 | 181 | |
|---|
| 164 | 182 | /* Load previously selected UART address */ |
|---|
| .. | .. |
|---|
| 173 | 191 | |
|---|
| 174 | 192 | .macro senduart, rd, rx |
|---|
| 175 | 193 | cmp \rx, #0 |
|---|
| 176 | | - strneb \rd, [\rx, #UART_TX << UART_SHIFT] |
|---|
| 194 | + strbne \rd, [\rx, #UART_TX << UART_SHIFT] |
|---|
| 177 | 195 | 1001: |
|---|
| 178 | 196 | .endm |
|---|
| 179 | 197 | |
|---|
| .. | .. |
|---|
| 187 | 205 | 1002: |
|---|
| 188 | 206 | .endm |
|---|
| 189 | 207 | |
|---|
| 190 | | - .macro waituart, rd, rx |
|---|
| 191 | | -#ifdef FLOW_CONTROL |
|---|
| 208 | + .macro waituartcts, rd, rx |
|---|
| 192 | 209 | cmp \rx, #0 |
|---|
| 193 | 210 | beq 1002f |
|---|
| 194 | 211 | 1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT] |
|---|
| 195 | 212 | tst \rd, #UART_MSR_CTS |
|---|
| 196 | 213 | beq 1001b |
|---|
| 197 | 214 | 1002: |
|---|
| 198 | | -#endif |
|---|
| 199 | 215 | .endm |
|---|
| 200 | 216 | |
|---|
| 201 | | -/* |
|---|
| 202 | | - * Storage for the state maintained by the macros above. |
|---|
| 203 | | - * |
|---|
| 204 | | - * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c. |
|---|
| 205 | | - * That's because this header is included from multiple files, and we only |
|---|
| 206 | | - * want a single copy of the data. In particular, the UART probing code above |
|---|
| 207 | | - * assumes it's running using physical addresses. This is true when this file |
|---|
| 208 | | - * is included from head.o, but not when included from debug.o. So we need |
|---|
| 209 | | - * to share the probe results between the two copies, rather than having |
|---|
| 210 | | - * to re-run the probing again later. |
|---|
| 211 | | - * |
|---|
| 212 | | - * In the decompressor, we put the symbol/storage right here, since common.c |
|---|
| 213 | | - * isn't included in the decompressor build. This symbol gets put in .text |
|---|
| 214 | | - * even though it's really data, since .data is discarded from the |
|---|
| 215 | | - * decompressor. Luckily, .text is writeable in the decompressor, unless |
|---|
| 216 | | - * CONFIG_ZBOOT_ROM. That dependency is handled in arch/arm/Kconfig.debug. |
|---|
| 217 | | - */ |
|---|
| 218 | | -#if defined(ZIMAGE) |
|---|
| 219 | | -tegra_uart_config: |
|---|
| 220 | | - /* Debug UART initialization required */ |
|---|
| 221 | | - .word 1 |
|---|
| 222 | | - /* Debug UART physical address */ |
|---|
| 223 | | - .word 0 |
|---|
| 224 | | - /* Debug UART virtual address */ |
|---|
| 225 | | - .word 0 |
|---|
| 226 | | -#endif |
|---|
| 217 | + .macro waituarttxrdy,rd,rx |
|---|
| 218 | + .endm |
|---|