aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 06:23:21 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 03:02:35 -0400
commit1d5cc192d431bce2ebe9fde64054ce903200e179 (patch)
treecdcdfb77712349bf46f0876d420e2be81f901d74 /drivers/net/wireless/hostap
parentac8b422838046ffc26be4874a3cbae0d313f4209 (diff)
pcmcia: use pcmica_{read,write}_config_byte
Use pcmcia_read_config_byte and pcmcia_write_config_byte instead of pcmcia_access_configuration_register. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-serial@vger.kernel.org CC: Michael Buesch <mb@bu3sch.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/hostap')
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c91
1 files changed, 25 insertions, 66 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 2f4b6d4350ab..691293675a93 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -224,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local)
224static void sandisk_set_iobase(local_info_t *local) 224static void sandisk_set_iobase(local_info_t *local)
225{ 225{
226 int res; 226 int res;
227 conf_reg_t reg;
228 struct hostap_cs_priv *hw_priv = local->hw_priv; 227 struct hostap_cs_priv *hw_priv = local->hw_priv;
229 228
230 reg.Function = 0; 229 res = pcmcia_write_config_byte(hw_priv->link, 0x10,
231 reg.Action = CS_WRITE; 230 hw_priv->link->io.BasePort1 & 0x00ff);
232 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
233 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
234 res = pcmcia_access_configuration_register(hw_priv->link,
235 &reg);
236 if (res != 0) { 231 if (res != 0) {
237 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 232 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
238 " res=%d\n", res); 233 " res=%d\n", res);
239 } 234 }
240 udelay(10); 235 udelay(10);
241 236
242 reg.Function = 0; 237 res = pcmcia_write_config_byte(hw_priv->link, 0x12,
243 reg.Action = CS_WRITE; 238 (hw_priv->link->io.BasePort1 >> 8) & 0x00ff);
244 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
245 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
246 res = pcmcia_access_configuration_register(hw_priv->link,
247 &reg);
248 if (res != 0) { 239 if (res != 0) {
249 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 240 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
250 " res=%d\n", res); 241 " res=%d\n", res);
@@ -270,7 +261,6 @@ static void sandisk_write_hcr(local_info_t *local, int hcr)
270static int sandisk_enable_wireless(struct net_device *dev) 261static int sandisk_enable_wireless(struct net_device *dev)
271{ 262{
272 int res, ret = 0; 263 int res, ret = 0;
273 conf_reg_t reg;
274 struct hostap_interface *iface = netdev_priv(dev); 264 struct hostap_interface *iface = netdev_priv(dev);
275 local_info_t *local = iface->local; 265 local_info_t *local = iface->local;
276 struct hostap_cs_priv *hw_priv = local->hw_priv; 266 struct hostap_cs_priv *hw_priv = local->hw_priv;
@@ -297,12 +287,8 @@ static int sandisk_enable_wireless(struct net_device *dev)
297 " - using vendor-specific initialization\n", dev->name); 287 " - using vendor-specific initialization\n", dev->name);
298 hw_priv->sandisk_connectplus = 1; 288 hw_priv->sandisk_connectplus = 1;
299 289
300 reg.Function = 0; 290 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
301 reg.Action = CS_WRITE; 291 COR_SOFT_RESET);
302 reg.Offset = CISREG_COR;
303 reg.Value = COR_SOFT_RESET;
304 res = pcmcia_access_configuration_register(hw_priv->link,
305 &reg);
306 if (res != 0) { 292 if (res != 0) {
307 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 293 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
308 dev->name, res); 294 dev->name, res);
@@ -310,16 +296,13 @@ static int sandisk_enable_wireless(struct net_device *dev)
310 } 296 }
311 mdelay(5); 297 mdelay(5);
312 298
313 reg.Function = 0;
314 reg.Action = CS_WRITE;
315 reg.Offset = CISREG_COR;
316 /* 299 /*
317 * Do not enable interrupts here to avoid some bogus events. Interrupts 300 * Do not enable interrupts here to avoid some bogus events. Interrupts
318 * will be enabled during the first cor_sreset call. 301 * will be enabled during the first cor_sreset call.
319 */ 302 */
320 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 303 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
321 res = pcmcia_access_configuration_register(hw_priv->link, 304 (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE |
322 &reg); 305 COR_FUNC_ENA));
323 if (res != 0) { 306 if (res != 0) {
324 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 307 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
325 dev->name, res); 308 dev->name, res);
@@ -342,30 +325,23 @@ done:
342static void prism2_pccard_cor_sreset(local_info_t *local) 325static void prism2_pccard_cor_sreset(local_info_t *local)
343{ 326{
344 int res; 327 int res;
345 conf_reg_t reg; 328 u8 val;
346 struct hostap_cs_priv *hw_priv = local->hw_priv; 329 struct hostap_cs_priv *hw_priv = local->hw_priv;
347 330
348 if (!prism2_pccard_card_present(local)) 331 if (!prism2_pccard_card_present(local))
349 return; 332 return;
350 333
351 reg.Function = 0; 334 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val);
352 reg.Action = CS_READ;
353 reg.Offset = CISREG_COR;
354 reg.Value = 0;
355 res = pcmcia_access_configuration_register(hw_priv->link,
356 &reg);
357 if (res != 0) { 335 if (res != 0) {
358 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 336 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
359 res); 337 res);
360 return; 338 return;
361 } 339 }
362 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", 340 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
363 reg.Value); 341 val);
364 342
365 reg.Action = CS_WRITE; 343 val |= COR_SOFT_RESET;
366 reg.Value |= COR_SOFT_RESET; 344 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
367 res = pcmcia_access_configuration_register(hw_priv->link,
368 &reg);
369 if (res != 0) { 345 if (res != 0) {
370 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 346 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
371 res); 347 res);
@@ -374,11 +350,10 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
374 350
375 mdelay(hw_priv->sandisk_connectplus ? 5 : 2); 351 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
376 352
377 reg.Value &= ~COR_SOFT_RESET; 353 val &= ~COR_SOFT_RESET;
378 if (hw_priv->sandisk_connectplus) 354 if (hw_priv->sandisk_connectplus)
379 reg.Value |= COR_IREQ_ENA; 355 val |= COR_IREQ_ENA;
380 res = pcmcia_access_configuration_register(hw_priv->link, 356 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
381 &reg);
382 if (res != 0) { 357 if (res != 0) {
383 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 358 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
384 res); 359 res);
@@ -395,8 +370,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
395static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) 370static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
396{ 371{
397 int res; 372 int res;
398 conf_reg_t reg; 373 u8 old_cor;
399 int old_cor;
400 struct hostap_cs_priv *hw_priv = local->hw_priv; 374 struct hostap_cs_priv *hw_priv = local->hw_priv;
401 375
402 if (!prism2_pccard_card_present(local)) 376 if (!prism2_pccard_card_present(local))
@@ -407,25 +381,17 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
407 return; 381 return;
408 } 382 }
409 383
410 reg.Function = 0; 384 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
411 reg.Action = CS_READ;
412 reg.Offset = CISREG_COR;
413 reg.Value = 0;
414 res = pcmcia_access_configuration_register(hw_priv->link,
415 &reg);
416 if (res != 0) { 385 if (res != 0) {
417 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 386 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
418 "(%d)\n", res); 387 "(%d)\n", res);
419 return; 388 return;
420 } 389 }
421 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", 390 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
422 reg.Value); 391 old_cor);
423 old_cor = reg.Value;
424 392
425 reg.Action = CS_WRITE; 393 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
426 reg.Value |= COR_SOFT_RESET; 394 old_cor | COR_SOFT_RESET);
427 res = pcmcia_access_configuration_register(hw_priv->link,
428 &reg);
429 if (res != 0) { 395 if (res != 0) {
430 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 396 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
431 "(%d)\n", res); 397 "(%d)\n", res);
@@ -435,11 +401,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
435 mdelay(10); 401 mdelay(10);
436 402
437 /* Setup Genesis mode */ 403 /* Setup Genesis mode */
438 reg.Action = CS_WRITE; 404 res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
439 reg.Value = hcr;
440 reg.Offset = CISREG_CCSR;
441 res = pcmcia_access_configuration_register(hw_priv->link,
442 &reg);
443 if (res != 0) { 405 if (res != 0) {
444 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 406 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
445 "(%d)\n", res); 407 "(%d)\n", res);
@@ -447,11 +409,8 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
447 } 409 }
448 mdelay(10); 410 mdelay(10);
449 411
450 reg.Action = CS_WRITE; 412 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
451 reg.Offset = CISREG_COR; 413 old_cor & ~COR_SOFT_RESET);
452 reg.Value = old_cor & ~COR_SOFT_RESET;
453 res = pcmcia_access_configuration_register(hw_priv->link,
454 &reg);
455 if (res != 0) { 414 if (res != 0) {
456 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 415 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
457 "(%d)\n", res); 416 "(%d)\n", res);