diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2009-10-12 08:08:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:48:05 -0400 |
commit | 746214178774bc7f9adbeaef7d43a634570eb870 (patch) | |
tree | 7a1b6e9875351b89b9abbe9a836ec8c5c805a8ee /drivers/net/wireless/wl12xx/wl1271_spi.c | |
parent | 207347e498cbe25fa2a8369edd49df43e56000be (diff) |
wl1271: Remove outdated SPI functions
With the change to the new firmware, there was a change to firmware memory
partitioning. Along with that change, the translation of all partitions was
unified, and separate functions for reg and mem access became unnecessary.
Cleanup the unnecessary functions.
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/wl12xx/wl1271_spi.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_spi.c | 85 |
1 files changed, 27 insertions, 58 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c index 7a7890b77b89..4800fdfd2373 100644 --- a/drivers/net/wireless/wl12xx/wl1271_spi.c +++ b/drivers/net/wireless/wl12xx/wl1271_spi.c | |||
@@ -183,13 +183,13 @@ int wl1271_set_partition(struct wl1271 *wl, | |||
183 | p->mem3.start, p->mem3.size); | 183 | p->mem3.start, p->mem3.size); |
184 | 184 | ||
185 | /* write partition info to the chipset */ | 185 | /* write partition info to the chipset */ |
186 | wl1271_write32(wl, HW_PART0_START_ADDR, p->mem.start); | 186 | wl1271_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start); |
187 | wl1271_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); | 187 | wl1271_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); |
188 | wl1271_write32(wl, HW_PART1_START_ADDR, p->reg.start); | 188 | wl1271_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start); |
189 | wl1271_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); | 189 | wl1271_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); |
190 | wl1271_write32(wl, HW_PART2_START_ADDR, p->mem2.start); | 190 | wl1271_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start); |
191 | wl1271_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); | 191 | wl1271_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); |
192 | wl1271_write32(wl, HW_PART3_START_ADDR, p->mem3.start); | 192 | wl1271_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start); |
193 | 193 | ||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
@@ -257,8 +257,8 @@ void wl1271_spi_read_busy(struct wl1271 *wl, void *buf, size_t len) | |||
257 | wl1271_error("SPI read busy-word timeout!\n"); | 257 | wl1271_error("SPI read busy-word timeout!\n"); |
258 | } | 258 | } |
259 | 259 | ||
260 | void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, | 260 | void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, |
261 | size_t len, bool fixed) | 261 | size_t len, bool fixed) |
262 | { | 262 | { |
263 | struct spi_transfer t[3]; | 263 | struct spi_transfer t[3]; |
264 | struct spi_message m; | 264 | struct spi_message m; |
@@ -302,8 +302,8 @@ void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, | |||
302 | wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); | 302 | wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); |
303 | } | 303 | } |
304 | 304 | ||
305 | void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, | 305 | void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf, |
306 | size_t len, bool fixed) | 306 | size_t len, bool fixed) |
307 | { | 307 | { |
308 | struct spi_transfer t[2]; | 308 | struct spi_transfer t[2]; |
309 | struct spi_message m; | 309 | struct spi_message m; |
@@ -336,77 +336,47 @@ void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, | |||
336 | wl1271_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); | 336 | wl1271_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); |
337 | } | 337 | } |
338 | 338 | ||
339 | void wl1271_spi_mem_read(struct wl1271 *wl, int addr, void *buf, | 339 | void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, size_t len, |
340 | size_t len) | 340 | bool fixed) |
341 | { | 341 | { |
342 | int physical; | 342 | int physical; |
343 | 343 | ||
344 | physical = wl1271_translate_addr(wl, addr); | 344 | physical = wl1271_translate_addr(wl, addr); |
345 | 345 | ||
346 | wl1271_spi_read(wl, physical, buf, len, false); | 346 | wl1271_spi_raw_read(wl, physical, buf, len, fixed); |
347 | } | 347 | } |
348 | 348 | ||
349 | void wl1271_spi_mem_write(struct wl1271 *wl, int addr, void *buf, | 349 | void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, size_t len, |
350 | size_t len) | 350 | bool fixed) |
351 | { | 351 | { |
352 | int physical; | 352 | int physical; |
353 | 353 | ||
354 | physical = wl1271_translate_addr(wl, addr); | 354 | physical = wl1271_translate_addr(wl, addr); |
355 | 355 | ||
356 | wl1271_spi_write(wl, physical, buf, len, false); | 356 | wl1271_spi_raw_write(wl, physical, buf, len, fixed); |
357 | } | 357 | } |
358 | 358 | ||
359 | void wl1271_spi_reg_read(struct wl1271 *wl, int addr, void *buf, size_t len, | 359 | u32 wl1271_spi_read32(struct wl1271 *wl, int addr) |
360 | bool fixed) | ||
361 | { | 360 | { |
362 | int physical; | 361 | return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr)); |
363 | |||
364 | physical = wl1271_translate_addr(wl, addr); | ||
365 | |||
366 | wl1271_spi_read(wl, physical, buf, len, fixed); | ||
367 | } | ||
368 | |||
369 | void wl1271_spi_reg_write(struct wl1271 *wl, int addr, void *buf, size_t len, | ||
370 | bool fixed) | ||
371 | { | ||
372 | int physical; | ||
373 | |||
374 | physical = wl1271_translate_addr(wl, addr); | ||
375 | |||
376 | wl1271_spi_write(wl, physical, buf, len, fixed); | ||
377 | } | 362 | } |
378 | 363 | ||
379 | u32 wl1271_mem_read32(struct wl1271 *wl, int addr) | 364 | void wl1271_spi_write32(struct wl1271 *wl, int addr, u32 val) |
380 | { | 365 | { |
381 | return wl1271_read32(wl, wl1271_translate_addr(wl, addr)); | 366 | wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val); |
382 | } | ||
383 | |||
384 | void wl1271_mem_write32(struct wl1271 *wl, int addr, u32 val) | ||
385 | { | ||
386 | wl1271_write32(wl, wl1271_translate_addr(wl, addr), val); | ||
387 | } | ||
388 | |||
389 | u32 wl1271_reg_read32(struct wl1271 *wl, int addr) | ||
390 | { | ||
391 | return wl1271_read32(wl, wl1271_translate_addr(wl, addr)); | ||
392 | } | ||
393 | |||
394 | void wl1271_reg_write32(struct wl1271 *wl, int addr, u32 val) | ||
395 | { | ||
396 | wl1271_write32(wl, wl1271_translate_addr(wl, addr), val); | ||
397 | } | 367 | } |
398 | 368 | ||
399 | void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val) | 369 | void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val) |
400 | { | 370 | { |
401 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ | 371 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ |
402 | addr = (addr >> 1) + 0x30000; | 372 | addr = (addr >> 1) + 0x30000; |
403 | wl1271_reg_write32(wl, OCP_POR_CTR, addr); | 373 | wl1271_spi_write32(wl, OCP_POR_CTR, addr); |
404 | 374 | ||
405 | /* write value to OCP_POR_WDATA */ | 375 | /* write value to OCP_POR_WDATA */ |
406 | wl1271_reg_write32(wl, OCP_DATA_WRITE, val); | 376 | wl1271_spi_write32(wl, OCP_DATA_WRITE, val); |
407 | 377 | ||
408 | /* write 1 to OCP_CMD */ | 378 | /* write 1 to OCP_CMD */ |
409 | wl1271_reg_write32(wl, OCP_CMD, OCP_CMD_WRITE); | 379 | wl1271_spi_write32(wl, OCP_CMD, OCP_CMD_WRITE); |
410 | } | 380 | } |
411 | 381 | ||
412 | u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) | 382 | u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) |
@@ -416,14 +386,14 @@ u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) | |||
416 | 386 | ||
417 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ | 387 | /* write address >> 1 + 0x30000 to OCP_POR_CTR */ |
418 | addr = (addr >> 1) + 0x30000; | 388 | addr = (addr >> 1) + 0x30000; |
419 | wl1271_reg_write32(wl, OCP_POR_CTR, addr); | 389 | wl1271_spi_write32(wl, OCP_POR_CTR, addr); |
420 | 390 | ||
421 | /* write 2 to OCP_CMD */ | 391 | /* write 2 to OCP_CMD */ |
422 | wl1271_reg_write32(wl, OCP_CMD, OCP_CMD_READ); | 392 | wl1271_spi_write32(wl, OCP_CMD, OCP_CMD_READ); |
423 | 393 | ||
424 | /* poll for data ready */ | 394 | /* poll for data ready */ |
425 | do { | 395 | do { |
426 | val = wl1271_reg_read32(wl, OCP_DATA_READ); | 396 | val = wl1271_spi_read32(wl, OCP_DATA_READ); |
427 | timeout--; | 397 | timeout--; |
428 | } while (!(val & OCP_READY_MASK) && timeout); | 398 | } while (!(val & OCP_READY_MASK) && timeout); |
429 | 399 | ||
@@ -440,4 +410,3 @@ u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) | |||
440 | return 0xffff; | 410 | return 0xffff; |
441 | } | 411 | } |
442 | } | 412 | } |
443 | |||