wl12xx: Add support for block reading from a fixed register address
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Fri, 12 Jun 2009 11:16:00 +0000 (14:16 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 18:57:46 +0000 (14:57 -0400)
Add support for block reading (multiple bytes) from a fixed chipset
register address. This is required for the wl1271 TX data path.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-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>
drivers/net/wireless/wl12xx/spi.c
drivers/net/wireless/wl12xx/spi.h

index c3d5b7378610386d3a6b157fb2c47d7dbef0c812..9c9943f98674d0d008d4dafd0f65febaf5820252 100644 (file)
@@ -301,7 +301,7 @@ void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
 }
 
 void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf,
-                     size_t len)
+                     size_t len, bool fixed)
 {
        struct spi_transfer t[2];
        struct spi_message m;
@@ -314,6 +314,9 @@ void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf,
        *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH;
        *cmd |= addr & WSPI_CMD_BYTE_ADDR;
 
+       if (fixed)
+               *cmd |= WSPI_CMD_FIXED;
+
        spi_message_init(&m);
        memset(t, 0, sizeof(t));
 
@@ -348,7 +351,7 @@ void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf,
 
        physical = wl12xx_translate_mem_addr(wl, addr);
 
-       wl12xx_spi_write(wl, physical, buf, len);
+       wl12xx_spi_write(wl, physical, buf, len, false);
 }
 
 void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len,
@@ -361,13 +364,14 @@ void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len,
        wl12xx_spi_read(wl, physical, buf, len, fixed);
 }
 
-void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len)
+void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len,
+                         bool fixed)
 {
        int physical;
 
        physical = wl12xx_translate_reg_addr(wl, addr);
 
-       wl12xx_spi_write(wl, physical, buf, len);
+       wl12xx_spi_write(wl, physical, buf, len, fixed);
 }
 
 u32 wl12xx_mem_read32(struct wl12xx *wl, int addr)
index 30f9098925f27d53ea124eab24fc3cd786421764..e48a552b2ea95ea3dd793d5f5bc55668615b102e 100644 (file)
@@ -71,7 +71,8 @@
 
 
 /* Raw target IO, address is not translated */
-void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, size_t len);
+void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf,
+                     size_t len, bool fixed);
 void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
                     size_t len, bool fixed);
 
@@ -84,7 +85,8 @@ void wl12xx_mem_write32(struct wl12xx *wl, int addr, u32 val);
 /* Registers IO */
 void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len,
                         bool fixed);
-void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf,size_t len);
+void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len,
+                         bool fixed);
 u32 wl12xx_reg_read32(struct wl12xx *wl, int addr);
 void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val);
 
@@ -106,7 +108,8 @@ static inline u32 wl12xx_read32(struct wl12xx *wl, int addr)
 static inline void wl12xx_write32(struct wl12xx *wl, int addr, u32 val)
 {
        wl->buffer_32 = val;
-       wl12xx_spi_write(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
+       wl12xx_spi_write(wl, addr, &wl->buffer_32,
+                        sizeof(wl->buffer_32), false);
 }
 
 #endif /* __WL12XX_SPI_H__ */