aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTeemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>2010-02-18 06:25:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-02-19 15:52:47 -0500
commit7b048c52d7283ebf07c826a45c631a6ba225c057 (patch)
tree913db3eb56919bca79b60070720735b2e2a3289a /drivers
parent521a5b2137cc15430e3b1ea4c148663d1dbe077f (diff)
wl1271: Renamed IO functions
In preparation for integration of SDIO implementation renamed some IO functions from wl1271_spi_* form to wl1271_*. Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com> Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_boot.c70
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c15
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_event.c9
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_io.c24
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_io.h29
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c12
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_ps.c1
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_rx.c11
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_spi.h30
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_tx.c17
10 files changed, 109 insertions, 109 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index fb3090c3ed15..2be76ee42bb9 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -27,6 +27,7 @@
27#include "wl1271_reg.h" 27#include "wl1271_reg.h"
28#include "wl1271_boot.h" 28#include "wl1271_boot.h"
29#include "wl1271_spi.h" 29#include "wl1271_spi.h"
30#include "wl1271_io.h"
30#include "wl1271_event.h" 31#include "wl1271_event.h"
31 32
32static struct wl1271_partition_set part_table[PART_TABLE_LEN] = { 33static struct wl1271_partition_set part_table[PART_TABLE_LEN] = {
@@ -93,19 +94,19 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
93 u32 cpu_ctrl; 94 u32 cpu_ctrl;
94 95
95 /* 10.5.0 run the firmware (I) */ 96 /* 10.5.0 run the firmware (I) */
96 cpu_ctrl = wl1271_spi_read32(wl, ACX_REG_ECPU_CONTROL); 97 cpu_ctrl = wl1271_read32(wl, ACX_REG_ECPU_CONTROL);
97 98
98 /* 10.5.1 run the firmware (II) */ 99 /* 10.5.1 run the firmware (II) */
99 cpu_ctrl |= flag; 100 cpu_ctrl |= flag;
100 wl1271_spi_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); 101 wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl);
101} 102}
102 103
103static void wl1271_boot_fw_version(struct wl1271 *wl) 104static void wl1271_boot_fw_version(struct wl1271 *wl)
104{ 105{
105 struct wl1271_static_data static_data; 106 struct wl1271_static_data static_data;
106 107
107 wl1271_spi_read(wl, wl->cmd_box_addr, 108 wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data),
108 &static_data, sizeof(static_data), false); 109 false);
109 110
110 strncpy(wl->chip.fw_ver, static_data.fw_version, 111 strncpy(wl->chip.fw_ver, static_data.fw_version,
111 sizeof(wl->chip.fw_ver)); 112 sizeof(wl->chip.fw_ver));
@@ -164,7 +165,7 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
164 memcpy(chunk, p, CHUNK_SIZE); 165 memcpy(chunk, p, CHUNK_SIZE);
165 wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", 166 wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x",
166 p, addr); 167 p, addr);
167 wl1271_spi_write(wl, addr, chunk, CHUNK_SIZE, false); 168 wl1271_write(wl, addr, chunk, CHUNK_SIZE, false);
168 169
169 chunk_num++; 170 chunk_num++;
170 } 171 }
@@ -175,7 +176,7 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
175 memcpy(chunk, p, fw_data_len % CHUNK_SIZE); 176 memcpy(chunk, p, fw_data_len % CHUNK_SIZE);
176 wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", 177 wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x",
177 fw_data_len % CHUNK_SIZE, p, addr); 178 fw_data_len % CHUNK_SIZE, p, addr);
178 wl1271_spi_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); 179 wl1271_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false);
179 180
180 kfree(chunk); 181 kfree(chunk);
181 return 0; 182 return 0;
@@ -256,7 +257,7 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
256 wl1271_debug(DEBUG_BOOT, 257 wl1271_debug(DEBUG_BOOT,
257 "nvs burst write 0x%x: 0x%x", 258 "nvs burst write 0x%x: 0x%x",
258 dest_addr, val); 259 dest_addr, val);
259 wl1271_spi_write32(wl, dest_addr, val); 260 wl1271_write32(wl, dest_addr, val);
260 261
261 nvs_ptr += 4; 262 nvs_ptr += 4;
262 dest_addr += 4; 263 dest_addr += 4;
@@ -290,7 +291,7 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
290 /* FIXME: In wl1271, we upload everything at once. 291 /* FIXME: In wl1271, we upload everything at once.
291 No endianness handling needed here?! The ref driver doesn't do 292 No endianness handling needed here?! The ref driver doesn't do
292 anything about it at this point */ 293 anything about it at this point */
293 wl1271_spi_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false); 294 wl1271_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false);
294 295
295 kfree(nvs_aligned); 296 kfree(nvs_aligned);
296 return 0; 297 return 0;
@@ -299,9 +300,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
299static void wl1271_boot_enable_interrupts(struct wl1271 *wl) 300static void wl1271_boot_enable_interrupts(struct wl1271 *wl)
300{ 301{
301 enable_irq(wl->irq); 302 enable_irq(wl->irq);
302 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, 303 wl1271_write32(wl, ACX_REG_INTERRUPT_MASK,
303 WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); 304 WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK));
304 wl1271_spi_write32(wl, HI_CFG, HI_CFG_DEF_VAL); 305 wl1271_write32(wl, HI_CFG, HI_CFG_DEF_VAL);
305} 306}
306 307
307static int wl1271_boot_soft_reset(struct wl1271 *wl) 308static int wl1271_boot_soft_reset(struct wl1271 *wl)
@@ -310,13 +311,12 @@ static int wl1271_boot_soft_reset(struct wl1271 *wl)
310 u32 boot_data; 311 u32 boot_data;
311 312
312 /* perform soft reset */ 313 /* perform soft reset */
313 wl1271_spi_write32(wl, ACX_REG_SLV_SOFT_RESET, 314 wl1271_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT);
314 ACX_SLV_SOFT_RESET_BIT);
315 315
316 /* SOFT_RESET is self clearing */ 316 /* SOFT_RESET is self clearing */
317 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); 317 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME);
318 while (1) { 318 while (1) {
319 boot_data = wl1271_spi_read32(wl, ACX_REG_SLV_SOFT_RESET); 319 boot_data = wl1271_read32(wl, ACX_REG_SLV_SOFT_RESET);
320 wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); 320 wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data);
321 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) 321 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0)
322 break; 322 break;
@@ -332,10 +332,10 @@ static int wl1271_boot_soft_reset(struct wl1271 *wl)
332 } 332 }
333 333
334 /* disable Rx/Tx */ 334 /* disable Rx/Tx */
335 wl1271_spi_write32(wl, ENABLE, 0x0); 335 wl1271_write32(wl, ENABLE, 0x0);
336 336
337 /* disable auto calibration on start*/ 337 /* disable auto calibration on start*/
338 wl1271_spi_write32(wl, SPARE_A2, 0xffff); 338 wl1271_write32(wl, SPARE_A2, 0xffff);
339 339
340 return 0; 340 return 0;
341} 341}
@@ -347,7 +347,7 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
347 347
348 wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); 348 wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT);
349 349
350 chip_id = wl1271_spi_read32(wl, CHIP_ID_B); 350 chip_id = wl1271_read32(wl, CHIP_ID_B);
351 351
352 wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); 352 wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id);
353 353
@@ -360,8 +360,7 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
360 loop = 0; 360 loop = 0;
361 while (loop++ < INIT_LOOP) { 361 while (loop++ < INIT_LOOP) {
362 udelay(INIT_LOOP_DELAY); 362 udelay(INIT_LOOP_DELAY);
363 interrupt = wl1271_spi_read32(wl, 363 interrupt = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
364 ACX_REG_INTERRUPT_NO_CLEAR);
365 364
366 if (interrupt == 0xffffffff) { 365 if (interrupt == 0xffffffff) {
367 wl1271_error("error reading hardware complete " 366 wl1271_error("error reading hardware complete "
@@ -370,8 +369,8 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
370 } 369 }
371 /* check that ACX_INTR_INIT_COMPLETE is enabled */ 370 /* check that ACX_INTR_INIT_COMPLETE is enabled */
372 else if (interrupt & WL1271_ACX_INTR_INIT_COMPLETE) { 371 else if (interrupt & WL1271_ACX_INTR_INIT_COMPLETE) {
373 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_ACK, 372 wl1271_write32(wl, ACX_REG_INTERRUPT_ACK,
374 WL1271_ACX_INTR_INIT_COMPLETE); 373 WL1271_ACX_INTR_INIT_COMPLETE);
375 break; 374 break;
376 } 375 }
377 } 376 }
@@ -383,10 +382,10 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
383 } 382 }
384 383
385 /* get hardware config command mail box */ 384 /* get hardware config command mail box */
386 wl->cmd_box_addr = wl1271_spi_read32(wl, REG_COMMAND_MAILBOX_PTR); 385 wl->cmd_box_addr = wl1271_read32(wl, REG_COMMAND_MAILBOX_PTR);
387 386
388 /* get hardware config event mail box */ 387 /* get hardware config event mail box */
389 wl->event_box_addr = wl1271_spi_read32(wl, REG_EVENT_MAILBOX_PTR); 388 wl->event_box_addr = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR);
390 389
391 /* set the working partition to its "running" mode offset */ 390 /* set the working partition to its "running" mode offset */
392 wl1271_set_partition(wl, &part_table[PART_WORK]); 391 wl1271_set_partition(wl, &part_table[PART_WORK]);
@@ -459,9 +458,9 @@ int wl1271_boot(struct wl1271 *wl)
459 wl1271_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); 458 wl1271_top_reg_write(wl, OCP_REG_CLK_POLARITY, val);
460 } 459 }
461 460
462 wl1271_spi_write32(wl, PLL_PARAMETERS, clk); 461 wl1271_write32(wl, PLL_PARAMETERS, clk);
463 462
464 pause = wl1271_spi_read32(wl, PLL_PARAMETERS); 463 pause = wl1271_read32(wl, PLL_PARAMETERS);
465 464
466 wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); 465 wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause);
467 466
@@ -470,10 +469,10 @@ int wl1271_boot(struct wl1271 *wl)
470 * 0x3ff (magic number ). How does 469 * 0x3ff (magic number ). How does
471 * this work?! */ 470 * this work?! */
472 pause |= WU_COUNTER_PAUSE_VAL; 471 pause |= WU_COUNTER_PAUSE_VAL;
473 wl1271_spi_write32(wl, WU_COUNTER_PAUSE, pause); 472 wl1271_write32(wl, WU_COUNTER_PAUSE, pause);
474 473
475 /* Continue the ELP wake up sequence */ 474 /* Continue the ELP wake up sequence */
476 wl1271_spi_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); 475 wl1271_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
477 udelay(500); 476 udelay(500);
478 477
479 wl1271_set_partition(wl, &part_table[PART_DRPW]); 478 wl1271_set_partition(wl, &part_table[PART_DRPW]);
@@ -483,18 +482,18 @@ int wl1271_boot(struct wl1271 *wl)
483 before taking DRPw out of reset */ 482 before taking DRPw out of reset */
484 483
485 wl1271_debug(DEBUG_BOOT, "DRPW_SCRATCH_START %08x", DRPW_SCRATCH_START); 484 wl1271_debug(DEBUG_BOOT, "DRPW_SCRATCH_START %08x", DRPW_SCRATCH_START);
486 clk = wl1271_spi_read32(wl, DRPW_SCRATCH_START); 485 clk = wl1271_read32(wl, DRPW_SCRATCH_START);
487 486
488 wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); 487 wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk);
489 488
490 /* 2 */ 489 /* 2 */
491 clk |= (REF_CLOCK << 1) << 4; 490 clk |= (REF_CLOCK << 1) << 4;
492 wl1271_spi_write32(wl, DRPW_SCRATCH_START, clk); 491 wl1271_write32(wl, DRPW_SCRATCH_START, clk);
493 492
494 wl1271_set_partition(wl, &part_table[PART_WORK]); 493 wl1271_set_partition(wl, &part_table[PART_WORK]);
495 494
496 /* Disable interrupts */ 495 /* Disable interrupts */
497 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 496 wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
498 497
499 ret = wl1271_boot_soft_reset(wl); 498 ret = wl1271_boot_soft_reset(wl);
500 if (ret < 0) 499 if (ret < 0)
@@ -509,23 +508,22 @@ int wl1271_boot(struct wl1271 *wl)
509 * ACX_EEPROMLESS_IND_REG */ 508 * ACX_EEPROMLESS_IND_REG */
510 wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); 509 wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG");
511 510
512 wl1271_spi_write32(wl, ACX_EEPROMLESS_IND_REG, 511 wl1271_write32(wl, ACX_EEPROMLESS_IND_REG, ACX_EEPROMLESS_IND_REG);
513 ACX_EEPROMLESS_IND_REG);
514 512
515 tmp = wl1271_spi_read32(wl, CHIP_ID_B); 513 tmp = wl1271_read32(wl, CHIP_ID_B);
516 514
517 wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); 515 wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp);
518 516
519 /* 6. read the EEPROM parameters */ 517 /* 6. read the EEPROM parameters */
520 tmp = wl1271_spi_read32(wl, SCR_PAD2); 518 tmp = wl1271_read32(wl, SCR_PAD2);
521 519
522 ret = wl1271_boot_write_irq_polarity(wl); 520 ret = wl1271_boot_write_irq_polarity(wl);
523 if (ret < 0) 521 if (ret < 0)
524 goto out; 522 goto out;
525 523
526 /* FIXME: Need to check whether this is really what we want */ 524 /* FIXME: Need to check whether this is really what we want */
527 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, 525 wl1271_write32(wl, ACX_REG_INTERRUPT_MASK,
528 WL1271_ACX_ALL_EVENTS_VECTOR); 526 WL1271_ACX_ALL_EVENTS_VECTOR);
529 527
530 /* WL1271: The reference driver skips steps 7 to 10 (jumps directly 528 /* WL1271: The reference driver skips steps 7 to 10 (jumps directly
531 * to upload_fw) */ 529 * to upload_fw) */
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 54b5124fc0c0..36a64e06f290 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -30,6 +30,7 @@
30#include "wl1271.h" 30#include "wl1271.h"
31#include "wl1271_reg.h" 31#include "wl1271_reg.h"
32#include "wl1271_spi.h" 32#include "wl1271_spi.h"
33#include "wl1271_io.h"
33#include "wl1271_acx.h" 34#include "wl1271_acx.h"
34#include "wl12xx_80211.h" 35#include "wl12xx_80211.h"
35#include "wl1271_cmd.h" 36#include "wl1271_cmd.h"
@@ -57,13 +58,13 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
57 58
58 WARN_ON(len % 4 != 0); 59 WARN_ON(len % 4 != 0);
59 60
60 wl1271_spi_write(wl, wl->cmd_box_addr, buf, len, false); 61 wl1271_write(wl, wl->cmd_box_addr, buf, len, false);
61 62
62 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); 63 wl1271_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
63 64
64 timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); 65 timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT);
65 66
66 intr = wl1271_spi_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 67 intr = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
67 while (!(intr & WL1271_ACX_INTR_CMD_COMPLETE)) { 68 while (!(intr & WL1271_ACX_INTR_CMD_COMPLETE)) {
68 if (time_after(jiffies, timeout)) { 69 if (time_after(jiffies, timeout)) {
69 wl1271_error("command complete timeout"); 70 wl1271_error("command complete timeout");
@@ -73,13 +74,13 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
73 74
74 msleep(1); 75 msleep(1);
75 76
76 intr = wl1271_spi_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 77 intr = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
77 } 78 }
78 79
79 /* read back the status code of the command */ 80 /* read back the status code of the command */
80 if (res_len == 0) 81 if (res_len == 0)
81 res_len = sizeof(struct wl1271_cmd_header); 82 res_len = sizeof(struct wl1271_cmd_header);
82 wl1271_spi_read(wl, wl->cmd_box_addr, cmd, res_len, false); 83 wl1271_read(wl, wl->cmd_box_addr, cmd, res_len, false);
83 84
84 status = le16_to_cpu(cmd->status); 85 status = le16_to_cpu(cmd->status);
85 if (status != CMD_STATUS_SUCCESS) { 86 if (status != CMD_STATUS_SUCCESS) {
@@ -87,8 +88,8 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
87 ret = -EIO; 88 ret = -EIO;
88 } 89 }
89 90
90 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_ACK, 91 wl1271_write32(wl, ACX_REG_INTERRUPT_ACK,
91 WL1271_ACX_INTR_CMD_COMPLETE); 92 WL1271_ACX_INTR_CMD_COMPLETE);
92 93
93out: 94out:
94 return ret; 95 return ret;
diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c
index 2803e700a75a..7468ef10194b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_event.c
+++ b/drivers/net/wireless/wl12xx/wl1271_event.c
@@ -24,6 +24,7 @@
24#include "wl1271.h" 24#include "wl1271.h"
25#include "wl1271_reg.h" 25#include "wl1271_reg.h"
26#include "wl1271_spi.h" 26#include "wl1271_spi.h"
27#include "wl1271_io.h"
27#include "wl1271_event.h" 28#include "wl1271_event.h"
28#include "wl1271_ps.h" 29#include "wl1271_ps.h"
29#include "wl12xx_80211.h" 30#include "wl12xx_80211.h"
@@ -214,7 +215,7 @@ int wl1271_event_unmask(struct wl1271 *wl)
214 215
215void wl1271_event_mbox_config(struct wl1271 *wl) 216void wl1271_event_mbox_config(struct wl1271 *wl)
216{ 217{
217 wl->mbox_ptr[0] = wl1271_spi_read32(wl, REG_EVENT_MAILBOX_PTR); 218 wl->mbox_ptr[0] = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR);
218 wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); 219 wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox);
219 220
220 wl1271_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x", 221 wl1271_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x",
@@ -232,8 +233,8 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num)
232 return -EINVAL; 233 return -EINVAL;
233 234
234 /* first we read the mbox descriptor */ 235 /* first we read the mbox descriptor */
235 wl1271_spi_read(wl, wl->mbox_ptr[mbox_num], &mbox, 236 wl1271_read(wl, wl->mbox_ptr[mbox_num], &mbox,
236 sizeof(struct event_mailbox), false); 237 sizeof(struct event_mailbox), false);
237 238
238 /* process the descriptor */ 239 /* process the descriptor */
239 ret = wl1271_event_process(wl, &mbox); 240 ret = wl1271_event_process(wl, &mbox);
@@ -241,7 +242,7 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num)
241 return ret; 242 return ret;
242 243
243 /* then we let the firmware know it can go on...*/ 244 /* then we let the firmware know it can go on...*/
244 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); 245 wl1271_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK);
245 246
246 return 0; 247 return 0;
247} 248}
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.c b/drivers/net/wireless/wl12xx/wl1271_io.c
index dcb588b4670d..00f98bdc48f7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.c
+++ b/drivers/net/wireless/wl12xx/wl1271_io.c
@@ -124,10 +124,10 @@ void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf,
124void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, 124void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf,
125 size_t len, bool fixed) 125 size_t len, bool fixed)
126{ 126{
127 wl1271_spi_read(wl, addr, buf, len, fixed); 127 wl1271_spi_raw_read(wl, addr, buf, len, fixed);
128} 128}
129 129
130void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, size_t len, 130void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len,
131 bool fixed) 131 bool fixed)
132{ 132{
133 int physical; 133 int physical;
@@ -137,8 +137,8 @@ void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, size_t len,
137 wl1271_spi_raw_read(wl, physical, buf, len, fixed); 137 wl1271_spi_raw_read(wl, physical, buf, len, fixed);
138} 138}
139 139
140void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, size_t len, 140void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len,
141 bool fixed) 141 bool fixed)
142{ 142{
143 int physical; 143 int physical;
144 144
@@ -147,12 +147,12 @@ void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, size_t len,
147 wl1271_spi_raw_write(wl, physical, buf, len, fixed); 147 wl1271_spi_raw_write(wl, physical, buf, len, fixed);
148} 148}
149 149
150u32 wl1271_spi_read32(struct wl1271 *wl, int addr) 150u32 wl1271_read32(struct wl1271 *wl, int addr)
151{ 151{
152 return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr)); 152 return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr));
153} 153}
154 154
155void wl1271_spi_write32(struct wl1271 *wl, int addr, u32 val) 155void wl1271_write32(struct wl1271 *wl, int addr, u32 val)
156{ 156{
157 wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val); 157 wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val);
158} 158}
@@ -161,13 +161,13 @@ void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val)
161{ 161{
162 /* write address >> 1 + 0x30000 to OCP_POR_CTR */ 162 /* write address >> 1 + 0x30000 to OCP_POR_CTR */
163 addr = (addr >> 1) + 0x30000; 163 addr = (addr >> 1) + 0x30000;
164 wl1271_spi_write32(wl, OCP_POR_CTR, addr); 164 wl1271_write32(wl, OCP_POR_CTR, addr);
165 165
166 /* write value to OCP_POR_WDATA */ 166 /* write value to OCP_POR_WDATA */
167 wl1271_spi_write32(wl, OCP_DATA_WRITE, val); 167 wl1271_write32(wl, OCP_DATA_WRITE, val);
168 168
169 /* write 1 to OCP_CMD */ 169 /* write 1 to OCP_CMD */
170 wl1271_spi_write32(wl, OCP_CMD, OCP_CMD_WRITE); 170 wl1271_write32(wl, OCP_CMD, OCP_CMD_WRITE);
171} 171}
172 172
173u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) 173u16 wl1271_top_reg_read(struct wl1271 *wl, int addr)
@@ -177,14 +177,14 @@ u16 wl1271_top_reg_read(struct wl1271 *wl, int addr)
177 177
178 /* write address >> 1 + 0x30000 to OCP_POR_CTR */ 178 /* write address >> 1 + 0x30000 to OCP_POR_CTR */
179 addr = (addr >> 1) + 0x30000; 179 addr = (addr >> 1) + 0x30000;
180 wl1271_spi_write32(wl, OCP_POR_CTR, addr); 180 wl1271_write32(wl, OCP_POR_CTR, addr);
181 181
182 /* write 2 to OCP_CMD */ 182 /* write 2 to OCP_CMD */
183 wl1271_spi_write32(wl, OCP_CMD, OCP_CMD_READ); 183 wl1271_write32(wl, OCP_CMD, OCP_CMD_READ);
184 184
185 /* poll for data ready */ 185 /* poll for data ready */
186 do { 186 do {
187 val = wl1271_spi_read32(wl, OCP_DATA_READ); 187 val = wl1271_read32(wl, OCP_DATA_READ);
188 } while (!(val & OCP_READY_MASK) && --timeout); 188 } while (!(val & OCP_READY_MASK) && --timeout);
189 189
190 if (!timeout) { 190 if (!timeout) {
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
index 2dc6abbe4dd5..859d571dc413 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.h
+++ b/drivers/net/wireless/wl12xx/wl1271_io.h
@@ -34,4 +34,33 @@ void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf,
34void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, 34void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf,
35 size_t len, bool fixed); 35 size_t len, bool fixed);
36 36
37/* Translated target IO */
38void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len,
39 bool fixed);
40void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len,
41 bool fixed);
42u32 wl1271_read32(struct wl1271 *wl, int addr);
43void wl1271_write32(struct wl1271 *wl, int addr, u32 val);
44
45/* Top Register IO */
46void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val);
47u16 wl1271_top_reg_read(struct wl1271 *wl, int addr);
48
49int wl1271_set_partition(struct wl1271 *wl,
50 struct wl1271_partition_set *p);
51
52static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr)
53{
54 wl1271_raw_read(wl, addr, &wl->buffer_32,
55 sizeof(wl->buffer_32), false);
56
57 return wl->buffer_32;
58}
59
60static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
61{
62 wl->buffer_32 = val;
63 wl1271_raw_write(wl, addr, &wl->buffer_32,
64 sizeof(wl->buffer_32), false);
65}
37#endif 66#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index aa8f79c4c98a..46968958aeff 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -38,6 +38,7 @@
38#include "wl12xx_80211.h" 38#include "wl12xx_80211.h"
39#include "wl1271_reg.h" 39#include "wl1271_reg.h"
40#include "wl1271_spi.h" 40#include "wl1271_spi.h"
41#include "wl1271_io.h"
41#include "wl1271_event.h" 42#include "wl1271_event.h"
42#include "wl1271_tx.h" 43#include "wl1271_tx.h"
43#include "wl1271_rx.h" 44#include "wl1271_rx.h"
@@ -386,8 +387,7 @@ static void wl1271_fw_status(struct wl1271 *wl,
386 u32 total = 0; 387 u32 total = 0;
387 int i; 388 int i;
388 389
389 wl1271_spi_read(wl, FW_STATUS_ADDR, status, 390 wl1271_read(wl, FW_STATUS_ADDR, status, sizeof(*status), false);
390 sizeof(*status), false);
391 391
392 wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " 392 wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, "
393 "drv_rx_counter = %d, tx_results_counter = %d)", 393 "drv_rx_counter = %d, tx_results_counter = %d)",
@@ -434,7 +434,7 @@ static void wl1271_irq_work(struct work_struct *work)
434 if (ret < 0) 434 if (ret < 0)
435 goto out; 435 goto out;
436 436
437 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 437 wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
438 438
439 wl1271_fw_status(wl, wl->fw_status); 439 wl1271_fw_status(wl, wl->fw_status);
440 intr = le32_to_cpu(wl->fw_status->intr); 440 intr = le32_to_cpu(wl->fw_status->intr);
@@ -476,8 +476,8 @@ static void wl1271_irq_work(struct work_struct *work)
476 } 476 }
477 477
478out_sleep: 478out_sleep:
479 wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, 479 wl1271_write32(wl, ACX_REG_INTERRUPT_MASK,
480 WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); 480 WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK));
481 wl1271_ps_elp_sleep(wl); 481 wl1271_ps_elp_sleep(wl);
482 482
483out: 483out:
@@ -664,7 +664,7 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
664 /* whal_FwCtrl_BootSm() */ 664 /* whal_FwCtrl_BootSm() */
665 665
666 /* 0. read chip id from CHIP_ID */ 666 /* 0. read chip id from CHIP_ID */
667 wl->chip.id = wl1271_spi_read32(wl, CHIP_ID_B); 667 wl->chip.id = wl1271_read32(wl, CHIP_ID_B);
668 668
669 /* 1. check if chip id is valid */ 669 /* 1. check if chip id is valid */
670 670
diff --git a/drivers/net/wireless/wl12xx/wl1271_ps.c b/drivers/net/wireless/wl12xx/wl1271_ps.c
index 29f670099d94..e2b1ebf096e8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_ps.c
+++ b/drivers/net/wireless/wl12xx/wl1271_ps.c
@@ -24,6 +24,7 @@
24#include "wl1271_reg.h" 24#include "wl1271_reg.h"
25#include "wl1271_ps.h" 25#include "wl1271_ps.h"
26#include "wl1271_spi.h" 26#include "wl1271_spi.h"
27#include "wl1271_io.h"
27 28
28#define WL1271_WAKEUP_TIMEOUT 500 29#define WL1271_WAKEUP_TIMEOUT 500
29 30
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index e8eee883848f..6730f5b96e76 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -26,6 +26,7 @@
26#include "wl1271_reg.h" 26#include "wl1271_reg.h"
27#include "wl1271_rx.h" 27#include "wl1271_rx.h"
28#include "wl1271_spi.h" 28#include "wl1271_spi.h"
29#include "wl1271_io.h"
29 30
30static u8 wl1271_rx_get_mem_block(struct wl1271_fw_status *status, 31static u8 wl1271_rx_get_mem_block(struct wl1271_fw_status *status,
31 u32 drv_rx_counter) 32 u32 drv_rx_counter)
@@ -166,7 +167,7 @@ static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length)
166 } 167 }
167 168
168 buf = skb_put(skb, length); 169 buf = skb_put(skb, length);
169 wl1271_spi_read(wl, WL1271_SLV_MEM_DATA, buf, length, true); 170 wl1271_read(wl, WL1271_SLV_MEM_DATA, buf, length, true);
170 171
171 /* the data read starts with the descriptor */ 172 /* the data read starts with the descriptor */
172 desc = (struct wl1271_rx_descriptor *) buf; 173 desc = (struct wl1271_rx_descriptor *) buf;
@@ -210,15 +211,13 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status)
210 wl->rx_mem_pool_addr.addr + 4; 211 wl->rx_mem_pool_addr.addr + 4;
211 212
212 /* Choose the block we want to read */ 213 /* Choose the block we want to read */
213 wl1271_spi_write(wl, WL1271_SLV_REG_DATA, 214 wl1271_write(wl, WL1271_SLV_REG_DATA, &wl->rx_mem_pool_addr,
214 &wl->rx_mem_pool_addr, 215 sizeof(wl->rx_mem_pool_addr), false);
215 sizeof(wl->rx_mem_pool_addr), false);
216 216
217 wl1271_rx_handle_data(wl, buf_size); 217 wl1271_rx_handle_data(wl, buf_size);
218 218
219 wl->rx_counter++; 219 wl->rx_counter++;
220 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; 220 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK;
221 wl1271_spi_write32(wl, RX_DRIVER_COUNTER_ADDRESS, 221 wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter);
222 wl->rx_counter);
223 } 222 }
224} 223}
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.h b/drivers/net/wireless/wl12xx/wl1271_spi.h
index cb7df1c56314..a803596dad4a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.h
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.h
@@ -90,37 +90,7 @@ void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
90void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, 90void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
91 size_t len, bool fixed); 91 size_t len, bool fixed);
92 92
93/* Translated target IO */
94void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, size_t len,
95 bool fixed);
96void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, size_t len,
97 bool fixed);
98u32 wl1271_spi_read32(struct wl1271 *wl, int addr);
99void wl1271_spi_write32(struct wl1271 *wl, int addr, u32 val);
100
101/* Top Register IO */
102void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val);
103u16 wl1271_top_reg_read(struct wl1271 *wl, int addr);
104
105/* INIT and RESET words */ 93/* INIT and RESET words */
106void wl1271_spi_reset(struct wl1271 *wl); 94void wl1271_spi_reset(struct wl1271 *wl);
107void wl1271_spi_init(struct wl1271 *wl); 95void wl1271_spi_init(struct wl1271 *wl);
108int wl1271_set_partition(struct wl1271 *wl,
109 struct wl1271_partition_set *p);
110
111static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr)
112{
113 wl1271_spi_raw_read(wl, addr, &wl->buffer_32,
114 sizeof(wl->buffer_32), false);
115
116 return wl->buffer_32;
117}
118
119static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
120{
121 wl->buffer_32 = val;
122 wl1271_spi_raw_write(wl, addr, &wl->buffer_32,
123 sizeof(wl->buffer_32), false);
124}
125
126#endif /* __WL1271_SPI_H__ */ 96#endif /* __WL1271_SPI_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index f9e06385d9fe..811e739d05bf 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -26,6 +26,7 @@
26 26
27#include "wl1271.h" 27#include "wl1271.h"
28#include "wl1271_spi.h" 28#include "wl1271_spi.h"
29#include "wl1271_io.h"
29#include "wl1271_reg.h" 30#include "wl1271_reg.h"
30#include "wl1271_ps.h" 31#include "wl1271_ps.h"
31#include "wl1271_tx.h" 32#include "wl1271_tx.h"
@@ -165,11 +166,11 @@ static int wl1271_tx_send_packet(struct wl1271 *wl, struct sk_buff *skb,
165 len = WL1271_TX_ALIGN(skb->len); 166 len = WL1271_TX_ALIGN(skb->len);
166 167
167 /* perform a fixed address block write with the packet */ 168 /* perform a fixed address block write with the packet */
168 wl1271_spi_write(wl, WL1271_SLV_MEM_DATA, skb->data, len, true); 169 wl1271_write(wl, WL1271_SLV_MEM_DATA, skb->data, len, true);
169 170
170 /* write packet new counter into the write access register */ 171 /* write packet new counter into the write access register */
171 wl->tx_packets_count++; 172 wl->tx_packets_count++;
172 wl1271_spi_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); 173 wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count);
173 174
174 desc = (struct wl1271_tx_hw_descr *) skb->data; 175 desc = (struct wl1271_tx_hw_descr *) skb->data;
175 wl1271_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u (%u words)", 176 wl1271_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u (%u words)",
@@ -375,8 +376,8 @@ void wl1271_tx_complete(struct wl1271 *wl, u32 count)
375 wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count); 376 wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count);
376 377
377 /* read the tx results from the chipset */ 378 /* read the tx results from the chipset */
378 wl1271_spi_read(wl, le32_to_cpu(memmap->tx_result), 379 wl1271_read(wl, le32_to_cpu(memmap->tx_result),
379 wl->tx_res_if, sizeof(*wl->tx_res_if), false); 380 wl->tx_res_if, sizeof(*wl->tx_res_if), false);
380 381
381 /* verify that the result buffer is not getting overrun */ 382 /* verify that the result buffer is not getting overrun */
382 if (count > TX_HW_RESULT_QUEUE_LEN) { 383 if (count > TX_HW_RESULT_QUEUE_LEN) {
@@ -397,10 +398,10 @@ void wl1271_tx_complete(struct wl1271 *wl, u32 count)
397 } 398 }
398 399
399 /* write host counter to chipset (to ack) */ 400 /* write host counter to chipset (to ack) */
400 wl1271_spi_write32(wl, le32_to_cpu(memmap->tx_result) + 401 wl1271_write32(wl, le32_to_cpu(memmap->tx_result) +
401 offsetof(struct wl1271_tx_hw_res_if, 402 offsetof(struct wl1271_tx_hw_res_if,
402 tx_result_host_counter), 403 tx_result_host_counter),
403 le32_to_cpu(wl->tx_res_if->tx_result_fw_counter)); 404 le32_to_cpu(wl->tx_res_if->tx_result_fw_counter));
404} 405}
405 406
406/* caller must hold wl->mutex */ 407/* caller must hold wl->mutex */