Skip to content

Commit fc30110

Browse files
author
Dominik Brodowski
committed
pcmcia: simplify Status, ExtStatus register access
The Status (CISREG_CCSR) and ExtStatus (CISREG_ESR) registers were only accessed to enable audio output for some drivers and IRQ for serial_cs.c. The former also required setting config_req_t.Attributes to CONF_ENABLE_SPKR; the latter can be simplified to setting this field to CONF_ENABLE_ESR. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-serial@vger.kernel.org CC: linux-scsi@vger.kernel.org Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
1 parent 1a4a046 commit fc30110

16 files changed

Lines changed: 38 additions & 53 deletions

File tree

‎drivers/isdn/hisax/sedlbauer_cs.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
175175
return -ENODEV;
176176

177177
/* Does this card need audio output? */
178-
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
178+
if (cfg->flags & CISTPL_CFTABLE_AUDIO)
179179
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
180-
p_dev->conf.Status = CCSR_AUDIO_ENA;
181-
}
182180

183181
/* Use power settings for Vcc and Vpp if present */
184182
/* Note that the CIS values need to be rescaled */

‎drivers/net/pcmcia/axnet_cs.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,8 @@ static int axnet_config(struct pcmcia_device *link)
334334
if (!link->irq)
335335
goto failed;
336336

337-
if (resource_size(link->resource[1]) == 8) {
337+
if (resource_size(link->resource[1]) == 8)
338338
link->conf.Attributes |= CONF_ENABLE_SPKR;
339-
link->conf.Status = CCSR_AUDIO_ENA;
340-
}
341339

342340
ret = pcmcia_request_configuration(link, &link->conf);
343341
if (ret)

‎drivers/net/pcmcia/pcnet_cs.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,9 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
560560
if (!link->irq)
561561
return NULL;
562562

563-
if (resource_size(link->resource[1]) == 8) {
563+
if (resource_size(link->resource[1]) == 8)
564564
link->conf.Attributes |= CONF_ENABLE_SPKR;
565-
link->conf.Status = CCSR_AUDIO_ENA;
566-
}
565+
567566
if ((link->manf_id == MANFID_IBM) &&
568567
(link->card_id == PRODID_IBM_HOME_AND_AWAY))
569568
link->conf.ConfigIndex |= 0x10;

‎drivers/net/pcmcia/smc91c92_cs.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ static int mhz_mfc_config(struct pcmcia_device *link)
446446
int i;
447447

448448
link->conf.Attributes |= CONF_ENABLE_SPKR;
449-
link->conf.Status = CCSR_AUDIO_ENA;
450449
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
451450
link->resource[1]->end = 8;
452451

@@ -640,7 +639,6 @@ static int osi_config(struct pcmcia_device *link)
640639
int i, j;
641640

642641
link->conf.Attributes |= CONF_ENABLE_SPKR;
643-
link->conf.Status = CCSR_AUDIO_ENA;
644642
link->resource[0]->end = 64;
645643
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
646644
link->resource[1]->end = 8;

‎drivers/net/pcmcia/xirc2ps_cs.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,9 @@ xirc2ps_config(struct pcmcia_device * link)
812812
if (local->modem) {
813813
int pass;
814814

815-
if (do_sound) {
815+
if (do_sound)
816816
link->conf.Attributes |= CONF_ENABLE_SPKR;
817-
link->conf.Status |= CCSR_AUDIO_ENA;
818-
}
817+
819818
link->resource[1]->end = 8;
820819
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
821820
if (local->dingo) {

‎drivers/net/wireless/airo_cs.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,8 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
158158
return -ENODEV;
159159

160160
/* Does this card need audio output? */
161-
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
161+
if (cfg->flags & CISTPL_CFTABLE_AUDIO)
162162
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
163-
p_dev->conf.Status = CCSR_AUDIO_ENA;
164-
}
165163

166164
/* Use power settings for Vcc and Vpp if present */
167165
/* Note that the CIS values need to be rescaled */

‎drivers/net/wireless/atmel_cs.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,8 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
175175
return -ENODEV;
176176

177177
/* Does this card need audio output? */
178-
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
178+
if (cfg->flags & CISTPL_CFTABLE_AUDIO)
179179
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
180-
p_dev->conf.Status = CCSR_AUDIO_ENA;
181-
}
182180

183181
/* Use power settings for Vcc and Vpp if present */
184182
/* Note that the CIS values need to be rescaled */

‎drivers/net/wireless/hostap/hostap_cs.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
484484
"(default 0x%02X)\n", cfg->index, dflt->index);
485485

486486
/* Does this card need audio output? */
487-
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
487+
if (cfg->flags & CISTPL_CFTABLE_AUDIO)
488488
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
489-
p_dev->conf.Status = CCSR_AUDIO_ENA;
490-
}
491489

492490
/* Use power settings for Vcc and Vpp if present */
493491
/* Note that the CIS values need to be rescaled */

‎drivers/pcmcia/cs_internal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef struct config_t {
3636
unsigned int Attributes;
3737
unsigned int IntType;
3838
unsigned int ConfigBase;
39-
unsigned char Status, Option, ExtStatus;
39+
unsigned char Option;
4040
unsigned int CardValues;
4141

4242
struct resource io[MAX_IO_WIN]; /* io ports */

‎drivers/pcmcia/pcmcia_resource.c‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
441441
struct pcmcia_socket *s = p_dev->socket;
442442
config_t *c;
443443
pccard_io_map iomap;
444+
unsigned char status = 0;
445+
unsigned char ext_status = 0;
444446

445447
if (!(s->state & SOCKET_PRESENT))
446448
return -ENODEV;
@@ -476,12 +478,21 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
476478
s->socket.flags |= SS_ZVCARD | SS_IOCARD;
477479
if (req->Attributes & CONF_ENABLE_DMA)
478480
s->socket.flags |= SS_DMA_MODE;
479-
if (req->Attributes & CONF_ENABLE_SPKR)
481+
if (req->Attributes & CONF_ENABLE_SPKR) {
480482
s->socket.flags |= SS_SPKR_ENA;
483+
status = CCSR_AUDIO_ENA;
484+
if (!(req->Present & PRESENT_STATUS))
485+
dev_warn(&p_dev->dev, "speaker requested, but "
486+
"PRESENT_STATUS not set!\n");
487+
}
481488
if (req->Attributes & CONF_ENABLE_IRQ)
482489
s->socket.io_irq = s->pcmcia_irq;
483490
else
484491
s->socket.io_irq = 0;
492+
if (req->Attributes & CONF_ENABLE_ESR) {
493+
req->Present |= PRESENT_EXT_STATUS;
494+
ext_status = ESR_REQ_ATTN_ENA;
495+
}
485496
s->ops->set_socket(s, &s->socket);
486497
s->lock_count++;
487498

@@ -513,14 +524,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
513524
pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option);
514525
mdelay(40);
515526
}
516-
if (req->Present & PRESENT_STATUS) {
517-
c->Status = req->Status;
518-
pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status);
519-
}
520-
if (req->Present & PRESENT_EXT_STATUS) {
521-
c->ExtStatus = req->ExtStatus;
522-
pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus);
523-
}
527+
if (req->Present & PRESENT_STATUS)
528+
pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status);
529+
530+
if (req->Present & PRESENT_EXT_STATUS)
531+
pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1,
532+
&ext_status);
533+
524534
if (req->Present & PRESENT_IOBASE_0) {
525535
u8 b = c->io[0].start & 0xff;
526536
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);

0 commit comments

Comments
 (0)