Tcl build fix
[gumsense-br.git] / package / wifistix / 2.6.17-new-pcmcia-layer.patch
blob209df1b1218ea1edd3d55bbe3a5b89cd8442de79
1 Index: src_cf8385/io/mcf/cf_io.c
2 ===================================================================
3 --- src_cf8385.orig/io/mcf/cf_io.c
4 +++ src_cf8385/io/mcf/cf_io.c
5 @@ -49,17 +49,15 @@ Change log:
7 dev_info_t cfio_dev_info = "mcf25";
9 -dev_link_t *dev_list = NULL;
11 -MODULE_PARM(interrupt_steer, "1-4i");
13 -INT_MODULE_PARM(irq_mask, CF_IRQMASK);
15 /* Module Variables */
16 static int interrupt_steer[IRQINFO2_LEN] = { -1 };
17 +static u_int irq_mask = CF_IRQMASK;
19 +module_param_array(interrupt_steer, int, NULL, 0);
20 +module_param(irq_mask, int, 0);
22 typedef struct _if_pcmcia_info_t {
23 - dev_link_t link;
24 + struct pcmcia_device *p_dev;
25 dev_node_t node;
26 int stop;
27 struct bus_operations *bus;
28 @@ -81,22 +79,9 @@ struct cf_card_rec cardp;
29 * @param arg pointer to dev_link_t
30 * @return N/A
32 -static void cf_release(ulong arg)
33 +static void mv8385_cf_release(struct pcmcia_device *arg)
35 - dev_link_t *link = (dev_link_t *) arg;
37 - link->dev = NULL;
39 - link->conf.Vcc = 0;
40 - pcmcia_release_configuration(link->handle);
41 - if (link->io.NumPorts1)
42 - pcmcia_release_io(link->handle, &link->io);
44 - if (link->irq.AssignedIRQ)
45 - pcmcia_release_irq(link->handle, &link->irq);
47 - link->state &= ~DEV_CONFIG;
49 + pcmcia_disable_device(arg);
50 } /* cf_release */
53 @@ -107,41 +92,9 @@ static void cf_release(ulong arg)
54 * @return N/A
57 -static void cf_detach(dev_link_t * link)
58 +static void mv8385_cf_detach(struct pcmcia_device * link)
60 - dev_link_t **p;
62 - for (p = &dev_list; *p; p = &(*p)->next)
63 - if (*p == link)
64 - break;
66 - if (*p == NULL)
67 - return;
69 -#ifdef LINUX_2_4
70 - del_timer_sync(&link->release);
71 -#endif
73 - if (((if_pcmcia_info_t *) link->priv)->eth_dev) {
74 - printk("Before calling wlan_remove function\n");
75 - cardp.remove(&cardp);
76 - printk("After calling wlan_remove function\n");
77 - }
79 - if (link->state & DEV_CONFIG) {
80 - cf_release((u32) link);
81 - }
83 - ((if_pcmcia_info_t *) link->priv)->eth_dev = NULL;
85 - if (link->handle) {
86 -#ifdef LINUX_2_4
87 - pcmcia_reset_card(link->handle, NULL);
88 -#endif
89 - pcmcia_deregister_client(link->handle);
90 - }
92 - *p = link->next;
93 + mv8385_cf_release(link);
94 /* This points to the parent if_pcmcia_info_t struct */
95 if (link->priv)
96 kfree(link->priv);
97 @@ -152,9 +105,8 @@ static void cf_detach(dev_link_t * link)
98 * @param link pointer to dev_link_t
99 * @return N/A
101 -static void cf_config(dev_link_t * link)
102 +static int mv8385_cf_config(struct pcmcia_device * link)
104 - client_handle_t handle = link->handle;
105 if_pcmcia_info_t *dev = link->priv;
106 tuple_t tuple;
107 cisparse_t parse;
108 @@ -169,22 +121,14 @@ static void cf_config(dev_link_t * link)
109 tuple.TupleDataMax = sizeof(buf);
110 tuple.TupleOffset = 0;
112 - if (pcmcia_get_first_tuple(handle, &tuple))
113 - goto onerror;
114 - if (pcmcia_get_tuple_data(handle, &tuple))
115 - goto onerror;
116 - if (pcmcia_parse_tuple(handle, &tuple, &parse))
117 - goto onerror;
118 + if(pcmcia_get_first_tuple(link, &tuple)) goto onerror;
119 + if(pcmcia_get_tuple_data(link, &tuple)) goto onerror;
120 + if(pcmcia_parse_tuple(link, &tuple, &parse)) goto onerror;
122 link->conf.ConfigBase = parse.config.base;
123 link->conf.Present = parse.config.rmask[0];
125 - link->state |= DEV_CONFIG;
127 - if (pcmcia_get_configuration_info(handle, &conf))
128 - goto onerror;
130 - link->conf.Vcc = conf.Vcc;
131 + if(pcmcia_get_configuration_info(link, &conf)) goto onerror;
134 The Configuration table consists of a series of configuration table
135 @@ -194,15 +138,9 @@ static void cf_config(dev_link_t * link)
137 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
139 - if (pcmcia_get_first_tuple(handle, &tuple))
140 - goto onerror;
142 - if (pcmcia_get_tuple_data(handle, &tuple) != CS_SUCCESS)
143 - goto onerror;
145 - if (pcmcia_parse_tuple(handle, &tuple, &parse) != CS_SUCCESS)
146 - goto onerror;
148 + if(pcmcia_get_first_tuple(link, &tuple)) goto onerror;
149 + if (pcmcia_get_tuple_data(link, &tuple) != CS_SUCCESS ||
150 + pcmcia_parse_tuple(link, &tuple, &parse) != CS_SUCCESS) goto onerror;
152 link->conf.ConfigIndex = cfg->index;
154 @@ -237,19 +175,18 @@ static void cf_config(dev_link_t * link)
155 link->io.NumPorts2 = io->win[1].len;
158 - if (pcmcia_request_io(link->handle, &link->io)
159 + if (pcmcia_request_io(link, &link->io)
160 != CS_SUCCESS) {
161 - pcmcia_release_io(link->handle, &link->io);
162 printk("Request IO Error !!\n");
163 goto onerror;
167 if (link->conf.Attributes & CONF_ENABLE_IRQ)
168 - if (pcmcia_request_irq(link->handle, &link->irq))
169 + if (pcmcia_request_irq(link, &link->irq))
170 goto onerror;
172 - if (pcmcia_request_configuration(link->handle, &link->conf))
173 + if (pcmcia_request_configuration(link, &link->conf))
174 goto onerror;
176 cardp.irq = link->irq.AssignedIRQ;
177 @@ -271,97 +208,40 @@ static void cf_config(dev_link_t * link)
179 strcpy(dev->node.dev_name, cardp.eth_dev->name);
180 dev->node.major = dev->node.minor = 0;
181 - link->dev = &dev->node;
182 + link->dev_node = &dev->node;
184 - link->state &= ~DEV_CONFIG_PENDING;
185 - return;
186 + return 0;
188 onerror:
189 printk("card configuration failed...calling cf_release function\n");
190 - cf_release((u32) link);
191 - link->state &= ~DEV_CONFIG_PENDING;
192 + mv8385_cf_release(link);
193 cardp.flag = 1;
194 + return -ENODEV;
196 } /* cf_config */
199 /**
200 - * @brief CF BUS driver Event handler
201 - * @param event event id
202 - * @param priority event priority
203 - * @param args pointer to event_callback_args_t
204 - * @return 0
205 - */
206 -static int cf_event(event_t event, int priority, event_callback_args_t *args)
208 - dev_link_t *link = args->client_data;
209 - if_pcmcia_info_t *dev = link->priv;
211 - switch (event) {
212 - case CS_EVENT_CARD_INSERTION:
213 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
214 -#ifdef LINUX_2_4
215 - dev->bus = args->bus;
216 -#endif
217 - cf_config(link);
218 - break;
220 - case CS_EVENT_CARD_REMOVAL:
221 - link->state &= ~DEV_PRESENT;
222 - printk("card removal event detected\n");
223 - if (link->state & DEV_CONFIG) {
224 - ((if_pcmcia_info_t *) link->priv)->stop = 1;
225 - printk("Before calling release function\n");
226 -#ifdef LINUX_2_4
227 -#define REMOVE_TIMEOUT (HZ/20)
228 - mod_timer(&link->release, jiffies + REMOVE_TIMEOUT);
229 -#else
230 - cf_detach(link);
231 -#endif
232 - printk("After calling release function\n");
234 - break;
235 - case CS_EVENT_CARD_RESET:
236 - if (link->state & DEV_CONFIG) {
237 - pcmcia_request_configuration(link->handle, &link->conf);
239 - dev->stop = 0;
240 - break;
243 - return 0;
244 -} /* cf_event */
246 -/**
247 * @brief attach CF BUS driver
248 * @return pointer to dev_link_t
251 -static dev_link_t *cf_attach(void)
252 +static int mv8385_cf_probe(struct pcmcia_device *link)
254 u8 i;
255 - int status;
256 if_pcmcia_info_t *ifinfo;
257 - dev_link_t *link;
258 - client_reg_t client_reg;
260 printk("Entering cf_attach()\n");
262 /* Allocate space for PCMCIA information */
263 if (!(ifinfo = kmalloc(sizeof(if_pcmcia_info_t), GFP_KERNEL))) {
264 - return NULL;
265 + return -ENOMEM;
268 memset(ifinfo, 0, sizeof(if_pcmcia_info_t));
269 - link = &ifinfo->link;
270 + ifinfo->p_dev = link;
271 link->priv = ifinfo;
273 -#ifdef LINUX_2_4
274 - init_timer(&link->release);
275 - link->release.function = &cf_release;
276 - link->release.data = (ulong) link;
277 -#endif
279 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
280 link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
282 @@ -380,38 +260,13 @@ static dev_link_t *cf_attach(void)
283 link->irq.Handler = NULL;
285 link->conf.Attributes = 0;
286 -#define VCC_VALUE 50
287 - link->conf.Vcc = VCC_VALUE;
288 - link->conf.Vpp1 = 0;
289 - link->conf.Vpp2 = 0;
290 + link->conf.Vpp = 0;
291 link->conf.IntType = INT_MEMORY_AND_IO;
292 link->conf.ConfigIndex = 1;
293 link->conf.Present = PRESENT_OPTION;
295 - link->next = dev_list;
296 - dev_list = link;
297 - client_reg.dev_info = &cfio_dev_info;
298 - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
299 - client_reg.EventMask = CS_EVENT_CARD_INSERTION |
300 - CS_EVENT_CARD_REMOVAL | CS_EVENT_CARD_RESET;
301 - client_reg.event_handler = &cf_event;
302 - client_reg.event_callback_args.client_data = link;
303 - client_reg.Version = CF_VERSION;
305 - printk("Before registering the client\n");
307 - if ((status = pcmcia_register_client(&link->handle,
308 - &client_reg)) != CS_SUCCESS) {
309 - printk("Registering the client failed\n");
310 - CS_ERROR(link->handle, RegisterClient, status);
311 - cf_detach(link);
312 - return NULL;
315 - printk("Leaving cf_attach()\n");
317 - return link;
318 -} /* cf_attach */
319 + return mv8385_cf_config(link);
320 +} /* cf_probe */
323 #ifndef LINUX_2_4
324 @@ -428,9 +283,8 @@ static struct pcmcia_driver cfio_cs_driv
325 .drv = {
326 .name = "mcf25"
328 - .attach = cf_attach,
329 - .detach = cf_detach,
330 - .event = cf_event,
331 + .probe = mv8385_cf_probe,
332 + .remove = mv8385_cf_detach,
333 .id_table = cfio_ids,
335 #endif
336 @@ -449,28 +303,11 @@ static struct pcmcia_driver cfio_cs_driv
337 u32 *register_cf_driver(cf_notifier_fn_add add,
338 cf_notifier_fn_remove remove, void *arg)
340 -#ifdef LINUX_2_4
341 - servinfo_t serv;
342 -#endif
344 cardp.add = add;
345 cardp.remove = remove;
346 cardp.host_int_mask = 0;
348 -#ifdef LINUX_2_4
349 - pcmcia_get_card_services_info(&serv);
351 - if (serv.Revision != CS_RELEASE_CODE) {
352 - return NULL;
354 -#endif
356 printk("Before register driver\n");
357 -#ifdef LINUX_2_4
358 - register_pccard_driver(&cfio_dev_info, &cf_attach, &cf_detach);
359 -#else
360 pcmcia_register_driver(&cfio_cs_driver);
361 -#endif
362 printk("After register driver\n");
364 return (u32 *) &cardp;
365 @@ -482,22 +319,7 @@ u32 *register_cf_driver(cf_notifier_fn_a
367 void unregister_cf_driver( void )
370 -#ifdef LINUX_2_4
371 - unregister_pccard_driver(&cfio_dev_info);
372 -#else
373 pcmcia_unregister_driver(&cfio_cs_driver);
374 -#endif
376 - cf_detach(dev_list);
378 - while (dev_list != NULL) {
379 -#ifdef LINUX_2_4
380 - del_timer(&dev_list->release);
381 -#endif
382 - if (dev_list->state & DEV_CONFIG)
383 - cf_release((u32) dev_list);
388 @@ -508,6 +330,8 @@ void unregister_cf_driver( void )
390 s16 cfio_read_cfg_reg(void* priv)
392 + if_pcmcia_info_t *ifinfo = (if_pcmcia_info_t *)priv;
394 conf_reg_t reg;
396 reg.Function = 0;
397 @@ -515,7 +339,7 @@ s16 cfio_read_cfg_reg(void* priv)
398 reg.Offset = 0;
399 reg.Value = 0;
401 - pcmcia_access_configuration_register(dev_list->handle, &reg);
402 + pcmcia_access_configuration_register(ifinfo->p_dev, &reg);
403 return 0;
406 Index: src_cf8385/io/mcf/cfio_io.h
407 ===================================================================
408 --- src_cf8385.orig/io/mcf/cfio_io.h
409 +++ src_cf8385/io/mcf/cfio_io.h
410 @@ -82,7 +82,6 @@ typedef void * (*cf_notifier_fn_add) (s
411 typedef int (*cf_notifier_fn_remove) (struct cf_card_rec *);
413 extern dev_info_t cfio_dev_info;
414 -extern dev_link_t *dev_list;
416 extern struct cf_card_rec cardp;
417 s16 cfio_read_cfg_reg(void *priv);
418 Index: src_cf8385/if/if_mcf/if_cf.c
419 ===================================================================
420 --- src_cf8385.orig/if/if_mcf/if_cf.c
421 +++ src_cf8385/if/if_mcf/if_cf.c
422 @@ -32,11 +32,9 @@ Change log:
423 do { \
424 tuple.DesiredTuple = X; \
426 - if (!handle) \
427 + if (pcmcia_get_first_tuple((&cisinfo), &tuple)) \
428 goto error; \
429 - if (pcmcia_get_first_tuple(handle, &tuple)) \
430 - goto error; \
431 - if (pcmcia_get_tuple_data(handle, &tuple)) \
432 + if (pcmcia_get_tuple_data((&cisinfo), &tuple)) \
433 goto error; \
435 cisbuf[ofs++] = tuple.TupleCode; \
436 @@ -48,7 +46,7 @@ Change log:
437 int *register_cf_driver(cf_notifier_fn_add ,cf_notifier_fn_remove , void *);
438 void unregister_cf_driver(void);
440 -static dev_link_t cisinfo;
441 +static struct pcmcia_device cisinfo;
443 static u16 int_cause = 0;
445 @@ -771,7 +769,6 @@ int sbi_host_to_card(wlan_private *priv,
446 int sbi_get_cis_info(wlan_private *priv)
448 wlan_adapter *Adapter = priv->adapter;
449 - client_handle_t handle = cisinfo.handle;
450 tuple_t tuple;
451 char buf[64], cisbuf[512];
452 int ofs=0, count=6;
453 @@ -793,9 +790,9 @@ int sbi_get_cis_info(wlan_private *priv)
457 - if (pcmcia_get_next_tuple(handle, &tuple))
458 + if (pcmcia_get_next_tuple((&cisinfo), &tuple))
459 goto error;
460 - if (pcmcia_get_tuple_data(handle, &tuple))
461 + if (pcmcia_get_tuple_data((&cisinfo), &tuple))
462 goto error;
464 cisbuf[ofs++] = tuple.TupleCode;
465 Index: src_cf8385/wlan/wlan_fw.c
466 ===================================================================
467 --- src_cf8385.orig/wlan/wlan_fw.c
468 +++ src_cf8385/wlan/wlan_fw.c
469 @@ -21,11 +21,11 @@ Change log:
470 ********************************************************/
473 -u8 *helper_name=NULL;
474 -u8 *fw_name=NULL;
475 +static char *helper_name=NULL;
476 +static char *fw_name=NULL;
478 -MODULE_PARM( helper_name, "s");
479 -MODULE_PARM( fw_name, "s" );
480 +module_param( helper_name, charp, 0);
481 +module_param( fw_name, charp, 0);
484 /********************************************************