aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco
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
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')
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c41
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c45
2 files changed, 11 insertions, 75 deletions
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index b92173827b5..263dfe9e0e3 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -142,42 +142,12 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
142 * device available to the system. 142 * device available to the system.
143 */ 143 */
144 144
145static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 145static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
146 cistpl_cftable_entry_t *cfg,
147 cistpl_cftable_entry_t *dflt,
148 void *priv_data)
149{ 146{
150 if (cfg->index == 0) 147 if (p_dev->config_index == 0)
151 goto next_entry; 148 return -EINVAL;
152
153 /* Do we need to allocate an interrupt? */
154 p_dev->config_flags |= CONF_ENABLE_IRQ;
155
156 /* IO window settings */
157 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
158 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
159 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
160 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
161 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
162 p_dev->resource[0]->flags |=
163 pcmcia_io_cfg_data_width(io->flags);
164 p_dev->resource[0]->start = io->win[0].base;
165 p_dev->resource[0]->end = io->win[0].len;
166 if (io->nwin > 1) {
167 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
168 p_dev->resource[1]->start = io->win[1].base;
169 p_dev->resource[1]->end = io->win[1].len;
170 }
171
172 /* This reserves IO space but doesn't actually enable it */
173 if (pcmcia_request_io(p_dev) != 0)
174 goto next_entry;
175 }
176 return 0;
177 149
178next_entry: 150 return pcmcia_request_io(p_dev);
179 pcmcia_disable_device(p_dev);
180 return -ENODEV;
181}; 151};
182 152
183static int 153static int
@@ -202,7 +172,8 @@ orinoco_cs_config(struct pcmcia_device *link)
202 * and most client drivers will only use the CIS to fill in 172 * and most client drivers will only use the CIS to fill in
203 * implementation-defined details. 173 * implementation-defined details.
204 */ 174 */
205 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; 175 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
176 CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
206 if (ignore_cis_vcc) 177 if (ignore_cis_vcc)
207 link->config_flags &= ~CONF_AUTO_CHECK_VCC; 178 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
208 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 179 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index f462c78856e..78446507873 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);