4 * driver for the GE IP-OCTAL boards
5 * Copyright (c) 2009 Nicolas Serafini, EIC2 SA
6 * Copyright (c) 2010,2011 Samuel Iglesias Gonsalvez <siglesia@cern.ch>, CERN
7 * Copyright (c) 2012 Samuel Iglesias Gonsalvez <siglesias@igalia.com>, Igalia
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; version 2 of the License.
14 #include <linux/device.h>
15 #include <linux/module.h>
16 #include <linux/interrupt.h>
17 #include <linux/sched.h>
18 #include <linux/tty.h>
19 #include <linux/serial.h>
20 #include <linux/tty_flip.h>
21 #include <linux/slab.h>
22 #include <linux/atomic.h>
28 #define IP_OCTAL_ID_SPACE_VECTOR 0x41
29 #define IP_OCTAL_NB_BLOCKS 4
31 static const struct tty_operations ipoctal_fops;
33 struct ipoctal_channel {
34 struct ipoctal_stats stats;
35 unsigned int nb_bytes;
36 wait_queue_head_t queue;
38 unsigned int pointer_read;
39 unsigned int pointer_write;
41 struct tty_port tty_port;
42 union scc2698_channel __iomem *regs;
43 union scc2698_block __iomem *block_regs;
44 unsigned int board_id;
45 unsigned char *board_write;
51 struct ipack_device *dev;
52 unsigned int board_id;
53 struct ipoctal_channel channel[NR_CHANNELS];
55 struct tty_driver *tty_drv;
58 static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty)
60 struct ipoctal_channel *channel;
62 channel = dev_get_drvdata(tty->dev);
64 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
68 static int ipoctal_open(struct tty_struct *tty, struct file *file)
71 struct ipoctal_channel *channel;
73 channel = dev_get_drvdata(tty->dev);
75 if (atomic_read(&channel->open))
78 tty->driver_data = channel;
80 res = tty_port_open(&channel->tty_port, tty, file);
84 atomic_inc(&channel->open);
88 static void ipoctal_reset_stats(struct ipoctal_stats *stats)
93 stats->framing_err = 0;
94 stats->overrun_err = 0;
95 stats->parity_err = 0;
98 static void ipoctal_free_channel(struct ipoctal_channel *channel)
100 ipoctal_reset_stats(&channel->stats);
101 channel->pointer_read = 0;
102 channel->pointer_write = 0;
103 channel->nb_bytes = 0;
106 static void ipoctal_close(struct tty_struct *tty, struct file *filp)
108 struct ipoctal_channel *channel = tty->driver_data;
110 tty_port_close(&channel->tty_port, tty, filp);
112 if (atomic_dec_and_test(&channel->open))
113 ipoctal_free_channel(channel);
116 static int ipoctal_get_icount(struct tty_struct *tty,
117 struct serial_icounter_struct *icount)
119 struct ipoctal_channel *channel = tty->driver_data;
125 icount->rx = channel->stats.rx;
126 icount->tx = channel->stats.tx;
127 icount->frame = channel->stats.framing_err;
128 icount->parity = channel->stats.parity_err;
129 icount->brk = channel->stats.rcv_break;
133 static void ipoctal_irq_rx(struct ipoctal_channel *channel,
134 struct tty_struct *tty, u8 sr)
137 unsigned char flag = TTY_NORMAL;
141 value = ioread8(&channel->regs->r.rhr);
142 /* Error: count statistics */
144 iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
146 if (sr & SR_OVERRUN_ERROR) {
147 channel->stats.overrun_err++;
148 /* Overrun doesn't affect the current character*/
149 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
151 if (sr & SR_PARITY_ERROR) {
152 channel->stats.parity_err++;
155 if (sr & SR_FRAMING_ERROR) {
156 channel->stats.framing_err++;
159 if (sr & SR_RECEIVED_BREAK) {
160 iowrite8(CR_CMD_RESET_BREAK_CHANGE, &channel->regs->w.cr);
161 channel->stats.rcv_break++;
165 tty_insert_flip_char(tty, value, flag);
167 /* Check if there are more characters in RX FIFO
168 * If there are more, the isr register for this channel
169 * has enabled the RxRDY|FFULL bit.
171 isr = ioread8(&channel->block_regs->r.isr);
172 sr = ioread8(&channel->regs->r.sr);
173 } while (isr & channel->isr_rx_rdy_mask);
175 tty_flip_buffer_push(tty);
178 static void ipoctal_irq_tx(struct ipoctal_channel *channel)
181 unsigned int *pointer_write = &channel->pointer_write;
183 if (channel->nb_bytes <= 0) {
184 channel->nb_bytes = 0;
188 value = channel->tty_port.xmit_buf[*pointer_write];
189 iowrite8(value, &channel->regs->w.thr);
192 *pointer_write = *pointer_write % PAGE_SIZE;
195 if ((channel->nb_bytes == 0) &&
196 (waitqueue_active(&channel->queue))) {
198 if (channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485) {
199 *channel->board_write = 1;
200 wake_up_interruptible(&channel->queue);
205 static void ipoctal_irq_channel(struct ipoctal_channel *channel)
208 struct tty_struct *tty;
210 /* If there is no client, skip the check */
211 if (!atomic_read(&channel->open))
214 tty = tty_port_tty_get(&channel->tty_port);
217 /* The HW is organized in pair of channels. See which register we need
219 isr = ioread8(&channel->block_regs->r.isr);
220 sr = ioread8(&channel->regs->r.sr);
222 /* In case of RS-485, change from TX to RX when finishing TX.
224 if ((channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) &&
225 (sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
226 iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
227 iowrite8(CR_CMD_NEGATE_RTSN, &channel->regs->w.cr);
228 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
229 *channel->board_write = 1;
230 wake_up_interruptible(&channel->queue);
234 if ((isr & channel->isr_rx_rdy_mask) && (sr & SR_RX_READY))
235 ipoctal_irq_rx(channel, tty, sr);
237 /* TX of each character */
238 if ((isr & channel->isr_tx_rdy_mask) && (sr & SR_TX_READY))
239 ipoctal_irq_tx(channel);
241 tty_flip_buffer_push(tty);
245 static irqreturn_t ipoctal_irq_handler(void *arg)
248 struct ipoctal *ipoctal = (struct ipoctal *) arg;
250 /* Check all channels */
251 for (i = 0; i < NR_CHANNELS; i++)
252 ipoctal_irq_channel(&ipoctal->channel[i]);
254 /* Clear the IPack device interrupt */
255 readw(ipoctal->dev->int_space.address + ACK_INT_REQ0);
256 readw(ipoctal->dev->int_space.address + ACK_INT_REQ1);
261 static int ipoctal_check_model(struct ipack_device *dev, unsigned char *id)
263 unsigned char manufacturerID;
264 unsigned char board_id;
267 manufacturerID = ioread8(dev->id_space.address + IPACK_IDPROM_OFFSET_MANUFACTURER_ID);
268 if (manufacturerID != IPACK1_VENDOR_ID_SBS)
270 board_id = ioread8(dev->id_space.address + IPACK_IDPROM_OFFSET_MODEL);
272 case IPACK1_DEVICE_ID_SBS_OCTAL_232:
273 case IPACK1_DEVICE_ID_SBS_OCTAL_422:
274 case IPACK1_DEVICE_ID_SBS_OCTAL_485:
284 static const struct tty_port_operations ipoctal_tty_port_ops = {
286 .activate = ipoctal_port_activate,
289 static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
294 struct tty_driver *tty;
296 unsigned char board_id;
297 struct ipoctal_channel *channel;
298 union scc2698_channel __iomem *chan_regs;
299 union scc2698_block __iomem *block_regs;
301 res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0,
304 dev_err(&ipoctal->dev->dev,
305 "Unable to map slot [%d:%d] ID space!\n",
310 res = ipoctal_check_model(ipoctal->dev, &board_id);
312 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev,
314 goto out_unregister_id_space;
316 ipoctal->board_id = board_id;
318 res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0,
321 dev_err(&ipoctal->dev->dev,
322 "Unable to map slot [%d:%d] IO space!\n",
324 goto out_unregister_id_space;
327 res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0,
330 dev_err(&ipoctal->dev->dev,
331 "Unable to map slot [%d:%d] INT space!\n",
333 goto out_unregister_io_space;
336 res = ipoctal->dev->bus->ops->map_space(ipoctal->dev,
337 0x8000, IPACK_MEM_SPACE);
339 dev_err(&ipoctal->dev->dev,
340 "Unable to map slot [%d:%d] MEM space!\n",
342 goto out_unregister_int_space;
345 /* Save the virtual address to access the registers easily */
347 (union scc2698_channel __iomem *) ipoctal->dev->io_space.address;
349 (union scc2698_block __iomem *) ipoctal->dev->io_space.address;
351 /* Disable RX and TX before touching anything */
352 for (i = 0; i < NR_CHANNELS ; i++) {
353 struct ipoctal_channel *channel = &ipoctal->channel[i];
354 channel->regs = chan_regs + i;
355 channel->block_regs = block_regs + (i >> 1);
356 channel->board_write = &ipoctal->write;
357 channel->board_id = ipoctal->board_id;
359 channel->isr_tx_rdy_mask = ISR_TxRDY_B;
360 channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_B;
362 channel->isr_tx_rdy_mask = ISR_TxRDY_A;
363 channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_A;
366 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
367 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
368 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
369 iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY,
370 &channel->regs->w.mr); /* mr1 */
371 iowrite8(0, &channel->regs->w.mr); /* mr2 */
372 iowrite8(TX_CLK_9600 | RX_CLK_9600, &channel->regs->w.csr);
375 for (i = 0; i < IP_OCTAL_NB_BLOCKS; i++) {
376 iowrite8(ACR_BRG_SET2, &block_regs[i].w.acr);
377 iowrite8(OPCR_MPP_OUTPUT | OPCR_MPOa_RTSN | OPCR_MPOb_RTSN,
378 &block_regs[i].w.opcr);
379 iowrite8(IMR_TxRDY_A | IMR_RxRDY_FFULL_A | IMR_DELTA_BREAK_A |
380 IMR_TxRDY_B | IMR_RxRDY_FFULL_B | IMR_DELTA_BREAK_B,
381 &block_regs[i].w.imr);
385 * IP-OCTAL has different addresses to copy its IRQ vector.
386 * Depending of the carrier these addresses are accesible or not.
387 * More info in the datasheet.
389 ipoctal->dev->bus->ops->request_irq(ipoctal->dev,
390 ipoctal_irq_handler, ipoctal);
392 iowrite8(1, ipoctal->dev->mem_space.address + 1);
394 /* Register the TTY device */
396 /* Each IP-OCTAL channel is a TTY port */
397 tty = alloc_tty_driver(NR_CHANNELS);
401 goto out_unregister_slot_unmap;
404 /* Fill struct tty_driver with ipoctal data */
405 tty->owner = THIS_MODULE;
406 tty->driver_name = KBUILD_MODNAME;
407 sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot);
411 tty->minor_start = 0;
412 tty->type = TTY_DRIVER_TYPE_SERIAL;
413 tty->subtype = SERIAL_TYPE_NORMAL;
414 tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
415 tty->init_termios = tty_std_termios;
416 tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
417 tty->init_termios.c_ispeed = 9600;
418 tty->init_termios.c_ospeed = 9600;
420 tty_set_operations(tty, &ipoctal_fops);
421 res = tty_register_driver(tty);
423 dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n");
425 goto out_unregister_slot_unmap;
428 /* Save struct tty_driver for use it when uninstalling the device */
429 ipoctal->tty_drv = tty;
431 for (i = 0; i < NR_CHANNELS; i++) {
432 struct device *tty_dev;
434 channel = &ipoctal->channel[i];
435 tty_port_init(&channel->tty_port);
436 tty_port_alloc_xmit_buf(&channel->tty_port);
437 channel->tty_port.ops = &ipoctal_tty_port_ops;
439 ipoctal_reset_stats(&channel->stats);
440 channel->nb_bytes = 0;
441 init_waitqueue_head(&channel->queue);
443 spin_lock_init(&channel->lock);
444 channel->pointer_read = 0;
445 channel->pointer_write = 0;
446 tty_dev = tty_register_device(tty, i, NULL);
447 if (IS_ERR(tty_dev)) {
448 dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n");
451 dev_set_drvdata(tty_dev, channel);
454 * Enable again the RX. TX will be enabled when
455 * there is something to send
457 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
462 out_unregister_slot_unmap:
463 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_ID_SPACE);
464 out_unregister_int_space:
465 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_INT_SPACE);
466 out_unregister_io_space:
467 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_IO_SPACE);
468 out_unregister_id_space:
469 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_MEM_SPACE);
473 static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
474 const unsigned char *buf,
479 unsigned int *pointer_read = &channel->pointer_read;
481 /* Copy the bytes from the user buffer to the internal one */
482 for (i = 0; i < count; i++) {
483 if (i <= (PAGE_SIZE - channel->nb_bytes)) {
484 spin_lock_irqsave(&channel->lock, flags);
485 channel->tty_port.xmit_buf[*pointer_read] = buf[i];
486 *pointer_read = (*pointer_read + 1) % PAGE_SIZE;
488 spin_unlock_irqrestore(&channel->lock, flags);
496 static int ipoctal_write_tty(struct tty_struct *tty,
497 const unsigned char *buf, int count)
499 struct ipoctal_channel *channel = tty->driver_data;
500 unsigned int char_copied;
502 char_copied = ipoctal_copy_write_buffer(channel, buf, count);
504 /* As the IP-OCTAL 485 only supports half duplex, do it manually */
505 if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) {
506 iowrite8(CR_DISABLE_RX, &channel->regs->w.cr);
507 iowrite8(CR_CMD_ASSERT_RTSN, &channel->regs->w.cr);
511 * Send a packet and then disable TX to avoid failure after several send
514 iowrite8(CR_ENABLE_TX, &channel->regs->w.cr);
515 wait_event_interruptible(channel->queue, *channel->board_write);
516 iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
518 *channel->board_write = 0;
522 static int ipoctal_write_room(struct tty_struct *tty)
524 struct ipoctal_channel *channel = tty->driver_data;
526 return PAGE_SIZE - channel->nb_bytes;
529 static int ipoctal_chars_in_buffer(struct tty_struct *tty)
531 struct ipoctal_channel *channel = tty->driver_data;
533 return channel->nb_bytes;
536 static void ipoctal_set_termios(struct tty_struct *tty,
537 struct ktermios *old_termios)
540 unsigned char mr1 = 0;
541 unsigned char mr2 = 0;
542 unsigned char csr = 0;
543 struct ipoctal_channel *channel = tty->driver_data;
546 cflag = tty->termios->c_cflag;
548 /* Disable and reset everything before change the setup */
549 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
550 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
551 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
552 iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
553 iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
555 /* Set Bits per chars */
556 switch (cflag & CSIZE) {
558 mr1 |= MR1_CHRL_6_BITS;
561 mr1 |= MR1_CHRL_7_BITS;
565 mr1 |= MR1_CHRL_8_BITS;
566 /* By default, select CS8 */
567 tty->termios->c_cflag = (cflag & ~CSIZE) | CS8;
574 mr1 |= MR1_PARITY_ON | MR1_PARITY_ODD;
576 mr1 |= MR1_PARITY_ON | MR1_PARITY_EVEN;
578 mr1 |= MR1_PARITY_OFF;
580 /* Mark or space parity is not supported */
581 tty->termios->c_cflag &= ~CMSPAR;
585 mr2 |= MR2_STOP_BITS_LENGTH_2;
587 mr2 |= MR2_STOP_BITS_LENGTH_1;
589 /* Set the flow control */
590 switch (channel->board_id) {
591 case IPACK1_DEVICE_ID_SBS_OCTAL_232:
592 if (cflag & CRTSCTS) {
593 mr1 |= MR1_RxRTS_CONTROL_ON;
594 mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_ON;
596 mr1 |= MR1_RxRTS_CONTROL_OFF;
597 mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_OFF;
600 case IPACK1_DEVICE_ID_SBS_OCTAL_422:
601 mr1 |= MR1_RxRTS_CONTROL_OFF;
602 mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_OFF;
604 case IPACK1_DEVICE_ID_SBS_OCTAL_485:
605 mr1 |= MR1_RxRTS_CONTROL_OFF;
606 mr2 |= MR2_TxRTS_CONTROL_ON | MR2_CTS_ENABLE_TX_OFF;
613 baud = tty_get_baud_rate(tty);
614 tty_termios_encode_baud_rate(tty->termios, baud, baud);
617 switch (tty->termios->c_ospeed) {
619 csr |= TX_CLK_75 | RX_CLK_75;
622 csr |= TX_CLK_110 | RX_CLK_110;
625 csr |= TX_CLK_150 | RX_CLK_150;
628 csr |= TX_CLK_300 | RX_CLK_300;
631 csr |= TX_CLK_600 | RX_CLK_600;
634 csr |= TX_CLK_1200 | RX_CLK_1200;
637 csr |= TX_CLK_1800 | RX_CLK_1800;
640 csr |= TX_CLK_2000 | RX_CLK_2000;
643 csr |= TX_CLK_2400 | RX_CLK_2400;
646 csr |= TX_CLK_4800 | RX_CLK_4800;
649 csr |= TX_CLK_9600 | RX_CLK_9600;
652 csr |= TX_CLK_19200 | RX_CLK_19200;
656 csr |= TX_CLK_38400 | RX_CLK_38400;
657 /* In case of default, we establish 38400 bps */
658 tty_termios_encode_baud_rate(tty->termios, 38400, 38400);
662 mr1 |= MR1_ERROR_CHAR;
663 mr1 |= MR1_RxINT_RxRDY;
665 /* Write the control registers */
666 iowrite8(mr1, &channel->regs->w.mr);
667 iowrite8(mr2, &channel->regs->w.mr);
668 iowrite8(csr, &channel->regs->w.csr);
670 /* Enable again the RX */
671 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
674 static void ipoctal_hangup(struct tty_struct *tty)
677 struct ipoctal_channel *channel = tty->driver_data;
682 spin_lock_irqsave(&channel->lock, flags);
683 channel->nb_bytes = 0;
684 channel->pointer_read = 0;
685 channel->pointer_write = 0;
686 spin_unlock_irqrestore(&channel->lock, flags);
688 tty_port_hangup(&channel->tty_port);
690 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
691 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
692 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
693 iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
694 iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
696 clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags);
697 wake_up_interruptible(&channel->tty_port.open_wait);
700 static const struct tty_operations ipoctal_fops = {
702 .open = ipoctal_open,
703 .close = ipoctal_close,
704 .write = ipoctal_write_tty,
705 .set_termios = ipoctal_set_termios,
706 .write_room = ipoctal_write_room,
707 .chars_in_buffer = ipoctal_chars_in_buffer,
708 .get_icount = ipoctal_get_icount,
709 .hangup = ipoctal_hangup,
712 static int ipoctal_probe(struct ipack_device *dev)
715 struct ipoctal *ipoctal;
717 ipoctal = kzalloc(sizeof(struct ipoctal), GFP_KERNEL);
722 res = ipoctal_inst_slot(ipoctal, dev->bus_nr, dev->slot);
726 dev_set_drvdata(&dev->dev, ipoctal);
734 static void __ipoctal_remove(struct ipoctal *ipoctal)
738 ipoctal->dev->bus->ops->free_irq(ipoctal->dev);
740 for (i = 0; i < NR_CHANNELS; i++) {
741 struct ipoctal_channel *channel = &ipoctal->channel[i];
742 tty_unregister_device(ipoctal->tty_drv, i);
743 tty_port_free_xmit_buf(&channel->tty_port);
746 tty_unregister_driver(ipoctal->tty_drv);
747 put_tty_driver(ipoctal->tty_drv);
748 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_MEM_SPACE);
749 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_INT_SPACE);
750 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_IO_SPACE);
751 ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_ID_SPACE);
755 static void ipoctal_remove(struct ipack_device *idev)
757 __ipoctal_remove(dev_get_drvdata(&idev->dev));
760 static DEFINE_IPACK_DEVICE_TABLE(ipoctal_ids) = {
761 { IPACK_DEVICE(IPACK_ID_VERSION_1, IPACK1_VENDOR_ID_SBS,
762 IPACK1_DEVICE_ID_SBS_OCTAL_232) },
763 { IPACK_DEVICE(IPACK_ID_VERSION_1, IPACK1_VENDOR_ID_SBS,
764 IPACK1_DEVICE_ID_SBS_OCTAL_422) },
765 { IPACK_DEVICE(IPACK_ID_VERSION_1, IPACK1_VENDOR_ID_SBS,
766 IPACK1_DEVICE_ID_SBS_OCTAL_485) },
770 MODULE_DEVICE_TABLE(ipack, ipoctal_ids);
772 static const struct ipack_driver_ops ipoctal_drv_ops = {
773 .probe = ipoctal_probe,
774 .remove = ipoctal_remove,
777 static struct ipack_driver driver = {
778 .ops = &ipoctal_drv_ops,
779 .id_table = ipoctal_ids,
782 static int __init ipoctal_init(void)
784 return ipack_driver_register(&driver, THIS_MODULE, KBUILD_MODNAME);
787 static void __exit ipoctal_exit(void)
789 ipack_driver_unregister(&driver);
792 MODULE_DESCRIPTION("IP-Octal 232, 422 and 485 device driver");
793 MODULE_LICENSE("GPL");
795 module_init(ipoctal_init);
796 module_exit(ipoctal_exit);