2  * IR port driver for the Cirrus Logic EP7211 processor.
 
   4  * Copyright 2001, Blue Mug Inc.  All rights reserved.
 
   7 #include <linux/module.h>
 
   8 #include <linux/delay.h>
 
  10 #include <linux/init.h>
 
  12 #include <net/irda/irda.h>
 
  13 #include <net/irda/irda_device.h>
 
  16 #include <asm/hardware.h>
 
  18 #define MIN_DELAY 25      /* 15 us, but wait a little more to be sure */
 
  19 #define MAX_DELAY 10000   /* 1 ms */
 
  21 static void ep7211_ir_open(dongle_t *self, struct qos_info *qos);
 
  22 static void ep7211_ir_close(dongle_t *self);
 
  23 static int  ep7211_ir_change_speed(struct irda_task *task);
 
  24 static int  ep7211_ir_reset(struct irda_task *task);
 
  26 static struct dongle_reg dongle = {
 
  27         .type = IRDA_EP7211_IR,
 
  28         .open = ep7211_ir_open,
 
  29         .close = ep7211_ir_close,
 
  30         .reset = ep7211_ir_reset,
 
  31         .change_speed = ep7211_ir_change_speed,
 
  35 static void ep7211_ir_open(dongle_t *self, struct qos_info *qos)
 
  37         unsigned int syscon1, flags;
 
  39         save_flags(flags); cli();
 
  41         /* Turn on the SIR encoder. */
 
  42         syscon1 = clps_readl(SYSCON1);
 
  43         syscon1 |= SYSCON1_SIREN;
 
  44         clps_writel(syscon1, SYSCON1);
 
  46         /* XXX: We should disable modem status interrupts on the first
 
  47                 UART (interrupt #14). */
 
  52 static void ep7211_ir_close(dongle_t *self)
 
  54         unsigned int syscon1, flags;
 
  56         save_flags(flags); cli();
 
  58         /* Turn off the SIR encoder. */
 
  59         syscon1 = clps_readl(SYSCON1);
 
  60         syscon1 &= ~SYSCON1_SIREN;
 
  61         clps_writel(syscon1, SYSCON1);
 
  63         /* XXX: If we've disabled the modem status interrupts, we should
 
  64                 reset them back to their original state. */
 
  70  * Function ep7211_ir_change_speed (task)
 
  72  *    Change speed of the EP7211 I/R port. We don't really have to do anything
 
  73  *    for the EP7211 as long as the rate is being changed at the serial port
 
  76 static int ep7211_ir_change_speed(struct irda_task *task)
 
  78         irda_task_next_state(task, IRDA_TASK_DONE);
 
  83  * Function ep7211_ir_reset (task)
 
  85  *      Reset the EP7211 I/R. We don't really have to do anything.
 
  88 static int ep7211_ir_reset(struct irda_task *task)
 
  90         irda_task_next_state(task, IRDA_TASK_DONE);
 
  95  * Function ep7211_ir_init(void)
 
  97  *    Initialize EP7211 I/R module
 
 100 static int __init ep7211_ir_init(void)
 
 102         return irda_device_register_dongle(&dongle);
 
 106  * Function ep7211_ir_cleanup(void)
 
 108  *    Cleanup EP7211 I/R module
 
 111 static void __exit ep7211_ir_cleanup(void)
 
 113         irda_device_unregister_dongle(&dongle);
 
 116 MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>");
 
 117 MODULE_DESCRIPTION("EP7211 I/R driver");
 
 118 MODULE_LICENSE("GPL");
 
 119 MODULE_ALIAS("irda-dongle-8"); /* IRDA_EP7211_IR */
 
 121 module_init(ep7211_ir_init);
 
 122 module_exit(ep7211_ir_cleanup);