aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclinkmp.c
diff options
context:
space:
mode:
authorGreg KH <gregkh@suse.de>2005-09-12 15:45:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-12 15:45:04 -0400
commitd58dde0f552a5c5c4485b962d8b6e9dd54fefb30 (patch)
treed9a7e35eb88fea6265d5aadcc3d4ed39122b052a /drivers/char/synclinkmp.c
parent877599fdef5ea4a7dd1956e22fa9d6923add97f8 (diff)
parent2ade81473636b33aaac64495f89a7dc572c529f0 (diff)
Merge ../torvalds-2.6/
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r--drivers/char/synclinkmp.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 8982eafd0fb7..6fb165cf8a61 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: synclinkmp.c,v 4.34 2005/03/04 15:07:10 paulkf Exp $ 2 * $Id: synclinkmp.c,v 4.38 2005/07/15 13:29:44 paulkf Exp $
3 * 3 *
4 * Device driver for Microgate SyncLink Multiport 4 * Device driver for Microgate SyncLink Multiport
5 * high speed multiprotocol serial adapter. 5 * high speed multiprotocol serial adapter.
@@ -486,7 +486,7 @@ module_param_array(maxframe, int, NULL, 0);
486module_param_array(dosyncppp, int, NULL, 0); 486module_param_array(dosyncppp, int, NULL, 0);
487 487
488static char *driver_name = "SyncLink MultiPort driver"; 488static char *driver_name = "SyncLink MultiPort driver";
489static char *driver_version = "$Revision: 4.34 $"; 489static char *driver_version = "$Revision: 4.38 $";
490 490
491static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent); 491static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent);
492static void synclinkmp_remove_one(struct pci_dev *dev); 492static void synclinkmp_remove_one(struct pci_dev *dev);
@@ -555,7 +555,6 @@ static int set_txidle(SLMP_INFO *info, int idle_mode);
555static int tx_enable(SLMP_INFO *info, int enable); 555static int tx_enable(SLMP_INFO *info, int enable);
556static int tx_abort(SLMP_INFO *info); 556static int tx_abort(SLMP_INFO *info);
557static int rx_enable(SLMP_INFO *info, int enable); 557static int rx_enable(SLMP_INFO *info, int enable);
558static int map_status(int signals);
559static int modem_input_wait(SLMP_INFO *info,int arg); 558static int modem_input_wait(SLMP_INFO *info,int arg);
560static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr); 559static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr);
561static int tiocmget(struct tty_struct *tty, struct file *file); 560static int tiocmget(struct tty_struct *tty, struct file *file);
@@ -644,7 +643,7 @@ static unsigned char tx_active_fifo_level = 16; // tx request FIFO activation le
644static unsigned char tx_negate_fifo_level = 32; // tx request FIFO negation level in bytes 643static unsigned char tx_negate_fifo_level = 32; // tx request FIFO negation level in bytes
645 644
646static u32 misc_ctrl_value = 0x007e4040; 645static u32 misc_ctrl_value = 0x007e4040;
647static u32 lcr1_brdr_value = 0x00800029; 646static u32 lcr1_brdr_value = 0x00800028;
648 647
649static u32 read_ahead_count = 8; 648static u32 read_ahead_count = 8;
650 649
@@ -2749,6 +2748,8 @@ static int startup(SLMP_INFO * info)
2749 2748
2750 info->pending_bh = 0; 2749 info->pending_bh = 0;
2751 2750
2751 memset(&info->icount, 0, sizeof(info->icount));
2752
2752 /* program hardware for current parameters */ 2753 /* program hardware for current parameters */
2753 reset_port(info); 2754 reset_port(info);
2754 2755
@@ -2952,12 +2953,12 @@ static int get_stats(SLMP_INFO * info, struct mgsl_icount __user *user_icount)
2952 printk("%s(%d):%s get_params()\n", 2953 printk("%s(%d):%s get_params()\n",
2953 __FILE__,__LINE__, info->device_name); 2954 __FILE__,__LINE__, info->device_name);
2954 2955
2955 COPY_TO_USER(err,user_icount, &info->icount, sizeof(struct mgsl_icount)); 2956 if (!user_icount) {
2956 if (err) { 2957 memset(&info->icount, 0, sizeof(info->icount));
2957 if ( debug_level >= DEBUG_LEVEL_INFO ) 2958 } else {
2958 printk( "%s(%d):%s get_stats() user buffer copy failed\n", 2959 COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount));
2959 __FILE__,__LINE__,info->device_name); 2960 if (err)
2960 return -EFAULT; 2961 return -EFAULT;
2961 } 2962 }
2962 2963
2963 return 0; 2964 return 0;
@@ -3108,16 +3109,6 @@ static int rx_enable(SLMP_INFO * info, int enable)
3108 return 0; 3109 return 0;
3109} 3110}
3110 3111
3111static int map_status(int signals)
3112{
3113 /* Map status bits to API event bits */
3114
3115 return ((signals & SerialSignal_DSR) ? MgslEvent_DsrActive : MgslEvent_DsrInactive) +
3116 ((signals & SerialSignal_CTS) ? MgslEvent_CtsActive : MgslEvent_CtsInactive) +
3117 ((signals & SerialSignal_DCD) ? MgslEvent_DcdActive : MgslEvent_DcdInactive) +
3118 ((signals & SerialSignal_RI) ? MgslEvent_RiActive : MgslEvent_RiInactive);
3119}
3120
3121/* wait for specified event to occur 3112/* wait for specified event to occur
3122 */ 3113 */
3123static int wait_mgsl_event(SLMP_INFO * info, int __user *mask_ptr) 3114static int wait_mgsl_event(SLMP_INFO * info, int __user *mask_ptr)
@@ -3144,7 +3135,7 @@ static int wait_mgsl_event(SLMP_INFO * info, int __user *mask_ptr)
3144 3135
3145 /* return immediately if state matches requested events */ 3136 /* return immediately if state matches requested events */
3146 get_signals(info); 3137 get_signals(info);
3147 s = map_status(info->serial_signals); 3138 s = info->serial_signals;
3148 3139
3149 events = mask & 3140 events = mask &
3150 ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) + 3141 ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) +
@@ -4488,11 +4479,13 @@ void async_mode(SLMP_INFO *info)
4488 /* MD2, Mode Register 2 4479 /* MD2, Mode Register 2
4489 * 4480 *
4490 * 07..02 Reserved, must be 0 4481 * 07..02 Reserved, must be 0
4491 * 01..00 CNCT<1..0> Channel connection, 0=normal 4482 * 01..00 CNCT<1..0> Channel connection, 00=normal 11=local loopback
4492 * 4483 *
4493 * 0000 0000 4484 * 0000 0000
4494 */ 4485 */
4495 RegValue = 0x00; 4486 RegValue = 0x00;
4487 if (info->params.loopback)
4488 RegValue |= (BIT1 + BIT0);
4496 write_reg(info, MD2, RegValue); 4489 write_reg(info, MD2, RegValue);
4497 4490
4498 /* RXS, Receive clock source 4491 /* RXS, Receive clock source
@@ -4573,9 +4566,6 @@ void async_mode(SLMP_INFO *info)
4573 write_reg(info, IE2, info->ie2_value); 4566 write_reg(info, IE2, info->ie2_value);
4574 4567
4575 set_rate( info, info->params.data_rate * 16 ); 4568 set_rate( info, info->params.data_rate * 16 );
4576
4577 if (info->params.loopback)
4578 enable_loopback(info,1);
4579} 4569}
4580 4570
4581/* Program the SCA for HDLC communications. 4571/* Program the SCA for HDLC communications.