linux/arch/mips
Maciej W. Rozycki 607460d386 MIPS: Malta: Do not byte-swap accesses to the CBUS UART
commit 9a936d6c3d3d6c33ecbadf72dccdb567b5cd3c72 upstream.

Correct big-endian accesses to the CBUS UART, a Malta on-board discrete
TI16C550C part wired directly to the system controller's device bus, and
do not use byte swapping with the 32-bit accesses to the device.

The CBUS is used for devices such as the boot flash memory needed early
on in system bootstrap even before PCI has been initialised.  Therefore
it uses the system controller's device bus, which follows the endianness
set with the CPU, which means no byte-swapping is ever required for data
accesses to CBUS, unlike with PCI.

The CBUS UART uses the UPIO_MEM32 access method, that is the `readl' and
`writel' MMIO accessors, which on the MIPS platform imply byte-swapping
with PCI systems.  Consequently the wrong byte lane is accessed with the
big-endian configuration and the UART is not correctly accessed.

As it happens the UPIO_MEM32BE access method makes use of the `ioread32'
and `iowrite32' MMIO accessors, which still use `readl' and `writel'
respectively, however they byte-swap data passed, effectively cancelling
swapping done with the accessors themselves and making it suitable for
the CBUS UART.

Make the CBUS UART switch between UPIO_MEM32 and UPIO_MEM32BE then,
based on the endianness selected.  With this change in place the device
is correctly recognised with big-endian Malta at boot, along with the
Super I/O devices behind PCI:

Serial: 8250/16550 driver, 5 ports, IRQ sharing enabled
printk: console [ttyS0] disabled
serial8250.0: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
printk: console [ttyS0] enabled
printk: bootconsole [uart8250] disabled
serial8250.0: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
serial8250.0: ttyS2 at MMIO 0x1f000900 (irq = 20, base_baud = 230400) is a 16550A

Fixes: e7c4782f92 ("[MIPS] Put an end to <asm/serial.h>'s long and annyoing existence")
Cc: stable@vger.kernel.org # v2.6.23+
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2106260524430.37803@angie.orcam.me.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-12 13:21:02 +02:00
..
alchemy MIPS: alchemy: xxs1500: add gpio-au1000.h header file 2021-06-03 08:59:16 +02:00
ar7
ath25
ath79
bcm47xx MIPS: BCM47XX: fix kconfig dependency bug for BCM47XX_BCMA 2020-12-30 11:51:07 +01:00
bcm63xx
bmips
boot mips: disable branch profiling in boot/decompress.o 2021-07-20 16:10:53 +02:00
cavium-octeon MIPS: OCTEON: add missing put_device() call in dwc3_octeon_device_init() 2020-08-19 08:16:15 +02:00
cobalt
configs scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2020-07-22 09:32:57 +02:00
crypto
dec MIPS: DEC: Restore bootmem reservation for firmware working memory area 2020-11-05 11:43:30 +01:00
emma
fw
generic MIPS: generic: Update node names to avoid unit addresses 2021-06-30 08:47:44 -04:00
include Revert "MIPS: add PMD table accounting into MIPS'pmd_alloc_one" 2021-07-28 13:30:58 +02:00
jazz
jz4740
kernel MIPS: properly stop .eh_frame generation 2021-03-04 10:26:21 +01:00
kvm KVM: MIPS: Change the definition of kvm type 2020-09-23 12:40:38 +02:00
lantiq MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0 2021-03-04 10:26:20 +01:00
lasat
lib MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER 2021-06-16 11:59:37 +02:00
loongson32
loongson64 MIPS: loongsoon64: Reserve memory below starting pfn to prevent Oops 2021-07-19 08:53:13 +02:00
math-emu
mm MIPS: c-r4k: Fix section mismatch for loongson2_sc_init 2021-03-04 10:26:19 +01:00
mti-malta MIPS: Malta: Do not byte-swap accesses to the CBUS UART 2021-08-12 13:21:02 +02:00
net bpf, mips: Limit to 33 tail calls 2020-01-12 12:21:24 +01:00
netlogic
oprofile
paravirt
pci MIPS: pci-legacy: stop using of_pci_range_to_resource 2021-05-14 09:44:30 +02:00
pic32
pistachio
pmcs-msp71xx
pnx833x
power
ralink MIPS: ralink: export rt_sysc_membase for rt2880_wdt.c 2021-06-03 08:59:16 +02:00
rb532
sgi-ip22
sgi-ip27 MIPS: SGI-IP27: Fix crash, when CPUs are disabled via nr_cpus parameter 2020-01-17 19:48:55 +01:00
sgi-ip32
sibyte
sni MIPS: SNI: Fix spurious interrupts 2020-09-23 12:40:42 +02:00
tools MIPS: tools: Fix resource leak in elf-entry.c 2020-06-22 09:31:08 +02:00
txx9
vdso MIPS: VDSO: Use CLANG_FLAGS instead of filtering out '--target=' 2021-03-07 12:20:41 +01:00
vr41xx
Kbuild
Kbuild.platforms
Kconfig MIPS: SNI: Fix MIPS_L1_CACHE_SHIFT 2020-09-23 12:40:41 +02:00
Kconfig.debug
Makefile mips: Fix non-POSIX regexp 2021-08-12 13:20:57 +02:00
Makefile.postlink MIPS: fix indentation of the 'RELOCS' message 2020-02-11 04:35:16 -08:00