tty: amba-pl011: add register lookup table
Add a register lookup table, which allows the register offsets to be adjusted on a per-port basis. 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:
Родитель
b985e9e368
Коммит
debb7f64f9
|
@ -73,6 +73,34 @@
|
|||
#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
|
||||
#define UART_DUMMY_DR_RX (1 << 16)
|
||||
|
||||
static u16 pl011_std_offsets[REG_ARRAY_SIZE] = {
|
||||
[REG_DR] = UART01x_DR,
|
||||
[REG_ST_DMAWM] = ST_UART011_DMAWM,
|
||||
[REG_ST_TIMEOUT] = ST_UART011_TIMEOUT,
|
||||
[REG_FR] = UART01x_FR,
|
||||
[REG_ST_LCRH_RX] = ST_UART011_LCRH_RX,
|
||||
[REG_IBRD] = UART011_IBRD,
|
||||
[REG_FBRD] = UART011_FBRD,
|
||||
[REG_LCRH] = UART011_LCRH,
|
||||
[REG_ST_LCRH_TX] = ST_UART011_LCRH_TX,
|
||||
[REG_CR] = UART011_CR,
|
||||
[REG_IFLS] = UART011_IFLS,
|
||||
[REG_IMSC] = UART011_IMSC,
|
||||
[REG_RIS] = UART011_RIS,
|
||||
[REG_MIS] = UART011_MIS,
|
||||
[REG_ICR] = UART011_ICR,
|
||||
[REG_DMACR] = UART011_DMACR,
|
||||
[REG_ST_XFCR] = ST_UART011_XFCR,
|
||||
[REG_ST_XON1] = ST_UART011_XON1,
|
||||
[REG_ST_XON2] = ST_UART011_XON2,
|
||||
[REG_ST_XOFF1] = ST_UART011_XOFF1,
|
||||
[REG_ST_XOFF2] = ST_UART011_XOFF2,
|
||||
[REG_ST_ITCR] = ST_UART011_ITCR,
|
||||
[REG_ST_ITIP] = ST_UART011_ITIP,
|
||||
[REG_ST_ABCR] = ST_UART011_ABCR,
|
||||
[REG_ST_ABIMSC] = ST_UART011_ABIMSC,
|
||||
};
|
||||
|
||||
/* There is by now at least one vendor with differing details, so handle it */
|
||||
struct vendor_data {
|
||||
unsigned int ifls;
|
||||
|
@ -164,6 +192,7 @@ struct pl011_dmatx_data {
|
|||
*/
|
||||
struct uart_amba_port {
|
||||
struct uart_port port;
|
||||
const u16 *reg_offset;
|
||||
struct clk *clk;
|
||||
const struct vendor_data *vendor;
|
||||
unsigned int dmacr; /* dma control reg */
|
||||
|
@ -189,7 +218,7 @@ struct uart_amba_port {
|
|||
static unsigned int pl011_reg_to_offset(const struct uart_amba_port *uap,
|
||||
unsigned int reg)
|
||||
{
|
||||
return reg;
|
||||
return uap->reg_offset[reg];
|
||||
}
|
||||
|
||||
static unsigned int pl011_read(const struct uart_amba_port *uap,
|
||||
|
@ -2397,6 +2426,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
|
|||
if (IS_ERR(uap->clk))
|
||||
return PTR_ERR(uap->clk);
|
||||
|
||||
uap->reg_offset = pl011_std_offsets;
|
||||
uap->vendor = vendor;
|
||||
uap->lcrh_rx = vendor->lcrh_rx;
|
||||
uap->lcrh_tx = vendor->lcrh_tx;
|
||||
|
@ -2478,6 +2508,7 @@ static int sbsa_uart_probe(struct platform_device *pdev)
|
|||
if (!uap)
|
||||
return -ENOMEM;
|
||||
|
||||
uap->reg_offset = pl011_std_offsets;
|
||||
uap->vendor = &vendor_sbsa;
|
||||
uap->fifosize = 32;
|
||||
uap->port.irq = platform_get_irq(pdev, 0);
|
||||
|
|
|
@ -2,31 +2,34 @@
|
|||
#define AMBA_PL011_H
|
||||
|
||||
enum {
|
||||
REG_DR = UART01x_DR,
|
||||
REG_ST_DMAWM = ST_UART011_DMAWM,
|
||||
REG_ST_TIMEOUT = ST_UART011_TIMEOUT,
|
||||
REG_FR = UART01x_FR,
|
||||
REG_ST_LCRH_RX = ST_UART011_LCRH_RX,
|
||||
REG_IBRD = UART011_IBRD,
|
||||
REG_FBRD = UART011_FBRD,
|
||||
REG_LCRH = UART011_LCRH,
|
||||
REG_ST_LCRH_TX = ST_UART011_LCRH_TX,
|
||||
REG_CR = UART011_CR,
|
||||
REG_IFLS = UART011_IFLS,
|
||||
REG_IMSC = UART011_IMSC,
|
||||
REG_RIS = UART011_RIS,
|
||||
REG_MIS = UART011_MIS,
|
||||
REG_ICR = UART011_ICR,
|
||||
REG_DMACR = UART011_DMACR,
|
||||
REG_ST_XFCR = ST_UART011_XFCR,
|
||||
REG_ST_XON1 = ST_UART011_XON1,
|
||||
REG_ST_XON2 = ST_UART011_XON2,
|
||||
REG_ST_XOFF1 = ST_UART011_XOFF1,
|
||||
REG_ST_XOFF2 = ST_UART011_XOFF2,
|
||||
REG_ST_ITCR = ST_UART011_ITCR,
|
||||
REG_ST_ITIP = ST_UART011_ITIP,
|
||||
REG_ST_ABCR = ST_UART011_ABCR,
|
||||
REG_ST_ABIMSC = ST_UART011_ABIMSC,
|
||||
REG_DR,
|
||||
REG_ST_DMAWM,
|
||||
REG_ST_TIMEOUT,
|
||||
REG_FR,
|
||||
REG_ST_LCRH_RX,
|
||||
REG_IBRD,
|
||||
REG_FBRD,
|
||||
REG_LCRH,
|
||||
REG_ST_LCRH_TX,
|
||||
REG_CR,
|
||||
REG_IFLS,
|
||||
REG_IMSC,
|
||||
REG_RIS,
|
||||
REG_MIS,
|
||||
REG_ICR,
|
||||
REG_DMACR,
|
||||
REG_ST_XFCR,
|
||||
REG_ST_XON1,
|
||||
REG_ST_XON2,
|
||||
REG_ST_XOFF1,
|
||||
REG_ST_XOFF2,
|
||||
REG_ST_ITCR,
|
||||
REG_ST_ITIP,
|
||||
REG_ST_ABCR,
|
||||
REG_ST_ABIMSC,
|
||||
|
||||
/* The size of the array - must be last */
|
||||
REG_ARRAY_SIZE,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче