aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_pcmcia.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 76da55d27e08..954f43c512f1 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -169,34 +169,16 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
169 169
170struct pcmcia_config_check { 170struct pcmcia_config_check {
171 unsigned long ctl_base; 171 unsigned long ctl_base;
172 int skip_vcc;
173 int is_kme; 172 int is_kme;
174}; 173};
175 174
176static int pcmcia_check_one_config(struct pcmcia_device *pdev, 175static int pcmcia_check_one_config(struct pcmcia_device *pdev,
177 cistpl_cftable_entry_t *cfg, 176 cistpl_cftable_entry_t *cfg,
178 cistpl_cftable_entry_t *dflt, 177 cistpl_cftable_entry_t *dflt,
179 unsigned int vcc,
180 void *priv_data) 178 void *priv_data)
181{ 179{
182 struct pcmcia_config_check *stk = priv_data; 180 struct pcmcia_config_check *stk = priv_data;
183 181
184 /* Check for matching Vcc, unless we're desperate */
185 if (!stk->skip_vcc) {
186 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
187 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
188 return -ENODEV;
189 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
190 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
191 return -ENODEV;
192 }
193 }
194
195 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
196 pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
197 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
198 pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
199
200 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 182 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
201 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 183 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
202 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 184 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
@@ -249,6 +231,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
249 pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 231 pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
250 pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 232 pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
251 pdev->config_flags |= CONF_ENABLE_IRQ; 233 pdev->config_flags |= CONF_ENABLE_IRQ;
234 pdev->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
252 235
253 /* See if we have a manufacturer identifier. Use it to set is_kme for 236 /* See if we have a manufacturer identifier. Use it to set is_kme for
254 vendor quirks */ 237 vendor quirks */
@@ -262,10 +245,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
262 if (!stk) 245 if (!stk)
263 goto out1; 246 goto out1;
264 stk->is_kme = is_kme; 247 stk->is_kme = is_kme;
265 stk->skip_vcc = io_base = ctl_base = 0; 248 io_base = ctl_base = 0;
266 249
267 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { 250 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
268 stk->skip_vcc = 1; 251 pdev->config_flags &= ~CONF_AUTO_CHECK_VCC;
269 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) 252 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
270 goto failed; /* No suitable config found */ 253 goto failed; /* No suitable config found */
271 } 254 }