aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@nokia.com>2009-06-12 07:15:41 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:45 -0400
commit052a625a859ceba68022862eeee70511f56483a5 (patch)
tree12650ed57e0a64230073e9730b15c220335bf1b4 /drivers/net/wireless/wl12xx
parent27797d68f70b28e77e6d183910dc7b3d7505105d (diff)
wl12xx: add support for fixed address in wl12xx_spi_read
In the wl1271 implementation, we need to read memory from the register partition using fixed addresses. This change adds the possibility to request fixed address when calling wl12xx_spi_read() or wl12xx_spi_reg_read(). Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r--drivers/net/wireless/wl12xx/spi.c12
-rw-r--r--drivers/net/wireless/wl12xx/spi.h9
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 0d2b13a550e..c3d5b737861 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -258,7 +258,7 @@ int wl12xx_set_partition(struct wl12xx *wl,
258} 258}
259 259
260void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, 260void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
261 size_t len) 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;
@@ -273,6 +273,9 @@ void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
273 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; 273 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH;
274 *cmd |= addr & WSPI_CMD_BYTE_ADDR; 274 *cmd |= addr & WSPI_CMD_BYTE_ADDR;
275 275
276 if (fixed)
277 *cmd |= WSPI_CMD_FIXED;
278
276 spi_message_init(&m); 279 spi_message_init(&m);
277 memset(t, 0, sizeof(t)); 280 memset(t, 0, sizeof(t));
278 281
@@ -335,7 +338,7 @@ void wl12xx_spi_mem_read(struct wl12xx *wl, int addr, void *buf,
335 338
336 physical = wl12xx_translate_mem_addr(wl, addr); 339 physical = wl12xx_translate_mem_addr(wl, addr);
337 340
338 wl12xx_spi_read(wl, physical, buf, len); 341 wl12xx_spi_read(wl, physical, buf, len, false);
339} 342}
340 343
341void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf, 344void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf,
@@ -348,13 +351,14 @@ void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf,
348 wl12xx_spi_write(wl, physical, buf, len); 351 wl12xx_spi_write(wl, physical, buf, len);
349} 352}
350 353
351void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len) 354void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len,
355 bool fixed)
352{ 356{
353 int physical; 357 int physical;
354 358
355 physical = wl12xx_translate_reg_addr(wl, addr); 359 physical = wl12xx_translate_reg_addr(wl, addr);
356 360
357 wl12xx_spi_read(wl, physical, buf, len); 361 wl12xx_spi_read(wl, physical, buf, len, fixed);
358} 362}
359 363
360void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len) 364void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len)
diff --git a/drivers/net/wireless/wl12xx/spi.h b/drivers/net/wireless/wl12xx/spi.h
index 0996e48af9f..30f9098925f 100644
--- a/drivers/net/wireless/wl12xx/spi.h
+++ b/drivers/net/wireless/wl12xx/spi.h
@@ -71,8 +71,9 @@
71 71
72 72
73/* Raw target IO, address is not translated */ 73/* Raw target IO, address is not translated */
74void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, size_t len);
75void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, size_t len); 74void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, size_t len);
75void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
76 size_t len, bool fixed);
76 77
77/* Memory target IO, address is tranlated to partition 0 */ 78/* Memory target IO, address is tranlated to partition 0 */
78void wl12xx_spi_mem_read(struct wl12xx *wl, int addr, void *buf, size_t len); 79void wl12xx_spi_mem_read(struct wl12xx *wl, int addr, void *buf, size_t len);
@@ -81,7 +82,8 @@ u32 wl12xx_mem_read32(struct wl12xx *wl, int addr);
81void wl12xx_mem_write32(struct wl12xx *wl, int addr, u32 val); 82void wl12xx_mem_write32(struct wl12xx *wl, int addr, u32 val);
82 83
83/* Registers IO */ 84/* Registers IO */
84void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len); 85void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len,
86 bool fixed);
85void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf,size_t len); 87void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf,size_t len);
86u32 wl12xx_reg_read32(struct wl12xx *wl, int addr); 88u32 wl12xx_reg_read32(struct wl12xx *wl, int addr);
87void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val); 89void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val);
@@ -95,7 +97,8 @@ int wl12xx_set_partition(struct wl12xx *wl,
95 97
96static inline u32 wl12xx_read32(struct wl12xx *wl, int addr) 98static inline u32 wl12xx_read32(struct wl12xx *wl, int addr)
97{ 99{
98 wl12xx_spi_read(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32)); 100 wl12xx_spi_read(wl, addr, &wl->buffer_32,
101 sizeof(wl->buffer_32), false);
99 102
100 return wl->buffer_32; 103 return wl->buffer_32;
101} 104}