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

tty: amba-pl011: add support for ZTE UART (EXPERIMENTAL)

Add (incomplete) support for the ZTE UART to the AMBA PL011 driver.
This is similar to the ARM and ST variants, except it has a different
register address layout, and requires 32-bit accesses to the registers.
Use the newly introduced register tables and access size support to
cope with these differences.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Russell King and committed by
Greg Kroah-Hartman
7ec75871 84c3e03b

+41
+23
drivers/tty/serial/amba-pl011.c
··· 171 171 .get_fifosize = get_fifosize_st, 172 172 }; 173 173 174 + static const u16 pl011_zte_offsets[REG_ARRAY_SIZE] = { 175 + [REG_DR] = ZX_UART011_DR, 176 + [REG_FR] = ZX_UART011_FR, 177 + [REG_LCRH_RX] = ZX_UART011_LCRH, 178 + [REG_LCRH_TX] = ZX_UART011_LCRH, 179 + [REG_IBRD] = ZX_UART011_IBRD, 180 + [REG_FBRD] = ZX_UART011_FBRD, 181 + [REG_CR] = ZX_UART011_CR, 182 + [REG_IFLS] = ZX_UART011_IFLS, 183 + [REG_IMSC] = ZX_UART011_IMSC, 184 + [REG_RIS] = ZX_UART011_RIS, 185 + [REG_MIS] = ZX_UART011_MIS, 186 + [REG_ICR] = ZX_UART011_ICR, 187 + [REG_DMACR] = ZX_UART011_DMACR, 188 + }; 189 + 190 + static struct vendor_data vendor_zte = { 191 + .reg_offset = pl011_zte_offsets, 192 + .access_32b = true, 193 + .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, 194 + .get_fifosize = get_fifosize_arm, 195 + }; 196 + 174 197 /* Deals with DMA transactions */ 175 198 176 199 struct pl011_sgbuf {
+18
include/linux/amba/serial.h
··· 65 65 #define ST_UART011_ABCR 0x100 /* Autobaud control register. */ 66 66 #define ST_UART011_ABIMSC 0x15C /* Autobaud interrupt mask/clear register. */ 67 67 68 + /* 69 + * ZTE UART register offsets. This UART has a radically different address 70 + * allocation from the ARM and ST variants, so we list all registers here. 71 + * We assume unlisted registers do not exist. 72 + */ 73 + #define ZX_UART011_DR 0x04 74 + #define ZX_UART011_FR 0x14 75 + #define ZX_UART011_IBRD 0x24 76 + #define ZX_UART011_FBRD 0x28 77 + #define ZX_UART011_LCRH 0x30 78 + #define ZX_UART011_CR 0x34 79 + #define ZX_UART011_IFLS 0x38 80 + #define ZX_UART011_IMSC 0x40 81 + #define ZX_UART011_RIS 0x44 82 + #define ZX_UART011_MIS 0x48 83 + #define ZX_UART011_ICR 0x4c 84 + #define ZX_UART011_DMACR 0x50 85 + 68 86 #define UART011_DR_OE (1 << 11) 69 87 #define UART011_DR_BE (1 << 10) 70 88 #define UART011_DR_PE (1 << 9)