[PATCH] irq-flags: drivers/net: Use the new IRQF_ constants
[linux-2.6-block.git] / drivers / net / irda / ep7211_ir.c
CommitLineData
1da177e4
LT
1/*
2 * IR port driver for the Cirrus Logic EP7211 processor.
3 *
4 * Copyright 2001, Blue Mug Inc. All rights reserved.
5 */
6
7#include <linux/module.h>
8#include <linux/delay.h>
9#include <linux/tty.h>
10#include <linux/init.h>
03488826 11#include <linux/spinlock.h>
1da177e4
LT
12
13#include <net/irda/irda.h>
14#include <net/irda/irda_device.h>
15
16#include <asm/io.h>
17#include <asm/hardware.h>
18
19#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
20#define MAX_DELAY 10000 /* 1 ms */
21
22static void ep7211_ir_open(dongle_t *self, struct qos_info *qos);
23static void ep7211_ir_close(dongle_t *self);
24static int ep7211_ir_change_speed(struct irda_task *task);
25static int ep7211_ir_reset(struct irda_task *task);
26
03488826
D
27static DEFINE_SPINLOCK(ep7211_lock);
28
1da177e4
LT
29static struct dongle_reg dongle = {
30 .type = IRDA_EP7211_IR,
31 .open = ep7211_ir_open,
32 .close = ep7211_ir_close,
33 .reset = ep7211_ir_reset,
34 .change_speed = ep7211_ir_change_speed,
35 .owner = THIS_MODULE,
36};
37
38static void ep7211_ir_open(dongle_t *self, struct qos_info *qos)
39{
40 unsigned int syscon1, flags;
41
03488826 42 spin_lock_irqsave(&ep7211_lock, flags);
1da177e4
LT
43
44 /* Turn on the SIR encoder. */
45 syscon1 = clps_readl(SYSCON1);
46 syscon1 |= SYSCON1_SIREN;
47 clps_writel(syscon1, SYSCON1);
48
49 /* XXX: We should disable modem status interrupts on the first
50 UART (interrupt #14). */
51
03488826 52 spin_unlock_irqrestore(&ep7211_lock, flags);
1da177e4
LT
53}
54
55static void ep7211_ir_close(dongle_t *self)
56{
57 unsigned int syscon1, flags;
58
03488826 59 spin_lock_irqsave(&ep7211_lock, flags);
1da177e4
LT
60
61 /* Turn off the SIR encoder. */
62 syscon1 = clps_readl(SYSCON1);
63 syscon1 &= ~SYSCON1_SIREN;
64 clps_writel(syscon1, SYSCON1);
65
66 /* XXX: If we've disabled the modem status interrupts, we should
67 reset them back to their original state. */
68
03488826 69 spin_unlock_irqrestore(&ep7211_lock, flags);
1da177e4
LT
70}
71
72/*
73 * Function ep7211_ir_change_speed (task)
74 *
75 * Change speed of the EP7211 I/R port. We don't really have to do anything
76 * for the EP7211 as long as the rate is being changed at the serial port
77 * level.
78 */
79static int ep7211_ir_change_speed(struct irda_task *task)
80{
81 irda_task_next_state(task, IRDA_TASK_DONE);
82 return 0;
83}
84
85/*
86 * Function ep7211_ir_reset (task)
87 *
88 * Reset the EP7211 I/R. We don't really have to do anything.
89 *
90 */
91static int ep7211_ir_reset(struct irda_task *task)
92{
93 irda_task_next_state(task, IRDA_TASK_DONE);
94 return 0;
95}
96
97/*
98 * Function ep7211_ir_init(void)
99 *
100 * Initialize EP7211 I/R module
101 *
102 */
103static int __init ep7211_ir_init(void)
104{
105 return irda_device_register_dongle(&dongle);
106}
107
108/*
109 * Function ep7211_ir_cleanup(void)
110 *
111 * Cleanup EP7211 I/R module
112 *
113 */
114static void __exit ep7211_ir_cleanup(void)
115{
116 irda_device_unregister_dongle(&dongle);
117}
118
119MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>");
120MODULE_DESCRIPTION("EP7211 I/R driver");
121MODULE_LICENSE("GPL");
122MODULE_ALIAS("irda-dongle-8"); /* IRDA_EP7211_IR */
123
124module_init(ep7211_ir_init);
125module_exit(ep7211_ir_cleanup);