aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/elsa_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/elsa_cs.c')
-rw-r--r--drivers/isdn/hisax/elsa_cs.c73
1 files changed, 23 insertions, 50 deletions
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index db7e64424afe..449800898dcf 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -203,68 +203,41 @@ static void elsa_cs_detach(struct pcmcia_device *link)
203 device available to the system. 203 device available to the system.
204 204
205======================================================================*/ 205======================================================================*/
206static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
207 cisparse_t *parse)
208{
209 int i = pcmcia_get_tuple_data(handle, tuple);
210 if (i != CS_SUCCESS) return i;
211 return pcmcia_parse_tuple(handle, tuple, parse);
212}
213
214static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
215 cisparse_t *parse)
216{
217 int i = pcmcia_get_first_tuple(handle, tuple);
218 if (i != CS_SUCCESS) return i;
219 return get_tuple(handle, tuple, parse);
220}
221 206
222static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, 207static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
223 cisparse_t *parse) 208 cistpl_cftable_entry_t *cf,
209 void *priv_data)
224{ 210{
225 int i = pcmcia_get_next_tuple(handle, tuple); 211 int j;
226 if (i != CS_SUCCESS) return i; 212
227 return get_tuple(handle, tuple, parse); 213 if ((cf->io.nwin > 0) && cf->io.win[0].base) {
214 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
215 p_dev->conf.ConfigIndex = cf->index;
216 p_dev->io.BasePort1 = cf->io.win[0].base;
217 if (!pcmcia_request_io(p_dev, &p_dev->io))
218 return 0;
219 } else {
220 printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n");
221 p_dev->conf.ConfigIndex = cf->index;
222 for (j = 0x2f0; j > 0x100; j -= 0x10) {
223 p_dev->io.BasePort1 = j;
224 if (!pcmcia_request_io(p_dev, &p_dev->io))
225 return 0;
226 }
227 }
228 return -ENODEV;
228} 229}
229 230
230static int elsa_cs_config(struct pcmcia_device *link) 231static int elsa_cs_config(struct pcmcia_device *link)
231{ 232{
232 tuple_t tuple;
233 cisparse_t parse;
234 local_info_t *dev; 233 local_info_t *dev;
235 int i, j, last_fn; 234 int i, last_fn;
236 u_short buf[128];
237 cistpl_cftable_entry_t *cf = &parse.cftable_entry;
238 IsdnCard_t icard; 235 IsdnCard_t icard;
239 236
240 DEBUG(0, "elsa_config(0x%p)\n", link); 237 DEBUG(0, "elsa_config(0x%p)\n", link);
241 dev = link->priv; 238 dev = link->priv;
242 239
243 tuple.TupleData = (cisdata_t *)buf; 240 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
244 tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
245 tuple.Attributes = 0;
246 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
247 i = first_tuple(link, &tuple, &parse);
248 while (i == CS_SUCCESS) {
249 if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
250 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
251 link->conf.ConfigIndex = cf->index;
252 link->io.BasePort1 = cf->io.win[0].base;
253 i = pcmcia_request_io(link, &link->io);
254 if (i == CS_SUCCESS) break;
255 } else {
256 printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n");
257 link->conf.ConfigIndex = cf->index;
258 for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
259 link->io.BasePort1 = j;
260 i = pcmcia_request_io(link, &link->io);
261 if (i == CS_SUCCESS) break;
262 }
263 break;
264 }
265 i = next_tuple(link, &tuple, &parse);
266 }
267
268 if (i != CS_SUCCESS) { 241 if (i != CS_SUCCESS) {
269 last_fn = RequestIO; 242 last_fn = RequestIO;
270 goto cs_failed; 243 goto cs_failed;