aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/spectrum_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-30 07:13:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:24 -0400
commit00990e7ce0b0e596fe41d9c64d6933ea70084003 (patch)
tree189e0dd92860feba84231c66955749574cac5d6d /drivers/net/wireless/orinoco/spectrum_cs.c
parent440eed43e2a95bb842488755683716814da10f2b (diff)
pcmcia: use autoconfiguration feature for ioports and iomem
When CONF_AUTO_SET_IO or CONF_AUTO_SET_IOMEM are set, the corresponding fields in struct pcmcia_device *p_dev->resource[0,1,2] are set accordinly. Drivers wishing to override certain settings may do so in the callback function, but they no longer need to parse the CIS entries stored in cistpl_cftable_entry_t themselves. 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: linux-bluetooth@vger.kernel.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 Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/orinoco/spectrum_cs.c')
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index f462c78856e9..78446507873f 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -205,48 +205,12 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
205 */ 205 */
206 206
207static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 207static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
208 cistpl_cftable_entry_t *cfg,
209 cistpl_cftable_entry_t *dflt,
210 void *priv_data) 208 void *priv_data)
211{ 209{
212 if (cfg->index == 0) 210 if (p_dev->config_index == 0)
213 goto next_entry; 211 return -EINVAL;
214
215 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
216 p_dev->vpp =
217 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
218 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
219 p_dev->vpp =
220 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
221
222 /* Do we need to allocate an interrupt? */
223 p_dev->config_flags |= CONF_ENABLE_IRQ;
224
225 /* IO window settings */
226 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
227 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
228 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
229 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
230 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
231 p_dev->resource[0]->flags |=
232 pcmcia_io_cfg_data_width(io->flags);
233 p_dev->resource[0]->start = io->win[0].base;
234 p_dev->resource[0]->end = io->win[0].len;
235 if (io->nwin > 1) {
236 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
237 p_dev->resource[1]->start = io->win[1].base;
238 p_dev->resource[1]->end = io->win[1].len;
239 }
240
241 /* This reserves IO space but doesn't actually enable it */
242 if (pcmcia_request_io(p_dev) != 0)
243 goto next_entry;
244 }
245 return 0;
246 212
247next_entry: 213 return pcmcia_request_io(p_dev);
248 pcmcia_disable_device(p_dev);
249 return -ENODEV;
250}; 214};
251 215
252static int 216static int
@@ -271,7 +235,8 @@ spectrum_cs_config(struct pcmcia_device *link)
271 * and most client drivers will only use the CIS to fill in 235 * and most client drivers will only use the CIS to fill in
272 * implementation-defined details. 236 * implementation-defined details.
273 */ 237 */
274 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; 238 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
239 CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
275 if (ignore_cis_vcc) 240 if (ignore_cis_vcc)
276 link->config_flags &= ~CONF_AUTO_CHECK_VCC; 241 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
277 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 242 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);