2 * BRIEF MODULE DESCRIPTION
4 * Infra-red driver for the OMAP1610-H2 and OMAP1710-H3 Platforms
6 * (based on omap-sir.c)
8 * Copyright 2003 MontaVista Software Inc.
9 * Author: MontaVista Software, Inc.
12 * Copyright 2004 Texas Instruments.
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
22 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * You should have received a copy of the GNU General Public License along
31 * with this program; if not, write to the Free Software Foundation, Inc.,
32 * 675 Mass Ave, Cambridge, MA 02139, USA.
35 Feb 2004, Texas Instruments
36 - Ported to 2.6 kernel (Feb 2004).
38 Apr 2004, Texas Instruments
39 - Added support for H3 (Apr 2004).
40 Nov 2004, Texas Instruments
41 - Added support for Power Management.
45 #include <linux/config.h>
46 #include <linux/module.h>
47 #include <linux/types.h>
48 #include <linux/init.h>
49 #include <linux/errno.h>
50 #include <linux/netdevice.h>
51 #include <linux/slab.h>
52 #include <linux/rtnetlink.h>
53 #include <linux/interrupt.h>
54 #include <linux/delay.h>
55 #include <linux/ioport.h>
56 #include <linux/dma-mapping.h>
57 #include <linux/platform_device.h>
58 #include <linux/i2c.h>
60 #include <net/irda/irda.h>
61 #include <net/irda/irmod.h>
62 #include <net/irda/wrapper.h>
63 #include <net/irda/irda_device.h>
67 #include <asm/hardware.h>
68 #include <asm/serial.h>
69 #include <asm/mach-types.h>
71 #include <asm/arch/mux.h>
72 #include <asm/arch/gpio.h>
73 #include <asm/arch/irda.h>
75 #define UART3_EFR_EN (1 << 4)
76 #define UART3_MCR_EN_TCR_TLR (1 << 6)
78 #define UART3_LCR_WL_8 (3 << 0)
79 #define UART3_LCR_SP2 (1 << 2)
80 #define UART3_LCR_DIVEN (1 << 7)
82 #define UART3_FCR_FIFO_EN (1 << 0)
83 #define UART3_FCR_FIFO_RX (1 << 1)
84 #define UART3_FCR_FIFO_TX (1 << 2)
85 #define UART3_FCR_FIFO_DMA1 (1 << 3)
86 #define UART3_FCR_FIFO_TX_TRIG16 (1 << 4)
87 #define UART3_FCR_FIFO_RX_TRIG16 (1 << 6)
88 #define UART3_FCR_CONFIG UART3_FCR_FIFO_EN | UART3_FCR_FIFO_RX | \
89 UART3_FCR_FIFO_TX | UART3_FCR_FIFO_DMA1 | \
90 UART3_FCR_FIFO_TX_TRIG16 | \
91 UART3_FCR_FIFO_RX_TRIG16
93 #define UART3_SCR_TX_TRIG1 (1 << 6)
94 #define UART3_SCR_RX_TRIG1 (1 << 7)
96 #define UART3_MDR1_RESET (0x07)
97 #define UART3_MDR1_SIR (1 << 0)
98 #define UART3_MDR1_MIR (4 << 0)
99 #define UART3_MDR1_FIR (5 << 0)
100 #define UART3_MDR1_SIP_AUTO (1 << 6)
102 #define UART3_MDR2_TRIG1 (0 << 1)
103 #define UART3_MDR2_IRTX_UNDERRUN (1 << 0)
105 #define UART3_ACERG_TX_UNDERRUN_DIS (1 << 4)
106 #define UART3_ACERG_SD_MODE_LOW (1 << 6)
107 #define UART3_ACERG_DIS_IR_RX (1 << 5)
109 #define UART3_IER_EOF (1 << 5)
110 #define UART3_IER_CTS (1 << 7)
112 #define UART3_IIR_TX_STATUS (1 << 5)
113 #define UART3_IIR_EOF (0x80)
115 #define IS_FIR(si) ((si)->speed >= 4000000)
116 #define IRDA_FRAME_SIZE_LIMIT 4096
118 static int rx_state = 0; /* RX state for IOCTL */
122 int speed; /* Current IrDA speed */
125 struct net_device_stats stats;
126 struct irlap_cb *irlap;
132 dma_addr_t rx_buf_dma_phys; /* Physical address of RX DMA buffer */
133 dma_addr_t tx_buf_dma_phys; /* Physical address of TX DMA buffer */
135 void *rx_buf_dma_virt; /* Virtual address of RX DMA buffer */
136 void *tx_buf_dma_virt; /* Virtual address of TX DMA buffer */
139 struct omap_irda_config *pdata;
142 static void inline uart_reg_out(int idx, u8 val)
144 omap_writeb(val, idx);
147 static u8 inline uart_reg_in(int idx)
149 u8 b = omap_readb(idx);
153 /* forward declarations */
154 extern void irda_device_setup(struct net_device *dev);
155 extern void omap_stop_dma(int lch);
156 static int omap_irda_set_speed(struct net_device *dev, int speed);
158 static void omap_irda_start_rx_dma(struct omap_irda *si)
161 omap_set_dma_src_params(si->rx_dma_channel, 0x3, 0x0,
162 si->pdata->src_start,
165 omap_enable_dma_irq(si->rx_dma_channel, 0x01);
167 omap_set_dma_dest_params(si->rx_dma_channel, 0x0, 0x1,
171 omap_set_dma_transfer_params(si->rx_dma_channel, 0x0,
172 IRDA_FRAME_SIZE_LIMIT, 0x1,
173 0x0, si->pdata->rx_trigger, 0);
175 omap_start_dma(si->rx_dma_channel);
178 static void omap_start_tx_dma(struct omap_irda *si, int size)
181 omap_set_dma_dest_params(si->tx_dma_channel, 0x03, 0x0,
182 si->pdata->dest_start, 0, 0);
184 omap_enable_dma_irq(si->tx_dma_channel, 0x01);
186 omap_set_dma_src_params(si->tx_dma_channel, 0x0, 0x1,
190 omap_set_dma_transfer_params(si->tx_dma_channel, 0x0, size, 0x1,
191 0x0, si->pdata->tx_trigger, 0);
194 omap_start_dma(si->tx_dma_channel);
197 /* DMA RX callback - normally, we should not go here,
198 * it calls only if something is going wrong
200 static void omap_irda_rx_dma_callback(int lch, u16 ch_status, void *data)
202 struct net_device *dev = data;
203 struct omap_irda *si = dev->priv;
205 printk(KERN_ERR "RX Transfer error or very big frame\n");
207 /* Clear interrupts */
208 uart_reg_in(UART3_IIR);
210 si->stats.rx_frame_errors++;
212 uart_reg_in(UART3_RESUME);
215 omap_irda_start_rx_dma(si);
218 /* DMA TX callback - calling when frame transfer has been finished */
219 static void omap_irda_tx_dma_callback(int lch, u16 ch_status, void *data)
221 struct net_device *dev = data;
222 struct omap_irda *si = dev->priv;
224 /*Stop DMA controller */
225 omap_stop_dma(si->tx_dma_channel);
229 * Set the IrDA communications speed.
230 * Interrupt have to be disabled here.
232 static int omap_irda_startup(struct net_device *dev)
234 struct omap_irda *si = dev->priv;
237 /* FIXME: use clk_* apis for UART3 clock*/
238 /* Enable UART3 clock and set UART3 to IrDA mode */
239 if (machine_is_omap_h2() || machine_is_omap_h3())
240 omap_writel(omap_readl(MOD_CONF_CTRL_0) | (1 << 31) | (1 << 15),
245 if (si->pdata->transceiver_mode && machine_is_omap_h2()) {
246 /* Is it select_irda on H2 ? */
247 omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7,
249 si->pdata->transceiver_mode(si->dev, IR_SIRMODE);
252 uart_reg_out(UART3_MDR1, UART3_MDR1_RESET); /* Reset mode */
254 /* Clear DLH and DLL */
255 uart_reg_out(UART3_LCR, UART3_LCR_DIVEN);
257 uart_reg_out(UART3_DLL, 0);
258 uart_reg_out(UART3_DLH, 0);
259 uart_reg_out(UART3_LCR, 0xbf); /* FIXME: Add #define */
261 uart_reg_out(UART3_EFR, UART3_EFR_EN);
262 uart_reg_out(UART3_LCR, UART3_LCR_DIVEN);
264 /* Enable access to UART3_TLR and UART3_TCR registers */
265 uart_reg_out(UART3_MCR, UART3_MCR_EN_TCR_TLR);
267 uart_reg_out(UART3_SCR, 0);
268 /* Set Rx trigger to 1 and Tx trigger to 1 */
269 uart_reg_out(UART3_TLR, 0);
271 /* Set LCR to 8 bits and 1 stop bit */
272 uart_reg_out(UART3_LCR, 0x03);
274 /* Clear RX and TX FIFO and enable FIFO */
275 /* Use DMA Req for transfers */
276 uart_reg_out(UART3_FCR, UART3_FCR_CONFIG);
278 uart_reg_out(UART3_MCR, 0);
280 uart_reg_out(UART3_SCR, UART3_SCR_TX_TRIG1 |
283 /* Enable UART3 SIR Mode,(Frame-length method to end frames) */
284 uart_reg_out(UART3_MDR1, UART3_MDR1_SIR);
286 /* Set Status FIFO trig to 1 */
287 uart_reg_out(UART3_MDR2, 0);
289 /* Enables RXIR input */
290 /* and disable TX underrun */
292 uart_reg_out(UART3_ACREG, UART3_ACERG_SD_MODE_LOW |
293 UART3_ACERG_TX_UNDERRUN_DIS);
295 /* Enable EOF Interrupt only */
296 uart_reg_out(UART3_IER, UART3_IER_CTS | UART3_IER_EOF);
298 /* Set Maximum Received Frame size to 2048 bytes */
299 uart_reg_out(UART3_RXFLL, 0x00);
300 uart_reg_out(UART3_RXFLH, 0x08);
302 uart_reg_in(UART3_RESUME);
307 static int omap_irda_shutdown(struct omap_irda *si)
311 local_irq_save(flags);
313 /* Disable all UART3 Interrupts */
314 uart_reg_out(UART3_IER, 0);
316 /* Disable UART3 and disable baud rate generator */
317 uart_reg_out(UART3_MDR1, UART3_MDR1_RESET);
319 /* set SD_MODE pin to high and Disable RX IR */
320 uart_reg_out(UART3_ACREG, (UART3_ACERG_DIS_IR_RX |
321 ~(UART3_ACERG_SD_MODE_LOW)));
323 /* Clear DLH and DLL */
324 uart_reg_out(UART3_LCR, UART3_LCR_DIVEN);
325 uart_reg_out(UART3_DLL, 0);
326 uart_reg_out(UART3_DLH, 0);
328 local_irq_restore(flags);
334 omap_irda_irq(int irq, void *dev_id, struct pt_regs *hw_regs)
336 struct net_device *dev = dev_id;
337 struct omap_irda *si = dev->priv;
343 /* Clear EOF interrupt */
344 status = uart_reg_in(UART3_IIR);
346 if (status & UART3_IIR_TX_STATUS) {
347 u8 mdr2 = uart_reg_in(UART3_MDR2);
348 if (mdr2 & UART3_MDR2_IRTX_UNDERRUN)
349 printk(KERN_ERR "IrDA Buffer underrun error\n");
351 si->stats.tx_packets++;
354 omap_irda_set_speed(dev, si->newspeed);
358 netif_wake_queue(dev);
359 if (!(status & UART3_IIR_EOF))
363 /* Stop DMA and if there are no errors, send frame to upper layer */
364 omap_stop_dma(si->rx_dma_channel);
366 status = uart_reg_in(UART3_SFLSR); /* Take a frame status */
368 if (status != 0) { /* Bad frame? */
369 si->stats.rx_frame_errors++;
370 uart_reg_in(UART3_RESUME);
372 /* We got a frame! */
373 skb = alloc_skb(IRDA_FRAME_SIZE_LIMIT, GFP_ATOMIC);
376 printk(KERN_ERR "omap_sir: out of memory for RX SKB\n");
380 * Align any IP headers that may be contained
386 w = OMAP_DMA_CDAC_REG(si->rx_dma_channel);
388 if (cpu_is_omap16xx())
389 w -= OMAP1_DMA_CDSA_L_REG(si->rx_dma_channel);
390 if (cpu_is_omap24xx())
391 w -= OMAP2_DMA_CDSA_REG(si->rx_dma_channel);
394 /* Copy DMA buffer to skb */
395 memcpy(skb_put(skb, w - 2), si->rx_buf_dma_virt, w - 2);
397 /* Copy DMA buffer to skb */
398 memcpy(skb_put(skb, w - 4), si->rx_buf_dma_virt, w - 4);
402 skb->mac.raw = skb->data;
403 skb->protocol = htons(ETH_P_IRDA);
404 si->stats.rx_packets++;
405 si->stats.rx_bytes += skb->len;
406 netif_receive_skb(skb); /* Send data to upper level */
410 omap_irda_start_rx_dma(si);
412 dev->last_rx = jiffies;
417 static int omap_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
419 struct omap_irda *si = dev->priv;
420 int speed = irda_get_next_speed(skb);
421 int mtt = irda_get_mtt(skb);
422 int xbofs = irda_get_next_xbofs(skb);
426 * Does this packet contain a request to change the interface
427 * speed? If so, remember it until we complete the transmission
430 if (speed != si->speed && speed != -1)
431 si->newspeed = speed;
433 if (xbofs) /* Set number of addtional BOFS */
434 uart_reg_out(UART3_EBLR, xbofs + 1);
437 * If this is an empty frame, we can bypass a lot.
442 omap_irda_set_speed(dev, speed);
448 netif_stop_queue(dev);
450 /* Copy skb data to DMA buffer */
451 memcpy(si->tx_buf_dma_virt, skb->data, skb->len);
453 /* Copy skb data to DMA buffer */
454 si->stats.tx_bytes += skb->len;
456 /* Set frame length */
457 uart_reg_out(UART3_TXFLL, (skb->len & 0xff));
458 uart_reg_out(UART3_TXFLH, (skb->len >> 8));
465 /* Start TX DMA transfer */
466 omap_start_tx_dma(si, skb->len);
468 /* We can free skb now because it's already in DMA buffer */
471 dev->trans_start = jiffies;
477 omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
479 struct if_irda_req *rq = (struct if_irda_req *)ifreq;
480 struct omap_irda *si = dev->priv;
481 int ret = -EOPNOTSUPP;
486 if (capable(CAP_NET_ADMIN)) {
488 * We are unable to set the speed if the
489 * device is not running.
492 ret = omap_irda_set_speed(dev,
495 printk(KERN_ERR "omap_irda_ioctl: SIOCSBANDWIDTH: !netif_running\n");
503 if (capable(CAP_NET_ADMIN)) {
504 irda_device_set_media_busy(dev, TRUE);
510 rq->ifr_receiving = rx_state;
520 static struct net_device_stats *omap_irda_stats(struct net_device *dev)
522 struct omap_irda *si = dev->priv;
526 static int omap_irda_start(struct net_device *dev)
528 struct omap_irda *si = dev->priv;
533 err = request_irq(dev->irq, omap_irda_irq, 0, dev->name, dev);
538 * The interrupt must remain disabled for now.
540 disable_irq(dev->irq);
542 /* Request DMA channels for IrDA hardware */
543 if (omap_request_dma(si->pdata->rx_channel, "IrDA Rx DMA",
544 (void *)omap_irda_rx_dma_callback,
545 dev, &(si->rx_dma_channel))) {
546 printk(KERN_ERR "Failed to request IrDA Rx DMA\n");
550 if (omap_request_dma(si->pdata->tx_channel, "IrDA Tx DMA",
551 (void *)omap_irda_tx_dma_callback,
552 dev, &(si->tx_dma_channel))) {
553 printk(KERN_ERR "Failed to request IrDA Tx DMA\n");
557 /* Allocate TX and RX buffers for DMA channels */
558 si->rx_buf_dma_virt =
559 dma_alloc_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
560 &(si->rx_buf_dma_phys),
563 if (!si->rx_buf_dma_virt) {
564 printk(KERN_ERR "Unable to allocate memory for rx_buf_dma\n");
568 si->tx_buf_dma_virt =
569 dma_alloc_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
570 &(si->tx_buf_dma_phys),
573 if (!si->tx_buf_dma_virt) {
574 printk(KERN_ERR "Unable to allocate memory for tx_buf_dma\n");
579 * Setup the serial port for the specified config.
581 if (si->pdata->select_irda)
582 si->pdata->select_irda(si->dev, IR_SEL);
584 err = omap_irda_startup(dev);
589 omap_irda_set_speed(dev, si->speed = 9600);
592 * Open a new IrLAP layer instance.
594 si->irlap = irlap_open(dev, &si->qos, "omap_sir");
600 /* Now enable the interrupt and start the queue */
604 omap_irda_start_rx_dma(si);
606 enable_irq(dev->irq);
607 netif_start_queue(dev);
613 omap_irda_shutdown(si);
615 dma_free_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
616 si->tx_buf_dma_virt, si->tx_buf_dma_phys);
618 dma_free_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
619 si->rx_buf_dma_virt, si->rx_buf_dma_phys);
621 free_irq(dev->irq, dev);
625 static int omap_irda_stop(struct net_device *dev)
627 struct omap_irda *si = dev->priv;
629 disable_irq(dev->irq);
631 netif_stop_queue(dev);
633 omap_free_dma(si->rx_dma_channel);
634 omap_free_dma(si->tx_dma_channel);
636 if (si->rx_buf_dma_virt)
637 dma_free_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
638 si->rx_buf_dma_virt, si->rx_buf_dma_phys);
639 if (si->tx_buf_dma_virt)
640 dma_free_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
641 si->tx_buf_dma_virt, si->tx_buf_dma_phys);
643 omap_irda_shutdown(si);
647 irlap_close(si->irlap);
656 free_irq(dev->irq, dev);
661 static int omap_irda_set_speed(struct net_device *dev, int speed)
663 struct omap_irda *si = dev->priv;
668 if (speed <= 115200) {
670 local_irq_save(flags);
673 if (si->pdata->transceiver_mode)
674 si->pdata->transceiver_mode(si->dev, IR_SIRMODE);
677 uart_reg_out(UART3_MDR1, 1);
678 uart_reg_out(UART3_EBLR, 1);
680 divisor = 48000000 / (16 * speed); /* Base clock 48 MHz */
682 uart_reg_out(UART3_LCR, UART3_LCR_DIVEN);
683 uart_reg_out(UART3_DLL, (divisor & 0xff));
684 uart_reg_out(UART3_DLH, (divisor >> 8));
685 uart_reg_out(UART3_LCR, 0x03);
687 uart_reg_out(UART3_MCR, 0);
689 local_irq_restore(flags);
690 } else if (speed <= 1152000) {
692 local_irq_save(flags);
694 /* Set MIR mode, auto SIP */
695 uart_reg_out(UART3_MDR1, UART3_MDR1_MIR |
696 UART3_MDR1_SIP_AUTO);
698 uart_reg_out(UART3_EBLR, 2);
700 divisor = 48000000 / (41 * speed); /* Base clock 48 MHz */
702 uart_reg_out(UART3_LCR, UART3_LCR_DIVEN);
703 uart_reg_out(UART3_DLL, (divisor & 0xff));
704 uart_reg_out(UART3_DLH, (divisor >> 8));
705 uart_reg_out(UART3_LCR, 0x03);
707 if (si->pdata->transceiver_mode)
708 si->pdata->transceiver_mode(si->dev, IR_MIRMODE);
710 local_irq_restore(flags);
712 local_irq_save(flags);
715 uart_reg_out(UART3_MDR1, UART3_MDR1_FIR |
716 UART3_MDR1_SIP_AUTO);
718 if (si->pdata->transceiver_mode)
719 si->pdata->transceiver_mode(si->dev, IR_FIRMODE);
721 local_irq_restore(flags);
731 * Suspend the IrDA interface.
733 static int omap_irda_suspend(struct platform_device *pdev, pm_message_t state)
735 struct net_device *dev = platform_get_drvdata(pdev);
736 struct omap_irda *si = dev->priv;
743 * Stop the transmit queue
745 netif_device_detach(dev);
746 disable_irq(dev->irq);
747 omap_irda_shutdown(si);
753 * Resume the IrDA interface.
755 static int omap_irda_resume(struct platform_device *pdev)
757 struct net_device *dev = platform_get_drvdata(pdev);
758 struct omap_irda *si= dev->priv;
765 * If we missed a speed change, initialise at the new speed
766 * directly. It is debatable whether this is actually
767 * required, but in the interests of continuing from where
768 * we left off it is desireable. The converse argument is
769 * that we should re-negotiate at 9600 baud again.
772 si->speed = si->newspeed;
776 omap_irda_startup(dev);
777 omap_irda_set_speed(dev, si->speed);
778 enable_irq(dev->irq);
781 * This automatically wakes up the queue
783 netif_device_attach(dev);
789 #define omap_irda_suspend NULL
790 #define omap_irda_resume NULL
793 static int omap_irda_probe(struct platform_device *pdev)
795 struct net_device *dev;
796 struct omap_irda *si;
797 struct omap_irda_config *pdata = pdev->dev.platform_data;
798 unsigned int baudrate_mask;
803 printk(KERN_ERR "IrDA Platform data not supplied\n");
807 if (!pdata->rx_channel || !pdata->tx_channel) {
808 printk(KERN_ERR "IrDA invalid rx/tx channel value\n");
812 irq = platform_get_irq(pdev, 0);
814 printk(KERN_WARNING "no irq for IrDA\n");
818 dev = alloc_irdadev(sizeof(struct omap_irda));
824 si->dev = &pdev->dev;
827 dev->hard_start_xmit = omap_irda_hard_xmit;
828 dev->open = omap_irda_start;
829 dev->stop = omap_irda_stop;
830 dev->do_ioctl = omap_irda_ioctl;
831 dev->get_stats = omap_irda_stats;
834 irda_init_max_qos_capabilies(&si->qos);
837 if (si->pdata->transceiver_cap & IR_SIRMODE)
838 baudrate_mask |= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
839 if (si->pdata->transceiver_cap & IR_MIRMODE)
840 baudrate_mask |= IR_57600 | IR_1152000;
841 if (si->pdata->transceiver_cap & IR_FIRMODE)
842 baudrate_mask |= IR_4000000 << 8;
844 si->qos.baud_rate.bits &= baudrate_mask;
845 si->qos.min_turn_time.bits = 7;
847 irda_qos_bits_to_value(&si->qos);
849 /* Any better way to avoid this? No. */
850 if (machine_is_omap_h3() || machine_is_omap_h4())
851 INIT_WORK(&si->pdata->gpio_expa, NULL, NULL);
853 err = register_netdev(dev);
855 platform_set_drvdata(pdev, dev);
863 static int omap_irda_remove(struct platform_device *pdev)
865 struct net_device *dev = platform_get_drvdata(pdev);
868 unregister_netdev(dev);
874 static struct platform_driver omapir_driver = {
875 .probe = omap_irda_probe,
876 .remove = omap_irda_remove,
877 .suspend = omap_irda_suspend,
878 .resume = omap_irda_resume,
884 static char __initdata banner[] = KERN_INFO "OMAP IrDA driver initializing\n";
886 static int __init omap_irda_init(void)
889 return platform_driver_register(&omapir_driver);
892 static void __exit omap_irda_exit(void)
894 platform_driver_unregister(&omapir_driver);
897 module_init(omap_irda_init);
898 module_exit(omap_irda_exit);
900 MODULE_AUTHOR("MontaVista");
901 MODULE_DESCRIPTION("OMAP IrDA Driver");
902 MODULE_LICENSE("GPL");