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>
This commit is contained in:
parent
c4f5c85218
commit
8d47cdb617
@ -167,24 +167,26 @@ void wl12xx_spi_init(struct wl12xx *wl)
|
|||||||
* | |
|
* | |
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void wl12xx_set_partition(struct wl12xx *wl,
|
int wl12xx_set_partition(struct wl12xx *wl,
|
||||||
u32 mem_start, u32 mem_size,
|
u32 mem_start, u32 mem_size,
|
||||||
u32 reg_start, u32 reg_size)
|
u32 reg_start, u32 reg_size)
|
||||||
{
|
{
|
||||||
u8 tx_buf[sizeof(u32) + 2 * sizeof(struct wl12xx_partition)];
|
|
||||||
struct wl12xx_partition *partition;
|
struct wl12xx_partition *partition;
|
||||||
struct spi_transfer t;
|
struct spi_transfer t;
|
||||||
struct spi_message m;
|
struct spi_message m;
|
||||||
|
size_t len, cmd_len;
|
||||||
u32 *cmd;
|
u32 *cmd;
|
||||||
size_t len;
|
|
||||||
int addr;
|
int addr;
|
||||||
|
|
||||||
|
cmd_len = sizeof(u32) + 2 * sizeof(struct wl12xx_partition);
|
||||||
|
cmd = kzalloc(cmd_len, GFP_KERNEL);
|
||||||
|
if (!cmd)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
spi_message_init(&m);
|
spi_message_init(&m);
|
||||||
memset(&t, 0, sizeof(t));
|
memset(&t, 0, sizeof(t));
|
||||||
memset(tx_buf, 0, sizeof(tx_buf));
|
|
||||||
|
|
||||||
cmd = (u32 *) tx_buf;
|
partition = (struct wl12xx_partition *) (cmd + 1);
|
||||||
partition = (struct wl12xx_partition *) (tx_buf + sizeof(u32));
|
|
||||||
addr = HW_ACCESS_PART0_SIZE_ADDR;
|
addr = HW_ACCESS_PART0_SIZE_ADDR;
|
||||||
len = 2 * sizeof(struct wl12xx_partition);
|
len = 2 * sizeof(struct wl12xx_partition);
|
||||||
|
|
||||||
@ -244,11 +246,15 @@ void wl12xx_set_partition(struct wl12xx *wl,
|
|||||||
wl->virtual_mem_addr = 0;
|
wl->virtual_mem_addr = 0;
|
||||||
wl->virtual_reg_addr = mem_size;
|
wl->virtual_reg_addr = mem_size;
|
||||||
|
|
||||||
t.tx_buf = tx_buf;
|
t.tx_buf = cmd;
|
||||||
t.len = sizeof(tx_buf);
|
t.len = cmd_len;
|
||||||
spi_message_add_tail(&t, &m);
|
spi_message_add_tail(&t, &m);
|
||||||
|
|
||||||
spi_sync(wl->spi, &m);
|
spi_sync(wl->spi, &m);
|
||||||
|
|
||||||
|
kfree(cmd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
|
void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
|
||||||
|
@ -88,9 +88,9 @@ void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val);
|
|||||||
/* INIT and RESET words */
|
/* INIT and RESET words */
|
||||||
void wl12xx_spi_reset(struct wl12xx *wl);
|
void wl12xx_spi_reset(struct wl12xx *wl);
|
||||||
void wl12xx_spi_init(struct wl12xx *wl);
|
void wl12xx_spi_init(struct wl12xx *wl);
|
||||||
void wl12xx_set_partition(struct wl12xx *wl,
|
int wl12xx_set_partition(struct wl12xx *wl,
|
||||||
u32 part_start, u32 part_size,
|
u32 part_start, u32 part_size,
|
||||||
u32 reg_start, u32 reg_size);
|
u32 reg_start, u32 reg_size);
|
||||||
|
|
||||||
static inline u32 wl12xx_read32(struct wl12xx *wl, int addr)
|
static inline u32 wl12xx_read32(struct wl12xx *wl, int addr)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user