.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2015 Imagination Technologies |
---|
3 | 4 | * Author: Paul Burton <paul.burton@mips.com> |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify it |
---|
6 | | - * under the terms of the GNU General Public License as published by the |
---|
7 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
8 | | - * option) any later version. |
---|
9 | 5 | */ |
---|
10 | 6 | |
---|
11 | 7 | #include <asm/addrspace.h> |
---|
.. | .. |
---|
18 | 14 | #define UART_TX_OFS (UART_TX << CONFIG_MIPS_CPS_NS16550_SHIFT) |
---|
19 | 15 | #define UART_LSR_OFS (UART_LSR << CONFIG_MIPS_CPS_NS16550_SHIFT) |
---|
20 | 16 | |
---|
| 17 | +#if CONFIG_MIPS_CPS_NS16550_WIDTH == 1 |
---|
| 18 | +# define UART_L lb |
---|
| 19 | +# define UART_S sb |
---|
| 20 | +#elif CONFIG_MIPS_CPS_NS16550_WIDTH == 2 |
---|
| 21 | +# define UART_L lh |
---|
| 22 | +# define UART_S sh |
---|
| 23 | +#elif CONFIG_MIPS_CPS_NS16550_WIDTH == 4 |
---|
| 24 | +# define UART_L lw |
---|
| 25 | +# define UART_S sw |
---|
| 26 | +#else |
---|
| 27 | +# define UART_L lb |
---|
| 28 | +# define UART_S sb |
---|
| 29 | +#endif |
---|
| 30 | + |
---|
21 | 31 | /** |
---|
22 | 32 | * _mips_cps_putc() - write a character to the UART |
---|
23 | 33 | * @a0: ASCII character to write |
---|
24 | 34 | * @t9: UART base address |
---|
25 | 35 | */ |
---|
26 | 36 | LEAF(_mips_cps_putc) |
---|
27 | | -1: lw t0, UART_LSR_OFS(t9) |
---|
| 37 | +1: UART_L t0, UART_LSR_OFS(t9) |
---|
28 | 38 | andi t0, t0, UART_LSR_TEMT |
---|
29 | 39 | beqz t0, 1b |
---|
30 | | - sb a0, UART_TX_OFS(t9) |
---|
| 40 | + UART_S a0, UART_TX_OFS(t9) |
---|
31 | 41 | jr ra |
---|
32 | 42 | END(_mips_cps_putc) |
---|
33 | 43 | |
---|