diff options
Diffstat (limited to 'drivers/staging/dgnc/dgnc_neo.c')
-rw-r--r-- | drivers/staging/dgnc/dgnc_neo.c | 329 |
1 files changed, 133 insertions, 196 deletions
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 68ff1161e67..a5bd08fef27 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -34,7 +34,7 @@ #include <linux/sched.h> /* For jiffies, task states */ #include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */ #include <linux/delay.h> /* For udelay */ -#include <asm/io.h> /* For read[bwl]/write[bwl] */ +#include <linux/io.h> /* For read[bwl]/write[bwl] */ #include <linux/serial.h> /* For struct async_serial */ #include <linux/serial_reg.h> /* For the various UART offsets */ @@ -53,7 +53,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch); static inline void neo_set_no_output_flow_control(struct channel_t *ch); static inline void neo_set_no_input_flow_control(struct channel_t *ch); static inline void neo_set_new_start_stop_chars(struct channel_t *ch); -static void neo_parse_modem(struct channel_t *ch, uchar signals); +static void neo_parse_modem(struct channel_t *ch, unsigned char signals); static void neo_tasklet(unsigned long data); static void neo_vpd(struct dgnc_board *brd); static void neo_uart_init(struct channel_t *ch); @@ -113,12 +113,10 @@ static inline void neo_pci_posting_flush(struct dgnc_board *bd) static inline void neo_set_cts_flow_control(struct channel_t *ch) { - uchar ier = readb(&ch->ch_neo_uart->ier); - uchar efr = readb(&ch->ch_neo_uart->efr); + unsigned char ier = readb(&ch->ch_neo_uart->ier); + unsigned char efr = readb(&ch->ch_neo_uart->efr); - DPR_PARAM(("Setting CTSFLOW\n")); - /* Turn on auto CTS flow control */ #if 1 ier |= (UART_17158_IER_CTSDSR); @@ -152,10 +150,8 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) static inline void neo_set_rts_flow_control(struct channel_t *ch) { - uchar ier = readb(&ch->ch_neo_uart->ier); - uchar efr = readb(&ch->ch_neo_uart->efr); - - DPR_PARAM(("Setting RTSFLOW\n")); + unsigned char ier = readb(&ch->ch_neo_uart->ier); + unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn on auto RTS flow control */ #if 1 @@ -197,10 +193,8 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch) static inline void neo_set_ixon_flow_control(struct channel_t *ch) { - uchar ier = readb(&ch->ch_neo_uart->ier); - uchar efr = readb(&ch->ch_neo_uart->efr); - - DPR_PARAM(("Setting IXON FLOW\n")); + unsigned char ier = readb(&ch->ch_neo_uart->ier); + unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto CTS flow control */ ier &= ~(UART_17158_IER_CTSDSR); @@ -236,10 +230,8 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch) static inline void neo_set_ixoff_flow_control(struct channel_t *ch) { - uchar ier = readb(&ch->ch_neo_uart->ier); - uchar efr = readb(&ch->ch_neo_uart->efr); - - DPR_PARAM(("Setting IXOFF FLOW\n")); + unsigned char ier = readb(&ch->ch_neo_uart->ier); + unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto RTS flow control */ ier &= ~(UART_17158_IER_RTSDTR); @@ -276,10 +268,8 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch) static inline void neo_set_no_input_flow_control(struct channel_t *ch) { - uchar ier = readb(&ch->ch_neo_uart->ier); - uchar efr = readb(&ch->ch_neo_uart->efr); - - DPR_PARAM(("Unsetting Input FLOW\n")); + unsigned char ier = readb(&ch->ch_neo_uart->ier); + unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto RTS flow control */ ier &= ~(UART_17158_IER_RTSDTR); @@ -318,10 +308,8 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch) static inline void neo_set_no_output_flow_control(struct channel_t *ch) { - uchar ier = readb(&ch->ch_neo_uart->ier); - uchar efr = readb(&ch->ch_neo_uart->efr); - - DPR_PARAM(("Unsetting Output FLOW\n")); + unsigned char ier = readb(&ch->ch_neo_uart->ier); + unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto CTS flow control */ ier &= ~(UART_17158_IER_CTSDSR); @@ -364,8 +352,6 @@ static inline void neo_set_new_start_stop_chars(struct channel_t *ch) if (ch->ch_digi.digi_flags & (CTSPACE | RTSPACE) || ch->ch_c_cflag & CRTSCTS) return; - DPR_PARAM(("In new start stop chars\n")); - /* Tell UART what start/stop chars it should be looking for */ writeb(ch->ch_startc, &ch->ch_neo_uart->xonchar1); writeb(0, &ch->ch_neo_uart->xonchar2); @@ -382,13 +368,13 @@ static inline void neo_set_new_start_stop_chars(struct channel_t *ch) */ static inline void neo_clear_break(struct channel_t *ch, int force) { - ulong lock_flags; + unsigned long flags; - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); /* Bail if we aren't currently sending a break. */ if (!ch->ch_stop_sending_break) { - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); return; } @@ -396,15 +382,15 @@ static inline void neo_clear_break(struct channel_t *ch, int force) if (ch->ch_flags & CH_BREAK_SENDING) { if (time_after_eq(jiffies, ch->ch_stop_sending_break) || force) { - uchar temp = readb(&ch->ch_neo_uart->lcr); + unsigned char temp = readb(&ch->ch_neo_uart->lcr); + writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr); neo_pci_posting_flush(ch->ch_bd); ch->ch_flags &= ~(CH_BREAK_SENDING); ch->ch_stop_sending_break = 0; - DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n", jiffies)); } } - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); } @@ -414,9 +400,9 @@ static inline void neo_clear_break(struct channel_t *ch, int force) static inline void neo_parse_isr(struct dgnc_board *brd, uint port) { struct channel_t *ch; - uchar isr; - uchar cause; - ulong lock_flags; + unsigned char isr; + unsigned char cause; + unsigned long flags; if (!brd || brd->magic != DGNC_BOARD_MAGIC) return; @@ -442,8 +428,6 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port) */ isr &= ~(UART_17158_IIR_FIFO_ENABLED); - DPR_INTR(("%s:%d isr: %x\n", __FILE__, __LINE__, isr)); - if (isr & (UART_17158_IIR_RDI_TIMEOUT | UART_IIR_RDI)) { /* Read data from uart -> queue */ brd->intr_rx++; @@ -451,26 +435,24 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port) neo_copy_data_from_uart_to_queue(ch); /* Call our tty layer to enforce queue flow control if needed. */ - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); dgnc_check_queue_flow_control(ch); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); } if (isr & UART_IIR_THRI) { brd->intr_tx++; ch->ch_intr_tx++; /* Transfer data (if any) from Write Queue -> UART. */ - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); neo_copy_data_from_queue_to_uart(ch); } if (isr & UART_17158_IIR_XONXOFF) { cause = readb(&ch->ch_neo_uart->xoffchar1); - DPR_INTR(("Port %d. Got ISR_XONXOFF: cause:%x\n", port, cause)); - /* * Since the UART detected either an XON or * XOFF match, we need to figure out which @@ -479,19 +461,20 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port) if (cause == UART_17158_XON_DETECT) { /* Is output stopped right now, if so, resume it */ if (brd->channels[port]->ch_flags & CH_STOP) { - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, + flags); ch->ch_flags &= ~(CH_STOP); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, + flags); } - DPR_INTR(("Port %d. XON detected in incoming data\n", port)); } else if (cause == UART_17158_XOFF_DETECT) { if (!(brd->channels[port]->ch_flags & CH_STOP)) { - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, + flags); ch->ch_flags |= CH_STOP; - DGNC_UNLOCK(ch->ch_lock, lock_flags); - DPR_INTR(("Setting CH_STOP\n")); + spin_unlock_irqrestore(&ch->ch_lock, + flags); } - DPR_INTR(("Port: %d. XOFF detected in incoming data\n", port)); } } @@ -506,29 +489,36 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port) /* Which pin is doing auto flow? RTS or DTR? */ if ((cause & 0x4) == 0) { if (cause & UART_MCR_RTS) { - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, + flags); ch->ch_mostat |= UART_MCR_RTS; - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, + flags); } else { - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, + flags); ch->ch_mostat &= ~(UART_MCR_RTS); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, + flags); } } else { if (cause & UART_MCR_DTR) { - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, + flags); ch->ch_mostat |= UART_MCR_DTR; - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, + flags); } else { - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, + flags); ch->ch_mostat &= ~(UART_MCR_DTR); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, + flags); } } } /* Parse any modem signal changes */ - DPR_INTR(("MOD_STAT: sending to parse_modem_sigs\n")); neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr)); } } @@ -538,7 +528,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) { struct channel_t *ch; int linestatus; - ulong lock_flags; + unsigned long flags; if (!brd) return; @@ -555,8 +545,6 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) linestatus = readb(&ch->ch_neo_uart->lsr); - DPR_INTR(("%s:%d port: %d linestatus: %x\n", __FILE__, __LINE__, port, linestatus)); - ch->ch_cached_lsr |= linestatus; if (ch->ch_cached_lsr & UART_LSR_DR) { @@ -564,20 +552,9 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) ch->ch_intr_rx++; /* Read data from uart -> queue */ neo_copy_data_from_uart_to_queue(ch); - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); dgnc_check_queue_flow_control(ch); - DGNC_UNLOCK(ch->ch_lock, lock_flags); - } - - /* - * This is a special flag. It indicates that at least 1 - * RX error (parity, framing, or break) has happened. - * Mark this in our struct, which will tell me that I have - *to do the special RX+LSR read for this FIFO load. - */ - if (linestatus & UART_17158_RX_FIFO_DATA_ERROR) { - DPR_INTR(("%s:%d Port: %d Got an RX error, need to parse LSR\n", - __FILE__, __LINE__, port)); + spin_unlock_irqrestore(&ch->ch_lock, flags); } /* @@ -585,20 +562,14 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) * should encapsulate all 3... At least, thats what Exar says. */ - if (linestatus & UART_LSR_PE) { + if (linestatus & UART_LSR_PE) ch->ch_err_parity++; - DPR_INTR(("%s:%d Port: %d. PAR ERR!\n", __FILE__, __LINE__, port)); - } - if (linestatus & UART_LSR_FE) { + if (linestatus & UART_LSR_FE) ch->ch_err_frame++; - DPR_INTR(("%s:%d Port: %d. FRM ERR!\n", __FILE__, __LINE__, port)); - } - if (linestatus & UART_LSR_BI) { + if (linestatus & UART_LSR_BI) ch->ch_err_break++; - DPR_INTR(("%s:%d Port: %d. BRK INTR!\n", __FILE__, __LINE__, port)); - } if (linestatus & UART_LSR_OE) { /* @@ -608,24 +579,23 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) * Probably we should eventually have an orun stat in our driver... */ ch->ch_err_overrun++; - DPR_INTR(("%s:%d Port: %d. Rx Overrun!\n", __FILE__, __LINE__, port)); } if (linestatus & UART_LSR_THRE) { brd->intr_tx++; ch->ch_intr_tx++; - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); /* Transfer data (if any) from Write Queue -> UART. */ neo_copy_data_from_queue_to_uart(ch); } else if (linestatus & UART_17158_TX_AND_FIFO_CLR) { brd->intr_tx++; ch->ch_intr_tx++; - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); /* Transfer data (if any) from Write Queue -> UART. */ neo_copy_data_from_queue_to_uart(ch); @@ -639,10 +609,10 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) */ static void neo_param(struct tty_struct *tty) { - uchar lcr = 0; - uchar uart_lcr = 0; - uchar ier = 0; - uchar uart_ier = 0; + unsigned char lcr = 0; + unsigned char uart_lcr = 0; + unsigned char ier = 0; + unsigned char uart_ier = 0; uint baud = 9600; int quot = 0; struct dgnc_board *bd; @@ -664,16 +634,16 @@ static void neo_param(struct tty_struct *tty) if (!bd || bd->magic != DGNC_BOARD_MAGIC) return; - DPR_PARAM(("param start: tdev: %x cflags: %x oflags: %x iflags: %x\n", - ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag, ch->ch_c_iflag)); - /* * If baud rate is zero, flush queues, and set mval to drop DTR. */ if ((ch->ch_c_cflag & (CBAUD)) == 0) { - ch->ch_r_head = ch->ch_r_tail = 0; - ch->ch_e_head = ch->ch_e_tail = 0; - ch->ch_w_head = ch->ch_w_tail = 0; + ch->ch_r_head = 0; + ch->ch_r_tail = 0; + ch->ch_e_head = 0; + ch->ch_e_tail = 0; + ch->ch_w_head = 0; + ch->ch_w_tail = 0; neo_flush_uart_write(ch); neo_flush_uart_read(ch); @@ -742,13 +712,10 @@ static void neo_param(struct tty_struct *tty) jindex = baud; - if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16)) { + if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16)) baud = bauds[iindex][jindex]; - } else { - DPR_IOCTL(("baud indices were out of range (%d)(%d)", - iindex, jindex)); + else baud = 0; - } if (baud == 0) baud = 9600; @@ -802,7 +769,9 @@ static void neo_param(struct tty_struct *tty) break; } - ier = uart_ier = readb(&ch->ch_neo_uart->ier); + uart_ier = readb(&ch->ch_neo_uart->ier); + ier = uart_ier; + uart_lcr = readb(&ch->ch_neo_uart->lcr); if (baud == 0) @@ -895,7 +864,7 @@ static void neo_tasklet(unsigned long data) { struct dgnc_board *bd = (struct dgnc_board *) data; struct channel_t *ch; - ulong lock_flags; + unsigned long flags; int i; int state = 0; int ports = 0; @@ -906,16 +875,16 @@ static void neo_tasklet(unsigned long data) } /* Cache a couple board values */ - DGNC_LOCK(bd->bd_lock, lock_flags); + spin_lock_irqsave(&bd->bd_lock, flags); state = bd->state; ports = bd->nasync; - DGNC_UNLOCK(bd->bd_lock, lock_flags); + spin_unlock_irqrestore(&bd->bd_lock, flags); /* * Do NOT allow the interrupt routine to read the intr registers * Until we release this lock. */ - DGNC_LOCK(bd->bd_intr_lock, lock_flags); + spin_lock_irqsave(&bd->bd_intr_lock, flags); /* * If board is ready, parse deeper to see if there is anything to do. @@ -964,7 +933,7 @@ static void neo_tasklet(unsigned long data) } /* Allow interrupt routine to access the interrupt register again */ - DGNC_UNLOCK(bd->bd_intr_lock, lock_flags); + spin_unlock_irqrestore(&bd->bd_intr_lock, flags); } @@ -983,8 +952,8 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) int current_port; u32 tmp; u32 uart_poll; - unsigned long lock_flags; - unsigned long lock_flags2; + unsigned long flags; + unsigned long flags2; if (!brd) { APR(("Received interrupt (%d) with null board associated\n", irq)); @@ -1002,7 +971,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) brd->intr_count++; /* Lock out the slow poller from running on this board. */ - DGNC_LOCK(brd->bd_intr_lock, lock_flags); + spin_lock_irqsave(&brd->bd_intr_lock, flags); /* * Read in "extended" IRQ information from the 32bit Neo register. @@ -1011,15 +980,12 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) */ uart_poll = readl(brd->re_map_membase + UART_17158_POLL_ADDR_OFFSET); - DPR_INTR(("%s:%d uart_poll: %x\n", __FILE__, __LINE__, uart_poll)); - /* * If 0, no interrupts pending. * This can happen if the IRQ is shared among a couple Neo/Classic boards. */ if (!uart_poll) { - DPR_INTR(("Kernel interrupted to me, but no pending interrupts...\n")); - DGNC_UNLOCK(brd->bd_intr_lock, lock_flags); + spin_unlock_irqrestore(&brd->bd_intr_lock, flags); return IRQ_NONE; } @@ -1042,14 +1008,11 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) continue; } - DPR_INTR(("%s:%d port: %x type: %x\n", __FILE__, __LINE__, port, type)); - /* Remove this port + type from uart_poll */ uart_poll &= ~(dgnc_offset_table[port]); if (!type) { /* If no type, just ignore it, and move onto next port */ - DPR_INTR(("Interrupt with no type! port: %d\n", port)); continue; } @@ -1070,9 +1033,9 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) neo_copy_data_from_uart_to_queue(ch); /* Call our tty layer to enforce queue flow control if needed. */ - DGNC_LOCK(ch->ch_lock, lock_flags2); + spin_lock_irqsave(&ch->ch_lock, flags2); dgnc_check_queue_flow_control(ch); - DGNC_UNLOCK(ch->ch_lock, lock_flags2); + spin_unlock_irqrestore(&ch->ch_lock, flags2); continue; @@ -1113,7 +1076,6 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) * these once and awhile. * Its harmless, just ignore it and move on. */ - DPR_INTR(("%s:%d Unknown Interrupt type: %x\n", __FILE__, __LINE__, type)); continue; } } @@ -1123,9 +1085,8 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) */ tasklet_schedule(&brd->helper_tasklet); - DGNC_UNLOCK(brd->bd_intr_lock, lock_flags); + spin_unlock_irqrestore(&brd->bd_intr_lock, flags); - DPR_INTR(("dgnc_intr finish.\n")); return IRQ_HANDLED; } @@ -1137,7 +1098,8 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) */ static void neo_disable_receiver(struct channel_t *ch) { - uchar tmp = readb(&ch->ch_neo_uart->ier); + unsigned char tmp = readb(&ch->ch_neo_uart->ier); + tmp &= ~(UART_IER_RDI); writeb(tmp, &ch->ch_neo_uart->ier); neo_pci_posting_flush(ch->ch_bd); @@ -1151,7 +1113,8 @@ static void neo_disable_receiver(struct channel_t *ch) */ static void neo_enable_receiver(struct channel_t *ch) { - uchar tmp = readb(&ch->ch_neo_uart->ier); + unsigned char tmp = readb(&ch->ch_neo_uart->ier); + tmp |= (UART_IER_RDI); writeb(tmp, &ch->ch_neo_uart->ier); neo_pci_posting_flush(ch->ch_bd); @@ -1161,18 +1124,18 @@ static void neo_enable_receiver(struct channel_t *ch) static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) { int qleft = 0; - uchar linestatus = 0; - uchar error_mask = 0; + unsigned char linestatus = 0; + unsigned char error_mask = 0; int n = 0; int total = 0; ushort head; ushort tail; - ulong lock_flags; + unsigned long flags; if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) return; - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); /* cache head and tail of queue */ head = ch->ch_r_head & RQUEUEMASK; @@ -1323,7 +1286,8 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) * Discard character if we are ignoring the error mask. */ if (linestatus & error_mask) { - uchar discard; + unsigned char discard; + linestatus = 0; memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1); continue; @@ -1338,20 +1302,16 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) * I hope thats okay with everyone? Yes? Good. */ while (qleft < 1) { - DPR_READ(("Queue full, dropping DATA:%x LSR:%x\n", - ch->ch_rqueue[tail], ch->ch_equeue[tail])); - - ch->ch_r_tail = tail = (tail + 1) & RQUEUEMASK; + tail = (tail + 1) & RQUEUEMASK; + ch->ch_r_tail = tail; ch->ch_err_overrun++; qleft++; } memcpy_fromio(ch->ch_rqueue + head, &ch->ch_neo_uart->txrxburst, 1); - ch->ch_equeue[head] = (uchar) linestatus; + ch->ch_equeue[head] = (unsigned char) linestatus; dgnc_sniff_nowait_nolock(ch, "UART READ", ch->ch_rqueue + head, 1); - DPR_READ(("DATA/LSR pair: %x %x\n", ch->ch_rqueue[head], ch->ch_equeue[head])); - /* Ditch any remaining linestatus value. */ linestatus = 0; @@ -1368,7 +1328,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) ch->ch_r_head = head & RQUEUEMASK; ch->ch_e_head = head & EQUEUEMASK; - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); } @@ -1378,7 +1338,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) */ static int neo_drain(struct tty_struct *tty, uint seconds) { - ulong lock_flags; + unsigned long flags; struct channel_t *ch; struct un_t *un; int rc = 0; @@ -1394,11 +1354,9 @@ static int neo_drain(struct tty_struct *tty, uint seconds) if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) return -ENXIO; - DPR_IOCTL(("%d Drain wait started.\n", __LINE__)); - - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); un->un_flags |= UN_EMPTY; - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); /* * Go to sleep waiting for the tty layer to wake me back up when @@ -1409,11 +1367,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds) rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0)); /* If ret is non-zero, user ctrl-c'ed us */ - if (rc) - DPR_IOCTL(("%d Drain - User ctrl c'ed\n", __LINE__)); - else - DPR_IOCTL(("%d Drain wait finished.\n", __LINE__)); - return rc; } @@ -1425,7 +1378,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds) */ static void neo_flush_uart_write(struct channel_t *ch) { - uchar tmp = 0; + unsigned char tmp = 0; int i = 0; if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1438,10 +1391,9 @@ static void neo_flush_uart_write(struct channel_t *ch) /* Check to see if the UART feels it completely flushed the FIFO. */ tmp = readb(&ch->ch_neo_uart->isr_fcr); - if (tmp & 4) { - DPR_IOCTL(("Still flushing TX UART... i: %d\n", i)); + if (tmp & 4) udelay(10); - } else + else break; } @@ -1456,7 +1408,7 @@ static void neo_flush_uart_write(struct channel_t *ch) */ static void neo_flush_uart_read(struct channel_t *ch) { - uchar tmp = 0; + unsigned char tmp = 0; int i = 0; if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1469,10 +1421,9 @@ static void neo_flush_uart_read(struct channel_t *ch) /* Check to see if the UART feels it completely flushed the FIFO. */ tmp = readb(&ch->ch_neo_uart->isr_fcr); - if (tmp & 2) { - DPR_IOCTL(("Still flushing RX UART... i: %d\n", i)); + if (tmp & 2) udelay(10); - } else + else break; } } @@ -1486,22 +1437,22 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) int s; int qlen; uint len_written = 0; - ulong lock_flags; + unsigned long flags; if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) return; - DGNC_LOCK(ch->ch_lock, lock_flags); + spin_lock_irqsave(&ch->ch_lock, flags); /* No data to write to the UART */ if (ch->ch_w_tail == ch->ch_w_head) { - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); return; } /* If port is "stopped", don't send any data to the UART */ if ((ch->ch_flags & CH_FORCED_STOP) || (ch->ch_flags & CH_BREAK_SENDING)) { - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); return; } @@ -1509,7 +1460,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) * If FIFOs are disabled. Send data directly to txrx register */ if (!(ch->ch_flags & CH_FIFO_ENABLED)) { - uchar lsrbits = readb(&ch->ch_neo_uart->lsr); + unsigned char lsrbits = readb(&ch->ch_neo_uart->lsr); /* Cache the LSR bits for later parsing */ ch->ch_cached_lsr |= lsrbits; @@ -1540,12 +1491,11 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) } writeb(ch->ch_wqueue[ch->ch_w_tail], &ch->ch_neo_uart->txrx); - DPR_WRITE(("Tx data: %x\n", ch->ch_wqueue[ch->ch_w_head])); ch->ch_w_tail++; ch->ch_w_tail &= WQUEUEMASK; ch->ch_txcount++; } - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); return; } @@ -1554,7 +1504,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) */ if ((ch->ch_bd->dvid & 0xf0) < UART_XR17E158_DVID) { if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) { - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); return; } @@ -1563,7 +1513,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) n = readb(&ch->ch_neo_uart->tfifo); if ((unsigned int) n > ch->ch_t_tlevel) { - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); return; } @@ -1630,25 +1580,23 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } - DGNC_UNLOCK(ch->ch_lock, lock_flags); + spin_unlock_irqrestore(&ch->ch_lock, flags); } -static void neo_parse_modem(struct channel_t *ch, uchar signals) +static void neo_parse_modem(struct channel_t *ch, unsigned char signals) { - volatile uchar msignals = signals; + unsigned char msignals = signals; if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) return; - DPR_MSIGS(("neo_parse_modem: port: %d msignals: %x\n", ch->ch_portnum, msignals)); - /* * Do altpin switching. Altpin switches DCD and DSR. * This prolly breaks DSRPACE, so we should be more clever here. */ if (ch->ch_digi.digi_flags & DIGI_ALTPIN) { - uchar mswap = msignals; + unsigned char mswap = msignals; if (mswap & UART_MSR_DDCD) { msignals &= ~UART_MSR_DDCD; @@ -1690,22 +1638,13 @@ static void neo_parse_modem(struct channel_t *ch, uchar signals) ch->ch_mistat |= UART_MSR_CTS; else ch->ch_mistat &= ~UART_MSR_CTS; - - DPR_MSIGS(("Port: %d DTR: %d RTS: %d CTS: %d DSR: %d " "RI: %d CD: %d\n", - ch->ch_portnum, - !!((ch->ch_mistat | ch->ch_mostat) & UART_MCR_DTR), - !!((ch->ch_mistat | ch->ch_mostat) & UART_MCR_RTS), - !!((ch->ch_mistat | ch->ch_mostat) & UART_MSR_CTS), - !!((ch->ch_mistat | ch->ch_mostat) & UART_MSR_DSR), - !!((ch->ch_mistat | ch->ch_mostat) & UART_MSR_RI), - !!((ch->ch_mistat | ch->ch_mostat) & UART_MSR_DCD))); } /* Make the UART raise any of the output signals we want up */ static void neo_assert_modem_signals(struct channel_t *ch) { - uchar out; + unsigned char out; if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) return; @@ -1792,17 +1731,16 @@ static void neo_uart_off(struct channel_t *ch) static uint neo_get_uart_bytes_left(struct channel_t *ch) { - uchar left = 0; - uchar lsr = readb(&ch->ch_neo_uart->lsr); + unsigned char left = 0; + unsigned char lsr = readb(&ch->ch_neo_uart->lsr); /* We must cache the LSR as some of the bits get reset once read... */ ch->ch_cached_lsr |= lsr; /* Determine whether the Transmitter is empty or not */ if (!(lsr & UART_LSR_TEMT)) { - if (ch->ch_flags & CH_TX_FIFO_EMPTY) { + if (ch->ch_flags & CH_TX_FIFO_EMPTY) tasklet_schedule(&ch->ch_bd->helper_tasklet); - } left = 1; } else { ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); @@ -1821,12 +1759,12 @@ static void neo_send_break(struct channel_t *ch, int msecs) */ if (msecs == 0) { if (ch->ch_flags & CH_BREAK_SENDING) { - uchar temp = readb(&ch->ch_neo_uart->lcr); + unsigned char temp = readb(&ch->ch_neo_uart->lcr); + writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr); neo_pci_posting_flush(ch->ch_bd); ch->ch_flags &= ~(CH_BREAK_SENDING); ch->ch_stop_sending_break = 0; - DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n", jiffies)); } return; } @@ -1840,12 +1778,11 @@ static void neo_send_break(struct channel_t *ch, int msecs) /* Tell the UART to start sending the break */ if (!(ch->ch_flags & CH_BREAK_SENDING)) { - uchar temp = readb(&ch->ch_neo_uart->lcr); + unsigned char temp = readb(&ch->ch_neo_uart->lcr); + writeb((temp | UART_LCR_SBC), &ch->ch_neo_uart->lcr); neo_pci_posting_flush(ch->ch_bd); ch->ch_flags |= (CH_BREAK_SENDING); - DPR_IOCTL(("Port %d. Starting UART_LCR_SBC! start: %lx should end: %lx\n", - ch->ch_portnum, jiffies, ch->ch_stop_sending_break)); } } @@ -1929,8 +1866,8 @@ static void neo_vpd(struct dgnc_board *brd) if (((brd->vpd[0x08] != 0x82) /* long resource name tag */ && (brd->vpd[0x10] != 0x82)) /* long resource name tag (PCI-66 files)*/ - || (brd->vpd[0x7F] != 0x78)) /* small resource end tag */ - { + || (brd->vpd[0x7F] != 0x78)) { /* small resource end tag */ + memset(brd->vpd, '\0', NEO_VPD_IMAGESIZE); } else { /* Search for the serial number */ |