aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-06-12 07:14:41 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:42 -0400
commit8d47cdb617e0e76e05ea0f92fc164e53bf874b30 (patch)
tree822a46412cbe804cca151340ed7b5f240a9a663a /drivers/net
parentc4f5c8521868789caaf704c9c2d523b40ccfcb02 (diff)
wl12xx: reserve buffer for partition command in struct wl12xx
This is now DMA safe. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/spi.c22
-rw-r--r--drivers/net/wireless/wl12xx/spi.h6
2 files changed, 17 insertions, 11 deletions
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index abdf171a47e..fb7c52c4d9c 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -167,24 +167,26 @@ void wl12xx_spi_init(struct wl12xx *wl)
167 * | | 167 * | |
168 * 168 *
169 */ 169 */
170void wl12xx_set_partition(struct wl12xx *wl, 170int wl12xx_set_partition(struct wl12xx *wl,
171 u32 mem_start, u32 mem_size, 171 u32 mem_start, u32 mem_size,
172 u32 reg_start, u32 reg_size) 172 u32 reg_start, u32 reg_size)
173{ 173{
174 u8 tx_buf[sizeof(u32) + 2 * sizeof(struct wl12xx_partition)];
175 struct wl12xx_partition *partition; 174 struct wl12xx_partition *partition;
176 struct spi_transfer t; 175 struct spi_transfer t;
177 struct spi_message m; 176 struct spi_message m;
177 size_t len, cmd_len;
178 u32 *cmd; 178 u32 *cmd;
179 size_t len;
180 int addr; 179 int addr;
181 180
181 cmd_len = sizeof(u32) + 2 * sizeof(struct wl12xx_partition);
182 cmd = kzalloc(cmd_len, GFP_KERNEL);
183 if (!cmd)
184 return -ENOMEM;
185
182 spi_message_init(&m); 186 spi_message_init(&m);
183 memset(&t, 0, sizeof(t)); 187 memset(&t, 0, sizeof(t));
184 memset(tx_buf, 0, sizeof(tx_buf));
185 188
186 cmd = (u32 *) tx_buf; 189 partition = (struct wl12xx_partition *) (cmd + 1);
187 partition = (struct wl12xx_partition *) (tx_buf + sizeof(u32));
188 addr = HW_ACCESS_PART0_SIZE_ADDR; 190 addr = HW_ACCESS_PART0_SIZE_ADDR;
189 len = 2 * sizeof(struct wl12xx_partition); 191 len = 2 * sizeof(struct wl12xx_partition);
190 192
@@ -244,11 +246,15 @@ void wl12xx_set_partition(struct wl12xx *wl,
244 wl->virtual_mem_addr = 0; 246 wl->virtual_mem_addr = 0;
245 wl->virtual_reg_addr = mem_size; 247 wl->virtual_reg_addr = mem_size;
246 248
247 t.tx_buf = tx_buf; 249 t.tx_buf = cmd;
248 t.len = sizeof(tx_buf); 250 t.len = cmd_len;
249 spi_message_add_tail(&t, &m); 251 spi_message_add_tail(&t, &m);
250 252
251 spi_sync(wl->spi, &m); 253 spi_sync(wl->spi, &m);
254
255 kfree(cmd);
256
257 return 0;
252} 258}
253 259
254void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, 260void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
diff --git a/drivers/net/wireless/wl12xx/spi.h b/drivers/net/wireless/wl12xx/spi.h
index f3f18958657..7edb218ee76 100644
--- a/drivers/net/wireless/wl12xx/spi.h
+++ b/drivers/net/wireless/wl12xx/spi.h
@@ -88,9 +88,9 @@ void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val);
88/* INIT and RESET words */ 88/* INIT and RESET words */
89void wl12xx_spi_reset(struct wl12xx *wl); 89void wl12xx_spi_reset(struct wl12xx *wl);
90void wl12xx_spi_init(struct wl12xx *wl); 90void wl12xx_spi_init(struct wl12xx *wl);
91void wl12xx_set_partition(struct wl12xx *wl, 91int wl12xx_set_partition(struct wl12xx *wl,
92 u32 part_start, u32 part_size, 92 u32 part_start, u32 part_size,
93 u32 reg_start, u32 reg_size); 93 u32 reg_start, u32 reg_size);
94 94
95static inline u32 wl12xx_read32(struct wl12xx *wl, int addr) 95static inline u32 wl12xx_read32(struct wl12xx *wl, int addr)
96{ 96{