Skip to content

Commit 2426fbc

Browse files
Shawn Guogregkh
authored andcommitted
tty: amba-pl011: probe ZTE device from AMBA bus with a pseudo-ID
There is no Peripheral Identification Registers on ZTE PL011 device, so although the driver amba-pl011 is ready to work for ZTE device, the device cannot be probed by the driver at all. With arm,primecell-periphid DT bindings (bindings/arm/primecell.txt) in place, it should be the cleanest the way to use a pseudo-ID to probe the device from AMBA bus. We create an unofficial vendor number AMBA_VENDOR_LINUX, which will practically never become an official vendor ID, and takes Configuration, Revision number, and Part number as input to compose a pseudo-ID for ZTE device. Also, since we start using vendor_zte to probe ZTE device, the __maybe_unused for vendor_zte is removed. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9c267dd commit 2426fbc

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎drivers/tty/serial/amba-pl011.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static unsigned int get_fifosize_zte(struct amba_device *dev)
209209
return 16;
210210
}
211211

212-
static struct vendor_data vendor_zte __maybe_unused = {
212+
static struct vendor_data vendor_zte = {
213213
.reg_offset = pl011_zte_offsets,
214214
.access_32b = true,
215215
.ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
@@ -2652,6 +2652,11 @@ static struct amba_id pl011_ids[] = {
26522652
.mask = 0x00ffffff,
26532653
.data = &vendor_st,
26542654
},
2655+
{
2656+
.id = AMBA_LINUX_ID(0x00, 0x1, 0xffe),
2657+
.mask = 0x00ffffff,
2658+
.data = &vendor_zte,
2659+
},
26552660
{ 0, 0 },
26562661
};
26572662

‎include/linux/amba/bus.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ enum amba_vendor {
5353
AMBA_VENDOR_ST = 0x80,
5454
AMBA_VENDOR_QCOM = 0x51,
5555
AMBA_VENDOR_LSI = 0xb6,
56+
AMBA_VENDOR_LINUX = 0xfe, /* This value is not official */
5657
};
5758

59+
/* This is used to generate pseudo-ID for AMBA device */
60+
#define AMBA_LINUX_ID(conf, rev, part) \
61+
(((conf) & 0xff) << 24 | ((rev) & 0xf) << 20 | \
62+
AMBA_VENDOR_LINUX << 12 | ((part) & 0xfff))
63+
5864
extern struct bus_type amba_bustype;
5965

6066
#define to_amba_device(d) container_of(d, struct amba_device, dev)

0 commit comments

Comments
 (0)