aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2009-10-12 08:08:46 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:03 -0400
commit451de97adb4d0f101f3befc881a548adb47c467a (patch)
tree6d40eb04db29f66983a6dd98e8bfff7eb654935b /drivers/net/wireless
parent37079a831d8194e138c03663b7cab281ab1dc181 (diff)
wl1271: Update memory mapping for firmware revision 6.1.0.0.241
Update the memory regions and memory mapping to support firmware revision 6.1.0.0.241. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h7
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_boot.c67
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c10
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_spi.c178
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_spi.h15
5 files changed, 116 insertions, 161 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 858bf6b160a1..b2bc7b59d645 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -148,6 +148,8 @@ struct wl1271_partition {
148struct wl1271_partition_set { 148struct wl1271_partition_set {
149 struct wl1271_partition mem; 149 struct wl1271_partition mem;
150 struct wl1271_partition reg; 150 struct wl1271_partition reg;
151 struct wl1271_partition mem2;
152 struct wl1271_partition mem3;
151}; 153};
152 154
153struct wl1271; 155struct wl1271;
@@ -302,10 +304,7 @@ struct wl1271 {
302 enum wl1271_state state; 304 enum wl1271_state state;
303 struct mutex mutex; 305 struct mutex mutex;
304 306
305 int physical_mem_addr; 307 struct wl1271_partition_set part;
306 int physical_reg_addr;
307 int virtual_mem_addr;
308 int virtual_reg_addr;
309 308
310 struct wl1271_chip chip; 309 struct wl1271_chip chip;
311 310
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index 140e94348bc1..2eb7836c9ac1 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -39,6 +39,14 @@ static struct wl1271_partition_set part_table[PART_TABLE_LEN] = {
39 .start = REGISTERS_BASE, 39 .start = REGISTERS_BASE,
40 .size = 0x00008800 40 .size = 0x00008800
41 }, 41 },
42 .mem2 = {
43 .start = 0x00000000,
44 .size = 0x00000000
45 },
46 .mem3 = {
47 .start = 0x00000000,
48 .size = 0x00000000
49 },
42 }, 50 },
43 51
44 [PART_WORK] = { 52 [PART_WORK] = {
@@ -48,7 +56,15 @@ static struct wl1271_partition_set part_table[PART_TABLE_LEN] = {
48 }, 56 },
49 .reg = { 57 .reg = {
50 .start = REGISTERS_BASE, 58 .start = REGISTERS_BASE,
51 .size = 0x0000b000 59 .size = 0x0000a000
60 },
61 .mem2 = {
62 .start = 0x003004f8,
63 .size = 0x00000004
64 },
65 .mem3 = {
66 .start = 0x00040404,
67 .size = 0x00000000
52 }, 68 },
53 }, 69 },
54 70
@@ -60,6 +76,14 @@ static struct wl1271_partition_set part_table[PART_TABLE_LEN] = {
60 .reg = { 76 .reg = {
61 .start = DRPW_BASE, 77 .start = DRPW_BASE,
62 .size = 0x00006000 78 .size = 0x00006000
79 },
80 .mem2 = {
81 .start = 0x00000000,
82 .size = 0x00000000
83 },
84 .mem3 = {
85 .start = 0x00000000,
86 .size = 0x00000000
63 } 87 }
64 } 88 }
65}; 89};
@@ -93,6 +117,7 @@ static void wl1271_boot_fw_version(struct wl1271 *wl)
93static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, 117static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
94 size_t fw_data_len, u32 dest) 118 size_t fw_data_len, u32 dest)
95{ 119{
120 struct wl1271_partition_set partition;
96 int addr, chunk_num, partition_limit; 121 int addr, chunk_num, partition_limit;
97 u8 *p, *chunk; 122 u8 *p, *chunk;
98 123
@@ -114,10 +139,9 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
114 return -ENOMEM; 139 return -ENOMEM;
115 } 140 }
116 141
117 wl1271_set_partition(wl, dest, 142 memcpy(&partition, &part_table[PART_DOWN], sizeof(partition));
118 part_table[PART_DOWN].mem.size, 143 partition.mem.start = dest;
119 part_table[PART_DOWN].reg.start, 144 wl1271_set_partition(wl, &partition);
120 part_table[PART_DOWN].reg.size);
121 145
122 /* 10.1 set partition limit and chunk num */ 146 /* 10.1 set partition limit and chunk num */
123 chunk_num = 0; 147 chunk_num = 0;
@@ -130,13 +154,8 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
130 addr = dest + chunk_num * CHUNK_SIZE; 154 addr = dest + chunk_num * CHUNK_SIZE;
131 partition_limit = chunk_num * CHUNK_SIZE + 155 partition_limit = chunk_num * CHUNK_SIZE +
132 part_table[PART_DOWN].mem.size; 156 part_table[PART_DOWN].mem.size;
133 157 partition.mem.start = addr;
134 /* FIXME: Over 80 chars! */ 158 wl1271_set_partition(wl, &partition);
135 wl1271_set_partition(wl,
136 addr,
137 part_table[PART_DOWN].mem.size,
138 part_table[PART_DOWN].reg.start,
139 part_table[PART_DOWN].reg.size);
140 } 159 }
141 160
142 /* 10.3 upload the chunk */ 161 /* 10.3 upload the chunk */
@@ -261,11 +280,7 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
261 /* FIXME: The driver sets the partition here, but this is not needed, 280 /* FIXME: The driver sets the partition here, but this is not needed,
262 since it sets to the same one as currently in use */ 281 since it sets to the same one as currently in use */
263 /* Now we must set the partition correctly */ 282 /* Now we must set the partition correctly */
264 wl1271_set_partition(wl, 283 wl1271_set_partition(wl, &part_table[PART_WORK]);
265 part_table[PART_WORK].mem.start,
266 part_table[PART_WORK].mem.size,
267 part_table[PART_WORK].reg.start,
268 part_table[PART_WORK].reg.size);
269 284
270 /* Copy the NVS tables to a new block to ensure alignment */ 285 /* Copy the NVS tables to a new block to ensure alignment */
271 nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); 286 nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL);
@@ -371,11 +386,7 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
371 wl->event_box_addr = wl1271_reg_read32(wl, REG_EVENT_MAILBOX_PTR); 386 wl->event_box_addr = wl1271_reg_read32(wl, REG_EVENT_MAILBOX_PTR);
372 387
373 /* set the working partition to its "running" mode offset */ 388 /* set the working partition to its "running" mode offset */
374 wl1271_set_partition(wl, 389 wl1271_set_partition(wl, &part_table[PART_WORK]);
375 part_table[PART_WORK].mem.start,
376 part_table[PART_WORK].mem.size,
377 part_table[PART_WORK].reg.start,
378 part_table[PART_WORK].reg.size);
379 390
380 wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x", 391 wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
381 wl->cmd_box_addr, wl->event_box_addr); 392 wl->cmd_box_addr, wl->event_box_addr);
@@ -469,11 +480,7 @@ int wl1271_boot(struct wl1271 *wl)
469 wl1271_reg_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); 480 wl1271_reg_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
470 udelay(500); 481 udelay(500);
471 482
472 wl1271_set_partition(wl, 483 wl1271_set_partition(wl, &part_table[PART_DRPW]);
473 part_table[PART_DRPW].mem.start,
474 part_table[PART_DRPW].mem.size,
475 part_table[PART_DRPW].reg.start,
476 part_table[PART_DRPW].reg.size);
477 484
478 /* Read-modify-write DRPW_SCRATCH_START register (see next state) 485 /* Read-modify-write DRPW_SCRATCH_START register (see next state)
479 to be used by DRPw FW. The RTRIM value will be added by the FW 486 to be used by DRPw FW. The RTRIM value will be added by the FW
@@ -488,11 +495,7 @@ int wl1271_boot(struct wl1271 *wl)
488 clk |= (REF_CLOCK << 1) << 4; 495 clk |= (REF_CLOCK << 1) << 4;
489 wl1271_reg_write32(wl, DRPW_SCRATCH_START, clk); 496 wl1271_reg_write32(wl, DRPW_SCRATCH_START, clk);
490 497
491 wl1271_set_partition(wl, 498 wl1271_set_partition(wl, &part_table[PART_WORK]);
492 part_table[PART_WORK].mem.start,
493 part_table[PART_WORK].mem.size,
494 part_table[PART_WORK].reg.start,
495 part_table[PART_WORK].reg.size);
496 499
497 /* Disable interrupts */ 500 /* Disable interrupts */
498 wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 501 wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index b9f20918a25d..22d44ba2e969 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -315,6 +315,7 @@ static int wl1271_setup(struct wl1271 *wl)
315 315
316static int wl1271_chip_wakeup(struct wl1271 *wl) 316static int wl1271_chip_wakeup(struct wl1271 *wl)
317{ 317{
318 struct wl1271_partition_set partition;
318 int ret = 0; 319 int ret = 0;
319 320
320 wl1271_power_on(wl); 321 wl1271_power_on(wl);
@@ -324,11 +325,10 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
324 325
325 /* We don't need a real memory partition here, because we only want 326 /* We don't need a real memory partition here, because we only want
326 * to use the registers at this point. */ 327 * to use the registers at this point. */
327 wl1271_set_partition(wl, 328 memset(&partition, 0, sizeof(partition));
328 0x00000000, 329 partition.reg.start = REGISTERS_BASE;
329 0x00000000, 330 partition.reg.size = REGISTERS_DOWN_SIZE;
330 REGISTERS_BASE, 331 wl1271_set_partition(wl, &partition);
331 REGISTERS_DOWN_SIZE);
332 332
333 /* ELP module wake up */ 333 /* ELP module wake up */
334 wl1271_fw_wakeup(wl); 334 wl1271_fw_wakeup(wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 504991acb052..367f2d3319ac 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -30,17 +30,29 @@
30#include "wl12xx_80211.h" 30#include "wl12xx_80211.h"
31#include "wl1271_spi.h" 31#include "wl1271_spi.h"
32 32
33static int wl1271_translate_reg_addr(struct wl1271 *wl, int addr) 33static int wl1271_translate_addr(struct wl1271 *wl, int addr)
34{ 34{
35 return addr - wl->physical_reg_addr + wl->virtual_reg_addr; 35 /*
36} 36 * To translate, first check to which window of addresses the
37 37 * particular address belongs. Then subtract the starting address
38static int wl1271_translate_mem_addr(struct wl1271 *wl, int addr) 38 * of that window from the address. Then, add offset of the
39{ 39 * translated region.
40 return addr - wl->physical_mem_addr + wl->virtual_mem_addr; 40 *
41 * The translated regions occur next to each other in physical device
42 * memory, so just add the sizes of the preceeding address regions to
43 * get the offset to the new region.
44 *
45 * Currently, only the two first regions are addressed, and the
46 * assumption is that all addresses will fall into either of those
47 * two.
48 */
49 if ((addr >= wl->part.reg.start) &&
50 (addr < wl->part.reg.start + wl->part.reg.size))
51 return addr - wl->part.reg.start + wl->part.mem.size;
52 else
53 return addr - wl->part.mem.start;
41} 54}
42 55
43
44void wl1271_spi_reset(struct wl1271 *wl) 56void wl1271_spi_reset(struct wl1271 *wl)
45{ 57{
46 u8 *cmd; 58 u8 *cmd;
@@ -123,123 +135,61 @@ void wl1271_spi_init(struct wl1271 *wl)
123 135
124/* Set the SPI partitions to access the chip addresses 136/* Set the SPI partitions to access the chip addresses
125 * 137 *
126 * There are two VIRTUAL (SPI) partitions (the memory partition and the 138 * To simplify driver code, a fixed (virtual) memory map is defined for
127 * registers partition), which are mapped to two different areas of the 139 * register and memory addresses. Because in the chipset, in different stages
128 * PHYSICAL (hardware) memory. This function also makes other checks to 140 * of operation, those addresses will move around, an address translation
129 * ensure that the partitions are not overlapping. In the diagram below, the 141 * mechanism is required.
130 * memory partition comes before the register partition, but the opposite is
131 * also supported.
132 * 142 *
133 * PHYSICAL address 143 * There are four partitions (three memory and one register partition),
144 * which are mapped to two different areas of the hardware memory.
145 *
146 * Virtual address
134 * space 147 * space
135 * 148 *
136 * | | 149 * | |
137 * ...+----+--> mem_start 150 * ...+----+--> mem.start
138 * VIRTUAL address ... | | 151 * Physical address ... | |
139 * space ... | | [PART_0] 152 * space ... | | [PART_0]
140 * ... | | 153 * ... | |
141 * 0x00000000 <--+----+... ...+----+--> mem_start + mem_size 154 * 00000000 <--+----+... ...+----+--> mem.start + mem.size
142 * | | ... | | 155 * | | ... | |
143 * |MEM | ... | | 156 * |MEM | ... | |
144 * | | ... | | 157 * | | ... | |
145 * part_size <--+----+... | | {unused area) 158 * mem.size <--+----+... | | {unused area)
146 * | | ... | | 159 * | | ... | |
147 * |REG | ... | | 160 * |REG | ... | |
148 * part_size | | ... | | 161 * mem.size | | ... | |
149 * + <--+----+... ...+----+--> reg_start 162 * + <--+----+... ...+----+--> reg.start
150 * reg_size ... | | 163 * reg.size | | ... | |
151 * ... | | [PART_1] 164 * |MEM2| ... | | [PART_1]
152 * ... | | 165 * | | ... | |
153 * ...+----+--> reg_start + reg_size 166 * ...+----+--> reg.start + reg.size
154 * | | 167 * | |
155 * 168 *
156 */ 169 */
157int wl1271_set_partition(struct wl1271 *wl, 170int wl1271_set_partition(struct wl1271 *wl,
158 u32 mem_start, u32 mem_size, 171 struct wl1271_partition_set *p)
159 u32 reg_start, u32 reg_size)
160{ 172{
161 struct wl1271_partition *partition; 173 /* copy partition info */
162 struct spi_transfer t; 174 memcpy(&wl->part, p, sizeof(*p));
163 struct spi_message m;
164 size_t len, cmd_len;
165 u32 *cmd;
166 int addr;
167
168 cmd_len = sizeof(u32) + 2 * sizeof(struct wl1271_partition);
169 cmd = kzalloc(cmd_len, GFP_KERNEL);
170 if (!cmd)
171 return -ENOMEM;
172
173 spi_message_init(&m);
174 memset(&t, 0, sizeof(t));
175
176 partition = (struct wl1271_partition *) (cmd + 1);
177 addr = HW_ACCESS_PART0_SIZE_ADDR;
178 len = 2 * sizeof(struct wl1271_partition);
179
180 *cmd |= WSPI_CMD_WRITE;
181 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH;
182 *cmd |= addr & WSPI_CMD_BYTE_ADDR;
183 175
184 wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 176 wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
185 mem_start, mem_size); 177 p->mem.start, p->mem.size);
186 wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 178 wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
187 reg_start, reg_size); 179 p->reg.start, p->reg.size);
188 180 wl1271_debug(DEBUG_SPI, "mem2_start %08X mem2_size %08X",
189 /* Make sure that the two partitions together don't exceed the 181 p->mem2.start, p->mem2.size);
190 * address range */ 182 wl1271_debug(DEBUG_SPI, "mem3_start %08X mem3_size %08X",
191 if ((mem_size + reg_size) > HW_ACCESS_MEMORY_MAX_RANGE) { 183 p->mem3.start, p->mem3.size);
192 wl1271_debug(DEBUG_SPI, "Total size exceeds maximum virtual" 184
193 " address range. Truncating partition[0]."); 185 /* write partition info to the chipset */
194 mem_size = HW_ACCESS_MEMORY_MAX_RANGE - reg_size; 186 wl1271_write32(wl, HW_PART0_START_ADDR, p->mem.start);
195 wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 187 wl1271_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size);
196 mem_start, mem_size); 188 wl1271_write32(wl, HW_PART1_START_ADDR, p->reg.start);
197 wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 189 wl1271_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size);
198 reg_start, reg_size); 190 wl1271_write32(wl, HW_PART2_START_ADDR, p->mem2.start);
199 } 191 wl1271_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size);
200 192 wl1271_write32(wl, HW_PART3_START_ADDR, p->mem3.start);
201 if ((mem_start < reg_start) &&
202 ((mem_start + mem_size) > reg_start)) {
203 /* Guarantee that the memory partition doesn't overlap the
204 * registers partition */
205 wl1271_debug(DEBUG_SPI, "End of partition[0] is "
206 "overlapping partition[1]. Adjusted.");
207 mem_size = reg_start - mem_start;
208 wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
209 mem_start, mem_size);
210 wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
211 reg_start, reg_size);
212 } else if ((reg_start < mem_start) &&
213 ((reg_start + reg_size) > mem_start)) {
214 /* Guarantee that the register partition doesn't overlap the
215 * memory partition */
216 wl1271_debug(DEBUG_SPI, "End of partition[1] is"
217 " overlapping partition[0]. Adjusted.");
218 reg_size = mem_start - reg_start;
219 wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
220 mem_start, mem_size);
221 wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
222 reg_start, reg_size);
223 }
224
225 partition[0].start = mem_start;
226 partition[0].size = mem_size;
227 partition[1].start = reg_start;
228 partition[1].size = reg_size;
229
230 wl->physical_mem_addr = mem_start;
231 wl->physical_reg_addr = reg_start;
232
233 wl->virtual_mem_addr = 0;
234 wl->virtual_reg_addr = mem_size;
235
236 t.tx_buf = cmd;
237 t.len = cmd_len;
238 spi_message_add_tail(&t, &m);
239
240 spi_sync(wl->spi, &m);
241
242 kfree(cmd);
243 193
244 return 0; 194 return 0;
245} 195}
@@ -391,7 +341,7 @@ void wl1271_spi_mem_read(struct wl1271 *wl, int addr, void *buf,
391{ 341{
392 int physical; 342 int physical;
393 343
394 physical = wl1271_translate_mem_addr(wl, addr); 344 physical = wl1271_translate_addr(wl, addr);
395 345
396 wl1271_spi_read(wl, physical, buf, len, false); 346 wl1271_spi_read(wl, physical, buf, len, false);
397} 347}
@@ -401,7 +351,7 @@ void wl1271_spi_mem_write(struct wl1271 *wl, int addr, void *buf,
401{ 351{
402 int physical; 352 int physical;
403 353
404 physical = wl1271_translate_mem_addr(wl, addr); 354 physical = wl1271_translate_addr(wl, addr);
405 355
406 wl1271_spi_write(wl, physical, buf, len, false); 356 wl1271_spi_write(wl, physical, buf, len, false);
407} 357}
@@ -411,7 +361,7 @@ void wl1271_spi_reg_read(struct wl1271 *wl, int addr, void *buf, size_t len,
411{ 361{
412 int physical; 362 int physical;
413 363
414 physical = wl1271_translate_reg_addr(wl, addr); 364 physical = wl1271_translate_addr(wl, addr);
415 365
416 wl1271_spi_read(wl, physical, buf, len, fixed); 366 wl1271_spi_read(wl, physical, buf, len, fixed);
417} 367}
@@ -421,27 +371,27 @@ void wl1271_spi_reg_write(struct wl1271 *wl, int addr, void *buf, size_t len,
421{ 371{
422 int physical; 372 int physical;
423 373
424 physical = wl1271_translate_reg_addr(wl, addr); 374 physical = wl1271_translate_addr(wl, addr);
425 375
426 wl1271_spi_write(wl, physical, buf, len, fixed); 376 wl1271_spi_write(wl, physical, buf, len, fixed);
427} 377}
428 378
429u32 wl1271_mem_read32(struct wl1271 *wl, int addr) 379u32 wl1271_mem_read32(struct wl1271 *wl, int addr)
430{ 380{
431 return wl1271_read32(wl, wl1271_translate_mem_addr(wl, addr)); 381 return wl1271_read32(wl, wl1271_translate_addr(wl, addr));
432} 382}
433 383
434void wl1271_mem_write32(struct wl1271 *wl, int addr, u32 val) 384void wl1271_mem_write32(struct wl1271 *wl, int addr, u32 val)
435{ 385{
436 wl1271_write32(wl, wl1271_translate_mem_addr(wl, addr), val); 386 wl1271_write32(wl, wl1271_translate_addr(wl, addr), val);
437} 387}
438 388
439u32 wl1271_reg_read32(struct wl1271 *wl, int addr) 389u32 wl1271_reg_read32(struct wl1271 *wl, int addr)
440{ 390{
441 return wl1271_read32(wl, wl1271_translate_reg_addr(wl, addr)); 391 return wl1271_read32(wl, wl1271_translate_addr(wl, addr));
442} 392}
443 393
444void wl1271_reg_write32(struct wl1271 *wl, int addr, u32 val) 394void wl1271_reg_write32(struct wl1271 *wl, int addr, u32 val)
445{ 395{
446 wl1271_write32(wl, wl1271_translate_reg_addr(wl, addr), val); 396 wl1271_write32(wl, wl1271_translate_addr(wl, addr), val);
447} 397}
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.h b/drivers/net/wireless/wl12xx/wl1271_spi.h
index 2c9968458646..c58e02724d02 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.h
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.h
@@ -29,10 +29,14 @@
29 29
30#define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0 30#define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0
31 31
32#define HW_ACCESS_PART0_SIZE_ADDR 0x1FFC0 32#define HW_PARTITION_REGISTERS_ADDR 0x1ffc0
33#define HW_ACCESS_PART0_START_ADDR 0x1FFC4 33#define HW_PART0_SIZE_ADDR (HW_PARTITION_REGISTERS_ADDR)
34#define HW_ACCESS_PART1_SIZE_ADDR 0x1FFC8 34#define HW_PART0_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 4)
35#define HW_ACCESS_PART1_START_ADDR 0x1FFCC 35#define HW_PART1_SIZE_ADDR (HW_PARTITION_REGISTERS_ADDR + 8)
36#define HW_PART1_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 12)
37#define HW_PART2_SIZE_ADDR (HW_PARTITION_REGISTERS_ADDR + 16)
38#define HW_PART2_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 20)
39#define HW_PART3_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 24)
36 40
37#define HW_ACCESS_REGISTER_SIZE 4 41#define HW_ACCESS_REGISTER_SIZE 4
38 42
@@ -92,8 +96,7 @@ void wl1271_reg_write32(struct wl1271 *wl, int addr, u32 val);
92void wl1271_spi_reset(struct wl1271 *wl); 96void wl1271_spi_reset(struct wl1271 *wl);
93void wl1271_spi_init(struct wl1271 *wl); 97void wl1271_spi_init(struct wl1271 *wl);
94int wl1271_set_partition(struct wl1271 *wl, 98int wl1271_set_partition(struct wl1271 *wl,
95 u32 part_start, u32 part_size, 99 struct wl1271_partition_set *p);
96 u32 reg_start, u32 reg_size);
97 100
98static inline u32 wl1271_read32(struct wl1271 *wl, int addr) 101static inline u32 wl1271_read32(struct wl1271 *wl, int addr)
99{ 102{