aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cs.c')
-rw-r--r--drivers/ide/ide-cs.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 87ad04925a9f..25b8a105a98d 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -99,6 +99,7 @@ static int ide_probe(struct pcmcia_device *link)
99 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 99 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
100 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 100 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
101 link->config_flags |= CONF_ENABLE_IRQ; 101 link->config_flags |= CONF_ENABLE_IRQ;
102 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
102 103
103 return ide_config(link); 104 return ide_config(link);
104} /* ide_attach */ 105} /* ide_attach */
@@ -195,34 +196,16 @@ out_release:
195 196
196struct pcmcia_config_check { 197struct pcmcia_config_check {
197 unsigned long ctl_base; 198 unsigned long ctl_base;
198 int skip_vcc;
199 int is_kme; 199 int is_kme;
200}; 200};
201 201
202static int pcmcia_check_one_config(struct pcmcia_device *pdev, 202static int pcmcia_check_one_config(struct pcmcia_device *pdev,
203 cistpl_cftable_entry_t *cfg, 203 cistpl_cftable_entry_t *cfg,
204 cistpl_cftable_entry_t *dflt, 204 cistpl_cftable_entry_t *dflt,
205 unsigned int vcc,
206 void *priv_data) 205 void *priv_data)
207{ 206{
208 struct pcmcia_config_check *stk = priv_data; 207 struct pcmcia_config_check *stk = priv_data;
209 208
210 /* Check for matching Vcc, unless we're desperate */
211 if (!stk->skip_vcc) {
212 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
213 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
214 return -ENODEV;
215 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
216 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
217 return -ENODEV;
218 }
219 }
220
221 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
222 pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
223 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
224 pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
225
226 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 209 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
227 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 210 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
228 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 211 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
@@ -271,10 +254,10 @@ static int ide_config(struct pcmcia_device *link)
271 if (!stk) 254 if (!stk)
272 goto err_mem; 255 goto err_mem;
273 stk->is_kme = is_kme; 256 stk->is_kme = is_kme;
274 stk->skip_vcc = io_base = ctl_base = 0; 257 io_base = ctl_base = 0;
275 258
276 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { 259 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
277 stk->skip_vcc = 1; 260 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
278 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 261 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
279 goto failed; /* No suitable config found */ 262 goto failed; /* No suitable config found */
280 } 263 }