From 7d01b475ab17018756c8df27c2ee3c220fab05f8 Mon Sep 17 00:00:00 2001 From: Graf Yang Date: Fri, 29 Feb 2008 11:31:08 +0800 Subject: Blackfin Serial Driver: Enable IR function when user application (irattach /dev/ttyBFx -s) call TIOCSETD ioctl with line discipline N_IRDA Signed-off-by: Graf Yang Signed-off-by: Bryan Wu --- drivers/serial/bfin_5xx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 46bb47f37b9a..4e0b8cd4d4e0 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -900,6 +900,31 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser) return 0; } +/* + * Enable the IrDA function if tty->ldisc.num is N_IRDA. + * In other cases, disable IrDA function. + */ +static void bfin_set_ldisc(struct tty_struct *tty) +{ + int line = tty->index; + unsigned short val; + + if (line >= tty->driver->num) + return; + + switch (tty->ldisc.num) { + case N_IRDA: + val = UART_GET_GCTL(&bfin_serial_ports[line]); + val |= (IREN | RPOLC); + UART_PUT_GCTL(&bfin_serial_ports[line], val); + break; + default: + val = UART_GET_GCTL(&bfin_serial_ports[line]); + val &= ~(IREN | RPOLC); + UART_PUT_GCTL(&bfin_serial_ports[line], val); + } +} + static struct uart_ops bfin_serial_pops = { .tx_empty = bfin_serial_tx_empty, .set_mctrl = bfin_serial_set_mctrl, @@ -1261,6 +1286,7 @@ static int __init bfin_serial_init(void) ret = uart_register_driver(&bfin_serial_reg); if (ret == 0) { + bfin_serial_reg.tty_driver->set_ldisc = bfin_set_ldisc; ret = platform_driver_register(&bfin_serial_driver); if (ret) { pr_debug("uart register failed\n"); -- cgit v1.2.3 From 0c44a86d9e19021b38a7d7835f25210ef74b2612 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 24 Apr 2008 04:56:02 +0800 Subject: Blackfin Serial Driver: punt unused lsr variable Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- drivers/serial/bfin_5xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 4e0b8cd4d4e0..b773764ddab9 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -749,7 +749,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, struct bfin_serial_port *uart = (struct bfin_serial_port *)port; unsigned long flags; unsigned int baud, quot; - unsigned short val, ier, lsr, lcr = 0; + unsigned short val, ier, lcr = 0; switch (termios->c_cflag & CSIZE) { case CS8: -- cgit v1.2.3 From 1a3a4c7130d6f39b56efc259d653f6dec4990ea3 Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Wed, 23 Apr 2008 09:43:20 +0800 Subject: Blackfin Serial Driver: Fix bug - kernel hangs when accessing uart 0 on bf537 when booting u-boot and linux on uart 1 Wait only when this UART is enabled. http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3995 Signed-off-by: Sonic Zhang Signed-off-by: Bryan Wu --- drivers/serial/bfin_5xx.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index b773764ddab9..1dc9b583fa62 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -806,10 +806,6 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15); - do { - lsr = UART_GET_LSR(uart); - } while (!(lsr & TEMT)); - /* Disable UART */ ier = UART_GET_IER(uart); #ifdef CONFIG_BF54x -- cgit v1.2.3 From 2ade972996feb8f81d7cf2deaf8321e33770c91a Mon Sep 17 00:00:00 2001 From: Graf Yang Date: Fri, 25 Apr 2008 02:55:49 +0800 Subject: Blackfin Serial Driver: use BFIN_UART_NR_PORTS to help SIR driver in uart port. Signed-off-by: Graf Yang Signed-off-by: Bryan Wu --- drivers/serial/bfin_5xx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 1dc9b583fa62..8dab6644297c 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -151,7 +151,8 @@ void kgdb_put_debug_char(int chr) { struct bfin_serial_port *uart; - if (CONFIG_KGDB_UART_PORT<0 || CONFIG_KGDB_UART_PORT>=NR_PORTS) + if (CONFIG_KGDB_UART_PORT < 0 + || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS) uart = &bfin_serial_ports[0]; else uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; @@ -173,7 +174,8 @@ int kgdb_get_debug_char(void) struct bfin_serial_port *uart; unsigned char chr; - if (CONFIG_KGDB_UART_PORT<0 || CONFIG_KGDB_UART_PORT>=NR_PORTS) + if (CONFIG_KGDB_UART_PORT < 0 + || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS) uart = &bfin_serial_ports[0]; else uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; @@ -1193,7 +1195,7 @@ static struct uart_driver bfin_serial_reg = { .dev_name = BFIN_SERIAL_NAME, .major = BFIN_SERIAL_MAJOR, .minor = BFIN_SERIAL_MINOR, - .nr = NR_PORTS, + .nr = BFIN_UART_NR_PORTS, .cons = BFIN_SERIAL_CONSOLE, }; -- cgit v1.2.3 From 50e2e15afaac59c955f43d78d0a1e53cf8a76370 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 25 Apr 2008 03:03:03 +0800 Subject: Blackfin Serial Driver: the uart break anomaly has been given its own number, so switch to it Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- drivers/serial/bfin_5xx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 8dab6644297c..47ca7b0267df 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -194,7 +194,7 @@ int kgdb_get_debug_char(void) } #endif -#if ANOMALY_05000230 && defined(CONFIG_SERIAL_BFIN_PIO) +#if ANOMALY_05000363 && defined(CONFIG_SERIAL_BFIN_PIO) # define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold) # define UART_SET_ANOMALY_THRESHOLD(uart, v) ((uart)->anomaly_threshold = (v)) #else @@ -239,7 +239,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) } #endif - if (ANOMALY_05000230) { + if (ANOMALY_05000363) { /* The BF533 (and BF561) family of processors have a nice anomaly * where they continuously generate characters for a "single" break. * We have to basically ignore this flood until the "next" valid @@ -251,9 +251,6 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) * timeout was picked as it must absolutely be larger than 1 * character time +/- some percent. So 1.5 sounds good. All other * Blackfin families operate properly. Woo. - * Note: While Anomaly 05000230 does not directly address this, - * the changes that went in for it also fixed this issue. - * That anomaly was fixed in 0.5+ silicon. I like bunnies. */ if (anomaly_start.tv_sec) { struct timeval curr; @@ -287,7 +284,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) } if (status & BI) { - if (ANOMALY_05000230) + if (ANOMALY_05000363) if (bfin_revid() < 5) do_gettimeofday(&anomaly_start); uart->port.icount.brk++; -- cgit v1.2.3 From 0a2784233785226fe5882c8af15118476f89e98e Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Fri, 25 Apr 2008 04:36:47 +0800 Subject: Blackfin Serial Driver: fix bug - use mod_timer to replace only add_timer. http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4045 If adding timer in both timer handler and rx interrupt, a timer may be added when it is till in the pending list. Signed-off-by: Sonic Zhang Signed-off-by: Bryan Wu --- drivers/serial/bfin_5xx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 47ca7b0267df..5f55534a290b 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -506,8 +506,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) uart->rx_dma_buf.tail = uart->rx_dma_buf.head; } - uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES; - add_timer(&(uart->rx_dma_timer)); + mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES); } static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) @@ -550,9 +549,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) clear_dma_irqstat(uart->rx_dma_channel); spin_unlock(&uart->port.lock); - del_timer(&(uart->rx_dma_timer)); - uart->rx_dma_timer.expires = jiffies; - add_timer(&(uart->rx_dma_timer)); + mod_timer(&(uart->rx_dma_timer), jiffies); return IRQ_HANDLED; } -- cgit v1.2.3