You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
pcmcia: move config_{base,index,regs} to struct pcmcia_device
Several drivers prefer to explicitly set config_{base,index,regs},
formerly known as ConfigBase, ConfigIndex and Present. Instead of
passing these values inside config_req_t, store it in struct
pcmcia_device.
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -34,9 +34,6 @@ typedef struct config_t {
|
||||
struct kref ref;
|
||||
unsigned int state;
|
||||
unsigned int Attributes;
|
||||
unsigned int ConfigBase;
|
||||
unsigned char Option;
|
||||
unsigned int CardValues;
|
||||
|
||||
struct resource io[MAX_IO_WIN]; /* io ports */
|
||||
struct resource mem[MAX_WIN]; /* mem areas */
|
||||
|
||||
+4
-4
@@ -276,13 +276,13 @@ static int pcmcia_device_probe(struct device *dev)
|
||||
ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG,
|
||||
&cis_config);
|
||||
if (!ret) {
|
||||
p_dev->conf.ConfigBase = cis_config.base;
|
||||
p_dev->conf.Present = cis_config.rmask[0];
|
||||
p_dev->config_base = cis_config.base;
|
||||
p_dev->config_regs = cis_config.rmask[0];
|
||||
} else {
|
||||
dev_printk(KERN_INFO, dev,
|
||||
"pcmcia: could not parse base and rmask0 of CIS\n");
|
||||
p_dev->conf.ConfigBase = 0;
|
||||
p_dev->conf.Present = 0;
|
||||
p_dev->config_base = 0;
|
||||
p_dev->config_regs = 0;
|
||||
}
|
||||
|
||||
ret = p_drv->probe(p_dev);
|
||||
|
||||
@@ -151,7 +151,7 @@ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv)
|
||||
struct pcmcia_cfg_mem *cfg_mem = priv;
|
||||
|
||||
/* default values */
|
||||
cfg_mem->p_dev->conf.ConfigIndex = cfg->index;
|
||||
cfg_mem->p_dev->config_index = cfg->index;
|
||||
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
|
||||
cfg_mem->dflt = *cfg;
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev,
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
addr = (c->ConfigBase + where) >> 1;
|
||||
addr = (p_dev->config_base + where) >> 1;
|
||||
|
||||
ret = accessf(s, 1, addr, 1, val);
|
||||
|
||||
@@ -443,6 +443,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
|
||||
pccard_io_map iomap;
|
||||
unsigned char status = 0;
|
||||
unsigned char ext_status = 0;
|
||||
unsigned char option = 0;
|
||||
|
||||
if (!(s->state & SOCKET_PRESENT))
|
||||
return -ENODEV;
|
||||
@@ -473,7 +474,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
|
||||
if (req->Attributes & CONF_ENABLE_SPKR) {
|
||||
s->socket.flags |= SS_SPKR_ENA;
|
||||
status = CCSR_AUDIO_ENA;
|
||||
if (!(req->Present & PRESENT_STATUS))
|
||||
if (!(p_dev->config_regs & PRESENT_STATUS))
|
||||
dev_warn(&p_dev->dev, "speaker requested, but "
|
||||
"PRESENT_STATUS not set!\n");
|
||||
}
|
||||
@@ -482,54 +483,53 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
|
||||
else
|
||||
s->socket.io_irq = 0;
|
||||
if (req->Attributes & CONF_ENABLE_ESR) {
|
||||
req->Present |= PRESENT_EXT_STATUS;
|
||||
p_dev->config_regs |= PRESENT_EXT_STATUS;
|
||||
ext_status = ESR_REQ_ATTN_ENA;
|
||||
}
|
||||
s->ops->set_socket(s, &s->socket);
|
||||
s->lock_count++;
|
||||
|
||||
/* Set up CIS configuration registers */
|
||||
base = c->ConfigBase = req->ConfigBase;
|
||||
c->CardValues = req->Present;
|
||||
if (req->Present & PRESENT_COPY) {
|
||||
base = p_dev->config_base;
|
||||
if (p_dev->config_regs & PRESENT_COPY) {
|
||||
u16 tmp = 0;
|
||||
dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n");
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp);
|
||||
}
|
||||
if (req->Present & PRESENT_PIN_REPLACE) {
|
||||
if (p_dev->config_regs & PRESENT_PIN_REPLACE) {
|
||||
u16 tmp = 0;
|
||||
dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n");
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp);
|
||||
}
|
||||
if (req->Present & PRESENT_OPTION) {
|
||||
if (p_dev->config_regs & PRESENT_OPTION) {
|
||||
if (s->functions == 1) {
|
||||
c->Option = req->ConfigIndex & COR_CONFIG_MASK;
|
||||
option = p_dev->config_index & COR_CONFIG_MASK;
|
||||
} else {
|
||||
c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK;
|
||||
c->Option |= COR_FUNC_ENA|COR_IREQ_ENA;
|
||||
if (req->Present & PRESENT_IOBASE_0)
|
||||
c->Option |= COR_ADDR_DECODE;
|
||||
option = p_dev->config_index & COR_MFC_CONFIG_MASK;
|
||||
option |= COR_FUNC_ENA|COR_IREQ_ENA;
|
||||
if (p_dev->config_regs & PRESENT_IOBASE_0)
|
||||
option |= COR_ADDR_DECODE;
|
||||
}
|
||||
if ((req->Attributes & CONF_ENABLE_IRQ) &&
|
||||
!(req->Attributes & CONF_ENABLE_PULSE_IRQ))
|
||||
c->Option |= COR_LEVEL_REQ;
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option);
|
||||
option |= COR_LEVEL_REQ;
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option);
|
||||
mdelay(40);
|
||||
}
|
||||
if (req->Present & PRESENT_STATUS)
|
||||
if (p_dev->config_regs & PRESENT_STATUS)
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status);
|
||||
|
||||
if (req->Present & PRESENT_EXT_STATUS)
|
||||
if (p_dev->config_regs & PRESENT_EXT_STATUS)
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1,
|
||||
&ext_status);
|
||||
|
||||
if (req->Present & PRESENT_IOBASE_0) {
|
||||
if (p_dev->config_regs & PRESENT_IOBASE_0) {
|
||||
u8 b = c->io[0].start & 0xff;
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);
|
||||
b = (c->io[0].start >> 8) & 0xff;
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b);
|
||||
}
|
||||
if (req->Present & PRESENT_IOSIZE) {
|
||||
if (p_dev->config_regs & PRESENT_IOSIZE) {
|
||||
u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1;
|
||||
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user