diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/net/irda/ep7211_ir.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/net/irda/ep7211_ir.c')
-rw-r--r-- | drivers/net/irda/ep7211_ir.c | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/drivers/net/irda/ep7211_ir.c b/drivers/net/irda/ep7211_ir.c new file mode 100644 index 000000000000..31896262d21c --- /dev/null +++ b/drivers/net/irda/ep7211_ir.c | |||
@@ -0,0 +1,122 @@ | |||
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> | ||
11 | |||
12 | #include <net/irda/irda.h> | ||
13 | #include <net/irda/irda_device.h> | ||
14 | |||
15 | #include <asm/io.h> | ||
16 | #include <asm/hardware.h> | ||
17 | |||
18 | #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ | ||
19 | #define MAX_DELAY 10000 /* 1 ms */ | ||
20 | |||
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); | ||
25 | |||
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, | ||
32 | .owner = THIS_MODULE, | ||
33 | }; | ||
34 | |||
35 | static void ep7211_ir_open(dongle_t *self, struct qos_info *qos) | ||
36 | { | ||
37 | unsigned int syscon1, flags; | ||
38 | |||
39 | save_flags(flags); cli(); | ||
40 | |||
41 | /* Turn on the SIR encoder. */ | ||
42 | syscon1 = clps_readl(SYSCON1); | ||
43 | syscon1 |= SYSCON1_SIREN; | ||
44 | clps_writel(syscon1, SYSCON1); | ||
45 | |||
46 | /* XXX: We should disable modem status interrupts on the first | ||
47 | UART (interrupt #14). */ | ||
48 | |||
49 | restore_flags(flags); | ||
50 | } | ||
51 | |||
52 | static void ep7211_ir_close(dongle_t *self) | ||
53 | { | ||
54 | unsigned int syscon1, flags; | ||
55 | |||
56 | save_flags(flags); cli(); | ||
57 | |||
58 | /* Turn off the SIR encoder. */ | ||
59 | syscon1 = clps_readl(SYSCON1); | ||
60 | syscon1 &= ~SYSCON1_SIREN; | ||
61 | clps_writel(syscon1, SYSCON1); | ||
62 | |||
63 | /* XXX: If we've disabled the modem status interrupts, we should | ||
64 | reset them back to their original state. */ | ||
65 | |||
66 | restore_flags(flags); | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * Function ep7211_ir_change_speed (task) | ||
71 | * | ||
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 | ||
74 | * level. | ||
75 | */ | ||
76 | static int ep7211_ir_change_speed(struct irda_task *task) | ||
77 | { | ||
78 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | /* | ||
83 | * Function ep7211_ir_reset (task) | ||
84 | * | ||
85 | * Reset the EP7211 I/R. We don't really have to do anything. | ||
86 | * | ||
87 | */ | ||
88 | static int ep7211_ir_reset(struct irda_task *task) | ||
89 | { | ||
90 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * Function ep7211_ir_init(void) | ||
96 | * | ||
97 | * Initialize EP7211 I/R module | ||
98 | * | ||
99 | */ | ||
100 | static int __init ep7211_ir_init(void) | ||
101 | { | ||
102 | return irda_device_register_dongle(&dongle); | ||
103 | } | ||
104 | |||
105 | /* | ||
106 | * Function ep7211_ir_cleanup(void) | ||
107 | * | ||
108 | * Cleanup EP7211 I/R module | ||
109 | * | ||
110 | */ | ||
111 | static void __exit ep7211_ir_cleanup(void) | ||
112 | { | ||
113 | irda_device_unregister_dongle(&dongle); | ||
114 | } | ||
115 | |||
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 */ | ||
120 | |||
121 | module_init(ep7211_ir_init); | ||
122 | module_exit(ep7211_ir_cleanup); | ||