diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:12:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:12:40 -0400 |
commit | 2be4ff2f084842839b041b793ed6237e8d1d315a (patch) | |
tree | 1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/net/wireless/orinoco_cs.c | |
parent | cf2fa66055d718ae13e62451bb546505f63906a2 (diff) | |
parent | a45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits)
pcmcia: ioctl-internal definitions
pcmcia: cistpl header cleanup
pcmcia: remove unused argument to pcmcia_parse_tuple()
pcmcia: card services header cleanup
pcmcia: device_id header cleanup
pcmcia: encapsulate ioaddr_t
pcmcia: cleanup device driver header file
pcmcia: cleanup socket services header file
pcmcia: merge ds_internal.h into cs_internal.h
pcmcia: cleanup cs_internal.h
pcmcia: cs_internal.h is internal
pcmcia: use dev_printk for cs_error()
pcmcia: remove CS_ error codes alltogether
pcmcia: deprecate CS_BAD_TUPLE
pcmcia: deprecate CS_BAD_ARGS
pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE
pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE
pcmcia: deprecate CS_NO_MORE_ITEMS
pcmcia: deprecate CS_IN_USE
pcmcia: deprecate CS_CONFIGURATION_LOCKED
...
Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/net/wireless/orinoco_cs.c')
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 165 |
1 files changed, 70 insertions, 95 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 9eaa252c2430..e585684e59a0 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -80,7 +80,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) | |||
80 | /* We need atomic ops here, because we're not holding the lock */ | 80 | /* We need atomic ops here, because we're not holding the lock */ |
81 | set_bit(0, &card->hard_reset_in_progress); | 81 | set_bit(0, &card->hard_reset_in_progress); |
82 | 82 | ||
83 | err = pcmcia_reset_card(link, NULL); | 83 | err = pcmcia_reset_card(link->socket); |
84 | if (err) | 84 | if (err) |
85 | return err; | 85 | return err; |
86 | 86 | ||
@@ -165,6 +165,70 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
165 | last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ | 165 | last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ |
166 | } while (0) | 166 | } while (0) |
167 | 167 | ||
168 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | ||
169 | cistpl_cftable_entry_t *cfg, | ||
170 | cistpl_cftable_entry_t *dflt, | ||
171 | unsigned int vcc, | ||
172 | void *priv_data) | ||
173 | { | ||
174 | if (cfg->index == 0) | ||
175 | goto next_entry; | ||
176 | |||
177 | /* Use power settings for Vcc and Vpp if present */ | ||
178 | /* Note that the CIS values need to be rescaled */ | ||
179 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
180 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
181 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
182 | if (!ignore_cis_vcc) | ||
183 | goto next_entry; | ||
184 | } | ||
185 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
186 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
187 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
188 | if (!ignore_cis_vcc) | ||
189 | goto next_entry; | ||
190 | } | ||
191 | } | ||
192 | |||
193 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
194 | p_dev->conf.Vpp = | ||
195 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
196 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
197 | p_dev->conf.Vpp = | ||
198 | dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
199 | |||
200 | /* Do we need to allocate an interrupt? */ | ||
201 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
202 | |||
203 | /* IO window settings */ | ||
204 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
205 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
206 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
207 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
208 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
209 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
210 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
211 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
212 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
213 | p_dev->io.BasePort1 = io->win[0].base; | ||
214 | p_dev->io.NumPorts1 = io->win[0].len; | ||
215 | if (io->nwin > 1) { | ||
216 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
217 | p_dev->io.BasePort2 = io->win[1].base; | ||
218 | p_dev->io.NumPorts2 = io->win[1].len; | ||
219 | } | ||
220 | |||
221 | /* This reserves IO space but doesn't actually enable it */ | ||
222 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
223 | goto next_entry; | ||
224 | } | ||
225 | return 0; | ||
226 | |||
227 | next_entry: | ||
228 | pcmcia_disable_device(p_dev); | ||
229 | return -ENODEV; | ||
230 | }; | ||
231 | |||
168 | static int | 232 | static int |
169 | orinoco_cs_config(struct pcmcia_device *link) | 233 | orinoco_cs_config(struct pcmcia_device *link) |
170 | { | 234 | { |
@@ -173,16 +237,8 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
173 | struct orinoco_pccard *card = priv->card; | 237 | struct orinoco_pccard *card = priv->card; |
174 | hermes_t *hw = &priv->hw; | 238 | hermes_t *hw = &priv->hw; |
175 | int last_fn, last_ret; | 239 | int last_fn, last_ret; |
176 | u_char buf[64]; | ||
177 | config_info_t conf; | ||
178 | tuple_t tuple; | ||
179 | cisparse_t parse; | ||
180 | void __iomem *mem; | 240 | void __iomem *mem; |
181 | 241 | ||
182 | /* Look up the current Vcc */ | ||
183 | CS_CHECK(GetConfigurationInfo, | ||
184 | pcmcia_get_configuration_info(link, &conf)); | ||
185 | |||
186 | /* | 242 | /* |
187 | * In this loop, we scan the CIS for configuration table | 243 | * In this loop, we scan the CIS for configuration table |
188 | * entries, each of which describes a valid card | 244 | * entries, each of which describes a valid card |
@@ -197,94 +253,14 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
197 | * and most client drivers will only use the CIS to fill in | 253 | * and most client drivers will only use the CIS to fill in |
198 | * implementation-defined details. | 254 | * implementation-defined details. |
199 | */ | 255 | */ |
200 | tuple.Attributes = 0; | 256 | last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); |
201 | tuple.TupleData = buf; | 257 | if (last_ret) { |
202 | tuple.TupleDataMax = sizeof(buf); | 258 | if (!ignore_cis_vcc) |
203 | tuple.TupleOffset = 0; | ||
204 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
205 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
206 | while (1) { | ||
207 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
208 | cistpl_cftable_entry_t dflt = { .index = 0 }; | ||
209 | |||
210 | if ( (pcmcia_get_tuple_data(link, &tuple) != 0) | ||
211 | || (pcmcia_parse_tuple(link, &tuple, &parse) != 0)) | ||
212 | goto next_entry; | ||
213 | |||
214 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
215 | dflt = *cfg; | ||
216 | if (cfg->index == 0) | ||
217 | goto next_entry; | ||
218 | link->conf.ConfigIndex = cfg->index; | ||
219 | |||
220 | /* Use power settings for Vcc and Vpp if present */ | ||
221 | /* Note that the CIS values need to be rescaled */ | ||
222 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
223 | if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
224 | DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, cfg CIS = %d)\n", conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
225 | if (!ignore_cis_vcc) | ||
226 | goto next_entry; | ||
227 | } | ||
228 | } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
229 | if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
230 | DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, dflt CIS = %d)\n", conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
231 | if(!ignore_cis_vcc) | ||
232 | goto next_entry; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
237 | link->conf.Vpp = | ||
238 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
239 | else if (dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
240 | link->conf.Vpp = | ||
241 | dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
242 | |||
243 | /* Do we need to allocate an interrupt? */ | ||
244 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
245 | |||
246 | /* IO window settings */ | ||
247 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
248 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
249 | cistpl_io_t *io = | ||
250 | (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
251 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
252 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
253 | link->io.Attributes1 = | ||
254 | IO_DATA_PATH_WIDTH_16; | ||
255 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
256 | link->io.Attributes1 = | ||
257 | IO_DATA_PATH_WIDTH_8; | ||
258 | link->io.IOAddrLines = | ||
259 | io->flags & CISTPL_IO_LINES_MASK; | ||
260 | link->io.BasePort1 = io->win[0].base; | ||
261 | link->io.NumPorts1 = io->win[0].len; | ||
262 | if (io->nwin > 1) { | ||
263 | link->io.Attributes2 = | ||
264 | link->io.Attributes1; | ||
265 | link->io.BasePort2 = io->win[1].base; | ||
266 | link->io.NumPorts2 = io->win[1].len; | ||
267 | } | ||
268 | |||
269 | /* This reserves IO space but doesn't actually enable it */ | ||
270 | if (pcmcia_request_io(link, &link->io) != 0) | ||
271 | goto next_entry; | ||
272 | } | ||
273 | |||
274 | |||
275 | /* If we got this far, we're cool! */ | ||
276 | |||
277 | break; | ||
278 | |||
279 | next_entry: | ||
280 | pcmcia_disable_device(link); | ||
281 | last_ret = pcmcia_get_next_tuple(link, &tuple); | ||
282 | if (last_ret == CS_NO_MORE_ITEMS) { | ||
283 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 259 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
284 | "CIS configuration. Maybe you need the " | 260 | "CIS configuration. Maybe you need the " |
285 | "ignore_cis_vcc=1 parameter.\n"); | 261 | "ignore_cis_vcc=1 parameter.\n"); |
286 | goto cs_failed; | 262 | cs_error(link, RequestIO, last_ret); |
287 | } | 263 | goto failed; |
288 | } | 264 | } |
289 | 265 | ||
290 | /* | 266 | /* |
@@ -335,7 +311,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
335 | "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id, | 311 | "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id, |
336 | link->irq.AssignedIRQ, link->io.BasePort1, | 312 | link->irq.AssignedIRQ, link->io.BasePort1, |
337 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 313 | link->io.BasePort1 + link->io.NumPorts1 - 1); |
338 | |||
339 | return 0; | 314 | return 0; |
340 | 315 | ||
341 | cs_failed: | 316 | cs_failed: |