linux-stable/arch/mips
Maciej W. Rozycki 9a936d6c3d MIPS: Malta: Do not byte-swap accesses to the CBUS UART
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-07-21 12:52:14 +02:00
..
alchemy MIPS: alchemy: xxs1500: add gpio-au1000.h header file 2021-05-25 15:16:23 +02:00
ar7 mips: ar7: convert to CONFIG_COMMON_CLK 2021-06-08 17:00:09 +02:00
ath25
ath79 MIPS: of: Introduce helper function to get DTB 2021-02-04 13:34:51 +01:00
bcm47xx
bcm63xx MIPS: BCM63XX: Use BUG_ON instead of condition followed by BUG. 2021-04-26 10:23:52 +02:00
bmips MIPS: bmips: include <linux/dma-direct.h> for phys_to_dma 2021-03-06 08:43:40 +01:00
boot - fix for accesing gic via vdso 2021-07-10 10:36:33 -07:00
cavium-octeon MIPS: OCTEON: octeon-usb: Use devm_platform_get_and_ioremap_resource() 2021-06-21 11:32:47 +02:00
cobalt
configs MIPS: Loongson64: Update loongson3_defconfig 2021-05-27 12:35:42 +02:00
crypto asm-generic: unaligned always use struct helpers 2021-05-10 17:50:47 +02:00
dec
fw
generic MIPS: generic: Update node names to avoid unit addresses 2021-04-12 16:48:35 +02:00
include MIPS: Fix unreachable code issue 2021-07-13 15:08:15 -05:00
ingenic MIPS: Kconfig: ingenic: Ensure MACH_INGENIC_GENERIC selects all SoCs 2021-06-01 11:44:47 +02:00
jazz MIPS: jazz: always allow little-endian builds 2021-01-22 13:53:21 +01:00
kernel irqchip fixes for 5.14, take #1 2021-07-09 15:35:13 +02:00
kvm - added support for OpeneEmbed SOM9331 board 2021-07-01 17:03:11 -07:00
lantiq MIPS: lantiq: Directly include linux/of.h in xway/dma.c 2021-06-10 13:09:16 +01:00
lib MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER 2021-05-25 15:33:17 +02:00
loongson2ef - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
loongson32
loongson64 MIPS: loongsoon64: Reserve memory below starting pfn to prevent Oops 2021-06-29 10:15:46 +02:00
math-emu
mm MIPS: Fix fall-through warnings for Clang 2021-07-13 15:00:23 -05:00
mti-malta MIPS: Malta: Do not byte-swap accesses to the CBUS UART 2021-07-21 12:52:14 +02:00
n64 mips: Add N64 machine type 2021-01-22 11:40:00 +01:00
net
netlogic mips: netlogic: Use irq_domain_simple_ops for XLP PIC 2021-04-07 13:25:52 +01:00
pci MIPS: Add missing linux/irqdomain.h includes 2021-06-10 13:09:16 +01:00
pic32 clkdev: remove CONFIG_CLKDEV_LOOKUP 2021-06-08 17:00:09 +02:00
pistachio driver core: lift dma_default_coherent into common code 2021-02-13 09:51:45 +01:00
power
ralink This is the bulk of pin control changes for the v5.14 kernel: 2021-07-01 16:57:14 -07:00
rb532 net: korina: Add support for device tree 2021-04-19 15:58:14 -07:00
sgi-ip22 kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
sgi-ip27 MIPS: Add missing linux/irqdomain.h includes 2021-06-10 13:09:16 +01:00
sgi-ip30 MIPS: Add missing linux/irqdomain.h includes 2021-06-10 13:09:16 +01:00
sgi-ip32 kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
sibyte
sni
tools
txx9
vdso MIPS: Makefile: Replace -pg with CC_FLAGS_FTRACE 2021-04-21 13:44:35 +02:00
vr41xx
Kbuild
Kbuild.platforms mips: Add N64 machine type 2021-01-22 11:40:00 +01:00
Kconfig Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
Kconfig.debug MIPS: boot: Support specifying UART port on Ingenic SoCs 2021-06-01 11:44:47 +02:00
Makefile kbuild: require all architectures to have arch/$(SRCARCH)/Kbuild 2021-05-26 23:10:37 +09:00
Makefile.postlink