aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 6210e1c2b432..a1fb0dc1a71f 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -168,7 +168,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev,
168 return -EACCES; 168 return -EACCES;
169 } 169 }
170 170
171 addr = (c->ConfigBase + where) >> 1; 171 addr = (p_dev->config_base + where) >> 1;
172 172
173 ret = accessf(s, 1, addr, 1, val); 173 ret = accessf(s, 1, addr, 1, val);
174 174
@@ -443,6 +443,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
443 pccard_io_map iomap; 443 pccard_io_map iomap;
444 unsigned char status = 0; 444 unsigned char status = 0;
445 unsigned char ext_status = 0; 445 unsigned char ext_status = 0;
446 unsigned char option = 0;
446 447
447 if (!(s->state & SOCKET_PRESENT)) 448 if (!(s->state & SOCKET_PRESENT))
448 return -ENODEV; 449 return -ENODEV;
@@ -473,7 +474,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
473 if (req->Attributes & CONF_ENABLE_SPKR) { 474 if (req->Attributes & CONF_ENABLE_SPKR) {
474 s->socket.flags |= SS_SPKR_ENA; 475 s->socket.flags |= SS_SPKR_ENA;
475 status = CCSR_AUDIO_ENA; 476 status = CCSR_AUDIO_ENA;
476 if (!(req->Present & PRESENT_STATUS)) 477 if (!(p_dev->config_regs & PRESENT_STATUS))
477 dev_warn(&p_dev->dev, "speaker requested, but " 478 dev_warn(&p_dev->dev, "speaker requested, but "
478 "PRESENT_STATUS not set!\n"); 479 "PRESENT_STATUS not set!\n");
479 } 480 }
@@ -482,54 +483,53 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
482 else 483 else
483 s->socket.io_irq = 0; 484 s->socket.io_irq = 0;
484 if (req->Attributes & CONF_ENABLE_ESR) { 485 if (req->Attributes & CONF_ENABLE_ESR) {
485 req->Present |= PRESENT_EXT_STATUS; 486 p_dev->config_regs |= PRESENT_EXT_STATUS;
486 ext_status = ESR_REQ_ATTN_ENA; 487 ext_status = ESR_REQ_ATTN_ENA;
487 } 488 }
488 s->ops->set_socket(s, &s->socket); 489 s->ops->set_socket(s, &s->socket);
489 s->lock_count++; 490 s->lock_count++;
490 491
491 /* Set up CIS configuration registers */ 492 /* Set up CIS configuration registers */
492 base = c->ConfigBase = req->ConfigBase; 493 base = p_dev->config_base;
493 c->CardValues = req->Present; 494 if (p_dev->config_regs & PRESENT_COPY) {
494 if (req->Present & PRESENT_COPY) {
495 u16 tmp = 0; 495 u16 tmp = 0;
496 dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n"); 496 dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n");
497 pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); 497 pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp);
498 } 498 }
499 if (req->Present & PRESENT_PIN_REPLACE) { 499 if (p_dev->config_regs & PRESENT_PIN_REPLACE) {
500 u16 tmp = 0; 500 u16 tmp = 0;
501 dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n"); 501 dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n");
502 pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); 502 pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp);
503 } 503 }
504 if (req->Present & PRESENT_OPTION) { 504 if (p_dev->config_regs & PRESENT_OPTION) {
505 if (s->functions == 1) { 505 if (s->functions == 1) {
506 c->Option = req->ConfigIndex & COR_CONFIG_MASK; 506 option = p_dev->config_index & COR_CONFIG_MASK;
507 } else { 507 } else {
508 c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK; 508 option = p_dev->config_index & COR_MFC_CONFIG_MASK;
509 c->Option |= COR_FUNC_ENA|COR_IREQ_ENA; 509 option |= COR_FUNC_ENA|COR_IREQ_ENA;
510 if (req->Present & PRESENT_IOBASE_0) 510 if (p_dev->config_regs & PRESENT_IOBASE_0)
511 c->Option |= COR_ADDR_DECODE; 511 option |= COR_ADDR_DECODE;
512 } 512 }
513 if ((req->Attributes & CONF_ENABLE_IRQ) && 513 if ((req->Attributes & CONF_ENABLE_IRQ) &&
514 !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) 514 !(req->Attributes & CONF_ENABLE_PULSE_IRQ))
515 c->Option |= COR_LEVEL_REQ; 515 option |= COR_LEVEL_REQ;
516 pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); 516 pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option);
517 mdelay(40); 517 mdelay(40);
518 } 518 }
519 if (req->Present & PRESENT_STATUS) 519 if (p_dev->config_regs & PRESENT_STATUS)
520 pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); 520 pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status);
521 521
522 if (req->Present & PRESENT_EXT_STATUS) 522 if (p_dev->config_regs & PRESENT_EXT_STATUS)
523 pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, 523 pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1,
524 &ext_status); 524 &ext_status);
525 525
526 if (req->Present & PRESENT_IOBASE_0) { 526 if (p_dev->config_regs & PRESENT_IOBASE_0) {
527 u8 b = c->io[0].start & 0xff; 527 u8 b = c->io[0].start & 0xff;
528 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 528 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);
529 b = (c->io[0].start >> 8) & 0xff; 529 b = (c->io[0].start >> 8) & 0xff;
530 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 530 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b);
531 } 531 }
532 if (req->Present & PRESENT_IOSIZE) { 532 if (p_dev->config_regs & PRESENT_IOSIZE) {
533 u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; 533 u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1;
534 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 534 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b);
535 } 535 }