diff options
Diffstat (limited to 'drivers/serial/crisv10.c')
-rw-r--r-- | drivers/serial/crisv10.c | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 3e0366eab412..8249ac490559 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -968,7 +968,7 @@ static DEFINE_MUTEX(tmp_buf_mutex); | |||
968 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ | 968 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ |
969 | static void update_char_time(struct e100_serial * info) | 969 | static void update_char_time(struct e100_serial * info) |
970 | { | 970 | { |
971 | tcflag_t cflags = info->tty->termios->c_cflag; | 971 | tcflag_t cflags = info->port.tty->termios->c_cflag; |
972 | int bits; | 972 | int bits; |
973 | 973 | ||
974 | /* calc. number of bits / data byte */ | 974 | /* calc. number of bits / data byte */ |
@@ -1483,7 +1483,8 @@ rs_stop(struct tty_struct *tty) | |||
1483 | CIRC_CNT(info->xmit.head, | 1483 | CIRC_CNT(info->xmit.head, |
1484 | info->xmit.tail,SERIAL_XMIT_SIZE))); | 1484 | info->xmit.tail,SERIAL_XMIT_SIZE))); |
1485 | 1485 | ||
1486 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); | 1486 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, |
1487 | STOP_CHAR(info->port.tty)); | ||
1487 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); | 1488 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); |
1488 | if (tty->termios->c_iflag & IXON ) { | 1489 | if (tty->termios->c_iflag & IXON ) { |
1489 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); | 1490 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); |
@@ -1772,7 +1773,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl | |||
1772 | 1773 | ||
1773 | info->icount.rx++; | 1774 | info->icount.rx++; |
1774 | } else { | 1775 | } else { |
1775 | struct tty_struct *tty = info->tty; | 1776 | struct tty_struct *tty = info->port.tty; |
1776 | tty_insert_flip_char(tty, data, flag); | 1777 | tty_insert_flip_char(tty, data, flag); |
1777 | info->icount.rx++; | 1778 | info->icount.rx++; |
1778 | } | 1779 | } |
@@ -1838,7 +1839,7 @@ static unsigned int handle_all_descr_data(struct e100_serial *info) | |||
1838 | descr->status = 0; | 1839 | descr->status = 0; |
1839 | 1840 | ||
1840 | DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); | 1841 | DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); |
1841 | if (info->tty->stopped) { | 1842 | if (info->port.tty->stopped) { |
1842 | unsigned char *buf = phys_to_virt(descr->buf); | 1843 | unsigned char *buf = phys_to_virt(descr->buf); |
1843 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); | 1844 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); |
1844 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); | 1845 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); |
@@ -1872,7 +1873,7 @@ static void receive_chars_dma(struct e100_serial *info) | |||
1872 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | | 1873 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | |
1873 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); | 1874 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); |
1874 | 1875 | ||
1875 | tty = info->tty; | 1876 | tty = info->port.tty; |
1876 | if (!tty) /* Something wrong... */ | 1877 | if (!tty) /* Something wrong... */ |
1877 | return; | 1878 | return; |
1878 | 1879 | ||
@@ -2122,7 +2123,7 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2122 | unsigned long flags; | 2123 | unsigned long flags; |
2123 | 2124 | ||
2124 | local_irq_save(flags); | 2125 | local_irq_save(flags); |
2125 | tty = info->tty; | 2126 | tty = info->port.tty; |
2126 | 2127 | ||
2127 | if (!tty) { | 2128 | if (!tty) { |
2128 | local_irq_restore(flags); | 2129 | local_irq_restore(flags); |
@@ -2287,7 +2288,7 @@ static | |||
2287 | struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) | 2288 | struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) |
2288 | { | 2289 | { |
2289 | unsigned long data_read; | 2290 | unsigned long data_read; |
2290 | struct tty_struct *tty = info->tty; | 2291 | struct tty_struct *tty = info->port.tty; |
2291 | 2292 | ||
2292 | if (!tty) { | 2293 | if (!tty) { |
2293 | printk("!NO TTY!\n"); | 2294 | printk("!NO TTY!\n"); |
@@ -2350,7 +2351,7 @@ more_data: | |||
2350 | data_in, data_read); | 2351 | data_in, data_read); |
2351 | char flag = TTY_NORMAL; | 2352 | char flag = TTY_NORMAL; |
2352 | if (info->errorcode == ERRCODE_INSERT_BREAK) { | 2353 | if (info->errorcode == ERRCODE_INSERT_BREAK) { |
2353 | struct tty_struct *tty = info->tty; | 2354 | struct tty_struct *tty = info->port.tty; |
2354 | tty_insert_flip_char(tty, 0, flag); | 2355 | tty_insert_flip_char(tty, 0, flag); |
2355 | info->icount.rx++; | 2356 | info->icount.rx++; |
2356 | } | 2357 | } |
@@ -2396,7 +2397,7 @@ more_data: | |||
2396 | goto more_data; | 2397 | goto more_data; |
2397 | } | 2398 | } |
2398 | 2399 | ||
2399 | tty_flip_buffer_push(info->tty); | 2400 | tty_flip_buffer_push(info->port.tty); |
2400 | return info; | 2401 | return info; |
2401 | } | 2402 | } |
2402 | 2403 | ||
@@ -2547,8 +2548,8 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2547 | rstat = info->port[REG_STATUS]; | 2548 | rstat = info->port[REG_STATUS]; |
2548 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2549 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2549 | e100_disable_serial_tx_ready_irq(info); | 2550 | e100_disable_serial_tx_ready_irq(info); |
2550 | if (info->tty->stopped) | 2551 | if (info->port.tty->stopped) |
2551 | rs_stop(info->tty); | 2552 | rs_stop(info->port.tty); |
2552 | /* Enable the DMA channel and tell it to continue */ | 2553 | /* Enable the DMA channel and tell it to continue */ |
2553 | e100_enable_txdma_channel(info); | 2554 | e100_enable_txdma_channel(info); |
2554 | /* Wait 12 cycles before doing the DMA command */ | 2555 | /* Wait 12 cycles before doing the DMA command */ |
@@ -2561,9 +2562,10 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2561 | } | 2562 | } |
2562 | /* Normal char-by-char interrupt */ | 2563 | /* Normal char-by-char interrupt */ |
2563 | if (info->xmit.head == info->xmit.tail | 2564 | if (info->xmit.head == info->xmit.tail |
2564 | || info->tty->stopped | 2565 | || info->port.tty->stopped |
2565 | || info->tty->hw_stopped) { | 2566 | || info->port.tty->hw_stopped) { |
2566 | DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", info->tty->stopped)); | 2567 | DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", |
2568 | info->port.tty->stopped)); | ||
2567 | e100_disable_serial_tx_ready_irq(info); | 2569 | e100_disable_serial_tx_ready_irq(info); |
2568 | info->tr_running = 0; | 2570 | info->tr_running = 0; |
2569 | return; | 2571 | return; |
@@ -2725,7 +2727,7 @@ do_softint(struct work_struct *work) | |||
2725 | 2727 | ||
2726 | info = container_of(work, struct e100_serial, work); | 2728 | info = container_of(work, struct e100_serial, work); |
2727 | 2729 | ||
2728 | tty = info->tty; | 2730 | tty = info->port.tty; |
2729 | if (!tty) | 2731 | if (!tty) |
2730 | return; | 2732 | return; |
2731 | 2733 | ||
@@ -2767,8 +2769,8 @@ startup(struct e100_serial * info) | |||
2767 | /* Bits and pieces collected from below. Better to have them | 2769 | /* Bits and pieces collected from below. Better to have them |
2768 | in one ifdef:ed clause than to mix in a lot of ifdefs, | 2770 | in one ifdef:ed clause than to mix in a lot of ifdefs, |
2769 | right? */ | 2771 | right? */ |
2770 | if (info->tty) | 2772 | if (info->port.tty) |
2771 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2773 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2772 | 2774 | ||
2773 | info->xmit.head = info->xmit.tail = 0; | 2775 | info->xmit.head = info->xmit.tail = 0; |
2774 | info->first_recv_buffer = info->last_recv_buffer = NULL; | 2776 | info->first_recv_buffer = info->last_recv_buffer = NULL; |
@@ -2825,8 +2827,8 @@ startup(struct e100_serial * info) | |||
2825 | e100_disable_txdma_channel(info); | 2827 | e100_disable_txdma_channel(info); |
2826 | } | 2828 | } |
2827 | 2829 | ||
2828 | if (info->tty) | 2830 | if (info->port.tty) |
2829 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2831 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2830 | 2832 | ||
2831 | info->xmit.head = info->xmit.tail = 0; | 2833 | info->xmit.head = info->xmit.tail = 0; |
2832 | info->first_recv_buffer = info->last_recv_buffer = NULL; | 2834 | info->first_recv_buffer = info->last_recv_buffer = NULL; |
@@ -2940,14 +2942,14 @@ shutdown(struct e100_serial * info) | |||
2940 | descr[i].buf = 0; | 2942 | descr[i].buf = 0; |
2941 | } | 2943 | } |
2942 | 2944 | ||
2943 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { | 2945 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) { |
2944 | /* hang up DTR and RTS if HUPCL is enabled */ | 2946 | /* hang up DTR and RTS if HUPCL is enabled */ |
2945 | e100_dtr(info, 0); | 2947 | e100_dtr(info, 0); |
2946 | e100_rts(info, 0); /* could check CRTSCTS before doing this */ | 2948 | e100_rts(info, 0); /* could check CRTSCTS before doing this */ |
2947 | } | 2949 | } |
2948 | 2950 | ||
2949 | if (info->tty) | 2951 | if (info->port.tty) |
2950 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2952 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2951 | 2953 | ||
2952 | info->flags &= ~ASYNC_INITIALIZED; | 2954 | info->flags &= ~ASYNC_INITIALIZED; |
2953 | local_irq_restore(flags); | 2955 | local_irq_restore(flags); |
@@ -2964,12 +2966,12 @@ change_speed(struct e100_serial *info) | |||
2964 | unsigned long flags; | 2966 | unsigned long flags; |
2965 | /* first some safety checks */ | 2967 | /* first some safety checks */ |
2966 | 2968 | ||
2967 | if (!info->tty || !info->tty->termios) | 2969 | if (!info->port.tty || !info->port.tty->termios) |
2968 | return; | 2970 | return; |
2969 | if (!info->port) | 2971 | if (!info->port) |
2970 | return; | 2972 | return; |
2971 | 2973 | ||
2972 | cflag = info->tty->termios->c_cflag; | 2974 | cflag = info->port.tty->termios->c_cflag; |
2973 | 2975 | ||
2974 | /* possibly, the tx/rx should be disabled first to do this safely */ | 2976 | /* possibly, the tx/rx should be disabled first to do this safely */ |
2975 | 2977 | ||
@@ -3097,10 +3099,11 @@ change_speed(struct e100_serial *info) | |||
3097 | 3099 | ||
3098 | info->port[REG_TR_CTRL] = info->tx_ctrl; | 3100 | info->port[REG_TR_CTRL] = info->tx_ctrl; |
3099 | info->port[REG_REC_CTRL] = info->rx_ctrl; | 3101 | info->port[REG_REC_CTRL] = info->rx_ctrl; |
3100 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); | 3102 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty)); |
3101 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); | 3103 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); |
3102 | if (info->tty->termios->c_iflag & IXON ) { | 3104 | if (info->port.tty->termios->c_iflag & IXON ) { |
3103 | DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", STOP_CHAR(info->tty))); | 3105 | DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", |
3106 | STOP_CHAR(info->port.tty))); | ||
3104 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); | 3107 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); |
3105 | } | 3108 | } |
3106 | 3109 | ||
@@ -3475,7 +3478,7 @@ set_serial_info(struct e100_serial *info, | |||
3475 | info->type = new_serial.type; | 3478 | info->type = new_serial.type; |
3476 | info->close_delay = new_serial.close_delay; | 3479 | info->close_delay = new_serial.close_delay; |
3477 | info->closing_wait = new_serial.closing_wait; | 3480 | info->closing_wait = new_serial.closing_wait; |
3478 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 3481 | info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
3479 | 3482 | ||
3480 | check_and_exit: | 3483 | check_and_exit: |
3481 | if (info->flags & ASYNC_INITIALIZED) { | 3484 | if (info->flags & ASYNC_INITIALIZED) { |
@@ -3811,7 +3814,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
3811 | tty_ldisc_flush(tty); | 3814 | tty_ldisc_flush(tty); |
3812 | tty->closing = 0; | 3815 | tty->closing = 0; |
3813 | info->event = 0; | 3816 | info->event = 0; |
3814 | info->tty = 0; | 3817 | info->port.tty = NULL; |
3815 | if (info->blocked_open) { | 3818 | if (info->blocked_open) { |
3816 | if (info->close_delay) | 3819 | if (info->close_delay) |
3817 | schedule_timeout_interruptible(info->close_delay); | 3820 | schedule_timeout_interruptible(info->close_delay); |
@@ -3915,7 +3918,7 @@ rs_hangup(struct tty_struct *tty) | |||
3915 | info->event = 0; | 3918 | info->event = 0; |
3916 | info->count = 0; | 3919 | info->count = 0; |
3917 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 3920 | info->flags &= ~ASYNC_NORMAL_ACTIVE; |
3918 | info->tty = 0; | 3921 | info->port.tty = NULL; |
3919 | wake_up_interruptible(&info->open_wait); | 3922 | wake_up_interruptible(&info->open_wait); |
3920 | } | 3923 | } |
3921 | 3924 | ||
@@ -4077,9 +4080,9 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4077 | 4080 | ||
4078 | info->count++; | 4081 | info->count++; |
4079 | tty->driver_data = info; | 4082 | tty->driver_data = info; |
4080 | info->tty = tty; | 4083 | info->port.tty = tty; |
4081 | 4084 | ||
4082 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 4085 | info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
4083 | 4086 | ||
4084 | if (!tmp_buf) { | 4087 | if (!tmp_buf) { |
4085 | page = get_zeroed_page(GFP_KERNEL); | 4088 | page = get_zeroed_page(GFP_KERNEL); |
@@ -4267,14 +4270,14 @@ static int line_info(char *buf, struct e100_serial *info) | |||
4267 | (unsigned long)info->max_recv_cnt); | 4270 | (unsigned long)info->max_recv_cnt); |
4268 | 4271 | ||
4269 | #if 1 | 4272 | #if 1 |
4270 | if (info->tty) { | 4273 | if (info->port.tty) { |
4271 | 4274 | ||
4272 | if (info->tty->stopped) | 4275 | if (info->port.tty->stopped) |
4273 | ret += sprintf(buf+ret, " stopped:%i", | 4276 | ret += sprintf(buf+ret, " stopped:%i", |
4274 | (int)info->tty->stopped); | 4277 | (int)info->port.tty->stopped); |
4275 | if (info->tty->hw_stopped) | 4278 | if (info->port.tty->hw_stopped) |
4276 | ret += sprintf(buf+ret, " hw_stopped:%i", | 4279 | ret += sprintf(buf+ret, " hw_stopped:%i", |
4277 | (int)info->tty->hw_stopped); | 4280 | (int)info->port.tty->hw_stopped); |
4278 | } | 4281 | } |
4279 | 4282 | ||
4280 | { | 4283 | { |
@@ -4465,7 +4468,7 @@ rs_init(void) | |||
4465 | info->uses_dma_in = 0; | 4468 | info->uses_dma_in = 0; |
4466 | info->uses_dma_out = 0; | 4469 | info->uses_dma_out = 0; |
4467 | info->line = i; | 4470 | info->line = i; |
4468 | info->tty = 0; | 4471 | info->port.tty = NULL; |
4469 | info->type = PORT_ETRAX; | 4472 | info->type = PORT_ETRAX; |
4470 | info->tr_running = 0; | 4473 | info->tr_running = 0; |
4471 | info->forced_eop = 0; | 4474 | info->forced_eop = 0; |