1 /*********************************************************************
5 * Description: Driver for the Sharp Universal Infrared
6 * Communications Controller (UIRCC)
7 * Status: Experimental.
8 * Author: Dag Brattli <dagb@cs.uit.no>
9 * Created at: Sat Dec 26 10:59:03 1998
10 * Modified at: Tue Jan 19 23:54:04 1999
11 * Modified by: Dag Brattli <dagb@cs.uit.no>
13 * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge.
24 * Applicable Models : Tecra 510CDT, 500C Series, 530CDT, 520CDT,
25 * 740CDT, Portege 300CT, 660CDT, Satellite 220C Series,
26 * Satellite Pro, 440C Series, 470CDT, 460C Series, 480C Series
28 * Notice that FIR mode is not working yet, since I don't know
29 * how to make the UIRCC drive the interrupt line, and not the
30 * UART (which is used for SIR speeds). Please mail me if you know!
32 ********************************************************************/
34 #include <linux/module.h>
36 #include <linux/kernel.h>
37 #include <linux/types.h>
38 #include <linux/skbuff.h>
39 #include <linux/netdevice.h>
40 #include <linux/ioport.h>
41 #include <linux/delay.h>
42 #include <linux/malloc.h>
43 #include <linux/delay.h>
44 #include <linux/init.h>
45 #include <linux/init.h>
49 #include <asm/byteorder.h>
51 #include <net/irda/wrapper.h>
52 #include <net/irda/irda.h>
53 #include <net/irda/irmod.h>
54 #include <net/irda/irlap_frame.h>
55 #include <net/irda/irda_device.h>
57 #include <net/irda/uircc.h>
58 #include <net/irda/irport.h>
60 static char *driver_name
= "uircc";
62 #define CHIP_IO_EXTENT 16
64 static unsigned int io
[] = { 0x300, ~0, ~0, ~0 };
65 static unsigned int io2
[] = { 0x3e8, 0, 0, 0};
66 static unsigned int irq
[] = { 11, 0, 0, 0 };
67 static unsigned int dma
[] = { 5, 0, 0, 0 };
69 static struct uircc_cb
*dev_self
[] = { NULL
, NULL
, NULL
, NULL
};
72 static int uircc_open( int i
, unsigned int iobase
, unsigned int board_addr
,
73 unsigned int irq
, unsigned int dma
);
74 static int uircc_close( struct irda_device
*idev
);
75 static int uircc_probe( int iobase
, int board_addr
, int irq
, int dma
);
76 static int uircc_dma_receive( struct irda_device
*idev
);
77 static int uircc_dma_receive_complete(struct irda_device
*idev
, int iobase
);
78 static int uircc_hard_xmit( struct sk_buff
*skb
, struct device
*dev
);
79 static void uircc_dma_write( struct irda_device
*idev
, int iobase
);
80 static void uircc_change_speed( struct irda_device
*idev
, int baud
);
81 static void uircc_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
);
82 static void uircc_wait_until_sent( struct irda_device
*idev
);
83 static int uircc_is_receiving( struct irda_device
*idev
);
85 static int uircc_net_init( struct device
*dev
);
86 static int uircc_net_open( struct device
*dev
);
87 static int uircc_net_close( struct device
*dev
);
90 * Function uircc_init ()
92 * Initialize chip. Just try to find out how many chips we are dealing with
95 __initfunc(int uircc_init(void))
99 for ( i
=0; (io
[i
] < 2000) && (i
< 4); i
++) {
101 if (check_region(ioaddr
, CHIP_IO_EXTENT
))
103 if (uircc_open( i
, io
[i
], io2
[i
], irq
[i
], dma
[i
]) == 0)
110 * Function uircc_cleanup ()
112 * Close all configured chips
116 static void uircc_cleanup(void)
120 DEBUG( 4, __FUNCTION__
"()\n");
122 for ( i
=0; i
< 4; i
++) {
124 uircc_close( &(dev_self
[i
]->idev
));
130 * Function uircc_open (iobase, irq)
132 * Open driver instance
135 static int uircc_open( int i
, unsigned int iobase
, unsigned int iobase2
,
136 unsigned int irq
, unsigned int dma
)
138 struct uircc_cb
*self
;
139 struct irda_device
*idev
;
142 DEBUG( 0, __FUNCTION__
"()\n");
144 if (( uircc_probe( iobase
, iobase2
, irq
, dma
)) == -1)
148 * Allocate new instance of the driver
150 self
= kmalloc( sizeof(struct uircc_cb
), GFP_KERNEL
);
152 printk( KERN_ERR
"IrDA: Can't allocate memory for "
153 "IrDA control block!\n");
156 memset( self
, 0, sizeof(struct uircc_cb
));
158 /* Need to store self somewhere */
164 idev
->io
.iobase
= iobase
;
165 idev
->io
.iobase2
= iobase2
; /* Used by irport */
167 idev
->io
.io_ext
= CHIP_IO_EXTENT
;
168 idev
->io
.io_ext2
= 8; /* Used by irport */
170 idev
->io
.fifo_size
= 16;
172 /* Lock the port that we need */
173 ret
= check_region( idev
->io
.iobase
, idev
->io
.io_ext
);
175 DEBUG( 0, __FUNCTION__
"(), can't get iobase of 0x%03x\n",
177 /* uircc_cleanup( self->idev); */
180 ret
= check_region( idev
->io
.iobase2
, idev
->io
.io_ext2
);
182 DEBUG( 0, __FUNCTION__
"(), can't get iobase of 0x%03x\n",
184 /* uircc_cleanup( self->idev); */
187 request_region( idev
->io
.iobase
, idev
->io
.io_ext
, idev
->name
);
188 request_region( idev
->io
.iobase2
, idev
->io
.io_ext2
, idev
->name
);
190 /* Initialize QoS for this device */
191 irda_init_max_qos_capabilies( &idev
->qos
);
193 /* The only value we must override it the baudrate */
194 idev
->qos
.baud_rate
.bits
= IR_9600
|IR_19200
|IR_38400
|IR_57600
|
195 IR_115200
|IR_576000
|IR_1152000
|(IR_4000000
<< 8);
197 idev
->qos
.min_turn_time
.bits
= 0x07;
198 irda_qos_bits_to_value( &idev
->qos
);
200 /* Specify which buffer allocation policy we need */
201 idev
->rx_buff
.flags
= GFP_KERNEL
| GFP_DMA
;
202 idev
->tx_buff
.flags
= GFP_KERNEL
| GFP_DMA
;
204 /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */
205 idev
->rx_buff
.truesize
= 4000;
206 idev
->tx_buff
.truesize
= 4000;
208 /* Initialize callbacks */
209 idev
->hard_xmit
= uircc_hard_xmit
;
210 idev
->change_speed
= uircc_change_speed
;
211 idev
->wait_until_sent
= uircc_wait_until_sent
;
212 idev
->is_receiving
= uircc_is_receiving
;
214 /* Override the network functions we need to use */
215 idev
->netdev
.init
= uircc_net_init
;
216 idev
->netdev
.hard_start_xmit
= uircc_hard_xmit
;
217 idev
->netdev
.open
= uircc_net_open
;
218 idev
->netdev
.stop
= uircc_net_close
;
220 irport_open( iobase2
);
222 /* Open the IrDA device */
223 irda_device_open( idev
, driver_name
, self
);
229 * Function uircc_close (idev)
231 * Close driver instance
234 static int uircc_close( struct irda_device
*idev
)
238 DEBUG( 4, __FUNCTION__
"()\n");
240 ASSERT( idev
!= NULL
, return -1;);
241 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return -1;);
243 iobase
= idev
->io
.iobase
;
246 outb( 0x00, iobase
+UIRCC_CR10
);
248 irport_close( idev
->io
.iobase2
);
250 /* Release the PORT that this driver is using */
251 DEBUG( 4, __FUNCTION__
"(), Releasing Region %03x\n", idev
->io
.iobase
);
252 release_region( idev
->io
.iobase
, idev
->io
.io_ext
);
254 if ( idev
->io
.iobase2
) {
255 DEBUG( 4, __FUNCTION__
"(), Releasing Region %03x\n",
257 release_region( idev
->io
.iobase2
, idev
->io
.io_ext2
);
260 irda_device_close( idev
);
266 * Function uircc_probe (iobase, board_addr, irq, dma)
268 * Returns non-negative on success.
271 static int uircc_probe( int iobase
, int iobase2
, int irq
, int dma
)
278 DEBUG( 0, __FUNCTION__
"()\n");
280 /* read the chip version, should be 0x03 */
281 version
= inb( iobase
+UIRCC_SR8
);
283 if ( version
!= 0x03) {
284 DEBUG( 0, __FUNCTION__
"(), Wrong chip version");
287 DEBUG( 0, "UIRCC driver loaded. Version: 0x%02x\n", version
);
290 outb( UIRCC_CR0_SYS_RST
, iobase
+UIRCC_CR0
);
292 /* Initialize some registers */
293 outb( 0, iobase
+UIRCC_CR11
);
294 outb( 0, iobase
+UIRCC_CR9
);
296 /* Enable DMA single mode */
297 outb( UIRCC_CR1_RX_DMA
|UIRCC_CR1_TX_DMA
|UIRCC_CR1_MUST_SET
,
300 /* Disable interrupts */
301 outb( 0xff, iobase
+UIRCC_CR2
);
304 irport_close( iobase2
);
308 /* Set appropriate speed mode */
309 outb( UIRCC_CR10_FIR
, iobase
+UIRCC_CR10
);
311 /* Enable DMA single mode */
312 outb( UIRCC_CR1_RX_DMA
|UIRCC_CR1_TX_DMA
|UIRCC_CR1_MUST_SET
,
316 outb( 0x01, iobase
+UIRCC_CR12
);
317 outb( 0x00, iobase
+UIRCC_CR13
);
319 /* Set interrupt mask */
320 outb( 0x82, iobase
+UIRCC_CR2
);
322 DEBUG( 0, __FUNCTION__
"(*), sr3=%#x, sr2=%#x, sr10=%#x, sr12=%#x\n",
323 inb( iobase
+UIRCC_SR3
), inb( iobase
+UIRCC_SR2
),
324 inb( iobase
+UIRCC_SR10
), inb( iobase
+UIRCC_SR12
));
326 mask
= probe_irq_on();
329 outb( 0x08, iobase
+UIRCC_CR11
);
331 udelay( 10000); /* Wait for interrupt! */
333 probe_irq
= probe_irq_off( mask
);
335 DEBUG( 0, "Found irq=%d\n", probe_irq
);
337 DEBUG( 0, __FUNCTION__
"(), sr3=%#x, sr2=%#x, sr10=%#x, sr12=%#x\n",
338 inb( iobase
+UIRCC_SR3
), inb( iobase
+UIRCC_SR2
),
339 inb( iobase
+UIRCC_SR10
), inb( iobase
+UIRCC_SR12
));
343 outb( 0x00, iobase
+UIRCC_CR11
);
347 /* Set self poll address */
353 * Function uircc_change_speed (idev, baud)
355 * Change the speed of the device
358 static void uircc_change_speed( struct irda_device
*idev
, int speed
)
360 struct uircc_cb
*self
;
362 int modem
= UIRCC_CR10_SIR
;
364 DEBUG( 0, __FUNCTION__
"()\n");
366 ASSERT( idev
!= NULL
, return;);
367 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return;);
370 iobase
= idev
->io
.iobase
;
372 /* Update accounting for new speed */
373 idev
->io
.baudrate
= speed
;
375 /* Disable interrupts */
376 outb( 0xff, iobase
+UIRCC_CR2
);
384 /* irport_open( idev->io.iobase2); */
385 irport_change_speed( idev
->io
.iobase2
, speed
);
386 modem
= UIRCC_CR10_SIR
;
390 DEBUG(0, __FUNCTION__
"(), handling baud of 576000\n");
394 DEBUG(0, __FUNCTION__
"(), handling baud of 1152000\n");
397 irport_close( idev
->io
.iobase2
);
398 modem
= UIRCC_CR10_FIR
;
399 DEBUG(0, __FUNCTION__
"(), handling baud of 4000000\n");
402 DEBUG( 0, __FUNCTION__
"(), unknown baud rate of %d\n", speed
);
406 /* Set appropriate speed mode */
407 outb( modem
, iobase
+UIRCC_CR10
);
409 idev
->netdev
.tbusy
= 0;
411 /* Enable some interrupts so we can receive frames */
412 if ( speed
> 115200) {
413 /* Enable DMA single mode */
414 outb( UIRCC_CR1_RX_DMA
|UIRCC_CR1_TX_DMA
|UIRCC_CR1_MUST_SET
,
417 /* outb( UIRCC_CR2_RECV_MASK, iobase+UIRCC_CR2); */
418 outb( 0, iobase
+UIRCC_CR2
);
419 uircc_dma_receive( idev
);
424 * Function uircc_hard_xmit (skb, dev)
426 * Transmit the frame!
429 static int uircc_hard_xmit( struct sk_buff
*skb
, struct device
*dev
)
431 struct irda_device
*idev
;
435 idev
= (struct irda_device
*) dev
->priv
;
437 ASSERT( idev
!= NULL
, return 0;);
438 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return 0;);
440 iobase
= idev
->io
.iobase
;
442 DEBUG(0, __FUNCTION__
"(%ld), skb->len=%d\n", jiffies
, (int) skb
->len
);
444 /* Use irport for SIR speeds */
445 if ( idev
->io
.baudrate
<= 115200) {
446 return irport_hard_xmit( skb
, dev
);
452 DEBUG( 4, __FUNCTION__
"(), tbusy==TRUE\n");
457 /* Lock transmit buffer */
458 if ( irda_lock( (void *) &dev
->tbusy
) == FALSE
)
461 memcpy( idev
->tx_buff
.data
, skb
->data
, skb
->len
);
463 /* Make sure that the length is a multiple of 16 bits */
464 if ( skb
->len
& 0x01)
467 idev
->tx_buff
.len
= skb
->len
;
468 idev
->tx_buff
.head
= idev
->tx_buff
.data
;
469 idev
->tx_buff
.offset
= 0;
471 mtt
= irda_get_mtt( skb
);
473 /* Use udelay for delays less than 50 us. */
477 /* Enable transmit interrupts */
478 /* outb( UIRCC_CR2_XMIT_MASK, iobase+UIRCC_CR2); */
479 outb( 0, iobase
+UIRCC_CR2
);
481 uircc_dma_write( idev
, iobase
);
489 * Function uircc_dma_xmit (idev, iobase)
491 * Transmit data using DMA
494 static void uircc_dma_write( struct irda_device
*idev
, int iobase
)
496 struct uircc_cb
*self
;
499 DEBUG( 0, __FUNCTION__
"()\n");
501 ASSERT( idev
!= NULL
, return;);
502 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return;);
506 /* Receiving disable */
507 self
->cr3
&= ~UIRCC_CR3_RECV_EN
;
508 outb( self
->cr3
, iobase
+UIRCC_CR3
);
510 setup_dma( idev
->io
.dma
, idev
->tx_buff
.data
, idev
->tx_buff
.len
,
513 DEBUG( 0, __FUNCTION__
"residue=%d\n",
514 get_dma_residue( idev
->io
.dma
));
516 idev
->io
.direction
= IO_XMIT
;
518 /* Set frame length */
519 outb( idev
->tx_buff
.len
& 0xff, iobase
+UIRCC_CR4
); /* Low byte */
520 outb( idev
->tx_buff
.len
>> 8, iobase
+UIRCC_CR5
); /* High byte */
522 /* Enable transmit and transmit CRC */
523 self
->cr3
|= (UIRCC_CR3_XMIT_EN
|UIRCC_CR3_TX_CRC_EN
);
524 outb( self
->cr3
, iobase
+UIRCC_CR3
);
528 * Function uircc_dma_xmit_complete (idev)
530 * The transfer of a frame in finished. This function will only be called
531 * by the interrupt handler
534 static void uircc_dma_xmit_complete( struct irda_device
*idev
, int underrun
)
536 struct uircc_cb
*self
;
540 DEBUG( 4, __FUNCTION__
"()\n");
542 ASSERT( idev
!= NULL
, return;);
543 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return;);
547 iobase
= idev
->io
.iobase
;
549 /* Select TX counter */
550 outb( UIRCC_CR0_CNT_SWT
, iobase
+UIRCC_CR0
);
552 /* Read TX length counter */
553 len
= inb( iobase
+UIRCC_SR4
); /* Low byte */
554 len
|= inb( iobase
+UIRCC_SR5
) << 8; /* High byte */
556 /* Disable transmit */
557 self
->cr3
&= ~UIRCC_CR3_XMIT_EN
;
558 outb( self
->cr3
, iobase
+UIRCC_CR3
);
560 /* Check for underrrun! */
562 idev
->stats
.tx_errors
++;
563 idev
->stats
.tx_fifo_errors
++;
565 idev
->stats
.tx_packets
++;
566 idev
->stats
.tx_bytes
+= idev
->tx_buff
.len
;
569 /* Unlock tx_buff and request another frame */
570 idev
->netdev
.tbusy
= 0; /* Unlock */
571 idev
->media_busy
= FALSE
;
573 /* Tell the network layer, that we can accept more frames */
578 * Function uircc_dma_receive (idev)
580 * Get ready for receiving a frame. The device will initiate a DMA
581 * if it starts to receive a frame.
584 static int uircc_dma_receive( struct irda_device
*idev
)
586 struct uircc_cb
*self
;
589 ASSERT( idev
!= NULL
, return -1;);
590 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return -1;);
592 DEBUG( 0, __FUNCTION__
"\n");
595 iobase
= idev
->io
.iobase
;
599 setup_dma( idev
->io
.dma
, idev
->rx_buff
.data
, idev
->rx_buff
.truesize
,
602 /* driver->media_busy = FALSE; */
603 idev
->io
.direction
= IO_RECV
;
604 idev
->rx_buff
.head
= idev
->rx_buff
.data
;
605 idev
->rx_buff
.offset
= 0;
607 /* Enable receiving with CRC */
608 self
->cr3
|= (UIRCC_CR3_RECV_EN
|UIRCC_CR3_RX_CRC_EN
);
609 outb( self
->cr3
, iobase
+UIRCC_CR3
);
613 DEBUG( 4, __FUNCTION__
"(), done!\n");
619 * Function uircc_dma_receive_complete (idev)
621 * Finished with receiving frames
625 static int uircc_dma_receive_complete( struct irda_device
*idev
, int iobase
)
628 struct uircc_cb
*self
;
633 DEBUG( 0, __FUNCTION__
"()\n");
635 /* Check for CRC or framing error */
636 if ( inb( iobase
+UIRCC_SR0
) & UIRCC_SR0_RX_CRCFRM
) {
637 DEBUG( 0, __FUNCTION__
"(), crc or frm error\n");
641 /* Select receive length counter */
642 outb( 0x00, iobase
+UIRCC_CR0
);
644 /* Read frame length */
645 len
= inb( iobase
+UIRCC_SR4
); /* Low byte */
646 len
|= inb( iobase
+UIRCC_SR5
) << 8; /* High byte */
648 DEBUG( 0, __FUNCTION__
"(), len=%d\n", len
);
650 /* Receiving disable */
651 self
->cr3
&= ~UIRCC_CR3_RECV_EN
;
652 outb( self
->cr3
, iobase
+UIRCC_CR3
);
654 skb
= dev_alloc_skb( len
+1);
656 printk( KERN_INFO __FUNCTION__
657 "(), memory squeeze, dropping frame.\n");
658 /* Restore bank register */
662 /* Make sure IP header gets aligned */
663 skb_reserve( skb
, 1);
665 /* Copy frame without CRC */
666 /* if ( idev->io.baudrate < 4000000) { */
667 /* skb_put( skb, len-2); */
668 /* memcpy( skb->data, idev->rx_buff.head, len-2); */
670 /* skb_put( skb, len-4); */
671 /* memcpy( skb->data, idev->rx_buff.head, len-4); */
675 memcpy( skb
->data
, idev
->rx_buff
.head
, len
);
676 idev
->stats
.rx_packets
++;
678 skb
->dev
= &idev
->netdev
;
679 skb
->mac
.raw
= skb
->data
;
680 skb
->protocol
= htons(ETH_P_IRDA
);
687 * Function uircc_interrupt (irq, dev_id, regs)
689 * An interrupt from the chip has arrived. Time to do some work
692 static void uircc_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
697 struct irda_device
*idev
= (struct irda_device
*) dev_id
;
700 printk( KERN_WARNING
"%s: irq %d for unknown device.\n",
705 if (idev
->io
.baudrate
<= 115200)
706 return irport_interrupt( irq
, dev_id
, regs
);
708 iobase
= idev
->io
.iobase
;
710 /* Read interrupt status */
711 sr3
= inb( iobase
+UIRCC_SR3
);
716 idev
->netdev
.interrupt
= 1;
718 DEBUG( 4, __FUNCTION__
"(), sr3=%#x, sr2=%#x, sr10=%#x\n",
719 inb( iobase
+UIRCC_SR3
), inb( iobase
+UIRCC_SR2
),
720 inb( iobase
+UIRCC_SR10
));
723 * Check what interrupt this is. The UIRCC will not report two
724 * different interrupts at the same time!
727 case UIRCC_SR3_RX_EOF
: /* Check of end of frame */
728 uircc_dma_receive_complete( idev
, iobase
);
730 case UIRCC_SR3_TXUR
: /* Check for transmit underrun */
731 uircc_dma_xmit_complete( idev
, TRUE
);
733 case UIRCC_SR3_TX_DONE
:
734 uircc_dma_xmit_complete( idev
, FALSE
);
736 case UIRCC_SR3_TMR_OUT
:
738 outb( inb( iobase
+UIRCC_CR11
) & ~UIRCC_CR11_TMR_EN
,
742 DEBUG( 0, __FUNCTION__
"(), unknown interrupt status=%#x\n",
747 idev
->netdev
.interrupt
= 0;
751 * Function uircc_wait_until_sent (idev)
753 * This function should put the current thread to sleep until all data
754 * have been sent, so it is safe to change the speed.
756 static void uircc_wait_until_sent( struct irda_device
*idev
)
758 /* Just delay 60 ms */
759 current
->state
= TASK_INTERRUPTIBLE
;
764 * Function uircc_is_receiving (idev)
766 * Return TRUE is we are currently receiving a frame
769 static int uircc_is_receiving( struct irda_device
*idev
)
774 ASSERT( idev
!= NULL
, return FALSE
;);
775 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return FALSE
;);
777 if ( idev
->io
.baudrate
> 115200) {
780 status
= ( idev
->rx_buff
.state
!= OUTSIDE_FRAME
);
786 * Function uircc_net_init (dev)
788 * Initialize network device
791 static int uircc_net_init( struct device
*dev
)
793 DEBUG( 4, __FUNCTION__
"()\n");
795 /* Setup to be a normal IrDA network device driver */
796 irda_device_setup( dev
);
798 /* Insert overrides below this line! */
805 * Function uircc_net_open (dev)
810 static int uircc_net_open( struct device
*dev
)
812 struct irda_device
*idev
;
815 DEBUG( 4, __FUNCTION__
"()\n");
817 ASSERT( dev
!= NULL
, return -1;);
818 idev
= (struct irda_device
*) dev
->priv
;
820 ASSERT( idev
!= NULL
, return 0;);
821 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return 0;);
823 iobase
= idev
->io
.iobase
;
825 if (request_irq( idev
->io
.irq
, uircc_interrupt
, 0, idev
->name
,
830 * Always allocate the DMA channel after the IRQ,
831 * and clean up on failure.
833 if (request_dma(idev
->io
.dma
, idev
->name
)) {
834 free_irq( idev
->io
.irq
, idev
);
843 /* turn on interrupts */
851 * Function uircc_net_close (dev)
856 static int uircc_net_close(struct device
*dev
)
858 struct irda_device
*idev
;
861 DEBUG( 4, __FUNCTION__
"()\n");
867 ASSERT( dev
!= NULL
, return -1;);
868 idev
= (struct irda_device
*) dev
->priv
;
870 ASSERT( idev
!= NULL
, return 0;);
871 ASSERT( idev
->magic
== IRDA_DEVICE_MAGIC
, return 0;);
873 iobase
= idev
->io
.iobase
;
875 disable_dma( idev
->io
.dma
);
877 /* Disable interrupts */
879 free_irq( idev
->io
.irq
, idev
);
880 free_dma( idev
->io
.dma
);
890 * Function init_module (void)
895 int init_module(void)
903 * Function cleanup_module (void)
908 void cleanup_module(void)