aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/sedlbauer_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/sedlbauer_cs.c')
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 2746acbd8b70..9a3c9f5e4fe8 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -217,17 +217,13 @@ static void sedlbauer_detach(struct pcmcia_device *link)
217#define CS_CHECK(fn, ret) \ 217#define CS_CHECK(fn, ret) \
218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
219 219
220struct sedlbauer_config_data {
221 config_info_t conf;
222 win_req_t req;
223};
224
225static int sedlbauer_config_check(struct pcmcia_device *p_dev, 220static int sedlbauer_config_check(struct pcmcia_device *p_dev,
226 cistpl_cftable_entry_t *cfg, 221 cistpl_cftable_entry_t *cfg,
227 cistpl_cftable_entry_t *dflt, 222 cistpl_cftable_entry_t *dflt,
223 unsigned int vcc,
228 void *priv_data) 224 void *priv_data)
229{ 225{
230 struct sedlbauer_config_data *cfg_mem = priv_data; 226 win_req_t *req = priv_data;
231 227
232 if (cfg->index == 0) 228 if (cfg->index == 0)
233 return -ENODEV; 229 return -ENODEV;
@@ -241,12 +237,10 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
241 /* Use power settings for Vcc and Vpp if present */ 237 /* Use power settings for Vcc and Vpp if present */
242 /* Note that the CIS values need to be rescaled */ 238 /* Note that the CIS values need to be rescaled */
243 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 239 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
244 if (cfg_mem->conf.Vcc != 240 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
245 cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
246 return -ENODEV; 241 return -ENODEV;
247 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { 242 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
248 if (cfg_mem->conf.Vcc != 243 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
249 dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
250 return -ENODEV; 244 return -ENODEV;
251 } 245 }
252 246
@@ -294,12 +288,12 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
294 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 288 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
295 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 289 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
296 memreq_t map; 290 memreq_t map;
297 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 291 req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
298 cfg_mem->req.Attributes |= WIN_ENABLE; 292 req->Attributes |= WIN_ENABLE;
299 cfg_mem->req.Base = mem->win[0].host_addr; 293 req->Base = mem->win[0].host_addr;
300 cfg_mem->req.Size = mem->win[0].len; 294 req->Size = mem->win[0].len;
301 cfg_mem->req.AccessSpeed = 0; 295 req->AccessSpeed = 0;
302 if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) 296 if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0)
303 return -ENODEV; 297 return -ENODEV;
304 map.Page = 0; 298 map.Page = 0;
305 map.CardOffset = mem->win[0].card_addr; 299 map.CardOffset = mem->win[0].card_addr;
@@ -314,20 +308,16 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
314static int sedlbauer_config(struct pcmcia_device *link) 308static int sedlbauer_config(struct pcmcia_device *link)
315{ 309{
316 local_info_t *dev = link->priv; 310 local_info_t *dev = link->priv;
317 struct sedlbauer_config_data *cfg_mem; 311 win_req_t *req;
318 int last_fn, last_ret; 312 int last_fn, last_ret;
319 IsdnCard_t icard; 313 IsdnCard_t icard;
320 314
321 DEBUG(0, "sedlbauer_config(0x%p)\n", link); 315 DEBUG(0, "sedlbauer_config(0x%p)\n", link);
322 316
323 cfg_mem = kzalloc(sizeof(struct sedlbauer_config_data), GFP_KERNEL); 317 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
324 if (!cfg_mem) 318 if (!req)
325 return -ENOMEM; 319 return -ENOMEM;
326 320
327 /* Look up the current Vcc */
328 CS_CHECK(GetConfigurationInfo,
329 pcmcia_get_configuration_info(link, &cfg_mem->conf));
330
331 /* 321 /*
332 In this loop, we scan the CIS for configuration table entries, 322 In this loop, we scan the CIS for configuration table entries,
333 each of which describes a valid card configuration, including 323 each of which describes a valid card configuration, including
@@ -340,7 +330,7 @@ static int sedlbauer_config(struct pcmcia_device *link)
340 these things without consulting the CIS, and most client drivers 330 these things without consulting the CIS, and most client drivers
341 will only use the CIS to fill in implementation-defined details. 331 will only use the CIS to fill in implementation-defined details.
342 */ 332 */
343 last_ret = pcmcia_loop_config(link, sedlbauer_config_check, cfg_mem); 333 last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req);
344 if (last_ret) 334 if (last_ret)
345 goto failed; 335 goto failed;
346 336
@@ -381,8 +371,8 @@ static int sedlbauer_config(struct pcmcia_device *link)
381 printk(" & 0x%04x-0x%04x", link->io.BasePort2, 371 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
382 link->io.BasePort2+link->io.NumPorts2-1); 372 link->io.BasePort2+link->io.NumPorts2-1);
383 if (link->win) 373 if (link->win)
384 printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 374 printk(", mem 0x%06lx-0x%06lx", req->Base,
385 cfg_mem->req.Base+cfg_mem->req.Size-1); 375 req->Base+req->Size-1);
386 printk("\n"); 376 printk("\n");
387 377
388 icard.para[0] = link->irq.AssignedIRQ; 378 icard.para[0] = link->irq.AssignedIRQ;