Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mips: Add CPS_NS16550_WIDTH config

On some platforms IO-memory might require to use a proper load/store
instructions (like Baikal-T1 IO-memory). To fix the cps-vec UART debug
printout let's add the CONFIG_CPS_NS16550_WIDTH config to determine which
instructions lb/sb, lh/sh or lw/sw are required for MMIO operations.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Serge Semin and committed by
Thomas Bogendoerfer
ad42e0a8 999079c8

+26 -2
+10
arch/mips/Kconfig.debug
··· 148 148 form their addresses. That is, log base 2 of the span between 149 149 adjacent ns16550 registers in the system. 150 150 151 + config MIPS_CPS_NS16550_WIDTH 152 + int "UART Register Width" 153 + default 1 154 + help 155 + ns16550 registers width. UART registers IO access methods will be 156 + selected in accordance with this parameter. By setting it to 1, 2 or 157 + 4 UART registers will be accessed by means of lb/sb, lh/sh or lw/sw 158 + instructions respectively. Any value not from that set activates 159 + lb/sb instructions. 160 + 151 161 endif # MIPS_CPS_NS16550_BOOL
+16 -2
arch/mips/kernel/cps-vec-ns16550.S
··· 14 14 #define UART_TX_OFS (UART_TX << CONFIG_MIPS_CPS_NS16550_SHIFT) 15 15 #define UART_LSR_OFS (UART_LSR << CONFIG_MIPS_CPS_NS16550_SHIFT) 16 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 + 17 31 /** 18 32 * _mips_cps_putc() - write a character to the UART 19 33 * @a0: ASCII character to write 20 34 * @t9: UART base address 21 35 */ 22 36 LEAF(_mips_cps_putc) 23 - 1: lw t0, UART_LSR_OFS(t9) 37 + 1: UART_L t0, UART_LSR_OFS(t9) 24 38 andi t0, t0, UART_LSR_TEMT 25 39 beqz t0, 1b 26 - sb a0, UART_TX_OFS(t9) 40 + UART_S a0, UART_TX_OFS(t9) 27 41 jr ra 28 42 END(_mips_cps_putc) 29 43