diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-01-19 03:01:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:10 -0500 |
commit | 16b4d60b56b9ec922d91cc11ede0bd59033deae4 (patch) | |
tree | f7d6fe75fd03c449f7e644fff59d707da8502d1e /drivers/net/irda | |
parent | e9888f5498083f5e4d873cbbe16aa97d89aa1342 (diff) |
[IrDA]: Irport removal - part 2
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r-- | drivers/net/irda/act200l.c | 297 | ||||
-rw-r--r-- | drivers/net/irda/actisys.c | 288 | ||||
-rw-r--r-- | drivers/net/irda/ep7211_ir.c | 125 | ||||
-rw-r--r-- | drivers/net/irda/esi.c | 149 | ||||
-rw-r--r-- | drivers/net/irda/girbil.c | 250 | ||||
-rw-r--r-- | drivers/net/irda/litelink.c | 179 | ||||
-rw-r--r-- | drivers/net/irda/ma600.c | 354 | ||||
-rw-r--r-- | drivers/net/irda/mcp2120.c | 240 | ||||
-rw-r--r-- | drivers/net/irda/old_belkin.c | 164 | ||||
-rw-r--r-- | drivers/net/irda/tekram.c | 282 |
10 files changed, 0 insertions, 2328 deletions
diff --git a/drivers/net/irda/act200l.c b/drivers/net/irda/act200l.c deleted file mode 100644 index 756cd44e857a..000000000000 --- a/drivers/net/irda/act200l.c +++ /dev/null | |||
@@ -1,297 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: act200l.c | ||
4 | * Version: 0.8 | ||
5 | * Description: Implementation for the ACTiSYS ACT-IR200L dongle | ||
6 | * Status: Experimental. | ||
7 | * Author: SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp> | ||
8 | * Created at: Fri Aug 3 17:35:42 2001 | ||
9 | * Modified at: Fri Aug 17 10:22:40 2001 | ||
10 | * Modified by: SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp> | ||
11 | * | ||
12 | * Copyright (c) 2001 SHIMIZU Takuya, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | ********************************************************************/ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/tty.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | #include <net/irda/irda.h> | ||
27 | #include <net/irda/irda_device.h> | ||
28 | |||
29 | static int act200l_reset(struct irda_task *task); | ||
30 | static void act200l_open(dongle_t *self, struct qos_info *qos); | ||
31 | static void act200l_close(dongle_t *self); | ||
32 | static int act200l_change_speed(struct irda_task *task); | ||
33 | |||
34 | /* Regsiter 0: Control register #1 */ | ||
35 | #define ACT200L_REG0 0x00 | ||
36 | #define ACT200L_TXEN 0x01 /* Enable transmitter */ | ||
37 | #define ACT200L_RXEN 0x02 /* Enable receiver */ | ||
38 | |||
39 | /* Register 1: Control register #2 */ | ||
40 | #define ACT200L_REG1 0x10 | ||
41 | #define ACT200L_LODB 0x01 /* Load new baud rate count value */ | ||
42 | #define ACT200L_WIDE 0x04 /* Expand the maximum allowable pulse */ | ||
43 | |||
44 | /* Register 4: Output Power register */ | ||
45 | #define ACT200L_REG4 0x40 | ||
46 | #define ACT200L_OP0 0x01 /* Enable LED1C output */ | ||
47 | #define ACT200L_OP1 0x02 /* Enable LED2C output */ | ||
48 | #define ACT200L_BLKR 0x04 | ||
49 | |||
50 | /* Register 5: Receive Mode register */ | ||
51 | #define ACT200L_REG5 0x50 | ||
52 | #define ACT200L_RWIDL 0x01 /* fixed 1.6us pulse mode */ | ||
53 | |||
54 | /* Register 6: Receive Sensitivity register #1 */ | ||
55 | #define ACT200L_REG6 0x60 | ||
56 | #define ACT200L_RS0 0x01 /* receive threshold bit 0 */ | ||
57 | #define ACT200L_RS1 0x02 /* receive threshold bit 1 */ | ||
58 | |||
59 | /* Register 7: Receive Sensitivity register #2 */ | ||
60 | #define ACT200L_REG7 0x70 | ||
61 | #define ACT200L_ENPOS 0x04 /* Ignore the falling edge */ | ||
62 | |||
63 | /* Register 8,9: Baud Rate Dvider register #1,#2 */ | ||
64 | #define ACT200L_REG8 0x80 | ||
65 | #define ACT200L_REG9 0x90 | ||
66 | |||
67 | #define ACT200L_2400 0x5f | ||
68 | #define ACT200L_9600 0x17 | ||
69 | #define ACT200L_19200 0x0b | ||
70 | #define ACT200L_38400 0x05 | ||
71 | #define ACT200L_57600 0x03 | ||
72 | #define ACT200L_115200 0x01 | ||
73 | |||
74 | /* Register 13: Control register #3 */ | ||
75 | #define ACT200L_REG13 0xd0 | ||
76 | #define ACT200L_SHDW 0x01 /* Enable access to shadow registers */ | ||
77 | |||
78 | /* Register 15: Status register */ | ||
79 | #define ACT200L_REG15 0xf0 | ||
80 | |||
81 | /* Register 21: Control register #4 */ | ||
82 | #define ACT200L_REG21 0x50 | ||
83 | #define ACT200L_EXCK 0x02 /* Disable clock output driver */ | ||
84 | #define ACT200L_OSCL 0x04 /* oscillator in low power, medium accuracy mode */ | ||
85 | |||
86 | static struct dongle_reg dongle = { | ||
87 | .type = IRDA_ACT200L_DONGLE, | ||
88 | .open = act200l_open, | ||
89 | .close = act200l_close, | ||
90 | .reset = act200l_reset, | ||
91 | .change_speed = act200l_change_speed, | ||
92 | .owner = THIS_MODULE, | ||
93 | }; | ||
94 | |||
95 | static int __init act200l_init(void) | ||
96 | { | ||
97 | return irda_device_register_dongle(&dongle); | ||
98 | } | ||
99 | |||
100 | static void __exit act200l_cleanup(void) | ||
101 | { | ||
102 | irda_device_unregister_dongle(&dongle); | ||
103 | } | ||
104 | |||
105 | static void act200l_open(dongle_t *self, struct qos_info *qos) | ||
106 | { | ||
107 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
108 | |||
109 | /* Power on the dongle */ | ||
110 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
111 | |||
112 | /* Set the speeds we can accept */ | ||
113 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; | ||
114 | qos->min_turn_time.bits = 0x03; | ||
115 | } | ||
116 | |||
117 | static void act200l_close(dongle_t *self) | ||
118 | { | ||
119 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
120 | |||
121 | /* Power off the dongle */ | ||
122 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * Function act200l_change_speed (dev, speed) | ||
127 | * | ||
128 | * Set the speed for the ACTiSYS ACT-IR200L type dongle. | ||
129 | * | ||
130 | */ | ||
131 | static int act200l_change_speed(struct irda_task *task) | ||
132 | { | ||
133 | dongle_t *self = (dongle_t *) task->instance; | ||
134 | __u32 speed = (__u32) task->param; | ||
135 | __u8 control[3]; | ||
136 | int ret = 0; | ||
137 | |||
138 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
139 | |||
140 | self->speed_task = task; | ||
141 | |||
142 | switch (task->state) { | ||
143 | case IRDA_TASK_INIT: | ||
144 | if (irda_task_execute(self, act200l_reset, NULL, task, | ||
145 | (void *) speed)) | ||
146 | { | ||
147 | /* Dongle need more time to reset */ | ||
148 | irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); | ||
149 | |||
150 | /* Give reset 1 sec to finish */ | ||
151 | ret = msecs_to_jiffies(1000); | ||
152 | } | ||
153 | break; | ||
154 | case IRDA_TASK_CHILD_WAIT: | ||
155 | IRDA_WARNING("%s(), resetting dongle timed out!\n", | ||
156 | __FUNCTION__); | ||
157 | ret = -1; | ||
158 | break; | ||
159 | case IRDA_TASK_CHILD_DONE: | ||
160 | /* Clear DTR and set RTS to enter command mode */ | ||
161 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
162 | |||
163 | switch (speed) { | ||
164 | case 9600: | ||
165 | default: | ||
166 | control[0] = ACT200L_REG8 | (ACT200L_9600 & 0x0f); | ||
167 | control[1] = ACT200L_REG9 | ((ACT200L_9600 >> 4) & 0x0f); | ||
168 | break; | ||
169 | case 19200: | ||
170 | control[0] = ACT200L_REG8 | (ACT200L_19200 & 0x0f); | ||
171 | control[1] = ACT200L_REG9 | ((ACT200L_19200 >> 4) & 0x0f); | ||
172 | break; | ||
173 | case 38400: | ||
174 | control[0] = ACT200L_REG8 | (ACT200L_38400 & 0x0f); | ||
175 | control[1] = ACT200L_REG9 | ((ACT200L_38400 >> 4) & 0x0f); | ||
176 | break; | ||
177 | case 57600: | ||
178 | control[0] = ACT200L_REG8 | (ACT200L_57600 & 0x0f); | ||
179 | control[1] = ACT200L_REG9 | ((ACT200L_57600 >> 4) & 0x0f); | ||
180 | break; | ||
181 | case 115200: | ||
182 | control[0] = ACT200L_REG8 | (ACT200L_115200 & 0x0f); | ||
183 | control[1] = ACT200L_REG9 | ((ACT200L_115200 >> 4) & 0x0f); | ||
184 | break; | ||
185 | } | ||
186 | control[2] = ACT200L_REG1 | ACT200L_LODB | ACT200L_WIDE; | ||
187 | |||
188 | /* Write control bytes */ | ||
189 | self->write(self->dev, control, 3); | ||
190 | irda_task_next_state(task, IRDA_TASK_WAIT); | ||
191 | ret = msecs_to_jiffies(5); | ||
192 | break; | ||
193 | case IRDA_TASK_WAIT: | ||
194 | /* Go back to normal mode */ | ||
195 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
196 | |||
197 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
198 | self->speed_task = NULL; | ||
199 | break; | ||
200 | default: | ||
201 | IRDA_ERROR("%s(), unknown state %d\n", | ||
202 | __FUNCTION__, task->state); | ||
203 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
204 | self->speed_task = NULL; | ||
205 | ret = -1; | ||
206 | break; | ||
207 | } | ||
208 | return ret; | ||
209 | } | ||
210 | |||
211 | /* | ||
212 | * Function act200l_reset (driver) | ||
213 | * | ||
214 | * Reset the ACTiSYS ACT-IR200L type dongle. | ||
215 | */ | ||
216 | static int act200l_reset(struct irda_task *task) | ||
217 | { | ||
218 | dongle_t *self = (dongle_t *) task->instance; | ||
219 | __u8 control[9] = { | ||
220 | ACT200L_REG15, | ||
221 | ACT200L_REG13 | ACT200L_SHDW, | ||
222 | ACT200L_REG21 | ACT200L_EXCK | ACT200L_OSCL, | ||
223 | ACT200L_REG13, | ||
224 | ACT200L_REG7 | ACT200L_ENPOS, | ||
225 | ACT200L_REG6 | ACT200L_RS0 | ACT200L_RS1, | ||
226 | ACT200L_REG5 | ACT200L_RWIDL, | ||
227 | ACT200L_REG4 | ACT200L_OP0 | ACT200L_OP1 | ACT200L_BLKR, | ||
228 | ACT200L_REG0 | ACT200L_TXEN | ACT200L_RXEN | ||
229 | }; | ||
230 | int ret = 0; | ||
231 | |||
232 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
233 | |||
234 | self->reset_task = task; | ||
235 | |||
236 | switch (task->state) { | ||
237 | case IRDA_TASK_INIT: | ||
238 | /* Power on the dongle */ | ||
239 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
240 | |||
241 | irda_task_next_state(task, IRDA_TASK_WAIT1); | ||
242 | ret = msecs_to_jiffies(50); | ||
243 | break; | ||
244 | case IRDA_TASK_WAIT1: | ||
245 | /* Reset the dongle : set RTS low for 25 ms */ | ||
246 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
247 | |||
248 | irda_task_next_state(task, IRDA_TASK_WAIT2); | ||
249 | ret = msecs_to_jiffies(50); | ||
250 | break; | ||
251 | case IRDA_TASK_WAIT2: | ||
252 | /* Clear DTR and set RTS to enter command mode */ | ||
253 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
254 | |||
255 | /* Write control bytes */ | ||
256 | self->write(self->dev, control, 9); | ||
257 | irda_task_next_state(task, IRDA_TASK_WAIT3); | ||
258 | ret = msecs_to_jiffies(15); | ||
259 | break; | ||
260 | case IRDA_TASK_WAIT3: | ||
261 | /* Go back to normal mode */ | ||
262 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
263 | |||
264 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
265 | self->reset_task = NULL; | ||
266 | break; | ||
267 | default: | ||
268 | IRDA_ERROR("%s(), unknown state %d\n", | ||
269 | __FUNCTION__, task->state); | ||
270 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
271 | self->reset_task = NULL; | ||
272 | ret = -1; | ||
273 | break; | ||
274 | } | ||
275 | return ret; | ||
276 | } | ||
277 | |||
278 | MODULE_AUTHOR("SHIMIZU Takuya <tshimizu@ga2.so-net.ne.jp>"); | ||
279 | MODULE_DESCRIPTION("ACTiSYS ACT-IR200L dongle driver"); | ||
280 | MODULE_LICENSE("GPL"); | ||
281 | MODULE_ALIAS("irda-dongle-10"); /* IRDA_ACT200L_DONGLE */ | ||
282 | |||
283 | /* | ||
284 | * Function init_module (void) | ||
285 | * | ||
286 | * Initialize ACTiSYS ACT-IR200L module | ||
287 | * | ||
288 | */ | ||
289 | module_init(act200l_init); | ||
290 | |||
291 | /* | ||
292 | * Function cleanup_module (void) | ||
293 | * | ||
294 | * Cleanup ACTiSYS ACT-IR200L module | ||
295 | * | ||
296 | */ | ||
297 | module_exit(act200l_cleanup); | ||
diff --git a/drivers/net/irda/actisys.c b/drivers/net/irda/actisys.c deleted file mode 100644 index ae0b80a5680c..000000000000 --- a/drivers/net/irda/actisys.c +++ /dev/null | |||
@@ -1,288 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: actisys.c | ||
4 | * Version: 1.0 | ||
5 | * Description: Implementation for the ACTiSYS IR-220L and IR-220L+ | ||
6 | * dongles | ||
7 | * Status: Beta. | ||
8 | * Authors: Dag Brattli <dagb@cs.uit.no> (initially) | ||
9 | * Jean Tourrilhes <jt@hpl.hp.com> (new version) | ||
10 | * Created at: Wed Oct 21 20:02:35 1998 | ||
11 | * Modified at: Fri Dec 17 09:10:43 1999 | ||
12 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
13 | * | ||
14 | * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. | ||
15 | * Copyright (c) 1999 Jean Tourrilhes | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or | ||
18 | * modify it under the terms of the GNU General Public License as | ||
19 | * published by the Free Software Foundation; either version 2 of | ||
20 | * the License, or (at your option) any later version. | ||
21 | * | ||
22 | * Neither Dag Brattli nor University of Tromsø admit liability nor | ||
23 | * provide warranty for any of this software. This material is | ||
24 | * provided "AS-IS" and at no charge. | ||
25 | * | ||
26 | ********************************************************************/ | ||
27 | |||
28 | /* | ||
29 | * Changelog | ||
30 | * | ||
31 | * 0.8 -> 0.9999 - Jean | ||
32 | * o New initialisation procedure : much safer and correct | ||
33 | * o New procedure the change speed : much faster and simpler | ||
34 | * o Other cleanups & comments | ||
35 | * Thanks to Lichen Wang @ Actisys for his excellent help... | ||
36 | */ | ||
37 | |||
38 | #include <linux/module.h> | ||
39 | #include <linux/delay.h> | ||
40 | #include <linux/tty.h> | ||
41 | #include <linux/init.h> | ||
42 | |||
43 | #include <net/irda/irda.h> | ||
44 | #include <net/irda/irda_device.h> | ||
45 | |||
46 | /* | ||
47 | * Define the timing of the pulses we send to the dongle (to reset it, and | ||
48 | * to toggle speeds). Basically, the limit here is the propagation speed of | ||
49 | * the signals through the serial port, the dongle being much faster. Any | ||
50 | * serial port support 115 kb/s, so we are sure that pulses 8.5 us wide can | ||
51 | * go through cleanly . If you are on the wild side, you can try to lower | ||
52 | * this value (Actisys recommended me 2 us, and 0 us work for me on a P233!) | ||
53 | */ | ||
54 | #define MIN_DELAY 10 /* 10 us to be on the conservative side */ | ||
55 | |||
56 | static int actisys_change_speed(struct irda_task *task); | ||
57 | static int actisys_reset(struct irda_task *task); | ||
58 | static void actisys_open(dongle_t *self, struct qos_info *qos); | ||
59 | static void actisys_close(dongle_t *self); | ||
60 | |||
61 | /* These are the baudrates supported, in the order available */ | ||
62 | /* Note : the 220L doesn't support 38400, but we will fix that below */ | ||
63 | static __u32 baud_rates[] = { 9600, 19200, 57600, 115200, 38400 }; | ||
64 | #define MAX_SPEEDS 5 | ||
65 | |||
66 | static struct dongle_reg dongle = { | ||
67 | .type = IRDA_ACTISYS_DONGLE, | ||
68 | .open = actisys_open, | ||
69 | .close = actisys_close, | ||
70 | .reset = actisys_reset, | ||
71 | .change_speed = actisys_change_speed, | ||
72 | .owner = THIS_MODULE, | ||
73 | }; | ||
74 | |||
75 | static struct dongle_reg dongle_plus = { | ||
76 | .type = IRDA_ACTISYS_PLUS_DONGLE, | ||
77 | .open = actisys_open, | ||
78 | .close = actisys_close, | ||
79 | .reset = actisys_reset, | ||
80 | .change_speed = actisys_change_speed, | ||
81 | .owner = THIS_MODULE, | ||
82 | }; | ||
83 | |||
84 | /* | ||
85 | * Function actisys_change_speed (task) | ||
86 | * | ||
87 | * There is two model of Actisys dongle we are dealing with, | ||
88 | * the 220L and 220L+. At this point, only irattach knows with | ||
89 | * kind the user has requested (it was an argument on irattach | ||
90 | * command line). | ||
91 | * So, we register a dongle of each sort and let irattach | ||
92 | * pick the right one... | ||
93 | */ | ||
94 | static int __init actisys_init(void) | ||
95 | { | ||
96 | int ret; | ||
97 | |||
98 | /* First, register an Actisys 220L dongle */ | ||
99 | ret = irda_device_register_dongle(&dongle); | ||
100 | if (ret < 0) | ||
101 | return ret; | ||
102 | /* Now, register an Actisys 220L+ dongle */ | ||
103 | ret = irda_device_register_dongle(&dongle_plus); | ||
104 | if (ret < 0) { | ||
105 | irda_device_unregister_dongle(&dongle); | ||
106 | return ret; | ||
107 | } | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static void __exit actisys_cleanup(void) | ||
112 | { | ||
113 | /* We have to remove both dongles */ | ||
114 | irda_device_unregister_dongle(&dongle); | ||
115 | irda_device_unregister_dongle(&dongle_plus); | ||
116 | } | ||
117 | |||
118 | static void actisys_open(dongle_t *self, struct qos_info *qos) | ||
119 | { | ||
120 | /* Power on the dongle */ | ||
121 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
122 | |||
123 | /* Set the speeds we can accept */ | ||
124 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; | ||
125 | |||
126 | /* Remove support for 38400 if this is not a 220L+ dongle */ | ||
127 | if (self->issue->type == IRDA_ACTISYS_DONGLE) | ||
128 | qos->baud_rate.bits &= ~IR_38400; | ||
129 | |||
130 | qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */ | ||
131 | } | ||
132 | |||
133 | static void actisys_close(dongle_t *self) | ||
134 | { | ||
135 | /* Power off the dongle */ | ||
136 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Function actisys_change_speed (task) | ||
141 | * | ||
142 | * Change speed of the ACTiSYS IR-220L and IR-220L+ type IrDA dongles. | ||
143 | * To cycle through the available baud rates, pulse RTS low for a few us. | ||
144 | * | ||
145 | * First, we reset the dongle to always start from a known state. | ||
146 | * Then, we cycle through the speeds by pulsing RTS low and then up. | ||
147 | * The dongle allow us to pulse quite fast, se we can set speed in one go, | ||
148 | * which is must faster ( < 100 us) and less complex than what is found | ||
149 | * in some other dongle drivers... | ||
150 | * Note that even if the new speed is the same as the current speed, | ||
151 | * we reassert the speed. This make sure that things are all right, | ||
152 | * and it's fast anyway... | ||
153 | * By the way, this function will work for both type of dongles, | ||
154 | * because the additional speed is at the end of the sequence... | ||
155 | */ | ||
156 | static int actisys_change_speed(struct irda_task *task) | ||
157 | { | ||
158 | dongle_t *self = (dongle_t *) task->instance; | ||
159 | __u32 speed = (__u32) task->param; /* Target speed */ | ||
160 | int ret = 0; | ||
161 | int i = 0; | ||
162 | |||
163 | IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __FUNCTION__, speed, | ||
164 | self->speed); | ||
165 | |||
166 | /* Go to a known state by reseting the dongle */ | ||
167 | |||
168 | /* Reset the dongle : set DTR low for 10 us */ | ||
169 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
170 | udelay(MIN_DELAY); | ||
171 | |||
172 | /* Go back to normal mode (we are now at 9600 b/s) */ | ||
173 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
174 | |||
175 | /* | ||
176 | * Now, we can set the speed requested. Send RTS pulses until we | ||
177 | * reach the target speed | ||
178 | */ | ||
179 | for (i=0; i<MAX_SPEEDS; i++) { | ||
180 | if (speed == baud_rates[i]) { | ||
181 | self->speed = baud_rates[i]; | ||
182 | break; | ||
183 | } | ||
184 | /* Make sure previous pulse is finished */ | ||
185 | udelay(MIN_DELAY); | ||
186 | |||
187 | /* Set RTS low for 10 us */ | ||
188 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
189 | udelay(MIN_DELAY); | ||
190 | |||
191 | /* Set RTS high for 10 us */ | ||
192 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
193 | } | ||
194 | |||
195 | /* Check if life is sweet... */ | ||
196 | if (i >= MAX_SPEEDS) | ||
197 | ret = -1; /* This should not happen */ | ||
198 | |||
199 | /* Basta lavoro, on se casse d'ici... */ | ||
200 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
201 | |||
202 | return ret; | ||
203 | } | ||
204 | |||
205 | /* | ||
206 | * Function actisys_reset (task) | ||
207 | * | ||
208 | * Reset the Actisys type dongle. Warning, this function must only be | ||
209 | * called with a process context! | ||
210 | * | ||
211 | * We need to do two things in this function : | ||
212 | * o first make sure that the dongle is in a state where it can operate | ||
213 | * o second put the dongle in a know state | ||
214 | * | ||
215 | * The dongle is powered of the RTS and DTR lines. In the dongle, there | ||
216 | * is a big capacitor to accommodate the current spikes. This capacitor | ||
217 | * takes a least 50 ms to be charged. In theory, the Bios set those lines | ||
218 | * up, so by the time we arrive here we should be set. It doesn't hurt | ||
219 | * to be on the conservative side, so we will wait... | ||
220 | * Then, we set the speed to 9600 b/s to get in a known state (see in | ||
221 | * change_speed for details). It is needed because the IrDA stack | ||
222 | * has tried to set the speed immediately after our first return, | ||
223 | * so before we can be sure the dongle is up and running. | ||
224 | */ | ||
225 | static int actisys_reset(struct irda_task *task) | ||
226 | { | ||
227 | dongle_t *self = (dongle_t *) task->instance; | ||
228 | int ret = 0; | ||
229 | |||
230 | IRDA_ASSERT(task != NULL, return -1;); | ||
231 | |||
232 | self->reset_task = task; | ||
233 | |||
234 | switch (task->state) { | ||
235 | case IRDA_TASK_INIT: | ||
236 | /* Set both DTR & RTS to power up the dongle */ | ||
237 | /* In theory redundant with power up in actisys_open() */ | ||
238 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
239 | |||
240 | /* Sleep 50 ms to make sure capacitor is charged */ | ||
241 | ret = msecs_to_jiffies(50); | ||
242 | irda_task_next_state(task, IRDA_TASK_WAIT); | ||
243 | break; | ||
244 | case IRDA_TASK_WAIT: | ||
245 | /* Reset the dongle : set DTR low for 10 us */ | ||
246 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
247 | udelay(MIN_DELAY); | ||
248 | |||
249 | /* Go back to normal mode */ | ||
250 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
251 | |||
252 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
253 | self->reset_task = NULL; | ||
254 | self->speed = 9600; /* That's the default */ | ||
255 | break; | ||
256 | default: | ||
257 | IRDA_ERROR("%s(), unknown state %d\n", | ||
258 | __FUNCTION__, task->state); | ||
259 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
260 | self->reset_task = NULL; | ||
261 | ret = -1; | ||
262 | break; | ||
263 | } | ||
264 | return ret; | ||
265 | } | ||
266 | |||
267 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> - Jean Tourrilhes <jt@hpl.hp.com>"); | ||
268 | MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver"); | ||
269 | MODULE_LICENSE("GPL"); | ||
270 | MODULE_ALIAS("irda-dongle-2"); /* IRDA_ACTISYS_DONGLE */ | ||
271 | MODULE_ALIAS("irda-dongle-3"); /* IRDA_ACTISYS_PLUS_DONGLE */ | ||
272 | |||
273 | |||
274 | /* | ||
275 | * Function init_module (void) | ||
276 | * | ||
277 | * Initialize Actisys module | ||
278 | * | ||
279 | */ | ||
280 | module_init(actisys_init); | ||
281 | |||
282 | /* | ||
283 | * Function cleanup_module (void) | ||
284 | * | ||
285 | * Cleanup Actisys module | ||
286 | * | ||
287 | */ | ||
288 | module_exit(actisys_cleanup); | ||
diff --git a/drivers/net/irda/ep7211_ir.c b/drivers/net/irda/ep7211_ir.c deleted file mode 100644 index 4cba38f7e4a8..000000000000 --- a/drivers/net/irda/ep7211_ir.c +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
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 | #include <linux/spinlock.h> | ||
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 | |||
22 | static void ep7211_ir_open(dongle_t *self, struct qos_info *qos); | ||
23 | static void ep7211_ir_close(dongle_t *self); | ||
24 | static int ep7211_ir_change_speed(struct irda_task *task); | ||
25 | static int ep7211_ir_reset(struct irda_task *task); | ||
26 | |||
27 | static DEFINE_SPINLOCK(ep7211_lock); | ||
28 | |||
29 | static 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 | |||
38 | static void ep7211_ir_open(dongle_t *self, struct qos_info *qos) | ||
39 | { | ||
40 | unsigned int syscon1, flags; | ||
41 | |||
42 | spin_lock_irqsave(&ep7211_lock, flags); | ||
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 | |||
52 | spin_unlock_irqrestore(&ep7211_lock, flags); | ||
53 | } | ||
54 | |||
55 | static void ep7211_ir_close(dongle_t *self) | ||
56 | { | ||
57 | unsigned int syscon1, flags; | ||
58 | |||
59 | spin_lock_irqsave(&ep7211_lock, flags); | ||
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 | |||
69 | spin_unlock_irqrestore(&ep7211_lock, flags); | ||
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 | */ | ||
79 | static 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 | */ | ||
91 | static 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 | */ | ||
103 | static 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 | */ | ||
114 | static void __exit ep7211_ir_cleanup(void) | ||
115 | { | ||
116 | irda_device_unregister_dongle(&dongle); | ||
117 | } | ||
118 | |||
119 | MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>"); | ||
120 | MODULE_DESCRIPTION("EP7211 I/R driver"); | ||
121 | MODULE_LICENSE("GPL"); | ||
122 | MODULE_ALIAS("irda-dongle-8"); /* IRDA_EP7211_IR */ | ||
123 | |||
124 | module_init(ep7211_ir_init); | ||
125 | module_exit(ep7211_ir_cleanup); | ||
diff --git a/drivers/net/irda/esi.c b/drivers/net/irda/esi.c deleted file mode 100644 index d3a61af6402d..000000000000 --- a/drivers/net/irda/esi.c +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: esi.c | ||
4 | * Version: 1.5 | ||
5 | * Description: Driver for the Extended Systems JetEye PC dongle | ||
6 | * Status: Experimental. | ||
7 | * Author: Dag Brattli <dagb@cs.uit.no> | ||
8 | * Created at: Sat Feb 21 18:54:38 1998 | ||
9 | * Modified at: Fri Dec 17 09:14:04 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1999 Dag Brattli, <dagb@cs.uit.no>, | ||
13 | * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>, | ||
14 | * All Rights Reserved. | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or | ||
17 | * modify it under the terms of the GNU General Public License as | ||
18 | * published by the Free Software Foundation; either version 2 of | ||
19 | * the License, or (at your option) any later version. | ||
20 | * | ||
21 | * This program is distributed in the hope that it will be useful, | ||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
24 | * GNU General Public License for more details. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License | ||
27 | * along with this program; if not, write to the Free Software | ||
28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
29 | * MA 02111-1307 USA | ||
30 | * | ||
31 | ********************************************************************/ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/delay.h> | ||
35 | #include <linux/tty.h> | ||
36 | #include <linux/init.h> | ||
37 | |||
38 | #include <net/irda/irda.h> | ||
39 | #include <net/irda/irda_device.h> | ||
40 | |||
41 | static void esi_open(dongle_t *self, struct qos_info *qos); | ||
42 | static void esi_close(dongle_t *self); | ||
43 | static int esi_change_speed(struct irda_task *task); | ||
44 | static int esi_reset(struct irda_task *task); | ||
45 | |||
46 | static struct dongle_reg dongle = { | ||
47 | .type = IRDA_ESI_DONGLE, | ||
48 | .open = esi_open, | ||
49 | .close = esi_close, | ||
50 | .reset = esi_reset, | ||
51 | .change_speed = esi_change_speed, | ||
52 | .owner = THIS_MODULE, | ||
53 | }; | ||
54 | |||
55 | static int __init esi_init(void) | ||
56 | { | ||
57 | return irda_device_register_dongle(&dongle); | ||
58 | } | ||
59 | |||
60 | static void __exit esi_cleanup(void) | ||
61 | { | ||
62 | irda_device_unregister_dongle(&dongle); | ||
63 | } | ||
64 | |||
65 | static void esi_open(dongle_t *self, struct qos_info *qos) | ||
66 | { | ||
67 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200; | ||
68 | qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */ | ||
69 | } | ||
70 | |||
71 | static void esi_close(dongle_t *dongle) | ||
72 | { | ||
73 | /* Power off dongle */ | ||
74 | dongle->set_dtr_rts(dongle->dev, FALSE, FALSE); | ||
75 | } | ||
76 | |||
77 | /* | ||
78 | * Function esi_change_speed (task) | ||
79 | * | ||
80 | * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle | ||
81 | * | ||
82 | */ | ||
83 | static int esi_change_speed(struct irda_task *task) | ||
84 | { | ||
85 | dongle_t *self = (dongle_t *) task->instance; | ||
86 | __u32 speed = (__u32) task->param; | ||
87 | int dtr, rts; | ||
88 | |||
89 | switch (speed) { | ||
90 | case 19200: | ||
91 | dtr = TRUE; | ||
92 | rts = FALSE; | ||
93 | break; | ||
94 | case 115200: | ||
95 | dtr = rts = TRUE; | ||
96 | break; | ||
97 | case 9600: | ||
98 | default: | ||
99 | dtr = FALSE; | ||
100 | rts = TRUE; | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | /* Change speed of dongle */ | ||
105 | self->set_dtr_rts(self->dev, dtr, rts); | ||
106 | self->speed = speed; | ||
107 | |||
108 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | /* | ||
114 | * Function esi_reset (task) | ||
115 | * | ||
116 | * Reset dongle; | ||
117 | * | ||
118 | */ | ||
119 | static int esi_reset(struct irda_task *task) | ||
120 | { | ||
121 | dongle_t *self = (dongle_t *) task->instance; | ||
122 | |||
123 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
124 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | ||
130 | MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver"); | ||
131 | MODULE_LICENSE("GPL"); | ||
132 | MODULE_ALIAS("irda-dongle-1"); /* IRDA_ESI_DONGLE */ | ||
133 | |||
134 | /* | ||
135 | * Function init_module (void) | ||
136 | * | ||
137 | * Initialize ESI module | ||
138 | * | ||
139 | */ | ||
140 | module_init(esi_init); | ||
141 | |||
142 | /* | ||
143 | * Function cleanup_module (void) | ||
144 | * | ||
145 | * Cleanup ESI module | ||
146 | * | ||
147 | */ | ||
148 | module_exit(esi_cleanup); | ||
149 | |||
diff --git a/drivers/net/irda/girbil.c b/drivers/net/irda/girbil.c deleted file mode 100644 index 1f57391a618b..000000000000 --- a/drivers/net/irda/girbil.c +++ /dev/null | |||
@@ -1,250 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: girbil.c | ||
4 | * Version: 1.2 | ||
5 | * Description: Implementation for the Greenwich GIrBIL dongle | ||
6 | * Status: Experimental. | ||
7 | * Author: Dag Brattli <dagb@cs.uit.no> | ||
8 | * Created at: Sat Feb 6 21:02:33 1999 | ||
9 | * Modified at: Fri Dec 17 09:13:20 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * Neither Dag Brattli nor University of Tromsø admit liability nor | ||
20 | * provide warranty for any of this software. This material is | ||
21 | * provided "AS-IS" and at no charge. | ||
22 | * | ||
23 | ********************************************************************/ | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/tty.h> | ||
28 | #include <linux/init.h> | ||
29 | |||
30 | #include <net/irda/irda.h> | ||
31 | #include <net/irda/irda_device.h> | ||
32 | |||
33 | static int girbil_reset(struct irda_task *task); | ||
34 | static void girbil_open(dongle_t *self, struct qos_info *qos); | ||
35 | static void girbil_close(dongle_t *self); | ||
36 | static int girbil_change_speed(struct irda_task *task); | ||
37 | |||
38 | /* Control register 1 */ | ||
39 | #define GIRBIL_TXEN 0x01 /* Enable transmitter */ | ||
40 | #define GIRBIL_RXEN 0x02 /* Enable receiver */ | ||
41 | #define GIRBIL_ECAN 0x04 /* Cancel self emmited data */ | ||
42 | #define GIRBIL_ECHO 0x08 /* Echo control characters */ | ||
43 | |||
44 | /* LED Current Register (0x2) */ | ||
45 | #define GIRBIL_HIGH 0x20 | ||
46 | #define GIRBIL_MEDIUM 0x21 | ||
47 | #define GIRBIL_LOW 0x22 | ||
48 | |||
49 | /* Baud register (0x3) */ | ||
50 | #define GIRBIL_2400 0x30 | ||
51 | #define GIRBIL_4800 0x31 | ||
52 | #define GIRBIL_9600 0x32 | ||
53 | #define GIRBIL_19200 0x33 | ||
54 | #define GIRBIL_38400 0x34 | ||
55 | #define GIRBIL_57600 0x35 | ||
56 | #define GIRBIL_115200 0x36 | ||
57 | |||
58 | /* Mode register (0x4) */ | ||
59 | #define GIRBIL_IRDA 0x40 | ||
60 | #define GIRBIL_ASK 0x41 | ||
61 | |||
62 | /* Control register 2 (0x5) */ | ||
63 | #define GIRBIL_LOAD 0x51 /* Load the new baud rate value */ | ||
64 | |||
65 | static struct dongle_reg dongle = { | ||
66 | .type = IRDA_GIRBIL_DONGLE, | ||
67 | .open = girbil_open, | ||
68 | .close = girbil_close, | ||
69 | .reset = girbil_reset, | ||
70 | .change_speed = girbil_change_speed, | ||
71 | .owner = THIS_MODULE, | ||
72 | }; | ||
73 | |||
74 | static int __init girbil_init(void) | ||
75 | { | ||
76 | return irda_device_register_dongle(&dongle); | ||
77 | } | ||
78 | |||
79 | static void __exit girbil_cleanup(void) | ||
80 | { | ||
81 | irda_device_unregister_dongle(&dongle); | ||
82 | } | ||
83 | |||
84 | static void girbil_open(dongle_t *self, struct qos_info *qos) | ||
85 | { | ||
86 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; | ||
87 | qos->min_turn_time.bits = 0x03; | ||
88 | } | ||
89 | |||
90 | static void girbil_close(dongle_t *self) | ||
91 | { | ||
92 | /* Power off dongle */ | ||
93 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * Function girbil_change_speed (dev, speed) | ||
98 | * | ||
99 | * Set the speed for the Girbil type dongle. | ||
100 | * | ||
101 | */ | ||
102 | static int girbil_change_speed(struct irda_task *task) | ||
103 | { | ||
104 | dongle_t *self = (dongle_t *) task->instance; | ||
105 | __u32 speed = (__u32) task->param; | ||
106 | __u8 control[2]; | ||
107 | int ret = 0; | ||
108 | |||
109 | self->speed_task = task; | ||
110 | |||
111 | switch (task->state) { | ||
112 | case IRDA_TASK_INIT: | ||
113 | /* Need to reset the dongle and go to 9600 bps before | ||
114 | programming */ | ||
115 | if (irda_task_execute(self, girbil_reset, NULL, task, | ||
116 | (void *) speed)) | ||
117 | { | ||
118 | /* Dongle need more time to reset */ | ||
119 | irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); | ||
120 | |||
121 | /* Give reset 1 sec to finish */ | ||
122 | ret = msecs_to_jiffies(1000); | ||
123 | } | ||
124 | break; | ||
125 | case IRDA_TASK_CHILD_WAIT: | ||
126 | IRDA_WARNING("%s(), resetting dongle timed out!\n", | ||
127 | __FUNCTION__); | ||
128 | ret = -1; | ||
129 | break; | ||
130 | case IRDA_TASK_CHILD_DONE: | ||
131 | /* Set DTR and Clear RTS to enter command mode */ | ||
132 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
133 | |||
134 | switch (speed) { | ||
135 | case 9600: | ||
136 | default: | ||
137 | control[0] = GIRBIL_9600; | ||
138 | break; | ||
139 | case 19200: | ||
140 | control[0] = GIRBIL_19200; | ||
141 | break; | ||
142 | case 34800: | ||
143 | control[0] = GIRBIL_38400; | ||
144 | break; | ||
145 | case 57600: | ||
146 | control[0] = GIRBIL_57600; | ||
147 | break; | ||
148 | case 115200: | ||
149 | control[0] = GIRBIL_115200; | ||
150 | break; | ||
151 | } | ||
152 | control[1] = GIRBIL_LOAD; | ||
153 | |||
154 | /* Write control bytes */ | ||
155 | self->write(self->dev, control, 2); | ||
156 | irda_task_next_state(task, IRDA_TASK_WAIT); | ||
157 | ret = msecs_to_jiffies(100); | ||
158 | break; | ||
159 | case IRDA_TASK_WAIT: | ||
160 | /* Go back to normal mode */ | ||
161 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
162 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
163 | self->speed_task = NULL; | ||
164 | break; | ||
165 | default: | ||
166 | IRDA_ERROR("%s(), unknown state %d\n", | ||
167 | __FUNCTION__, task->state); | ||
168 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
169 | self->speed_task = NULL; | ||
170 | ret = -1; | ||
171 | break; | ||
172 | } | ||
173 | return ret; | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * Function girbil_reset (driver) | ||
178 | * | ||
179 | * This function resets the girbil dongle. | ||
180 | * | ||
181 | * Algorithm: | ||
182 | * 0. set RTS, and wait at least 5 ms | ||
183 | * 1. clear RTS | ||
184 | */ | ||
185 | static int girbil_reset(struct irda_task *task) | ||
186 | { | ||
187 | dongle_t *self = (dongle_t *) task->instance; | ||
188 | __u8 control = GIRBIL_TXEN | GIRBIL_RXEN; | ||
189 | int ret = 0; | ||
190 | |||
191 | self->reset_task = task; | ||
192 | |||
193 | switch (task->state) { | ||
194 | case IRDA_TASK_INIT: | ||
195 | /* Reset dongle */ | ||
196 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
197 | irda_task_next_state(task, IRDA_TASK_WAIT1); | ||
198 | /* Sleep at least 5 ms */ | ||
199 | ret = msecs_to_jiffies(20); | ||
200 | break; | ||
201 | case IRDA_TASK_WAIT1: | ||
202 | /* Set DTR and clear RTS to enter command mode */ | ||
203 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
204 | irda_task_next_state(task, IRDA_TASK_WAIT2); | ||
205 | ret = msecs_to_jiffies(20); | ||
206 | break; | ||
207 | case IRDA_TASK_WAIT2: | ||
208 | /* Write control byte */ | ||
209 | self->write(self->dev, &control, 1); | ||
210 | irda_task_next_state(task, IRDA_TASK_WAIT3); | ||
211 | ret = msecs_to_jiffies(20); | ||
212 | break; | ||
213 | case IRDA_TASK_WAIT3: | ||
214 | /* Go back to normal mode */ | ||
215 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
216 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
217 | self->reset_task = NULL; | ||
218 | break; | ||
219 | default: | ||
220 | IRDA_ERROR("%s(), unknown state %d\n", | ||
221 | __FUNCTION__, task->state); | ||
222 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
223 | self->reset_task = NULL; | ||
224 | ret = -1; | ||
225 | break; | ||
226 | } | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | ||
231 | MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver"); | ||
232 | MODULE_LICENSE("GPL"); | ||
233 | MODULE_ALIAS("irda-dongle-4"); /* IRDA_GIRBIL_DONGLE */ | ||
234 | |||
235 | /* | ||
236 | * Function init_module (void) | ||
237 | * | ||
238 | * Initialize Girbil module | ||
239 | * | ||
240 | */ | ||
241 | module_init(girbil_init); | ||
242 | |||
243 | /* | ||
244 | * Function cleanup_module (void) | ||
245 | * | ||
246 | * Cleanup Girbil module | ||
247 | * | ||
248 | */ | ||
249 | module_exit(girbil_cleanup); | ||
250 | |||
diff --git a/drivers/net/irda/litelink.c b/drivers/net/irda/litelink.c deleted file mode 100644 index 7db11431d0f4..000000000000 --- a/drivers/net/irda/litelink.c +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: litelink.c | ||
4 | * Version: 1.1 | ||
5 | * Description: Driver for the Parallax LiteLink dongle | ||
6 | * Status: Stable | ||
7 | * Author: Dag Brattli <dagb@cs.uit.no> | ||
8 | * Created at: Fri May 7 12:50:33 1999 | ||
9 | * Modified at: Fri Dec 17 09:14:23 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
27 | * MA 02111-1307 USA | ||
28 | * | ||
29 | ********************************************************************/ | ||
30 | |||
31 | #include <linux/module.h> | ||
32 | #include <linux/delay.h> | ||
33 | #include <linux/tty.h> | ||
34 | #include <linux/init.h> | ||
35 | |||
36 | #include <net/irda/irda.h> | ||
37 | #include <net/irda/irda_device.h> | ||
38 | |||
39 | #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ | ||
40 | #define MAX_DELAY 10000 /* 1 ms */ | ||
41 | |||
42 | static void litelink_open(dongle_t *self, struct qos_info *qos); | ||
43 | static void litelink_close(dongle_t *self); | ||
44 | static int litelink_change_speed(struct irda_task *task); | ||
45 | static int litelink_reset(struct irda_task *task); | ||
46 | |||
47 | /* These are the baudrates supported */ | ||
48 | static __u32 baud_rates[] = { 115200, 57600, 38400, 19200, 9600 }; | ||
49 | |||
50 | static struct dongle_reg dongle = { | ||
51 | .type = IRDA_LITELINK_DONGLE, | ||
52 | .open = litelink_open, | ||
53 | .close = litelink_close, | ||
54 | .reset = litelink_reset, | ||
55 | .change_speed = litelink_change_speed, | ||
56 | .owner = THIS_MODULE, | ||
57 | }; | ||
58 | |||
59 | static int __init litelink_init(void) | ||
60 | { | ||
61 | return irda_device_register_dongle(&dongle); | ||
62 | } | ||
63 | |||
64 | static void __exit litelink_cleanup(void) | ||
65 | { | ||
66 | irda_device_unregister_dongle(&dongle); | ||
67 | } | ||
68 | |||
69 | static void litelink_open(dongle_t *self, struct qos_info *qos) | ||
70 | { | ||
71 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; | ||
72 | qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */ | ||
73 | } | ||
74 | |||
75 | static void litelink_close(dongle_t *self) | ||
76 | { | ||
77 | /* Power off dongle */ | ||
78 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * Function litelink_change_speed (task) | ||
83 | * | ||
84 | * Change speed of the Litelink dongle. To cycle through the available | ||
85 | * baud rates, pulse RTS low for a few ms. | ||
86 | */ | ||
87 | static int litelink_change_speed(struct irda_task *task) | ||
88 | { | ||
89 | dongle_t *self = (dongle_t *) task->instance; | ||
90 | __u32 speed = (__u32) task->param; | ||
91 | int i; | ||
92 | |||
93 | /* Clear RTS to reset dongle */ | ||
94 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
95 | |||
96 | /* Sleep a minimum of 15 us */ | ||
97 | udelay(MIN_DELAY); | ||
98 | |||
99 | /* Go back to normal mode */ | ||
100 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
101 | |||
102 | /* Sleep a minimum of 15 us */ | ||
103 | udelay(MIN_DELAY); | ||
104 | |||
105 | /* Cycle through avaiable baudrates until we reach the correct one */ | ||
106 | for (i=0; i<5 && baud_rates[i] != speed; i++) { | ||
107 | /* Set DTR, clear RTS */ | ||
108 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
109 | |||
110 | /* Sleep a minimum of 15 us */ | ||
111 | udelay(MIN_DELAY); | ||
112 | |||
113 | /* Set DTR, Set RTS */ | ||
114 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
115 | |||
116 | /* Sleep a minimum of 15 us */ | ||
117 | udelay(MIN_DELAY); | ||
118 | } | ||
119 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * Function litelink_reset (task) | ||
126 | * | ||
127 | * Reset the Litelink type dongle. | ||
128 | * | ||
129 | */ | ||
130 | static int litelink_reset(struct irda_task *task) | ||
131 | { | ||
132 | dongle_t *self = (dongle_t *) task->instance; | ||
133 | |||
134 | /* Power on dongle */ | ||
135 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
136 | |||
137 | /* Sleep a minimum of 15 us */ | ||
138 | udelay(MIN_DELAY); | ||
139 | |||
140 | /* Clear RTS to reset dongle */ | ||
141 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
142 | |||
143 | /* Sleep a minimum of 15 us */ | ||
144 | udelay(MIN_DELAY); | ||
145 | |||
146 | /* Go back to normal mode */ | ||
147 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
148 | |||
149 | /* Sleep a minimum of 15 us */ | ||
150 | udelay(MIN_DELAY); | ||
151 | |||
152 | /* This dongles speed defaults to 115200 bps */ | ||
153 | self->speed = 115200; | ||
154 | |||
155 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | ||
161 | MODULE_DESCRIPTION("Parallax Litelink dongle driver"); | ||
162 | MODULE_LICENSE("GPL"); | ||
163 | MODULE_ALIAS("irda-dongle-5"); /* IRDA_LITELINK_DONGLE */ | ||
164 | |||
165 | /* | ||
166 | * Function init_module (void) | ||
167 | * | ||
168 | * Initialize Litelink module | ||
169 | * | ||
170 | */ | ||
171 | module_init(litelink_init); | ||
172 | |||
173 | /* | ||
174 | * Function cleanup_module (void) | ||
175 | * | ||
176 | * Cleanup Litelink module | ||
177 | * | ||
178 | */ | ||
179 | module_exit(litelink_cleanup); | ||
diff --git a/drivers/net/irda/ma600.c b/drivers/net/irda/ma600.c deleted file mode 100644 index f5e6836667fd..000000000000 --- a/drivers/net/irda/ma600.c +++ /dev/null | |||
@@ -1,354 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: ma600.c | ||
4 | * Version: 0.1 | ||
5 | * Description: Implementation of the MA600 dongle | ||
6 | * Status: Experimental. | ||
7 | * Author: Leung <95Etwl@alumni.ee.ust.hk> http://www.engsvr.ust/~eetwl95 | ||
8 | * Created at: Sat Jun 10 20:02:35 2000 | ||
9 | * Modified at: | ||
10 | * Modified by: | ||
11 | * | ||
12 | * Note: very thanks to Mr. Maru Wang <maru@mobileaction.com.tw> for providing | ||
13 | * information on the MA600 dongle | ||
14 | * | ||
15 | * Copyright (c) 2000 Leung, All Rights Reserved. | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or | ||
18 | * modify it under the terms of the GNU General Public License as | ||
19 | * published by the Free Software Foundation; either version 2 of | ||
20 | * the License, or (at your option) any later version. | ||
21 | * | ||
22 | * This program is distributed in the hope that it will be useful, | ||
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
25 | * GNU General Public License for more details. | ||
26 | * | ||
27 | * You should have received a copy of the GNU General Public License | ||
28 | * along with this program; if not, write to the Free Software | ||
29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
30 | * MA 02111-1307 USA | ||
31 | * | ||
32 | ********************************************************************/ | ||
33 | |||
34 | /* define this macro for release version */ | ||
35 | //#define NDEBUG | ||
36 | |||
37 | #include <linux/module.h> | ||
38 | #include <linux/delay.h> | ||
39 | #include <linux/tty.h> | ||
40 | #include <linux/init.h> | ||
41 | |||
42 | #include <net/irda/irda.h> | ||
43 | #include <net/irda/irda_device.h> | ||
44 | |||
45 | #ifndef NDEBUG | ||
46 | #undef IRDA_DEBUG | ||
47 | #define IRDA_DEBUG(n, args...) (printk(KERN_DEBUG args)) | ||
48 | |||
49 | #undef ASSERT | ||
50 | #define ASSERT(expr, func) \ | ||
51 | if(!(expr)) { \ | ||
52 | printk( "Assertion failed! %s,%s,%s,line=%d\n",\ | ||
53 | #expr,__FILE__,__FUNCTION__,__LINE__); \ | ||
54 | func} | ||
55 | #endif | ||
56 | |||
57 | /* convert hex value to ascii hex */ | ||
58 | static const char hexTbl[] = "0123456789ABCDEF"; | ||
59 | |||
60 | |||
61 | static void ma600_open(dongle_t *self, struct qos_info *qos); | ||
62 | static void ma600_close(dongle_t *self); | ||
63 | static int ma600_change_speed(struct irda_task *task); | ||
64 | static int ma600_reset(struct irda_task *task); | ||
65 | |||
66 | /* control byte for MA600 */ | ||
67 | #define MA600_9600 0x00 | ||
68 | #define MA600_19200 0x01 | ||
69 | #define MA600_38400 0x02 | ||
70 | #define MA600_57600 0x03 | ||
71 | #define MA600_115200 0x04 | ||
72 | #define MA600_DEV_ID1 0x05 | ||
73 | #define MA600_DEV_ID2 0x06 | ||
74 | #define MA600_2400 0x08 | ||
75 | |||
76 | static struct dongle_reg dongle = { | ||
77 | .type = IRDA_MA600_DONGLE, | ||
78 | .open = ma600_open, | ||
79 | .close = ma600_close, | ||
80 | .reset = ma600_reset, | ||
81 | .change_speed = ma600_change_speed, | ||
82 | .owner = THIS_MODULE, | ||
83 | }; | ||
84 | |||
85 | static int __init ma600_init(void) | ||
86 | { | ||
87 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
88 | return irda_device_register_dongle(&dongle); | ||
89 | } | ||
90 | |||
91 | static void __exit ma600_cleanup(void) | ||
92 | { | ||
93 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
94 | irda_device_unregister_dongle(&dongle); | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | Power on: | ||
99 | (0) Clear RTS and DTR for 1 second | ||
100 | (1) Set RTS and DTR for 1 second | ||
101 | (2) 9600 bps now | ||
102 | Note: assume RTS, DTR are clear before | ||
103 | */ | ||
104 | static void ma600_open(dongle_t *self, struct qos_info *qos) | ||
105 | { | ||
106 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
107 | |||
108 | qos->baud_rate.bits &= IR_2400|IR_9600|IR_19200|IR_38400 | ||
109 | |IR_57600|IR_115200; | ||
110 | qos->min_turn_time.bits = 0x01; /* Needs at least 1 ms */ | ||
111 | irda_qos_bits_to_value(qos); | ||
112 | |||
113 | //self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
114 | // should wait 1 second | ||
115 | |||
116 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
117 | // should wait 1 second | ||
118 | } | ||
119 | |||
120 | static void ma600_close(dongle_t *self) | ||
121 | { | ||
122 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
123 | |||
124 | /* Power off dongle */ | ||
125 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
126 | } | ||
127 | |||
128 | static __u8 get_control_byte(__u32 speed) | ||
129 | { | ||
130 | __u8 byte; | ||
131 | |||
132 | switch (speed) { | ||
133 | default: | ||
134 | case 115200: | ||
135 | byte = MA600_115200; | ||
136 | break; | ||
137 | case 57600: | ||
138 | byte = MA600_57600; | ||
139 | break; | ||
140 | case 38400: | ||
141 | byte = MA600_38400; | ||
142 | break; | ||
143 | case 19200: | ||
144 | byte = MA600_19200; | ||
145 | break; | ||
146 | case 9600: | ||
147 | byte = MA600_9600; | ||
148 | break; | ||
149 | case 2400: | ||
150 | byte = MA600_2400; | ||
151 | break; | ||
152 | } | ||
153 | |||
154 | return byte; | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * Function ma600_change_speed (dev, state, speed) | ||
159 | * | ||
160 | * Set the speed for the MA600 type dongle. Warning, this | ||
161 | * function must be called with a process context! | ||
162 | * | ||
163 | * Algorithm | ||
164 | * 1. Reset | ||
165 | * 2. clear RTS, set DTR and wait for 1ms | ||
166 | * 3. send Control Byte to the MA600 through TXD to set new baud rate | ||
167 | * wait until the stop bit of Control Byte is sent (for 9600 baud rate, | ||
168 | * it takes about 10 msec) | ||
169 | * 4. set RTS, set DTR (return to NORMAL Operation) | ||
170 | * 5. wait at least 10 ms, new setting (baud rate, etc) takes effect here | ||
171 | * after | ||
172 | */ | ||
173 | static int ma600_change_speed(struct irda_task *task) | ||
174 | { | ||
175 | dongle_t *self = (dongle_t *) task->instance; | ||
176 | __u32 speed = (__u32) task->param; | ||
177 | static __u8 byte; | ||
178 | __u8 byte_echo; | ||
179 | int ret = 0; | ||
180 | |||
181 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
182 | |||
183 | ASSERT(task != NULL, return -1;); | ||
184 | |||
185 | if (self->speed_task && self->speed_task != task) { | ||
186 | IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__); | ||
187 | return msecs_to_jiffies(10); | ||
188 | } else { | ||
189 | self->speed_task = task; | ||
190 | } | ||
191 | |||
192 | switch (task->state) { | ||
193 | case IRDA_TASK_INIT: | ||
194 | case IRDA_TASK_CHILD_INIT: | ||
195 | /* | ||
196 | * Need to reset the dongle and go to 9600 bps before | ||
197 | * programming | ||
198 | */ | ||
199 | if (irda_task_execute(self, ma600_reset, NULL, task, | ||
200 | (void *) speed)) { | ||
201 | /* Dongle need more time to reset */ | ||
202 | irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); | ||
203 | |||
204 | /* give 1 second to finish */ | ||
205 | ret = msecs_to_jiffies(1000); | ||
206 | } else { | ||
207 | irda_task_next_state(task, IRDA_TASK_CHILD_DONE); | ||
208 | } | ||
209 | break; | ||
210 | |||
211 | case IRDA_TASK_CHILD_WAIT: | ||
212 | IRDA_WARNING("%s(), resetting dongle timed out!\n", | ||
213 | __FUNCTION__); | ||
214 | ret = -1; | ||
215 | break; | ||
216 | |||
217 | case IRDA_TASK_CHILD_DONE: | ||
218 | /* Set DTR, Clear RTS */ | ||
219 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
220 | |||
221 | ret = msecs_to_jiffies(1); /* Sleep 1 ms */ | ||
222 | irda_task_next_state(task, IRDA_TASK_WAIT); | ||
223 | break; | ||
224 | |||
225 | case IRDA_TASK_WAIT: | ||
226 | speed = (__u32) task->param; | ||
227 | byte = get_control_byte(speed); | ||
228 | |||
229 | /* Write control byte */ | ||
230 | self->write(self->dev, &byte, sizeof(byte)); | ||
231 | |||
232 | irda_task_next_state(task, IRDA_TASK_WAIT1); | ||
233 | |||
234 | /* Wait at least 10 ms */ | ||
235 | ret = msecs_to_jiffies(15); | ||
236 | break; | ||
237 | |||
238 | case IRDA_TASK_WAIT1: | ||
239 | /* Read control byte echo */ | ||
240 | self->read(self->dev, &byte_echo, sizeof(byte_echo)); | ||
241 | |||
242 | if(byte != byte_echo) { | ||
243 | /* if control byte != echo, I don't know what to do */ | ||
244 | printk(KERN_WARNING "%s() control byte written != read!\n", __FUNCTION__); | ||
245 | printk(KERN_WARNING "control byte = 0x%c%c\n", | ||
246 | hexTbl[(byte>>4)&0x0f], hexTbl[byte&0x0f]); | ||
247 | printk(KERN_WARNING "byte echo = 0x%c%c\n", | ||
248 | hexTbl[(byte_echo>>4) & 0x0f], | ||
249 | hexTbl[byte_echo & 0x0f]); | ||
250 | #ifndef NDEBUG | ||
251 | } else { | ||
252 | IRDA_DEBUG(2, "%s() control byte write read OK\n", __FUNCTION__); | ||
253 | #endif | ||
254 | } | ||
255 | |||
256 | /* Set DTR, Set RTS */ | ||
257 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
258 | |||
259 | irda_task_next_state(task, IRDA_TASK_WAIT2); | ||
260 | |||
261 | /* Wait at least 10 ms */ | ||
262 | ret = msecs_to_jiffies(10); | ||
263 | break; | ||
264 | |||
265 | case IRDA_TASK_WAIT2: | ||
266 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
267 | self->speed_task = NULL; | ||
268 | break; | ||
269 | |||
270 | default: | ||
271 | IRDA_ERROR("%s(), unknown state %d\n", | ||
272 | __FUNCTION__, task->state); | ||
273 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
274 | self->speed_task = NULL; | ||
275 | ret = -1; | ||
276 | break; | ||
277 | } | ||
278 | return ret; | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * Function ma600_reset (driver) | ||
283 | * | ||
284 | * This function resets the ma600 dongle. Warning, this function | ||
285 | * must be called with a process context!! | ||
286 | * | ||
287 | * Algorithm: | ||
288 | * 0. DTR=0, RTS=1 and wait 10 ms | ||
289 | * 1. DTR=1, RTS=1 and wait 10 ms | ||
290 | * 2. 9600 bps now | ||
291 | */ | ||
292 | int ma600_reset(struct irda_task *task) | ||
293 | { | ||
294 | dongle_t *self = (dongle_t *) task->instance; | ||
295 | int ret = 0; | ||
296 | |||
297 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
298 | |||
299 | ASSERT(task != NULL, return -1;); | ||
300 | |||
301 | if (self->reset_task && self->reset_task != task) { | ||
302 | IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__); | ||
303 | return msecs_to_jiffies(10); | ||
304 | } else | ||
305 | self->reset_task = task; | ||
306 | |||
307 | switch (task->state) { | ||
308 | case IRDA_TASK_INIT: | ||
309 | /* Clear DTR and Set RTS */ | ||
310 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
311 | irda_task_next_state(task, IRDA_TASK_WAIT1); | ||
312 | ret = msecs_to_jiffies(10); /* Sleep 10 ms */ | ||
313 | break; | ||
314 | case IRDA_TASK_WAIT1: | ||
315 | /* Set DTR and RTS */ | ||
316 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
317 | irda_task_next_state(task, IRDA_TASK_WAIT2); | ||
318 | ret = msecs_to_jiffies(10); /* Sleep 10 ms */ | ||
319 | break; | ||
320 | case IRDA_TASK_WAIT2: | ||
321 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
322 | self->reset_task = NULL; | ||
323 | break; | ||
324 | default: | ||
325 | IRDA_ERROR("%s(), unknown state %d\n", | ||
326 | __FUNCTION__, task->state); | ||
327 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
328 | self->reset_task = NULL; | ||
329 | ret = -1; | ||
330 | } | ||
331 | return ret; | ||
332 | } | ||
333 | |||
334 | MODULE_AUTHOR("Leung <95Etwl@alumni.ee.ust.hk> http://www.engsvr.ust/~eetwl95"); | ||
335 | MODULE_DESCRIPTION("MA600 dongle driver version 0.1"); | ||
336 | MODULE_LICENSE("GPL"); | ||
337 | MODULE_ALIAS("irda-dongle-11"); /* IRDA_MA600_DONGLE */ | ||
338 | |||
339 | /* | ||
340 | * Function init_module (void) | ||
341 | * | ||
342 | * Initialize MA600 module | ||
343 | * | ||
344 | */ | ||
345 | module_init(ma600_init); | ||
346 | |||
347 | /* | ||
348 | * Function cleanup_module (void) | ||
349 | * | ||
350 | * Cleanup MA600 module | ||
351 | * | ||
352 | */ | ||
353 | module_exit(ma600_cleanup); | ||
354 | |||
diff --git a/drivers/net/irda/mcp2120.c b/drivers/net/irda/mcp2120.c deleted file mode 100644 index 5e6199eeef4f..000000000000 --- a/drivers/net/irda/mcp2120.c +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * | ||
4 | * Filename: mcp2120.c | ||
5 | * Version: 1.0 | ||
6 | * Description: Implementation for the MCP2120 (Microchip) | ||
7 | * Status: Experimental. | ||
8 | * Author: Felix Tang (tangf@eyetap.org) | ||
9 | * Created at: Sun Mar 31 19:32:12 EST 2002 | ||
10 | * Based on code by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 2002 Felix Tang, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | ********************************************************************/ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/tty.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | #include <net/irda/irda.h> | ||
27 | #include <net/irda/irda_device.h> | ||
28 | |||
29 | static int mcp2120_reset(struct irda_task *task); | ||
30 | static void mcp2120_open(dongle_t *self, struct qos_info *qos); | ||
31 | static void mcp2120_close(dongle_t *self); | ||
32 | static int mcp2120_change_speed(struct irda_task *task); | ||
33 | |||
34 | #define MCP2120_9600 0x87 | ||
35 | #define MCP2120_19200 0x8B | ||
36 | #define MCP2120_38400 0x85 | ||
37 | #define MCP2120_57600 0x83 | ||
38 | #define MCP2120_115200 0x81 | ||
39 | |||
40 | #define MCP2120_COMMIT 0x11 | ||
41 | |||
42 | static struct dongle_reg dongle = { | ||
43 | .type = IRDA_MCP2120_DONGLE, | ||
44 | .open = mcp2120_open, | ||
45 | .close = mcp2120_close, | ||
46 | .reset = mcp2120_reset, | ||
47 | .change_speed = mcp2120_change_speed, | ||
48 | .owner = THIS_MODULE, | ||
49 | }; | ||
50 | |||
51 | static int __init mcp2120_init(void) | ||
52 | { | ||
53 | return irda_device_register_dongle(&dongle); | ||
54 | } | ||
55 | |||
56 | static void __exit mcp2120_cleanup(void) | ||
57 | { | ||
58 | irda_device_unregister_dongle(&dongle); | ||
59 | } | ||
60 | |||
61 | static void mcp2120_open(dongle_t *self, struct qos_info *qos) | ||
62 | { | ||
63 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; | ||
64 | qos->min_turn_time.bits = 0x01; | ||
65 | } | ||
66 | |||
67 | static void mcp2120_close(dongle_t *self) | ||
68 | { | ||
69 | /* Power off dongle */ | ||
70 | /* reset and inhibit mcp2120 */ | ||
71 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
72 | //self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * Function mcp2120_change_speed (dev, speed) | ||
77 | * | ||
78 | * Set the speed for the MCP2120. | ||
79 | * | ||
80 | */ | ||
81 | static int mcp2120_change_speed(struct irda_task *task) | ||
82 | { | ||
83 | dongle_t *self = (dongle_t *) task->instance; | ||
84 | __u32 speed = (__u32) task->param; | ||
85 | __u8 control[2]; | ||
86 | int ret = 0; | ||
87 | |||
88 | self->speed_task = task; | ||
89 | |||
90 | switch (task->state) { | ||
91 | case IRDA_TASK_INIT: | ||
92 | /* Need to reset the dongle and go to 9600 bps before | ||
93 | programming */ | ||
94 | //printk("Dmcp2120_change_speed irda_task_init\n"); | ||
95 | if (irda_task_execute(self, mcp2120_reset, NULL, task, | ||
96 | (void *) speed)) | ||
97 | { | ||
98 | /* Dongle need more time to reset */ | ||
99 | irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); | ||
100 | |||
101 | /* Give reset 1 sec to finish */ | ||
102 | ret = msecs_to_jiffies(1000); | ||
103 | } | ||
104 | break; | ||
105 | case IRDA_TASK_CHILD_WAIT: | ||
106 | IRDA_WARNING("%s(), resetting dongle timed out!\n", | ||
107 | __FUNCTION__); | ||
108 | ret = -1; | ||
109 | break; | ||
110 | case IRDA_TASK_CHILD_DONE: | ||
111 | /* Set DTR to enter command mode */ | ||
112 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
113 | udelay(500); | ||
114 | |||
115 | switch (speed) { | ||
116 | case 9600: | ||
117 | default: | ||
118 | control[0] = MCP2120_9600; | ||
119 | //printk("mcp2120 9600\n"); | ||
120 | break; | ||
121 | case 19200: | ||
122 | control[0] = MCP2120_19200; | ||
123 | //printk("mcp2120 19200\n"); | ||
124 | break; | ||
125 | case 34800: | ||
126 | control[0] = MCP2120_38400; | ||
127 | //printk("mcp2120 38400\n"); | ||
128 | break; | ||
129 | case 57600: | ||
130 | control[0] = MCP2120_57600; | ||
131 | //printk("mcp2120 57600\n"); | ||
132 | break; | ||
133 | case 115200: | ||
134 | control[0] = MCP2120_115200; | ||
135 | //printk("mcp2120 115200\n"); | ||
136 | break; | ||
137 | } | ||
138 | control[1] = MCP2120_COMMIT; | ||
139 | |||
140 | /* Write control bytes */ | ||
141 | self->write(self->dev, control, 2); | ||
142 | |||
143 | irda_task_next_state(task, IRDA_TASK_WAIT); | ||
144 | ret = msecs_to_jiffies(100); | ||
145 | //printk("mcp2120_change_speed irda_child_done\n"); | ||
146 | break; | ||
147 | case IRDA_TASK_WAIT: | ||
148 | /* Go back to normal mode */ | ||
149 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
150 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
151 | self->speed_task = NULL; | ||
152 | //printk("mcp2120_change_speed irda_task_wait\n"); | ||
153 | break; | ||
154 | default: | ||
155 | IRDA_ERROR("%s(), unknown state %d\n", | ||
156 | __FUNCTION__, task->state); | ||
157 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
158 | self->speed_task = NULL; | ||
159 | ret = -1; | ||
160 | break; | ||
161 | } | ||
162 | return ret; | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * Function mcp2120_reset (driver) | ||
167 | * | ||
168 | * This function resets the mcp2120 dongle. | ||
169 | * | ||
170 | * Info: -set RTS to reset mcp2120 | ||
171 | * -set DTR to set mcp2120 software command mode | ||
172 | * -mcp2120 defaults to 9600 baud after reset | ||
173 | * | ||
174 | * Algorithm: | ||
175 | * 0. Set RTS to reset mcp2120. | ||
176 | * 1. Clear RTS and wait for device reset timer of 30 ms (max). | ||
177 | * | ||
178 | */ | ||
179 | |||
180 | |||
181 | static int mcp2120_reset(struct irda_task *task) | ||
182 | { | ||
183 | dongle_t *self = (dongle_t *) task->instance; | ||
184 | int ret = 0; | ||
185 | |||
186 | self->reset_task = task; | ||
187 | |||
188 | switch (task->state) { | ||
189 | case IRDA_TASK_INIT: | ||
190 | //printk("mcp2120_reset irda_task_init\n"); | ||
191 | /* Reset dongle by setting RTS*/ | ||
192 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
193 | irda_task_next_state(task, IRDA_TASK_WAIT1); | ||
194 | ret = msecs_to_jiffies(50); | ||
195 | break; | ||
196 | case IRDA_TASK_WAIT1: | ||
197 | //printk("mcp2120_reset irda_task_wait1\n"); | ||
198 | /* clear RTS and wait for at least 30 ms. */ | ||
199 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
200 | irda_task_next_state(task, IRDA_TASK_WAIT2); | ||
201 | ret = msecs_to_jiffies(50); | ||
202 | break; | ||
203 | case IRDA_TASK_WAIT2: | ||
204 | //printk("mcp2120_reset irda_task_wait2\n"); | ||
205 | /* Go back to normal mode */ | ||
206 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
207 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
208 | self->reset_task = NULL; | ||
209 | break; | ||
210 | default: | ||
211 | IRDA_ERROR("%s(), unknown state %d\n", | ||
212 | __FUNCTION__, task->state); | ||
213 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
214 | self->reset_task = NULL; | ||
215 | ret = -1; | ||
216 | break; | ||
217 | } | ||
218 | return ret; | ||
219 | } | ||
220 | |||
221 | MODULE_AUTHOR("Felix Tang <tangf@eyetap.org>"); | ||
222 | MODULE_DESCRIPTION("Microchip MCP2120"); | ||
223 | MODULE_LICENSE("GPL"); | ||
224 | MODULE_ALIAS("irda-dongle-9"); /* IRDA_MCP2120_DONGLE */ | ||
225 | |||
226 | /* | ||
227 | * Function init_module (void) | ||
228 | * | ||
229 | * Initialize MCP2120 module | ||
230 | * | ||
231 | */ | ||
232 | module_init(mcp2120_init); | ||
233 | |||
234 | /* | ||
235 | * Function cleanup_module (void) | ||
236 | * | ||
237 | * Cleanup MCP2120 module | ||
238 | * | ||
239 | */ | ||
240 | module_exit(mcp2120_cleanup); | ||
diff --git a/drivers/net/irda/old_belkin.c b/drivers/net/irda/old_belkin.c deleted file mode 100644 index 26f81fd28371..000000000000 --- a/drivers/net/irda/old_belkin.c +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: old_belkin.c | ||
4 | * Version: 1.1 | ||
5 | * Description: Driver for the Belkin (old) SmartBeam dongle | ||
6 | * Status: Experimental... | ||
7 | * Author: Jean Tourrilhes <jt@hpl.hp.com> | ||
8 | * Created at: 22/11/99 | ||
9 | * Modified at: Fri Dec 17 09:13:32 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1999 Jean Tourrilhes, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
27 | * MA 02111-1307 USA | ||
28 | * | ||
29 | ********************************************************************/ | ||
30 | |||
31 | #include <linux/module.h> | ||
32 | #include <linux/delay.h> | ||
33 | #include <linux/tty.h> | ||
34 | #include <linux/init.h> | ||
35 | |||
36 | #include <net/irda/irda.h> | ||
37 | #include <net/irda/irda_device.h> | ||
38 | |||
39 | /* | ||
40 | * Belkin is selling a dongle called the SmartBeam. | ||
41 | * In fact, there is two hardware version of this dongle, of course with | ||
42 | * the same name and looking the exactly same (grrr...). | ||
43 | * I guess that I've got the old one, because inside I don't have | ||
44 | * a jumper for IrDA/ASK... | ||
45 | * | ||
46 | * As far as I can make it from info on their web site, the old dongle | ||
47 | * support only 9600 b/s, which make our life much simpler as far as | ||
48 | * the driver is concerned, but you might not like it very much ;-) | ||
49 | * The new SmartBeam does 115 kb/s, and I've not tested it... | ||
50 | * | ||
51 | * Belkin claim that the correct driver for the old dongle (in Windows) | ||
52 | * is the generic Parallax 9500a driver, but the Linux LiteLink driver | ||
53 | * fails for me (probably because Linux-IrDA doesn't rate fallback), | ||
54 | * so I created this really dumb driver... | ||
55 | * | ||
56 | * In fact, this driver doesn't do much. The only thing it does is to | ||
57 | * prevent Linux-IrDA to use any other speed than 9600 b/s ;-) This | ||
58 | * driver is called "old_belkin" so that when the new SmartBeam is supported | ||
59 | * its driver can be called "belkin" instead of "new_belkin". | ||
60 | * | ||
61 | * Note : this driver was written without any info/help from Belkin, | ||
62 | * so a lot of info here might be totally wrong. Blame me ;-) | ||
63 | */ | ||
64 | |||
65 | /* Let's guess */ | ||
66 | #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ | ||
67 | |||
68 | static void old_belkin_open(dongle_t *self, struct qos_info *qos); | ||
69 | static void old_belkin_close(dongle_t *self); | ||
70 | static int old_belkin_change_speed(struct irda_task *task); | ||
71 | static int old_belkin_reset(struct irda_task *task); | ||
72 | |||
73 | /* These are the baudrates supported */ | ||
74 | /* static __u32 baud_rates[] = { 9600 }; */ | ||
75 | |||
76 | static struct dongle_reg dongle = { | ||
77 | .type = IRDA_OLD_BELKIN_DONGLE, | ||
78 | .open = old_belkin_open, | ||
79 | .close = old_belkin_close, | ||
80 | .reset = old_belkin_reset, | ||
81 | .change_speed = old_belkin_change_speed, | ||
82 | .owner = THIS_MODULE, | ||
83 | }; | ||
84 | |||
85 | static int __init old_belkin_init(void) | ||
86 | { | ||
87 | return irda_device_register_dongle(&dongle); | ||
88 | } | ||
89 | |||
90 | static void __exit old_belkin_cleanup(void) | ||
91 | { | ||
92 | irda_device_unregister_dongle(&dongle); | ||
93 | } | ||
94 | |||
95 | static void old_belkin_open(dongle_t *self, struct qos_info *qos) | ||
96 | { | ||
97 | /* Not too fast, please... */ | ||
98 | qos->baud_rate.bits &= IR_9600; | ||
99 | /* Needs at least 10 ms (totally wild guess, can do probably better) */ | ||
100 | qos->min_turn_time.bits = 0x01; | ||
101 | } | ||
102 | |||
103 | static void old_belkin_close(dongle_t *self) | ||
104 | { | ||
105 | /* Power off dongle */ | ||
106 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * Function old_belkin_change_speed (task) | ||
111 | * | ||
112 | * With only one speed available, not much to do... | ||
113 | */ | ||
114 | static int old_belkin_change_speed(struct irda_task *task) | ||
115 | { | ||
116 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * Function old_belkin_reset (task) | ||
123 | * | ||
124 | * Reset the Old-Belkin type dongle. | ||
125 | * | ||
126 | */ | ||
127 | static int old_belkin_reset(struct irda_task *task) | ||
128 | { | ||
129 | dongle_t *self = (dongle_t *) task->instance; | ||
130 | |||
131 | /* Power on dongle */ | ||
132 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
133 | |||
134 | /* Sleep a minimum of 15 us */ | ||
135 | udelay(MIN_DELAY); | ||
136 | |||
137 | /* This dongles speed "defaults" to 9600 bps ;-) */ | ||
138 | self->speed = 9600; | ||
139 | |||
140 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>"); | ||
146 | MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver"); | ||
147 | MODULE_LICENSE("GPL"); | ||
148 | MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */ | ||
149 | |||
150 | /* | ||
151 | * Function init_module (void) | ||
152 | * | ||
153 | * Initialize Old-Belkin module | ||
154 | * | ||
155 | */ | ||
156 | module_init(old_belkin_init); | ||
157 | |||
158 | /* | ||
159 | * Function cleanup_module (void) | ||
160 | * | ||
161 | * Cleanup Old-Belkin module | ||
162 | * | ||
163 | */ | ||
164 | module_exit(old_belkin_cleanup); | ||
diff --git a/drivers/net/irda/tekram.c b/drivers/net/irda/tekram.c deleted file mode 100644 index 9bfd2441adbf..000000000000 --- a/drivers/net/irda/tekram.c +++ /dev/null | |||
@@ -1,282 +0,0 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: tekram.c | ||
4 | * Version: 1.2 | ||
5 | * Description: Implementation of the Tekram IrMate IR-210B dongle | ||
6 | * Status: Experimental. | ||
7 | * Author: Dag Brattli <dagb@cs.uit.no> | ||
8 | * Created at: Wed Oct 21 20:02:35 1998 | ||
9 | * Modified at: Fri Dec 17 09:13:09 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * Neither Dag Brattli nor University of Tromsø admit liability nor | ||
20 | * provide warranty for any of this software. This material is | ||
21 | * provided "AS-IS" and at no charge. | ||
22 | * | ||
23 | ********************************************************************/ | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/tty.h> | ||
28 | #include <linux/init.h> | ||
29 | |||
30 | #include <net/irda/irda.h> | ||
31 | #include <net/irda/irda_device.h> | ||
32 | |||
33 | static void tekram_open(dongle_t *self, struct qos_info *qos); | ||
34 | static void tekram_close(dongle_t *self); | ||
35 | static int tekram_change_speed(struct irda_task *task); | ||
36 | static int tekram_reset(struct irda_task *task); | ||
37 | |||
38 | #define TEKRAM_115200 0x00 | ||
39 | #define TEKRAM_57600 0x01 | ||
40 | #define TEKRAM_38400 0x02 | ||
41 | #define TEKRAM_19200 0x03 | ||
42 | #define TEKRAM_9600 0x04 | ||
43 | |||
44 | #define TEKRAM_PW 0x10 /* Pulse select bit */ | ||
45 | |||
46 | static struct dongle_reg dongle = { | ||
47 | .type = IRDA_TEKRAM_DONGLE, | ||
48 | .open = tekram_open, | ||
49 | .close = tekram_close, | ||
50 | .reset = tekram_reset, | ||
51 | .change_speed = tekram_change_speed, | ||
52 | .owner = THIS_MODULE, | ||
53 | }; | ||
54 | |||
55 | static int __init tekram_init(void) | ||
56 | { | ||
57 | return irda_device_register_dongle(&dongle); | ||
58 | } | ||
59 | |||
60 | static void __exit tekram_cleanup(void) | ||
61 | { | ||
62 | irda_device_unregister_dongle(&dongle); | ||
63 | } | ||
64 | |||
65 | static void tekram_open(dongle_t *self, struct qos_info *qos) | ||
66 | { | ||
67 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
68 | |||
69 | qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; | ||
70 | qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */ | ||
71 | irda_qos_bits_to_value(qos); | ||
72 | } | ||
73 | |||
74 | static void tekram_close(dongle_t *self) | ||
75 | { | ||
76 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
77 | |||
78 | /* Power off dongle */ | ||
79 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
80 | |||
81 | if (self->reset_task) | ||
82 | irda_task_delete(self->reset_task); | ||
83 | if (self->speed_task) | ||
84 | irda_task_delete(self->speed_task); | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * Function tekram_change_speed (dev, state, speed) | ||
89 | * | ||
90 | * Set the speed for the Tekram IRMate 210 type dongle. Warning, this | ||
91 | * function must be called with a process context! | ||
92 | * | ||
93 | * Algorithm | ||
94 | * 1. clear DTR | ||
95 | * 2. set RTS, and wait at least 7 us | ||
96 | * 3. send Control Byte to the IR-210 through TXD to set new baud rate | ||
97 | * wait until the stop bit of Control Byte is sent (for 9600 baud rate, | ||
98 | * it takes about 100 msec) | ||
99 | * 5. clear RTS (return to NORMAL Operation) | ||
100 | * 6. wait at least 50 us, new setting (baud rate, etc) takes effect here | ||
101 | * after | ||
102 | */ | ||
103 | static int tekram_change_speed(struct irda_task *task) | ||
104 | { | ||
105 | dongle_t *self = (dongle_t *) task->instance; | ||
106 | __u32 speed = (__u32) task->param; | ||
107 | __u8 byte; | ||
108 | int ret = 0; | ||
109 | |||
110 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
111 | |||
112 | IRDA_ASSERT(task != NULL, return -1;); | ||
113 | |||
114 | if (self->speed_task && self->speed_task != task) { | ||
115 | IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__ ); | ||
116 | return msecs_to_jiffies(10); | ||
117 | } else | ||
118 | self->speed_task = task; | ||
119 | |||
120 | switch (speed) { | ||
121 | default: | ||
122 | case 9600: | ||
123 | byte = TEKRAM_PW|TEKRAM_9600; | ||
124 | break; | ||
125 | case 19200: | ||
126 | byte = TEKRAM_PW|TEKRAM_19200; | ||
127 | break; | ||
128 | case 38400: | ||
129 | byte = TEKRAM_PW|TEKRAM_38400; | ||
130 | break; | ||
131 | case 57600: | ||
132 | byte = TEKRAM_PW|TEKRAM_57600; | ||
133 | break; | ||
134 | case 115200: | ||
135 | byte = TEKRAM_115200; | ||
136 | break; | ||
137 | } | ||
138 | |||
139 | switch (task->state) { | ||
140 | case IRDA_TASK_INIT: | ||
141 | case IRDA_TASK_CHILD_INIT: | ||
142 | /* | ||
143 | * Need to reset the dongle and go to 9600 bps before | ||
144 | * programming | ||
145 | */ | ||
146 | if (irda_task_execute(self, tekram_reset, NULL, task, | ||
147 | (void *) speed)) | ||
148 | { | ||
149 | /* Dongle need more time to reset */ | ||
150 | irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); | ||
151 | |||
152 | /* Give reset 1 sec to finish */ | ||
153 | ret = msecs_to_jiffies(1000); | ||
154 | } else | ||
155 | irda_task_next_state(task, IRDA_TASK_CHILD_DONE); | ||
156 | break; | ||
157 | case IRDA_TASK_CHILD_WAIT: | ||
158 | IRDA_WARNING("%s(), resetting dongle timed out!\n", | ||
159 | __FUNCTION__); | ||
160 | ret = -1; | ||
161 | break; | ||
162 | case IRDA_TASK_CHILD_DONE: | ||
163 | /* Set DTR, Clear RTS */ | ||
164 | self->set_dtr_rts(self->dev, TRUE, FALSE); | ||
165 | |||
166 | /* Wait at least 7us */ | ||
167 | udelay(14); | ||
168 | |||
169 | /* Write control byte */ | ||
170 | self->write(self->dev, &byte, 1); | ||
171 | |||
172 | irda_task_next_state(task, IRDA_TASK_WAIT); | ||
173 | |||
174 | /* Wait at least 100 ms */ | ||
175 | ret = msecs_to_jiffies(150); | ||
176 | break; | ||
177 | case IRDA_TASK_WAIT: | ||
178 | /* Set DTR, Set RTS */ | ||
179 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
180 | |||
181 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
182 | self->speed_task = NULL; | ||
183 | break; | ||
184 | default: | ||
185 | IRDA_ERROR("%s(), unknown state %d\n", | ||
186 | __FUNCTION__, task->state); | ||
187 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
188 | self->speed_task = NULL; | ||
189 | ret = -1; | ||
190 | break; | ||
191 | } | ||
192 | return ret; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * Function tekram_reset (driver) | ||
197 | * | ||
198 | * This function resets the tekram dongle. Warning, this function | ||
199 | * must be called with a process context!! | ||
200 | * | ||
201 | * Algorithm: | ||
202 | * 0. Clear RTS and DTR, and wait 50 ms (power off the IR-210 ) | ||
203 | * 1. clear RTS | ||
204 | * 2. set DTR, and wait at least 1 ms | ||
205 | * 3. clear DTR to SPACE state, wait at least 50 us for further | ||
206 | * operation | ||
207 | */ | ||
208 | int tekram_reset(struct irda_task *task) | ||
209 | { | ||
210 | dongle_t *self = (dongle_t *) task->instance; | ||
211 | int ret = 0; | ||
212 | |||
213 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | ||
214 | |||
215 | IRDA_ASSERT(task != NULL, return -1;); | ||
216 | |||
217 | if (self->reset_task && self->reset_task != task) { | ||
218 | IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__ ); | ||
219 | return msecs_to_jiffies(10); | ||
220 | } else | ||
221 | self->reset_task = task; | ||
222 | |||
223 | /* Power off dongle */ | ||
224 | //self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
225 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
226 | |||
227 | switch (task->state) { | ||
228 | case IRDA_TASK_INIT: | ||
229 | irda_task_next_state(task, IRDA_TASK_WAIT1); | ||
230 | |||
231 | /* Sleep 50 ms */ | ||
232 | ret = msecs_to_jiffies(50); | ||
233 | break; | ||
234 | case IRDA_TASK_WAIT1: | ||
235 | /* Clear DTR, Set RTS */ | ||
236 | self->set_dtr_rts(self->dev, FALSE, TRUE); | ||
237 | |||
238 | irda_task_next_state(task, IRDA_TASK_WAIT2); | ||
239 | |||
240 | /* Should sleep 1 ms */ | ||
241 | ret = msecs_to_jiffies(1); | ||
242 | break; | ||
243 | case IRDA_TASK_WAIT2: | ||
244 | /* Set DTR, Set RTS */ | ||
245 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
246 | |||
247 | /* Wait at least 50 us */ | ||
248 | udelay(75); | ||
249 | |||
250 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
251 | self->reset_task = NULL; | ||
252 | break; | ||
253 | default: | ||
254 | IRDA_ERROR("%s(), unknown state %d\n", | ||
255 | __FUNCTION__, task->state); | ||
256 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
257 | self->reset_task = NULL; | ||
258 | ret = -1; | ||
259 | } | ||
260 | return ret; | ||
261 | } | ||
262 | |||
263 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | ||
264 | MODULE_DESCRIPTION("Tekram IrMate IR-210B dongle driver"); | ||
265 | MODULE_LICENSE("GPL"); | ||
266 | MODULE_ALIAS("irda-dongle-0"); /* IRDA_TEKRAM_DONGLE */ | ||
267 | |||
268 | /* | ||
269 | * Function init_module (void) | ||
270 | * | ||
271 | * Initialize Tekram module | ||
272 | * | ||
273 | */ | ||
274 | module_init(tekram_init); | ||
275 | |||
276 | /* | ||
277 | * Function cleanup_module (void) | ||
278 | * | ||
279 | * Cleanup Tekram module | ||
280 | * | ||
281 | */ | ||
282 | module_exit(tekram_cleanup); | ||