diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2009-06-12 07:14:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 14:57:42 -0400 |
commit | 56343a3cfdea4d341c7c13d26013024037eae602 (patch) | |
tree | 5c28dbc6b24d5d1a764af3749a81f4013e2a99f2 /drivers/net | |
parent | 8d47cdb617e0e76e05ea0f92fc164e53bf874b30 (diff) |
wl12xx: allocate buffer spi read/write command buffer kzalloc()
Needed for DMA safe transfers.
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.c | 34 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx.h | 1 |
2 files changed, 20 insertions, 15 deletions
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c index fb7c52c4d9c4..939274291a07 100644 --- a/drivers/net/wireless/wl12xx/spi.c +++ b/drivers/net/wireless/wl12xx/spi.c | |||
@@ -263,17 +263,19 @@ void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, | |||
263 | struct spi_transfer t[3]; | 263 | struct spi_transfer t[3]; |
264 | struct spi_message m; | 264 | struct spi_message m; |
265 | char busy_buf[TNETWIF_READ_OFFSET_BYTES]; | 265 | char busy_buf[TNETWIF_READ_OFFSET_BYTES]; |
266 | u32 cmd; | 266 | u32 *cmd; |
267 | 267 | ||
268 | cmd = 0; | 268 | cmd = &wl->buffer_cmd; |
269 | cmd |= WSPI_CMD_READ; | 269 | |
270 | cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; | 270 | *cmd = 0; |
271 | cmd |= addr & WSPI_CMD_BYTE_ADDR; | 271 | *cmd |= WSPI_CMD_READ; |
272 | *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; | ||
273 | *cmd |= addr & WSPI_CMD_BYTE_ADDR; | ||
272 | 274 | ||
273 | spi_message_init(&m); | 275 | spi_message_init(&m); |
274 | memset(t, 0, sizeof(t)); | 276 | memset(t, 0, sizeof(t)); |
275 | 277 | ||
276 | t[0].tx_buf = &cmd; | 278 | t[0].tx_buf = cmd; |
277 | t[0].len = 4; | 279 | t[0].len = 4; |
278 | spi_message_add_tail(&t[0], &m); | 280 | spi_message_add_tail(&t[0], &m); |
279 | 281 | ||
@@ -290,7 +292,7 @@ void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, | |||
290 | 292 | ||
291 | /* FIXME: check busy words */ | 293 | /* FIXME: check busy words */ |
292 | 294 | ||
293 | wl12xx_dump(DEBUG_SPI, "spi_read cmd -> ", &cmd, sizeof(cmd)); | 295 | wl12xx_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd)); |
294 | wl12xx_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); | 296 | wl12xx_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); |
295 | } | 297 | } |
296 | 298 | ||
@@ -299,18 +301,20 @@ void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, | |||
299 | { | 301 | { |
300 | struct spi_transfer t[2]; | 302 | struct spi_transfer t[2]; |
301 | struct spi_message m; | 303 | struct spi_message m; |
302 | u32 cmd; | 304 | u32 *cmd; |
303 | 305 | ||
304 | cmd = 0; | 306 | cmd = &wl->buffer_cmd; |
305 | cmd |= WSPI_CMD_WRITE; | 307 | |
306 | cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; | 308 | *cmd = 0; |
307 | cmd |= addr & WSPI_CMD_BYTE_ADDR; | 309 | *cmd |= WSPI_CMD_WRITE; |
310 | *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; | ||
311 | *cmd |= addr & WSPI_CMD_BYTE_ADDR; | ||
308 | 312 | ||
309 | spi_message_init(&m); | 313 | spi_message_init(&m); |
310 | memset(t, 0, sizeof(t)); | 314 | memset(t, 0, sizeof(t)); |
311 | 315 | ||
312 | t[0].tx_buf = &cmd; | 316 | t[0].tx_buf = cmd; |
313 | t[0].len = sizeof(cmd); | 317 | t[0].len = sizeof(*cmd); |
314 | spi_message_add_tail(&t[0], &m); | 318 | spi_message_add_tail(&t[0], &m); |
315 | 319 | ||
316 | t[1].tx_buf = buf; | 320 | t[1].tx_buf = buf; |
@@ -319,7 +323,7 @@ void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, | |||
319 | 323 | ||
320 | spi_sync(wl->spi, &m); | 324 | spi_sync(wl->spi, &m); |
321 | 325 | ||
322 | wl12xx_dump(DEBUG_SPI, "spi_write cmd -> ", &cmd, sizeof(cmd)); | 326 | wl12xx_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); |
323 | wl12xx_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); | 327 | wl12xx_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); |
324 | } | 328 | } |
325 | 329 | ||
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index f252a1189254..586593563511 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -384,6 +384,7 @@ struct wl12xx { | |||
384 | struct wl12xx_debugfs debugfs; | 384 | struct wl12xx_debugfs debugfs; |
385 | 385 | ||
386 | u32 buffer_32; | 386 | u32 buffer_32; |
387 | u32 buffer_cmd; | ||
387 | }; | 388 | }; |
388 | 389 | ||
389 | int wl12xx_plt_start(struct wl12xx *wl); | 390 | int wl12xx_plt_start(struct wl12xx *wl); |