diff options
Diffstat (limited to 'drivers/tty/synclink.c')
-rw-r--r-- | drivers/tty/synclink.c | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index 593d40ad0a6b..70e3a525bc82 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c | |||
@@ -1359,7 +1359,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1359 | } | 1359 | } |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | if ( (info->port.flags & ASYNC_CTS_FLOW) && | 1362 | if (tty_port_cts_enabled(&info->port) && |
1363 | (status & MISCSTATUS_CTS_LATCHED) ) { | 1363 | (status & MISCSTATUS_CTS_LATCHED) ) { |
1364 | if (info->port.tty->hw_stopped) { | 1364 | if (info->port.tty->hw_stopped) { |
1365 | if (status & MISCSTATUS_CTS) { | 1365 | if (status & MISCSTATUS_CTS) { |
@@ -1840,22 +1840,22 @@ static void shutdown(struct mgsl_struct * info) | |||
1840 | usc_DisableInterrupts(info,RECEIVE_DATA + RECEIVE_STATUS + | 1840 | usc_DisableInterrupts(info,RECEIVE_DATA + RECEIVE_STATUS + |
1841 | TRANSMIT_DATA + TRANSMIT_STATUS + IO_PIN + MISC ); | 1841 | TRANSMIT_DATA + TRANSMIT_STATUS + IO_PIN + MISC ); |
1842 | usc_DisableDmaInterrupts(info,DICR_MASTER + DICR_TRANSMIT + DICR_RECEIVE); | 1842 | usc_DisableDmaInterrupts(info,DICR_MASTER + DICR_TRANSMIT + DICR_RECEIVE); |
1843 | 1843 | ||
1844 | /* Disable DMAEN (Port 7, Bit 14) */ | 1844 | /* Disable DMAEN (Port 7, Bit 14) */ |
1845 | /* This disconnects the DMA request signal from the ISA bus */ | 1845 | /* This disconnects the DMA request signal from the ISA bus */ |
1846 | /* on the ISA adapter. This has no effect for the PCI adapter */ | 1846 | /* on the ISA adapter. This has no effect for the PCI adapter */ |
1847 | usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT15) | BIT14)); | 1847 | usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT15) | BIT14)); |
1848 | 1848 | ||
1849 | /* Disable INTEN (Port 6, Bit12) */ | 1849 | /* Disable INTEN (Port 6, Bit12) */ |
1850 | /* This disconnects the IRQ request signal to the ISA bus */ | 1850 | /* This disconnects the IRQ request signal to the ISA bus */ |
1851 | /* on the ISA adapter. This has no effect for the PCI adapter */ | 1851 | /* on the ISA adapter. This has no effect for the PCI adapter */ |
1852 | usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); | 1852 | usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); |
1853 | 1853 | ||
1854 | if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { | 1854 | if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { |
1855 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); | 1855 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); |
1856 | usc_set_serial_signals(info); | 1856 | usc_set_serial_signals(info); |
1857 | } | 1857 | } |
1858 | 1858 | ||
1859 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 1859 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
1860 | 1860 | ||
1861 | mgsl_release_resources(info); | 1861 | mgsl_release_resources(info); |
@@ -1895,7 +1895,7 @@ static void mgsl_program_hw(struct mgsl_struct *info) | |||
1895 | usc_EnableInterrupts(info, IO_PIN); | 1895 | usc_EnableInterrupts(info, IO_PIN); |
1896 | usc_get_serial_signals(info); | 1896 | usc_get_serial_signals(info); |
1897 | 1897 | ||
1898 | if (info->netcount || info->port.tty->termios->c_cflag & CREAD) | 1898 | if (info->netcount || info->port.tty->termios.c_cflag & CREAD) |
1899 | usc_start_receiver(info); | 1899 | usc_start_receiver(info); |
1900 | 1900 | ||
1901 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 1901 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
@@ -1908,14 +1908,14 @@ static void mgsl_change_params(struct mgsl_struct *info) | |||
1908 | unsigned cflag; | 1908 | unsigned cflag; |
1909 | int bits_per_char; | 1909 | int bits_per_char; |
1910 | 1910 | ||
1911 | if (!info->port.tty || !info->port.tty->termios) | 1911 | if (!info->port.tty) |
1912 | return; | 1912 | return; |
1913 | 1913 | ||
1914 | if (debug_level >= DEBUG_LEVEL_INFO) | 1914 | if (debug_level >= DEBUG_LEVEL_INFO) |
1915 | printk("%s(%d):mgsl_change_params(%s)\n", | 1915 | printk("%s(%d):mgsl_change_params(%s)\n", |
1916 | __FILE__,__LINE__, info->device_name ); | 1916 | __FILE__,__LINE__, info->device_name ); |
1917 | 1917 | ||
1918 | cflag = info->port.tty->termios->c_cflag; | 1918 | cflag = info->port.tty->termios.c_cflag; |
1919 | 1919 | ||
1920 | /* if B0 rate (hangup) specified then negate DTR and RTS */ | 1920 | /* if B0 rate (hangup) specified then negate DTR and RTS */ |
1921 | /* otherwise assert DTR and RTS */ | 1921 | /* otherwise assert DTR and RTS */ |
@@ -2367,8 +2367,8 @@ static void mgsl_throttle(struct tty_struct * tty) | |||
2367 | 2367 | ||
2368 | if (I_IXOFF(tty)) | 2368 | if (I_IXOFF(tty)) |
2369 | mgsl_send_xchar(tty, STOP_CHAR(tty)); | 2369 | mgsl_send_xchar(tty, STOP_CHAR(tty)); |
2370 | 2370 | ||
2371 | if (tty->termios->c_cflag & CRTSCTS) { | 2371 | if (tty->termios.c_cflag & CRTSCTS) { |
2372 | spin_lock_irqsave(&info->irq_spinlock,flags); | 2372 | spin_lock_irqsave(&info->irq_spinlock,flags); |
2373 | info->serial_signals &= ~SerialSignal_RTS; | 2373 | info->serial_signals &= ~SerialSignal_RTS; |
2374 | usc_set_serial_signals(info); | 2374 | usc_set_serial_signals(info); |
@@ -2401,8 +2401,8 @@ static void mgsl_unthrottle(struct tty_struct * tty) | |||
2401 | else | 2401 | else |
2402 | mgsl_send_xchar(tty, START_CHAR(tty)); | 2402 | mgsl_send_xchar(tty, START_CHAR(tty)); |
2403 | } | 2403 | } |
2404 | 2404 | ||
2405 | if (tty->termios->c_cflag & CRTSCTS) { | 2405 | if (tty->termios.c_cflag & CRTSCTS) { |
2406 | spin_lock_irqsave(&info->irq_spinlock,flags); | 2406 | spin_lock_irqsave(&info->irq_spinlock,flags); |
2407 | info->serial_signals |= SerialSignal_RTS; | 2407 | info->serial_signals |= SerialSignal_RTS; |
2408 | usc_set_serial_signals(info); | 2408 | usc_set_serial_signals(info); |
@@ -3045,7 +3045,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio | |||
3045 | 3045 | ||
3046 | /* Handle transition to B0 status */ | 3046 | /* Handle transition to B0 status */ |
3047 | if (old_termios->c_cflag & CBAUD && | 3047 | if (old_termios->c_cflag & CBAUD && |
3048 | !(tty->termios->c_cflag & CBAUD)) { | 3048 | !(tty->termios.c_cflag & CBAUD)) { |
3049 | info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); | 3049 | info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); |
3050 | spin_lock_irqsave(&info->irq_spinlock,flags); | 3050 | spin_lock_irqsave(&info->irq_spinlock,flags); |
3051 | usc_set_serial_signals(info); | 3051 | usc_set_serial_signals(info); |
@@ -3054,9 +3054,9 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio | |||
3054 | 3054 | ||
3055 | /* Handle transition away from B0 status */ | 3055 | /* Handle transition away from B0 status */ |
3056 | if (!(old_termios->c_cflag & CBAUD) && | 3056 | if (!(old_termios->c_cflag & CBAUD) && |
3057 | tty->termios->c_cflag & CBAUD) { | 3057 | tty->termios.c_cflag & CBAUD) { |
3058 | info->serial_signals |= SerialSignal_DTR; | 3058 | info->serial_signals |= SerialSignal_DTR; |
3059 | if (!(tty->termios->c_cflag & CRTSCTS) || | 3059 | if (!(tty->termios.c_cflag & CRTSCTS) || |
3060 | !test_bit(TTY_THROTTLED, &tty->flags)) { | 3060 | !test_bit(TTY_THROTTLED, &tty->flags)) { |
3061 | info->serial_signals |= SerialSignal_RTS; | 3061 | info->serial_signals |= SerialSignal_RTS; |
3062 | } | 3062 | } |
@@ -3067,7 +3067,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio | |||
3067 | 3067 | ||
3068 | /* Handle turning off CRTSCTS */ | 3068 | /* Handle turning off CRTSCTS */ |
3069 | if (old_termios->c_cflag & CRTSCTS && | 3069 | if (old_termios->c_cflag & CRTSCTS && |
3070 | !(tty->termios->c_cflag & CRTSCTS)) { | 3070 | !(tty->termios.c_cflag & CRTSCTS)) { |
3071 | tty->hw_stopped = 0; | 3071 | tty->hw_stopped = 0; |
3072 | mgsl_start(tty); | 3072 | mgsl_start(tty); |
3073 | } | 3073 | } |
@@ -3287,7 +3287,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3287 | return 0; | 3287 | return 0; |
3288 | } | 3288 | } |
3289 | 3289 | ||
3290 | if (tty->termios->c_cflag & CLOCAL) | 3290 | if (tty->termios.c_cflag & CLOCAL) |
3291 | do_clocal = true; | 3291 | do_clocal = true; |
3292 | 3292 | ||
3293 | /* Wait for carrier detect and the line to become | 3293 | /* Wait for carrier detect and the line to become |
@@ -3313,7 +3313,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3313 | port->blocked_open++; | 3313 | port->blocked_open++; |
3314 | 3314 | ||
3315 | while (1) { | 3315 | while (1) { |
3316 | if (tty->termios->c_cflag & CBAUD) | 3316 | if (tty->termios.c_cflag & CBAUD) |
3317 | tty_port_raise_dtr_rts(port); | 3317 | tty_port_raise_dtr_rts(port); |
3318 | 3318 | ||
3319 | set_current_state(TASK_INTERRUPTIBLE); | 3319 | set_current_state(TASK_INTERRUPTIBLE); |
@@ -3338,9 +3338,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3338 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", | 3338 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", |
3339 | __FILE__,__LINE__, tty->driver->name, port->count ); | 3339 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3340 | 3340 | ||
3341 | tty_unlock(); | 3341 | tty_unlock(tty); |
3342 | schedule(); | 3342 | schedule(); |
3343 | tty_lock(); | 3343 | tty_lock(tty); |
3344 | } | 3344 | } |
3345 | 3345 | ||
3346 | set_current_state(TASK_RUNNING); | 3346 | set_current_state(TASK_RUNNING); |
@@ -3362,6 +3362,29 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3362 | 3362 | ||
3363 | } /* end of block_til_ready() */ | 3363 | } /* end of block_til_ready() */ |
3364 | 3364 | ||
3365 | static int mgsl_install(struct tty_driver *driver, struct tty_struct *tty) | ||
3366 | { | ||
3367 | struct mgsl_struct *info; | ||
3368 | int line = tty->index; | ||
3369 | |||
3370 | /* verify range of specified line number */ | ||
3371 | if (line >= mgsl_device_count) { | ||
3372 | printk("%s(%d):mgsl_open with invalid line #%d.\n", | ||
3373 | __FILE__, __LINE__, line); | ||
3374 | return -ENODEV; | ||
3375 | } | ||
3376 | |||
3377 | /* find the info structure for the specified line */ | ||
3378 | info = mgsl_device_list; | ||
3379 | while (info && info->line != line) | ||
3380 | info = info->next_device; | ||
3381 | if (mgsl_paranoia_check(info, tty->name, "mgsl_open")) | ||
3382 | return -ENODEV; | ||
3383 | tty->driver_data = info; | ||
3384 | |||
3385 | return tty_port_install(&info->port, driver, tty); | ||
3386 | } | ||
3387 | |||
3365 | /* mgsl_open() | 3388 | /* mgsl_open() |
3366 | * | 3389 | * |
3367 | * Called when a port is opened. Init and enable port. | 3390 | * Called when a port is opened. Init and enable port. |
@@ -3374,26 +3397,10 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3374 | */ | 3397 | */ |
3375 | static int mgsl_open(struct tty_struct *tty, struct file * filp) | 3398 | static int mgsl_open(struct tty_struct *tty, struct file * filp) |
3376 | { | 3399 | { |
3377 | struct mgsl_struct *info; | 3400 | struct mgsl_struct *info = tty->driver_data; |
3378 | int retval, line; | ||
3379 | unsigned long flags; | 3401 | unsigned long flags; |
3402 | int retval; | ||
3380 | 3403 | ||
3381 | /* verify range of specified line number */ | ||
3382 | line = tty->index; | ||
3383 | if (line >= mgsl_device_count) { | ||
3384 | printk("%s(%d):mgsl_open with invalid line #%d.\n", | ||
3385 | __FILE__,__LINE__,line); | ||
3386 | return -ENODEV; | ||
3387 | } | ||
3388 | |||
3389 | /* find the info structure for the specified line */ | ||
3390 | info = mgsl_device_list; | ||
3391 | while(info && info->line != line) | ||
3392 | info = info->next_device; | ||
3393 | if (mgsl_paranoia_check(info, tty->name, "mgsl_open")) | ||
3394 | return -ENODEV; | ||
3395 | |||
3396 | tty->driver_data = info; | ||
3397 | info->port.tty = tty; | 3404 | info->port.tty = tty; |
3398 | 3405 | ||
3399 | if (debug_level >= DEBUG_LEVEL_INFO) | 3406 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -4297,6 +4304,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4297 | } /* end of mgsl_allocate_device()*/ | 4304 | } /* end of mgsl_allocate_device()*/ |
4298 | 4305 | ||
4299 | static const struct tty_operations mgsl_ops = { | 4306 | static const struct tty_operations mgsl_ops = { |
4307 | .install = mgsl_install, | ||
4300 | .open = mgsl_open, | 4308 | .open = mgsl_open, |
4301 | .close = mgsl_close, | 4309 | .close = mgsl_close, |
4302 | .write = mgsl_write, | 4310 | .write = mgsl_write, |