Commit fc301101 authored by Dominik Brodowski's avatar Dominik Brodowski

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: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 1a4a0460
...@@ -175,10 +175,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, ...@@ -175,10 +175,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */ /* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */ /* Note that the CIS values need to be rescaled */
......
...@@ -334,10 +334,8 @@ static int axnet_config(struct pcmcia_device *link) ...@@ -334,10 +334,8 @@ static int axnet_config(struct pcmcia_device *link)
if (!link->irq) if (!link->irq)
goto failed; goto failed;
if (resource_size(link->resource[1]) == 8) { if (resource_size(link->resource[1]) == 8)
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
}
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
......
...@@ -560,10 +560,9 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link, ...@@ -560,10 +560,9 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
if (!link->irq) if (!link->irq)
return NULL; return NULL;
if (resource_size(link->resource[1]) == 8) { if (resource_size(link->resource[1]) == 8)
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
}
if ((link->manf_id == MANFID_IBM) && if ((link->manf_id == MANFID_IBM) &&
(link->card_id == PRODID_IBM_HOME_AND_AWAY)) (link->card_id == PRODID_IBM_HOME_AND_AWAY))
link->conf.ConfigIndex |= 0x10; link->conf.ConfigIndex |= 0x10;
......
...@@ -446,7 +446,6 @@ static int mhz_mfc_config(struct pcmcia_device *link) ...@@ -446,7 +446,6 @@ static int mhz_mfc_config(struct pcmcia_device *link)
int i; int i;
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[1]->end = 8; link->resource[1]->end = 8;
...@@ -640,7 +639,6 @@ static int osi_config(struct pcmcia_device *link) ...@@ -640,7 +639,6 @@ static int osi_config(struct pcmcia_device *link)
int i, j; int i, j;
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
link->resource[0]->end = 64; link->resource[0]->end = 64;
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[1]->end = 8; link->resource[1]->end = 8;
......
...@@ -812,10 +812,9 @@ xirc2ps_config(struct pcmcia_device * link) ...@@ -812,10 +812,9 @@ xirc2ps_config(struct pcmcia_device * link)
if (local->modem) { if (local->modem) {
int pass; int pass;
if (do_sound) { if (do_sound)
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status |= CCSR_AUDIO_ENA;
}
link->resource[1]->end = 8; link->resource[1]->end = 8;
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
if (local->dingo) { if (local->dingo) {
......
...@@ -158,10 +158,8 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, ...@@ -158,10 +158,8 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */ /* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */ /* Note that the CIS values need to be rescaled */
......
...@@ -175,10 +175,8 @@ static int atmel_config_check(struct pcmcia_device *p_dev, ...@@ -175,10 +175,8 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */ /* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */ /* Note that the CIS values need to be rescaled */
......
...@@ -484,10 +484,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev, ...@@ -484,10 +484,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
"(default 0x%02X)\n", cfg->index, dflt->index); "(default 0x%02X)\n", cfg->index, dflt->index);
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */ /* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */ /* Note that the CIS values need to be rescaled */
......
...@@ -36,7 +36,7 @@ typedef struct config_t { ...@@ -36,7 +36,7 @@ typedef struct config_t {
unsigned int Attributes; unsigned int Attributes;
unsigned int IntType; unsigned int IntType;
unsigned int ConfigBase; unsigned int ConfigBase;
unsigned char Status, Option, ExtStatus; unsigned char Option;
unsigned int CardValues; unsigned int CardValues;
struct resource io[MAX_IO_WIN]; /* io ports */ struct resource io[MAX_IO_WIN]; /* io ports */
......
...@@ -441,6 +441,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, ...@@ -441,6 +441,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
struct pcmcia_socket *s = p_dev->socket; struct pcmcia_socket *s = p_dev->socket;
config_t *c; config_t *c;
pccard_io_map iomap; pccard_io_map iomap;
unsigned char status = 0;
unsigned char ext_status = 0;
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return -ENODEV; return -ENODEV;
...@@ -476,12 +478,21 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, ...@@ -476,12 +478,21 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
s->socket.flags |= SS_ZVCARD | SS_IOCARD; s->socket.flags |= SS_ZVCARD | SS_IOCARD;
if (req->Attributes & CONF_ENABLE_DMA) if (req->Attributes & CONF_ENABLE_DMA)
s->socket.flags |= SS_DMA_MODE; s->socket.flags |= SS_DMA_MODE;
if (req->Attributes & CONF_ENABLE_SPKR) if (req->Attributes & CONF_ENABLE_SPKR) {
s->socket.flags |= SS_SPKR_ENA; s->socket.flags |= SS_SPKR_ENA;
status = CCSR_AUDIO_ENA;
if (!(req->Present & PRESENT_STATUS))
dev_warn(&p_dev->dev, "speaker requested, but "
"PRESENT_STATUS not set!\n");
}
if (req->Attributes & CONF_ENABLE_IRQ) if (req->Attributes & CONF_ENABLE_IRQ)
s->socket.io_irq = s->pcmcia_irq; s->socket.io_irq = s->pcmcia_irq;
else else
s->socket.io_irq = 0; s->socket.io_irq = 0;
if (req->Attributes & CONF_ENABLE_ESR) {
req->Present |= PRESENT_EXT_STATUS;
ext_status = ESR_REQ_ATTN_ENA;
}
s->ops->set_socket(s, &s->socket); s->ops->set_socket(s, &s->socket);
s->lock_count++; s->lock_count++;
...@@ -513,14 +524,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, ...@@ -513,14 +524,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option);
mdelay(40); mdelay(40);
} }
if (req->Present & PRESENT_STATUS) { if (req->Present & PRESENT_STATUS)
c->Status = req->Status; pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status);
pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status);
} if (req->Present & PRESENT_EXT_STATUS)
if (req->Present & PRESENT_EXT_STATUS) { pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1,
c->ExtStatus = req->ExtStatus; &ext_status);
pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus);
}
if (req->Present & PRESENT_IOBASE_0) { if (req->Present & PRESENT_IOBASE_0) {
u8 b = c->io[0].start & 0xff; u8 b = c->io[0].start & 0xff;
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);
......
...@@ -1608,10 +1608,8 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, ...@@ -1608,10 +1608,8 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */ /* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */ /* Note that the CIS values need to be rescaled */
......
...@@ -183,10 +183,8 @@ static void quirk_config_socket(struct pcmcia_device *link) ...@@ -183,10 +183,8 @@ static void quirk_config_socket(struct pcmcia_device *link)
{ {
struct serial_info *info = link->priv; struct serial_info *info = link->priv;
if (info->multi) { if (info->multi)
link->conf.Present |= PRESENT_EXT_STATUS; link->conf.Attributes |= CONF_ENABLE_ESR;
link->conf.ExtStatus = ESR_REQ_ATTN_ENA;
}
} }
static const struct serial_quirk quirks[] = { static const struct serial_quirk quirks[] = {
...@@ -336,10 +334,9 @@ static int serial_probe(struct pcmcia_device *link) ...@@ -336,10 +334,9 @@ static int serial_probe(struct pcmcia_device *link)
link->priv = info; link->priv = info;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
if (do_sound) { if (do_sound)
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
}
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
return serial_config(link); return serial_config(link);
......
...@@ -550,10 +550,8 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, ...@@ -550,10 +550,8 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Do we need to allocate an interrupt? */ /* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ; p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
......
...@@ -302,10 +302,8 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, ...@@ -302,10 +302,8 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Do we need to allocate an interrupt? */ /* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ; p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
......
...@@ -281,10 +281,8 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, ...@@ -281,10 +281,8 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
return -ENODEV; return -ENODEV;
/* Does this card need audio output? */ /* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) { if (cfg->flags & CISTPL_CFTABLE_AUDIO)
p_dev->conf.Attributes |= CONF_ENABLE_SPKR; p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Do we need to allocate an interrupt? */ /* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
......
...@@ -24,7 +24,6 @@ typedef struct config_req_t { ...@@ -24,7 +24,6 @@ typedef struct config_req_t {
u_int Attributes; u_int Attributes;
u_int IntType; u_int IntType;
u_int ConfigBase; u_int ConfigBase;
u_char Status, ExtStatus;
u_char ConfigIndex; u_char ConfigIndex;
u_int Present; u_int Present;
} config_req_t; } config_req_t;
...@@ -34,6 +33,7 @@ typedef struct config_req_t { ...@@ -34,6 +33,7 @@ typedef struct config_req_t {
#define CONF_ENABLE_DMA 0x02 #define CONF_ENABLE_DMA 0x02
#define CONF_ENABLE_SPKR 0x04 #define CONF_ENABLE_SPKR 0x04
#define CONF_ENABLE_PULSE_IRQ 0x08 #define CONF_ENABLE_PULSE_IRQ 0x08
#define CONF_ENABLE_ESR 0x10
#define CONF_VALID_CLIENT 0x100 #define CONF_VALID_CLIENT 0x100
/* IntType field */ /* IntType field */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment