Blackfin Serial Driver: macro away the IER differences between processors
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
This commit is contained in:
parent
56f8771302
commit
89bf6dc51a
5 changed files with 12 additions and 54 deletions
|
@ -65,9 +65,6 @@ static void bfin_serial_stop_tx(struct uart_port *port)
|
||||||
{
|
{
|
||||||
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
|
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
|
||||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||||
#if !defined(CONFIG_BF54x) && !defined(CONFIG_SERIAL_BFIN_DMA)
|
|
||||||
unsigned short ier;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (!(UART_GET_LSR(uart) & TEMT))
|
while (!(UART_GET_LSR(uart) & TEMT))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
|
@ -82,12 +79,8 @@ static void bfin_serial_stop_tx(struct uart_port *port)
|
||||||
#ifdef CONFIG_BF54x
|
#ifdef CONFIG_BF54x
|
||||||
/* Clear TFI bit */
|
/* Clear TFI bit */
|
||||||
UART_PUT_LSR(uart, TFI);
|
UART_PUT_LSR(uart, TFI);
|
||||||
UART_CLEAR_IER(uart, ETBEI);
|
|
||||||
#else
|
|
||||||
ier = UART_GET_IER(uart);
|
|
||||||
ier &= ~ETBEI;
|
|
||||||
UART_PUT_IER(uart, ier);
|
|
||||||
#endif
|
#endif
|
||||||
|
UART_CLEAR_IER(uart, ETBEI);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,14 +95,7 @@ static void bfin_serial_start_tx(struct uart_port *port)
|
||||||
if (uart->tx_done)
|
if (uart->tx_done)
|
||||||
bfin_serial_dma_tx_chars(uart);
|
bfin_serial_dma_tx_chars(uart);
|
||||||
#else
|
#else
|
||||||
#ifdef CONFIG_BF54x
|
|
||||||
UART_SET_IER(uart, ETBEI);
|
UART_SET_IER(uart, ETBEI);
|
||||||
#else
|
|
||||||
unsigned short ier;
|
|
||||||
ier = UART_GET_IER(uart);
|
|
||||||
ier |= ETBEI;
|
|
||||||
UART_PUT_IER(uart, ier);
|
|
||||||
#endif
|
|
||||||
bfin_serial_tx_chars(uart);
|
bfin_serial_tx_chars(uart);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -120,21 +106,10 @@ static void bfin_serial_start_tx(struct uart_port *port)
|
||||||
static void bfin_serial_stop_rx(struct uart_port *port)
|
static void bfin_serial_stop_rx(struct uart_port *port)
|
||||||
{
|
{
|
||||||
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
|
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
|
||||||
#ifdef CONFIG_KGDB_UART
|
#ifdef CONFIG_KGDB_UART
|
||||||
if (uart->port.line != CONFIG_KGDB_UART_PORT) {
|
if (uart->port.line != CONFIG_KGDB_UART_PORT)
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_BF54x
|
|
||||||
UART_CLEAR_IER(uart, ERBFI);
|
UART_CLEAR_IER(uart, ERBFI);
|
||||||
#else
|
|
||||||
unsigned short ier;
|
|
||||||
|
|
||||||
ier = UART_GET_IER(uart);
|
|
||||||
ier &= ~ERBFI;
|
|
||||||
UART_PUT_IER(uart, ier);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_KGDB_UART
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -208,9 +183,6 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
|
||||||
struct tty_struct *tty = uart->port.info->tty;
|
struct tty_struct *tty = uart->port.info->tty;
|
||||||
unsigned int status, ch, flg;
|
unsigned int status, ch, flg;
|
||||||
static struct timeval anomaly_start = { .tv_sec = 0 };
|
static struct timeval anomaly_start = { .tv_sec = 0 };
|
||||||
#ifdef CONFIG_KGDB_UART
|
|
||||||
struct pt_regs *regs = get_irq_regs();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
status = UART_GET_LSR(uart);
|
status = UART_GET_LSR(uart);
|
||||||
UART_CLEAR_LSR(uart);
|
UART_CLEAR_LSR(uart);
|
||||||
|
@ -220,6 +192,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
|
||||||
|
|
||||||
#ifdef CONFIG_KGDB_UART
|
#ifdef CONFIG_KGDB_UART
|
||||||
if (uart->port.line == CONFIG_KGDB_UART_PORT) {
|
if (uart->port.line == CONFIG_KGDB_UART_PORT) {
|
||||||
|
struct pt_regs *regs = get_irq_regs();
|
||||||
if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
|
if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
|
||||||
kgdb_breakkey_pressed(regs);
|
kgdb_breakkey_pressed(regs);
|
||||||
return;
|
return;
|
||||||
|
@ -391,7 +364,6 @@ static void bfin_serial_do_work(struct work_struct *work)
|
||||||
static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
|
static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
|
||||||
{
|
{
|
||||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||||
unsigned short ier;
|
|
||||||
|
|
||||||
uart->tx_done = 0;
|
uart->tx_done = 0;
|
||||||
|
|
||||||
|
@ -429,13 +401,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
|
||||||
set_dma_x_modify(uart->tx_dma_channel, 1);
|
set_dma_x_modify(uart->tx_dma_channel, 1);
|
||||||
enable_dma(uart->tx_dma_channel);
|
enable_dma(uart->tx_dma_channel);
|
||||||
|
|
||||||
#ifdef CONFIG_BF54x
|
|
||||||
UART_SET_IER(uart, ETBEI);
|
UART_SET_IER(uart, ETBEI);
|
||||||
#else
|
|
||||||
ier = UART_GET_IER(uart);
|
|
||||||
ier |= ETBEI;
|
|
||||||
UART_PUT_IER(uart, ier);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
|
static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
|
||||||
|
@ -513,19 +479,12 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct bfin_serial_port *uart = dev_id;
|
struct bfin_serial_port *uart = dev_id;
|
||||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||||
unsigned short ier;
|
|
||||||
|
|
||||||
spin_lock(&uart->port.lock);
|
spin_lock(&uart->port.lock);
|
||||||
if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
|
if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
|
||||||
disable_dma(uart->tx_dma_channel);
|
disable_dma(uart->tx_dma_channel);
|
||||||
clear_dma_irqstat(uart->tx_dma_channel);
|
clear_dma_irqstat(uart->tx_dma_channel);
|
||||||
#ifdef CONFIG_BF54x
|
|
||||||
UART_CLEAR_IER(uart, ETBEI);
|
UART_CLEAR_IER(uart, ETBEI);
|
||||||
#else
|
|
||||||
ier = UART_GET_IER(uart);
|
|
||||||
ier &= ~ETBEI;
|
|
||||||
UART_PUT_IER(uart, ier);
|
|
||||||
#endif
|
|
||||||
xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1);
|
xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1);
|
||||||
uart->port.icount.tx += uart->tx_count;
|
uart->port.icount.tx += uart->tx_count;
|
||||||
|
|
||||||
|
@ -701,7 +660,6 @@ static int bfin_serial_startup(struct uart_port *port)
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (request_irq
|
if (request_irq
|
||||||
(uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
|
(uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
|
||||||
"BFIN_UART_TX", uart)) {
|
"BFIN_UART_TX", uart)) {
|
||||||
|
@ -710,11 +668,7 @@ static int bfin_serial_startup(struct uart_port *port)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_BF54x
|
|
||||||
UART_SET_IER(uart, ERBFI);
|
UART_SET_IER(uart, ERBFI);
|
||||||
#else
|
|
||||||
UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1290,11 +1244,7 @@ static int __init bfin_serial_init(void)
|
||||||
request_irq(uart->port.irq, bfin_serial_rx_int,
|
request_irq(uart->port.irq, bfin_serial_rx_int,
|
||||||
IRQF_DISABLED, "BFIN_UART_RX", uart);
|
IRQF_DISABLED, "BFIN_UART_RX", uart);
|
||||||
pr_info("Request irq for kgdb uart port\n");
|
pr_info("Request irq for kgdb uart port\n");
|
||||||
#ifdef CONFIG_BF54x
|
|
||||||
UART_SET_IER(uart, ERBFI);
|
UART_SET_IER(uart, ERBFI);
|
||||||
#else
|
|
||||||
UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
|
|
||||||
#endif
|
|
||||||
SSYNC();
|
SSYNC();
|
||||||
t.c_cflag = CS8|B57600;
|
t.c_cflag = CS8|B57600;
|
||||||
t.c_iflag = 0;
|
t.c_iflag = 0;
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v)
|
#define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v)
|
||||||
#define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v)
|
#define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v)
|
||||||
#define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v)
|
#define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v)
|
||||||
|
#define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v))
|
||||||
|
#define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v))
|
||||||
#define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v)
|
#define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v)
|
||||||
#define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v)
|
#define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v)
|
||||||
#define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v)
|
#define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v)
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
|
#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
|
||||||
#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
|
#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
|
||||||
#define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v)
|
#define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v)
|
||||||
|
#define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v))
|
||||||
|
#define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v))
|
||||||
#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
|
#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
|
||||||
#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
|
#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
|
||||||
#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
|
#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
|
#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
|
||||||
#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
|
#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
|
||||||
#define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v)
|
#define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v)
|
||||||
|
#define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v))
|
||||||
|
#define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v))
|
||||||
#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
|
#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
|
||||||
#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
|
#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
|
||||||
#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
|
#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
|
#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
|
||||||
#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
|
#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
|
||||||
#define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v)
|
#define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v)
|
||||||
|
#define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v))
|
||||||
|
#define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v))
|
||||||
#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
|
#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
|
||||||
#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
|
#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
|
||||||
#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
|
#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
|
||||||
|
|
Reference in a new issue