tty: amba-pl011: add register offset table to vendor data

Add the register offset table to the vendor data, allowing vendor
differences to be described in this table.

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>
This commit is contained in:
Russell King 2015-11-16 17:40:31 +00:00 committed by Greg Kroah-Hartman
parent debb7f64f9
commit 439403bde9

View file

@ -103,6 +103,7 @@ static u16 pl011_std_offsets[REG_ARRAY_SIZE] = {
/* There is by now at least one vendor with differing details, so handle it */ /* There is by now at least one vendor with differing details, so handle it */
struct vendor_data { struct vendor_data {
const u16 *reg_offset;
unsigned int ifls; unsigned int ifls;
unsigned int lcrh_tx; unsigned int lcrh_tx;
unsigned int lcrh_rx; unsigned int lcrh_rx;
@ -121,6 +122,7 @@ static unsigned int get_fifosize_arm(struct amba_device *dev)
} }
static struct vendor_data vendor_arm = { static struct vendor_data vendor_arm = {
.reg_offset = pl011_std_offsets,
.ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
.lcrh_tx = REG_LCRH, .lcrh_tx = REG_LCRH,
.lcrh_rx = REG_LCRH, .lcrh_rx = REG_LCRH,
@ -133,6 +135,7 @@ static struct vendor_data vendor_arm = {
}; };
static struct vendor_data vendor_sbsa = { static struct vendor_data vendor_sbsa = {
.reg_offset = pl011_std_offsets,
.oversampling = false, .oversampling = false,
.dma_threshold = false, .dma_threshold = false,
.cts_event_workaround = false, .cts_event_workaround = false,
@ -146,6 +149,7 @@ static unsigned int get_fifosize_st(struct amba_device *dev)
} }
static struct vendor_data vendor_st = { static struct vendor_data vendor_st = {
.reg_offset = pl011_std_offsets,
.ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF, .ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF,
.lcrh_tx = REG_ST_LCRH_TX, .lcrh_tx = REG_ST_LCRH_TX,
.lcrh_rx = REG_ST_LCRH_RX, .lcrh_rx = REG_ST_LCRH_RX,
@ -2426,7 +2430,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
if (IS_ERR(uap->clk)) if (IS_ERR(uap->clk))
return PTR_ERR(uap->clk); return PTR_ERR(uap->clk);
uap->reg_offset = pl011_std_offsets; uap->reg_offset = vendor->reg_offset;
uap->vendor = vendor; uap->vendor = vendor;
uap->lcrh_rx = vendor->lcrh_rx; uap->lcrh_rx = vendor->lcrh_rx;
uap->lcrh_tx = vendor->lcrh_tx; uap->lcrh_tx = vendor->lcrh_tx;
@ -2508,7 +2512,7 @@ static int sbsa_uart_probe(struct platform_device *pdev)
if (!uap) if (!uap)
return -ENOMEM; return -ENOMEM;
uap->reg_offset = pl011_std_offsets; uap->reg_offset = vendor_sbsa.reg_offset;
uap->vendor = &vendor_sbsa; uap->vendor = &vendor_sbsa;
uap->fifosize = 32; uap->fifosize = 32;
uap->port.irq = platform_get_irq(pdev, 0); uap->port.irq = platform_get_irq(pdev, 0);