From: Russell King <rmk+kernel@arm.linux.org.uk>
To: linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Peter Hurley <peter@hurleysoftware.com>,
Andre Przywara <andre.przywara@arm.com>,
Linus Walleij <linus.walleij@linaro.org>,
Andrew.Jackson@arm.com, Timur Tabi <timur@tabi.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>, Jun Nie <jun.nie@linaro.org>
Subject: [PATCH 11/12] tty: amba-pl011: add support for ZTE UART (EXPERIMENTAL)
Date: Mon, 16 Nov 2015 17:40:57 +0000 [thread overview]
Message-ID: <E1ZyNlx-0003kG-Ju@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20151116173935.GQ8644@n2100.arm.linux.org.uk>
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>
---
drivers/tty/serial/amba-pl011.c | 23 +++++++++++++++++++++++
include/linux/amba/serial.h | 18 ++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 3470a1e67bbc..54c6c88a71a3 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -171,6 +171,29 @@ static struct vendor_data vendor_st = {
.get_fifosize = get_fifosize_st,
};
+static const u16 pl011_zte_offsets[REG_ARRAY_SIZE] = {
+ [REG_DR] = ZX_UART011_DR,
+ [REG_FR] = ZX_UART011_FR,
+ [REG_LCRH_RX] = ZX_UART011_LCRH,
+ [REG_LCRH_TX] = ZX_UART011_LCRH,
+ [REG_IBRD] = ZX_UART011_IBRD,
+ [REG_FBRD] = ZX_UART011_FBRD,
+ [REG_CR] = ZX_UART011_CR,
+ [REG_IFLS] = ZX_UART011_IFLS,
+ [REG_IMSC] = ZX_UART011_IMSC,
+ [REG_RIS] = ZX_UART011_RIS,
+ [REG_MIS] = ZX_UART011_MIS,
+ [REG_ICR] = ZX_UART011_ICR,
+ [REG_DMACR] = ZX_UART011_DMACR,
+};
+
+static struct vendor_data vendor_zte = {
+ .reg_offset = pl011_zte_offsets,
+ .access_32b = true,
+ .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
+ .get_fifosize = get_fifosize_arm,
+};
+
/* Deals with DMA transactions */
struct pl011_sgbuf {
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 0ddb5c02ad8b..d76a19ba2cff 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -65,6 +65,24 @@
#define ST_UART011_ABCR 0x100 /* Autobaud control register. */
#define ST_UART011_ABIMSC 0x15C /* Autobaud interrupt mask/clear register. */
+/*
+ * ZTE UART register offsets. This UART has a radically different address
+ * allocation from the ARM and ST variants, so we list all registers here.
+ * We assume unlisted registers do not exist.
+ */
+#define ZX_UART011_DR 0x04
+#define ZX_UART011_FR 0x14
+#define ZX_UART011_IBRD 0x24
+#define ZX_UART011_FBRD 0x28
+#define ZX_UART011_LCRH 0x30
+#define ZX_UART011_CR 0x34
+#define ZX_UART011_IFLS 0x38
+#define ZX_UART011_IMSC 0x40
+#define ZX_UART011_RIS 0x44
+#define ZX_UART011_MIS 0x48
+#define ZX_UART011_ICR 0x4c
+#define ZX_UART011_DMACR 0x50
+
#define UART011_DR_OE (1 << 11)
#define UART011_DR_BE (1 << 10)
#define UART011_DR_PE (1 << 9)
--
2.1.0
next prev parent reply other threads:[~2015-11-16 17:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 17:39 [PATCH 00/12] Prepare amba-pl011 for ZTE UART support Russell King - ARM Linux
2015-11-16 17:40 ` [PATCH 01/12] tty: amba-pl011: add register accessor functions Russell King
2015-12-05 18:57 ` Peter Hurley
2015-12-24 15:14 ` Russell King - ARM Linux
2015-11-16 17:40 ` [PATCH 02/12] tty: amba-pl011: convert accessor functions to take uart_amba_port Russell King
2015-11-16 17:40 ` [PATCH 03/12] tty: amba-pl011: add helper to detect split LCRH register Russell King
2015-11-16 17:40 ` [PATCH 04/12] tty: amba-pl011: prepare REG_* register indexes Russell King
2015-11-16 17:40 ` [PATCH 05/12] tty: amba-pl011: add register lookup table Russell King
2015-11-19 14:10 ` Dave Martin
2015-12-24 6:54 ` Huang Shijie
2015-12-24 11:01 ` Russell King - ARM Linux
2015-12-24 15:03 ` Timur Tabi
2015-12-24 15:05 ` Russell King - ARM Linux
2015-12-24 15:35 ` Timur Tabi
2015-12-24 15:40 ` Russell King - ARM Linux
2015-12-24 15:50 ` Timur Tabi
2015-12-24 15:54 ` Russell King - ARM Linux
2015-12-24 16:07 ` Russell King - ARM Linux
2015-12-24 16:51 ` Russell King - ARM Linux
2015-11-16 17:40 ` [PATCH 06/12] tty: amba-pl011: add register offset table to vendor data Russell King
2015-11-16 17:40 ` [PATCH 07/12] tty: amba-pl011: add ST register offset table Russell King
2015-11-16 17:40 ` [PATCH 08/12] tty: amba-pl011: clean up LCR register offsets Russell King
2015-11-16 17:40 ` [PATCH 09/12] tty: amba-pl011: remove ST micro registers from standard table Russell King
2015-11-16 17:40 ` [PATCH 10/12] tty: amba-pl011: add support for 32-bit register access Russell King
2015-11-16 17:45 ` Timur Tabi
2015-11-16 17:52 ` Russell King - ARM Linux
2015-11-16 18:25 ` Timur Tabi
2015-11-16 18:30 ` Russell King - ARM Linux
2015-11-16 20:52 ` Timur Tabi
2015-11-16 21:18 ` Peter Hurley
2015-11-16 17:40 ` Russell King [this message]
2015-11-16 17:41 ` [PATCH 12/12] tty: amba-pl011: switch to using relaxed IO accessors Russell King
2015-12-05 18:49 ` [PATCH 00/12] Prepare amba-pl011 for ZTE UART support Peter Hurley
2015-12-05 19:06 ` Timur Tabi
2015-12-13 6:36 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1ZyNlx-0003kG-Ju@rmk-PC.arm.linux.org.uk \
--to=rmk+kernel@arm.linux.org.uk \
--cc=Andrew.Jackson@arm.com \
--cc=andre.przywara@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=jun.nie@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=peter@hurleysoftware.com \
--cc=timur@tabi.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).