Commit e8405f0f authored by Dominik Brodowski's avatar Dominik Brodowski

pcmcia: move Vpp setup to struct pcmcia_device

Some drivers prefer to explicitly set Vpp. Instead of passing the
voltage inside config_req_t, store it in struct pcmcia_device.

CC: linux-ide@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-mtd@lists.infradead.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent fb49fa53
...@@ -194,9 +194,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, ...@@ -194,9 +194,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
} }
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
......
...@@ -686,7 +686,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, ...@@ -686,7 +686,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
(cf->io.win[0].base != 0)) { (cf->io.win[0].base != 0)) {
p_dev->resource[0]->start = cf->io.win[0].base; p_dev->resource[0]->start = cf->io.win[0].base;
......
...@@ -615,7 +615,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev, ...@@ -615,7 +615,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
(cf->io.win[0].base != 0)) { (cf->io.win[0].base != 0)) {
p_dev->resource[0]->start = cf->io.win[0].base; p_dev->resource[0]->start = cf->io.win[0].base;
......
...@@ -221,9 +221,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, ...@@ -221,9 +221,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
} }
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
...@@ -311,7 +311,7 @@ static int ide_config(struct pcmcia_device *link) ...@@ -311,7 +311,7 @@ static int ide_config(struct pcmcia_device *link)
info->host = host; info->host = host;
dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n",
'a' + host->ports[0]->index * 2, 'a' + host->ports[0]->index * 2,
link->conf.Vpp / 10, link->conf.Vpp % 10); link->vpp / 10, link->vpp % 10);
kfree(stk); kfree(stk);
return 0; return 0;
......
...@@ -191,9 +191,9 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, ...@@ -191,9 +191,9 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
} }
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
p_dev->conf.Attributes |= CONF_ENABLE_IRQ; p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
...@@ -257,8 +257,8 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) ...@@ -257,8 +257,8 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
/* Finally, report what we've done */ /* Finally, report what we've done */
dev_info(&link->dev, "index 0x%02x:", dev_info(&link->dev, "index 0x%02x:",
link->conf.ConfigIndex); link->conf.ConfigIndex);
if (link->conf.Vpp) if (link->vpp)
printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq); printk(", irq %d", link->irq);
if (link->resource[0]) if (link->resource[0])
......
...@@ -570,9 +570,9 @@ static int pcmciamtd_config(struct pcmcia_device *link) ...@@ -570,9 +570,9 @@ static int pcmciamtd_config(struct pcmcia_device *link)
dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp;
link->conf.Attributes = 0; link->conf.Attributes = 0;
if(setvpp == 2) { if(setvpp == 2) {
link->conf.Vpp = dev->vpp; link->vpp = dev->vpp;
} else { } else {
link->conf.Vpp = 0; link->vpp = 0;
} }
link->conf.IntType = INT_MEMORY; link->conf.IntType = INT_MEMORY;
......
...@@ -166,9 +166,9 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, ...@@ -166,9 +166,9 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
/* 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 */
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
p_dev->conf.Attributes |= CONF_ENABLE_IRQ; p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
...@@ -244,8 +244,8 @@ static int airo_config(struct pcmcia_device *link) ...@@ -244,8 +244,8 @@ static int airo_config(struct pcmcia_device *link)
/* Finally, report what we've done */ /* Finally, report what we've done */
dev_info(&link->dev, "index 0x%02x: ", dev_info(&link->dev, "index 0x%02x: ",
link->conf.ConfigIndex); link->conf.ConfigIndex);
if (link->conf.Vpp) if (link->vpp)
printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
printk(", irq %d", link->irq); printk(", irq %d", link->irq);
if (link->resource[0]) if (link->resource[0])
printk(" & %pR", link->resource[0]); printk(" & %pR", link->resource[0]);
......
...@@ -183,9 +183,9 @@ static int atmel_config_check(struct pcmcia_device *p_dev, ...@@ -183,9 +183,9 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
/* 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 */
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
p_dev->conf.Attributes |= CONF_ENABLE_IRQ; p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
......
...@@ -508,9 +508,9 @@ static int prism2_config_check(struct pcmcia_device *p_dev, ...@@ -508,9 +508,9 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
} }
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* 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;
...@@ -605,9 +605,9 @@ static int prism2_config(struct pcmcia_device *link) ...@@ -605,9 +605,9 @@ static int prism2_config(struct pcmcia_device *link)
/* Finally, report what we've done */ /* Finally, report what we've done */
printk(KERN_INFO "%s: index 0x%02x: ", printk(KERN_INFO "%s: index 0x%02x: ",
dev_info, link->conf.ConfigIndex); dev_info, link->conf.ConfigIndex);
if (link->conf.Vpp) if (link->vpp)
printk(", Vpp %d.%d", link->conf.Vpp / 10, printk(", Vpp %d.%d", link->vpp / 10,
link->conf.Vpp % 10); link->vpp % 10);
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq); printk(", irq %d", link->irq);
if (link->resource[0]) if (link->resource[0])
......
...@@ -181,10 +181,10 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, ...@@ -181,10 +181,10 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
} }
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* Do we need to allocate an interrupt? */ /* Do we need to allocate an interrupt? */
......
...@@ -243,10 +243,10 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, ...@@ -243,10 +243,10 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
} }
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* Do we need to allocate an interrupt? */ /* Do we need to allocate an interrupt? */
......
...@@ -303,6 +303,7 @@ int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp) ...@@ -303,6 +303,7 @@ int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp)
ret = -EIO; ret = -EIO;
goto unlock; goto unlock;
} }
p_dev->vpp = new_vpp;
unlock: unlock:
mutex_unlock(&s->ops_mutex); mutex_unlock(&s->ops_mutex);
...@@ -458,7 +459,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, ...@@ -458,7 +459,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
} }
/* Do power control. We don't allow changes in Vcc. */ /* Do power control. We don't allow changes in Vcc. */
s->socket.Vpp = req->Vpp; s->socket.Vpp = p_dev->vpp;
if (s->ops->set_socket(s, &s->socket)) { if (s->ops->set_socket(s, &s->socket)) {
mutex_unlock(&s->ops_mutex); mutex_unlock(&s->ops_mutex);
dev_printk(KERN_WARNING, &p_dev->dev, dev_printk(KERN_WARNING, &p_dev->dev,
......
...@@ -1624,10 +1624,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, ...@@ -1624,10 +1624,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
} }
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
p_dev->conf.Vpp = p_dev->vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
} else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) { } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
p_dev->conf.Vpp = p_dev->vpp =
dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
} }
...@@ -1749,8 +1749,8 @@ static int nsp_cs_config(struct pcmcia_device *link) ...@@ -1749,8 +1749,8 @@ static int nsp_cs_config(struct pcmcia_device *link)
/* Finally, report what we've done */ /* Finally, report what we've done */
printk(KERN_INFO "nsp_cs: index 0x%02x: ", printk(KERN_INFO "nsp_cs: index 0x%02x: ",
link->conf.ConfigIndex); link->conf.ConfigIndex);
if (link->conf.Vpp) { if (link->vpp) {
printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
} }
if (link->conf.Attributes & CONF_ENABLE_IRQ) { if (link->conf.Attributes & CONF_ENABLE_IRQ) {
printk(", irq %d", link->irq); printk(", irq %d", link->irq);
......
...@@ -440,7 +440,7 @@ static int simple_config_check(struct pcmcia_device *p_dev, ...@@ -440,7 +440,7 @@ static int simple_config_check(struct pcmcia_device *p_dev,
int *try = priv_data; int *try = priv_data;
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
p_dev->io_lines = ((*try & 0x1) == 0) ? p_dev->io_lines = ((*try & 0x1) == 0) ?
......
...@@ -152,10 +152,10 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, ...@@ -152,10 +152,10 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
} }
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = p_dev->vpp =
dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
/* we need an interrupt */ /* we need an interrupt */
...@@ -201,8 +201,8 @@ static int sl811_cs_config(struct pcmcia_device *link) ...@@ -201,8 +201,8 @@ static int sl811_cs_config(struct pcmcia_device *link)
dev_info(&link->dev, "index 0x%02x: ", dev_info(&link->dev, "index 0x%02x: ",
link->conf.ConfigIndex); link->conf.ConfigIndex);
if (link->conf.Vpp) if (link->vpp)
printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
printk(", irq %d", link->irq); printk(", irq %d", link->irq);
printk(", io %pR", link->resource[0]); printk(", io %pR", link->resource[0]);
printk("\n"); printk("\n");
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
/* For RequestConfiguration */ /* For RequestConfiguration */
typedef struct config_req_t { typedef struct config_req_t {
u_int Attributes; u_int Attributes;
u_int Vpp; /* both Vpp1 and Vpp2 */
u_int IntType; u_int IntType;
u_int ConfigBase; u_int ConfigBase;
u_char Status, Pin, Copy, ExtStatus; u_char Status, Pin, Copy, ExtStatus;
......
...@@ -94,6 +94,7 @@ struct pcmcia_device { ...@@ -94,6 +94,7 @@ struct pcmcia_device {
/* device setup */ /* device setup */
unsigned int irq; unsigned int irq;
struct resource *resource[PCMCIA_NUM_RESOURCES]; struct resource *resource[PCMCIA_NUM_RESOURCES];
unsigned int vpp;
unsigned int io_lines; /* number of I/O lines */ unsigned int io_lines; /* number of I/O lines */
......
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