Lines Matching refs:ar
23 int ath6kl_bmi_done(struct ath6kl *ar) in ath6kl_bmi_done() argument
28 if (ar->bmi.done_sent) { in ath6kl_bmi_done()
33 ar->bmi.done_sent = true; in ath6kl_bmi_done()
35 ret = ath6kl_hif_bmi_write(ar, (u8 *)&cid, sizeof(cid)); in ath6kl_bmi_done()
44 int ath6kl_bmi_get_target_info(struct ath6kl *ar, in ath6kl_bmi_get_target_info() argument
50 if (ar->bmi.done_sent) { in ath6kl_bmi_get_target_info()
55 ret = ath6kl_hif_bmi_write(ar, (u8 *)&cid, sizeof(cid)); in ath6kl_bmi_get_target_info()
61 if (ar->hif_type == ATH6KL_HIF_TYPE_USB) { in ath6kl_bmi_get_target_info()
62 ret = ath6kl_hif_bmi_read(ar, (u8 *)targ_info, in ath6kl_bmi_get_target_info()
65 ret = ath6kl_hif_bmi_read(ar, (u8 *)&targ_info->version, in ath6kl_bmi_get_target_info()
76 ret = ath6kl_hif_bmi_read(ar, in ath6kl_bmi_get_target_info()
95 ret = ath6kl_hif_bmi_read(ar, in ath6kl_bmi_get_target_info()
114 int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) in ath6kl_bmi_read() argument
122 if (ar->bmi.done_sent) { in ath6kl_bmi_read()
127 size = ar->bmi.max_data_size + sizeof(cid) + sizeof(addr) + sizeof(len); in ath6kl_bmi_read()
128 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_read()
132 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_read()
141 rx_len = (len_remain < ar->bmi.max_data_size) ? in ath6kl_bmi_read()
142 len_remain : ar->bmi.max_data_size; in ath6kl_bmi_read()
144 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_read()
146 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_read()
148 memcpy(&(ar->bmi.cmd_buf[offset]), &rx_len, sizeof(rx_len)); in ath6kl_bmi_read()
151 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_read()
157 ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, rx_len); in ath6kl_bmi_read()
163 memcpy(&buf[len - len_remain], ar->bmi.cmd_buf, rx_len); in ath6kl_bmi_read()
170 int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) in ath6kl_bmi_write() argument
180 if (ar->bmi.done_sent) { in ath6kl_bmi_write()
185 if ((ar->bmi.max_data_size + header) > ar->bmi.max_cmd_size) { in ath6kl_bmi_write()
190 if (WARN_ON(ar->bmi.max_data_size > sizeof(aligned_buf))) in ath6kl_bmi_write()
193 memset(ar->bmi.cmd_buf, 0, ar->bmi.max_data_size + header); in ath6kl_bmi_write()
202 if (len_remain < (ar->bmi.max_data_size - header)) { in ath6kl_bmi_write()
212 tx_len = (ar->bmi.max_data_size - header); in ath6kl_bmi_write()
216 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_write()
218 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_write()
220 memcpy(&(ar->bmi.cmd_buf[offset]), &tx_len, sizeof(tx_len)); in ath6kl_bmi_write()
222 memcpy(&(ar->bmi.cmd_buf[offset]), src, tx_len); in ath6kl_bmi_write()
225 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_write()
237 int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param) in ath6kl_bmi_execute() argument
244 if (ar->bmi.done_sent) { in ath6kl_bmi_execute()
250 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_execute()
254 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_execute()
260 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_execute()
262 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_execute()
264 memcpy(&(ar->bmi.cmd_buf[offset]), param, sizeof(*param)); in ath6kl_bmi_execute()
267 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_execute()
273 ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, sizeof(*param)); in ath6kl_bmi_execute()
279 memcpy(param, ar->bmi.cmd_buf, sizeof(*param)); in ath6kl_bmi_execute()
284 int ath6kl_bmi_set_app_start(struct ath6kl *ar, u32 addr) in ath6kl_bmi_set_app_start() argument
291 if (ar->bmi.done_sent) { in ath6kl_bmi_set_app_start()
297 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_set_app_start()
301 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_set_app_start()
306 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_set_app_start()
308 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_set_app_start()
311 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_set_app_start()
320 int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param) in ath6kl_bmi_reg_read() argument
327 if (ar->bmi.done_sent) { in ath6kl_bmi_reg_read()
333 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_reg_read()
337 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_reg_read()
342 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_reg_read()
344 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_reg_read()
347 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_reg_read()
353 ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, sizeof(*param)); in ath6kl_bmi_reg_read()
358 memcpy(param, ar->bmi.cmd_buf, sizeof(*param)); in ath6kl_bmi_reg_read()
363 int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param) in ath6kl_bmi_reg_write() argument
370 if (ar->bmi.done_sent) { in ath6kl_bmi_reg_write()
376 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_reg_write()
380 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_reg_write()
387 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_reg_write()
389 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_reg_write()
391 memcpy(&(ar->bmi.cmd_buf[offset]), ¶m, sizeof(param)); in ath6kl_bmi_reg_write()
394 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_reg_write()
403 int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len) in ath6kl_bmi_lz_data() argument
412 if (ar->bmi.done_sent) { in ath6kl_bmi_lz_data()
417 size = ar->bmi.max_data_size + header; in ath6kl_bmi_lz_data()
418 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_lz_data()
422 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_lz_data()
429 tx_len = (len_remain < (ar->bmi.max_data_size - header)) ? in ath6kl_bmi_lz_data()
430 len_remain : (ar->bmi.max_data_size - header); in ath6kl_bmi_lz_data()
433 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_lz_data()
435 memcpy(&(ar->bmi.cmd_buf[offset]), &tx_len, sizeof(tx_len)); in ath6kl_bmi_lz_data()
437 memcpy(&(ar->bmi.cmd_buf[offset]), &buf[len - len_remain], in ath6kl_bmi_lz_data()
441 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_lz_data()
454 int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, u32 addr) in ath6kl_bmi_lz_stream_start() argument
461 if (ar->bmi.done_sent) { in ath6kl_bmi_lz_stream_start()
467 if (size > ar->bmi.max_cmd_size) { in ath6kl_bmi_lz_stream_start()
471 memset(ar->bmi.cmd_buf, 0, size); in ath6kl_bmi_lz_stream_start()
478 memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); in ath6kl_bmi_lz_stream_start()
480 memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); in ath6kl_bmi_lz_stream_start()
483 ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); in ath6kl_bmi_lz_stream_start()
493 int ath6kl_bmi_fast_download(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) in ath6kl_bmi_fast_download() argument
500 ret = ath6kl_bmi_lz_stream_start(ar, addr); in ath6kl_bmi_fast_download()
509 ret = ath6kl_bmi_lz_data(ar, buf, last_word_offset); in ath6kl_bmi_fast_download()
514 ret = ath6kl_bmi_lz_data(ar, (u8 *)&last_word, 4); in ath6kl_bmi_fast_download()
519 ret = ath6kl_bmi_lz_stream_start(ar, 0x00); in ath6kl_bmi_fast_download()
524 void ath6kl_bmi_reset(struct ath6kl *ar) in ath6kl_bmi_reset() argument
526 ar->bmi.done_sent = false; in ath6kl_bmi_reset()
529 int ath6kl_bmi_init(struct ath6kl *ar) in ath6kl_bmi_init() argument
531 if (WARN_ON(ar->bmi.max_data_size == 0)) in ath6kl_bmi_init()
535 ar->bmi.max_cmd_size = ar->bmi.max_data_size + (sizeof(u32) * 3); in ath6kl_bmi_init()
537 ar->bmi.cmd_buf = kzalloc(ar->bmi.max_cmd_size, GFP_KERNEL); in ath6kl_bmi_init()
538 if (!ar->bmi.cmd_buf) in ath6kl_bmi_init()
544 void ath6kl_bmi_cleanup(struct ath6kl *ar) in ath6kl_bmi_cleanup() argument
546 kfree(ar->bmi.cmd_buf); in ath6kl_bmi_cleanup()
547 ar->bmi.cmd_buf = NULL; in ath6kl_bmi_cleanup()