diff options
author | Dave Jones <davej@redhat.com> | 2006-12-12 18:13:32 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-12-12 18:13:32 -0500 |
commit | f0eef25339f92f7cd4aeea23d9ae97987a5a1e82 (patch) | |
tree | 2472e94d39f43a9580a6d2d5d92de0b749023263 /drivers/char/synclink.c | |
parent | 0cfea5dd98205f2fa318836da664a7d7df1afbc1 (diff) | |
parent | e1036502e5263851259d147771226161e5ccc85a (diff) |
Merge ../linus
Diffstat (limited to 'drivers/char/synclink.c')
-rw-r--r-- | drivers/char/synclink.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 78b1b1a2732b..acc6fab601cc 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #define MAX_PCI_DEVICES 10 | 63 | #define MAX_PCI_DEVICES 10 |
64 | #define MAX_TOTAL_DEVICES 20 | 64 | #define MAX_TOTAL_DEVICES 20 |
65 | 65 | ||
66 | #include <linux/config.h> | ||
67 | #include <linux/module.h> | 66 | #include <linux/module.h> |
68 | #include <linux/errno.h> | 67 | #include <linux/errno.h> |
69 | #include <linux/signal.h> | 68 | #include <linux/signal.h> |
@@ -87,7 +86,6 @@ | |||
87 | 86 | ||
88 | #include <linux/vmalloc.h> | 87 | #include <linux/vmalloc.h> |
89 | #include <linux/init.h> | 88 | #include <linux/init.h> |
90 | #include <asm/serial.h> | ||
91 | 89 | ||
92 | #include <linux/delay.h> | 90 | #include <linux/delay.h> |
93 | #include <linux/ioctl.h> | 91 | #include <linux/ioctl.h> |
@@ -103,8 +101,10 @@ | |||
103 | #include <linux/hdlc.h> | 101 | #include <linux/hdlc.h> |
104 | #include <linux/dma-mapping.h> | 102 | #include <linux/dma-mapping.h> |
105 | 103 | ||
106 | #ifdef CONFIG_HDLC_MODULE | 104 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_MODULE)) |
107 | #define CONFIG_HDLC 1 | 105 | #define SYNCLINK_GENERIC_HDLC 1 |
106 | #else | ||
107 | #define SYNCLINK_GENERIC_HDLC 0 | ||
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | #define GET_USER(error,value,addr) error = get_user(value,addr) | 110 | #define GET_USER(error,value,addr) error = get_user(value,addr) |
@@ -135,8 +135,8 @@ static MGSL_PARAMS default_params = { | |||
135 | }; | 135 | }; |
136 | 136 | ||
137 | #define SHARED_MEM_ADDRESS_SIZE 0x40000 | 137 | #define SHARED_MEM_ADDRESS_SIZE 0x40000 |
138 | #define BUFFERLISTSIZE (PAGE_SIZE) | 138 | #define BUFFERLISTSIZE 4096 |
139 | #define DMABUFFERSIZE (PAGE_SIZE) | 139 | #define DMABUFFERSIZE 4096 |
140 | #define MAXRXFRAMES 7 | 140 | #define MAXRXFRAMES 7 |
141 | 141 | ||
142 | typedef struct _DMABUFFERENTRY | 142 | typedef struct _DMABUFFERENTRY |
@@ -322,7 +322,7 @@ struct mgsl_struct { | |||
322 | int dosyncppp; | 322 | int dosyncppp; |
323 | spinlock_t netlock; | 323 | spinlock_t netlock; |
324 | 324 | ||
325 | #ifdef CONFIG_HDLC | 325 | #if SYNCLINK_GENERIC_HDLC |
326 | struct net_device *netdev; | 326 | struct net_device *netdev; |
327 | #endif | 327 | #endif |
328 | }; | 328 | }; |
@@ -730,7 +730,7 @@ static void usc_loopmode_send_done( struct mgsl_struct * info ); | |||
730 | 730 | ||
731 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); | 731 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); |
732 | 732 | ||
733 | #ifdef CONFIG_HDLC | 733 | #if SYNCLINK_GENERIC_HDLC |
734 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 734 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
735 | static void hdlcdev_tx_done(struct mgsl_struct *info); | 735 | static void hdlcdev_tx_done(struct mgsl_struct *info); |
736 | static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); | 736 | static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); |
@@ -804,7 +804,7 @@ static int save_tx_buffer_request(struct mgsl_struct *info,const char *Buffer, u | |||
804 | /* | 804 | /* |
805 | * Bottom half interrupt handlers | 805 | * Bottom half interrupt handlers |
806 | */ | 806 | */ |
807 | static void mgsl_bh_handler(void* Context); | 807 | static void mgsl_bh_handler(struct work_struct *work); |
808 | static void mgsl_bh_receive(struct mgsl_struct *info); | 808 | static void mgsl_bh_receive(struct mgsl_struct *info); |
809 | static void mgsl_bh_transmit(struct mgsl_struct *info); | 809 | static void mgsl_bh_transmit(struct mgsl_struct *info); |
810 | static void mgsl_bh_status(struct mgsl_struct *info); | 810 | static void mgsl_bh_status(struct mgsl_struct *info); |
@@ -1073,9 +1073,10 @@ static int mgsl_bh_action(struct mgsl_struct *info) | |||
1073 | /* | 1073 | /* |
1074 | * Perform bottom half processing of work items queued by ISR. | 1074 | * Perform bottom half processing of work items queued by ISR. |
1075 | */ | 1075 | */ |
1076 | static void mgsl_bh_handler(void* Context) | 1076 | static void mgsl_bh_handler(struct work_struct *work) |
1077 | { | 1077 | { |
1078 | struct mgsl_struct *info = (struct mgsl_struct*)Context; | 1078 | struct mgsl_struct *info = |
1079 | container_of(work, struct mgsl_struct, task); | ||
1079 | int action; | 1080 | int action; |
1080 | 1081 | ||
1081 | if (!info) | 1082 | if (!info) |
@@ -1278,7 +1279,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info ) | |||
1278 | info->drop_rts_on_tx_done = 0; | 1279 | info->drop_rts_on_tx_done = 0; |
1279 | } | 1280 | } |
1280 | 1281 | ||
1281 | #ifdef CONFIG_HDLC | 1282 | #if SYNCLINK_GENERIC_HDLC |
1282 | if (info->netcount) | 1283 | if (info->netcount) |
1283 | hdlcdev_tx_done(info); | 1284 | hdlcdev_tx_done(info); |
1284 | else | 1285 | else |
@@ -1343,7 +1344,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1343 | info->input_signal_events.dcd_up++; | 1344 | info->input_signal_events.dcd_up++; |
1344 | } else | 1345 | } else |
1345 | info->input_signal_events.dcd_down++; | 1346 | info->input_signal_events.dcd_down++; |
1346 | #ifdef CONFIG_HDLC | 1347 | #if SYNCLINK_GENERIC_HDLC |
1347 | if (info->netcount) { | 1348 | if (info->netcount) { |
1348 | if (status & MISCSTATUS_DCD) | 1349 | if (status & MISCSTATUS_DCD) |
1349 | netif_carrier_on(info->netdev); | 1350 | netif_carrier_on(info->netdev); |
@@ -1700,11 +1701,10 @@ static void mgsl_isr_transmit_dma( struct mgsl_struct *info ) | |||
1700 | * | 1701 | * |
1701 | * irq interrupt number that caused interrupt | 1702 | * irq interrupt number that caused interrupt |
1702 | * dev_id device ID supplied during interrupt registration | 1703 | * dev_id device ID supplied during interrupt registration |
1703 | * regs interrupted processor context | ||
1704 | * | 1704 | * |
1705 | * Return Value: None | 1705 | * Return Value: None |
1706 | */ | 1706 | */ |
1707 | static irqreturn_t mgsl_interrupt(int irq, void *dev_id, struct pt_regs * regs) | 1707 | static irqreturn_t mgsl_interrupt(int irq, void *dev_id) |
1708 | { | 1708 | { |
1709 | struct mgsl_struct * info; | 1709 | struct mgsl_struct * info; |
1710 | u16 UscVector; | 1710 | u16 UscVector; |
@@ -3060,7 +3060,7 @@ static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigne | |||
3060 | * | 3060 | * |
3061 | * Return Value: None | 3061 | * Return Value: None |
3062 | */ | 3062 | */ |
3063 | static void mgsl_set_termios(struct tty_struct *tty, struct termios *old_termios) | 3063 | static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
3064 | { | 3064 | { |
3065 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 3065 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; |
3066 | unsigned long flags; | 3066 | unsigned long flags; |
@@ -4315,7 +4315,7 @@ static void mgsl_add_device( struct mgsl_struct *info ) | |||
4315 | info->max_frame_size ); | 4315 | info->max_frame_size ); |
4316 | } | 4316 | } |
4317 | 4317 | ||
4318 | #ifdef CONFIG_HDLC | 4318 | #if SYNCLINK_GENERIC_HDLC |
4319 | hdlcdev_init(info); | 4319 | hdlcdev_init(info); |
4320 | #endif | 4320 | #endif |
4321 | 4321 | ||
@@ -4340,7 +4340,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4340 | } else { | 4340 | } else { |
4341 | memset(info, 0, sizeof(struct mgsl_struct)); | 4341 | memset(info, 0, sizeof(struct mgsl_struct)); |
4342 | info->magic = MGSL_MAGIC; | 4342 | info->magic = MGSL_MAGIC; |
4343 | INIT_WORK(&info->task, mgsl_bh_handler, info); | 4343 | INIT_WORK(&info->task, mgsl_bh_handler); |
4344 | info->max_frame_size = 4096; | 4344 | info->max_frame_size = 4096; |
4345 | info->close_delay = 5*HZ/10; | 4345 | info->close_delay = 5*HZ/10; |
4346 | info->closing_wait = 30*HZ; | 4346 | info->closing_wait = 30*HZ; |
@@ -4360,7 +4360,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4360 | 4360 | ||
4361 | } /* end of mgsl_allocate_device()*/ | 4361 | } /* end of mgsl_allocate_device()*/ |
4362 | 4362 | ||
4363 | static struct tty_operations mgsl_ops = { | 4363 | static const struct tty_operations mgsl_ops = { |
4364 | .open = mgsl_open, | 4364 | .open = mgsl_open, |
4365 | .close = mgsl_close, | 4365 | .close = mgsl_close, |
4366 | .write = mgsl_write, | 4366 | .write = mgsl_write, |
@@ -4405,6 +4405,8 @@ static int mgsl_init_tty(void) | |||
4405 | serial_driver->init_termios = tty_std_termios; | 4405 | serial_driver->init_termios = tty_std_termios; |
4406 | serial_driver->init_termios.c_cflag = | 4406 | serial_driver->init_termios.c_cflag = |
4407 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 4407 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
4408 | serial_driver->init_termios.c_ispeed = 9600; | ||
4409 | serial_driver->init_termios.c_ospeed = 9600; | ||
4408 | serial_driver->flags = TTY_DRIVER_REAL_RAW; | 4410 | serial_driver->flags = TTY_DRIVER_REAL_RAW; |
4409 | tty_set_operations(serial_driver, &mgsl_ops); | 4411 | tty_set_operations(serial_driver, &mgsl_ops); |
4410 | if ((rc = tty_register_driver(serial_driver)) < 0) { | 4412 | if ((rc = tty_register_driver(serial_driver)) < 0) { |
@@ -4473,7 +4475,7 @@ static void synclink_cleanup(void) | |||
4473 | 4475 | ||
4474 | info = mgsl_device_list; | 4476 | info = mgsl_device_list; |
4475 | while(info) { | 4477 | while(info) { |
4476 | #ifdef CONFIG_HDLC | 4478 | #if SYNCLINK_GENERIC_HDLC |
4477 | hdlcdev_exit(info); | 4479 | hdlcdev_exit(info); |
4478 | #endif | 4480 | #endif |
4479 | mgsl_release_resources(info); | 4481 | mgsl_release_resources(info); |
@@ -6647,7 +6649,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6647 | return_frame = 1; | 6649 | return_frame = 1; |
6648 | } | 6650 | } |
6649 | framesize = 0; | 6651 | framesize = 0; |
6650 | #ifdef CONFIG_HDLC | 6652 | #if SYNCLINK_GENERIC_HDLC |
6651 | { | 6653 | { |
6652 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 6654 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
6653 | stats->rx_errors++; | 6655 | stats->rx_errors++; |
@@ -6723,7 +6725,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6723 | *ptmp); | 6725 | *ptmp); |
6724 | } | 6726 | } |
6725 | 6727 | ||
6726 | #ifdef CONFIG_HDLC | 6728 | #if SYNCLINK_GENERIC_HDLC |
6727 | if (info->netcount) | 6729 | if (info->netcount) |
6728 | hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); | 6730 | hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); |
6729 | else | 6731 | else |
@@ -7627,7 +7629,7 @@ static void mgsl_tx_timeout(unsigned long context) | |||
7627 | 7629 | ||
7628 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 7630 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
7629 | 7631 | ||
7630 | #ifdef CONFIG_HDLC | 7632 | #if SYNCLINK_GENERIC_HDLC |
7631 | if (info->netcount) | 7633 | if (info->netcount) |
7632 | hdlcdev_tx_done(info); | 7634 | hdlcdev_tx_done(info); |
7633 | else | 7635 | else |
@@ -7703,7 +7705,7 @@ static int usc_loopmode_active( struct mgsl_struct * info) | |||
7703 | return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; | 7705 | return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; |
7704 | } | 7706 | } |
7705 | 7707 | ||
7706 | #ifdef CONFIG_HDLC | 7708 | #if SYNCLINK_GENERIC_HDLC |
7707 | 7709 | ||
7708 | /** | 7710 | /** |
7709 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 7711 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |