Lines Matching full:cmd

66 static int wilc_sdio_cmd52(struct wilc *wilc, struct sdio_cmd52 *cmd)  in wilc_sdio_cmd52()  argument
74 func->num = cmd->function; in wilc_sdio_cmd52()
75 if (cmd->read_write) { /* write */ in wilc_sdio_cmd52()
76 if (cmd->raw) { in wilc_sdio_cmd52()
77 sdio_writeb(func, cmd->data, cmd->address, &ret); in wilc_sdio_cmd52()
78 data = sdio_readb(func, cmd->address, &ret); in wilc_sdio_cmd52()
79 cmd->data = data; in wilc_sdio_cmd52()
81 sdio_writeb(func, cmd->data, cmd->address, &ret); in wilc_sdio_cmd52()
84 data = sdio_readb(func, cmd->address, &ret); in wilc_sdio_cmd52()
85 cmd->data = data; in wilc_sdio_cmd52()
95 static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd) in wilc_sdio_cmd53() argument
100 u8 *buf = cmd->buffer; in wilc_sdio_cmd53()
104 func->num = cmd->function; in wilc_sdio_cmd53()
105 func->cur_blksize = cmd->block_size; in wilc_sdio_cmd53()
106 if (cmd->block_mode) in wilc_sdio_cmd53()
107 size = cmd->count * cmd->block_size; in wilc_sdio_cmd53()
109 size = cmd->count; in wilc_sdio_cmd53()
111 if (cmd->use_global_buf) { in wilc_sdio_cmd53()
119 if (cmd->read_write) { /* write */ in wilc_sdio_cmd53()
120 if (cmd->use_global_buf) in wilc_sdio_cmd53()
121 memcpy(buf, cmd->buffer, size); in wilc_sdio_cmd53()
123 ret = sdio_memcpy_toio(func, cmd->address, buf, size); in wilc_sdio_cmd53()
125 ret = sdio_memcpy_fromio(func, buf, cmd->address, size); in wilc_sdio_cmd53()
127 if (cmd->use_global_buf) in wilc_sdio_cmd53()
128 memcpy(cmd->buffer, buf, size); in wilc_sdio_cmd53()
224 struct sdio_cmd52 cmd; in wilc_sdio_reset() local
228 cmd.read_write = 1; in wilc_sdio_reset()
229 cmd.function = 0; in wilc_sdio_reset()
230 cmd.raw = 0; in wilc_sdio_reset()
231 cmd.address = SDIO_CCCR_ABORT; in wilc_sdio_reset()
232 cmd.data = WILC_SDIO_CCCR_ABORT_RESET; in wilc_sdio_reset()
233 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_reset()
235 dev_err(&func->dev, "Fail cmd 52, reset cmd ...\n"); in wilc_sdio_reset()
285 struct sdio_cmd52 cmd; in wilc_sdio_set_func0_csa_address() local
291 cmd.read_write = 1; in wilc_sdio_set_func0_csa_address()
292 cmd.function = 0; in wilc_sdio_set_func0_csa_address()
293 cmd.raw = 0; in wilc_sdio_set_func0_csa_address()
294 cmd.address = WILC_SDIO_FBR_CSA_REG; in wilc_sdio_set_func0_csa_address()
295 cmd.data = (u8)adr; in wilc_sdio_set_func0_csa_address()
296 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_set_func0_csa_address()
299 cmd.address); in wilc_sdio_set_func0_csa_address()
303 cmd.address = WILC_SDIO_FBR_CSA_REG + 1; in wilc_sdio_set_func0_csa_address()
304 cmd.data = (u8)(adr >> 8); in wilc_sdio_set_func0_csa_address()
305 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_set_func0_csa_address()
308 cmd.address); in wilc_sdio_set_func0_csa_address()
312 cmd.address = WILC_SDIO_FBR_CSA_REG + 2; in wilc_sdio_set_func0_csa_address()
313 cmd.data = (u8)(adr >> 16); in wilc_sdio_set_func0_csa_address()
314 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_set_func0_csa_address()
317 cmd.address); in wilc_sdio_set_func0_csa_address()
328 struct sdio_cmd52 cmd; in wilc_sdio_set_block_size() local
331 cmd.read_write = 1; in wilc_sdio_set_block_size()
332 cmd.function = 0; in wilc_sdio_set_block_size()
333 cmd.raw = 0; in wilc_sdio_set_block_size()
334 cmd.address = SDIO_FBR_BASE(func_num) + SDIO_CCCR_BLKSIZE; in wilc_sdio_set_block_size()
335 cmd.data = (u8)block_size; in wilc_sdio_set_block_size()
336 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_set_block_size()
339 cmd.address); in wilc_sdio_set_block_size()
343 cmd.address = SDIO_FBR_BASE(func_num) + SDIO_CCCR_BLKSIZE + 1; in wilc_sdio_set_block_size()
344 cmd.data = (u8)(block_size >> 8); in wilc_sdio_set_block_size()
345 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_set_block_size()
348 cmd.address); in wilc_sdio_set_block_size()
369 struct sdio_cmd52 cmd; in wilc_sdio_write_reg() local
371 cmd.read_write = 1; in wilc_sdio_write_reg()
372 cmd.function = 0; in wilc_sdio_write_reg()
373 cmd.raw = 0; in wilc_sdio_write_reg()
374 cmd.address = addr; in wilc_sdio_write_reg()
375 cmd.data = data; in wilc_sdio_write_reg()
376 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_write_reg()
379 "Failed cmd 52, read reg (%08x) ...\n", addr); in wilc_sdio_write_reg()
381 struct sdio_cmd53 cmd; in wilc_sdio_write_reg() local
390 cmd.read_write = 1; in wilc_sdio_write_reg()
391 cmd.function = 0; in wilc_sdio_write_reg()
392 cmd.address = WILC_SDIO_FBR_DATA_REG; in wilc_sdio_write_reg()
393 cmd.block_mode = 0; in wilc_sdio_write_reg()
394 cmd.increment = 1; in wilc_sdio_write_reg()
395 cmd.count = sizeof(u32); in wilc_sdio_write_reg()
396 cmd.buffer = (u8 *)&data; in wilc_sdio_write_reg()
397 cmd.use_global_buf = true; in wilc_sdio_write_reg()
398 cmd.block_size = sdio_priv->block_size; in wilc_sdio_write_reg()
399 ret = wilc_sdio_cmd53(wilc, &cmd); in wilc_sdio_write_reg()
413 struct sdio_cmd53 cmd; in wilc_sdio_write() local
416 cmd.read_write = 1; in wilc_sdio_write()
421 cmd.function = 0; in wilc_sdio_write()
422 cmd.address = WILC_SDIO_FBR_DATA_REG; in wilc_sdio_write()
427 cmd.function = 1; in wilc_sdio_write()
428 cmd.address = WILC_SDIO_F1_DATA_REG; in wilc_sdio_write()
435 cmd.use_global_buf = false; in wilc_sdio_write()
437 cmd.block_mode = 1; in wilc_sdio_write()
438 cmd.increment = 1; in wilc_sdio_write()
439 cmd.count = nblk; in wilc_sdio_write()
440 cmd.buffer = buf; in wilc_sdio_write()
441 cmd.block_size = block_size; in wilc_sdio_write()
447 ret = wilc_sdio_cmd53(wilc, &cmd); in wilc_sdio_write()
459 cmd.block_mode = 0; in wilc_sdio_write()
460 cmd.increment = 1; in wilc_sdio_write()
461 cmd.count = nleft; in wilc_sdio_write()
462 cmd.buffer = buf; in wilc_sdio_write()
464 cmd.block_size = block_size; in wilc_sdio_write()
471 ret = wilc_sdio_cmd53(wilc, &cmd); in wilc_sdio_write()
489 struct sdio_cmd52 cmd; in wilc_sdio_read_reg() local
491 cmd.read_write = 0; in wilc_sdio_read_reg()
492 cmd.function = 0; in wilc_sdio_read_reg()
493 cmd.raw = 0; in wilc_sdio_read_reg()
494 cmd.address = addr; in wilc_sdio_read_reg()
495 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_read_reg()
498 "Failed cmd 52, read reg (%08x) ...\n", addr); in wilc_sdio_read_reg()
501 *data = cmd.data; in wilc_sdio_read_reg()
503 struct sdio_cmd53 cmd; in wilc_sdio_read_reg() local
509 cmd.read_write = 0; in wilc_sdio_read_reg()
510 cmd.function = 0; in wilc_sdio_read_reg()
511 cmd.address = WILC_SDIO_FBR_DATA_REG; in wilc_sdio_read_reg()
512 cmd.block_mode = 0; in wilc_sdio_read_reg()
513 cmd.increment = 1; in wilc_sdio_read_reg()
514 cmd.count = sizeof(u32); in wilc_sdio_read_reg()
515 cmd.buffer = (u8 *)data; in wilc_sdio_read_reg()
516 cmd.use_global_buf = true; in wilc_sdio_read_reg()
518 cmd.block_size = sdio_priv->block_size; in wilc_sdio_read_reg()
519 ret = wilc_sdio_cmd53(wilc, &cmd); in wilc_sdio_read_reg()
536 struct sdio_cmd53 cmd; in wilc_sdio_read() local
539 cmd.read_write = 0; in wilc_sdio_read()
544 cmd.function = 0; in wilc_sdio_read()
545 cmd.address = WILC_SDIO_FBR_DATA_REG; in wilc_sdio_read()
550 cmd.function = 1; in wilc_sdio_read()
551 cmd.address = WILC_SDIO_F1_DATA_REG; in wilc_sdio_read()
558 cmd.use_global_buf = false; in wilc_sdio_read()
560 cmd.block_mode = 1; in wilc_sdio_read()
561 cmd.increment = 1; in wilc_sdio_read()
562 cmd.count = nblk; in wilc_sdio_read()
563 cmd.buffer = buf; in wilc_sdio_read()
564 cmd.block_size = block_size; in wilc_sdio_read()
570 ret = wilc_sdio_cmd53(wilc, &cmd); in wilc_sdio_read()
582 cmd.block_mode = 0; in wilc_sdio_read()
583 cmd.increment = 1; in wilc_sdio_read()
584 cmd.count = nleft; in wilc_sdio_read()
585 cmd.buffer = buf; in wilc_sdio_read()
587 cmd.block_size = block_size; in wilc_sdio_read()
594 ret = wilc_sdio_cmd53(wilc, &cmd); in wilc_sdio_read()
615 struct sdio_cmd52 cmd; in wilc_sdio_deinit() local
618 cmd.read_write = 1; in wilc_sdio_deinit()
619 cmd.function = 0; in wilc_sdio_deinit()
620 cmd.raw = 1; in wilc_sdio_deinit()
623 cmd.address = SDIO_CCCR_IENx; in wilc_sdio_deinit()
624 cmd.data = 0; in wilc_sdio_deinit()
625 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_deinit()
632 cmd.address = SDIO_CCCR_IOEx; in wilc_sdio_deinit()
633 cmd.data = 0; in wilc_sdio_deinit()
634 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_deinit()
642 cmd.read_write = 0; in wilc_sdio_deinit()
643 cmd.address = SDIO_FBR_BASE(1); in wilc_sdio_deinit()
644 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_deinit()
650 cmd.read_write = 1; in wilc_sdio_deinit()
651 cmd.address = SDIO_FBR_BASE(1); in wilc_sdio_deinit()
652 cmd.data &= ~SDIO_FBR_ENABLE_CSA; in wilc_sdio_deinit()
653 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_deinit()
668 struct sdio_cmd52 cmd; in wilc_sdio_init() local
675 cmd.read_write = 1; in wilc_sdio_init()
676 cmd.function = 0; in wilc_sdio_init()
677 cmd.raw = 1; in wilc_sdio_init()
678 cmd.address = SDIO_FBR_BASE(1); in wilc_sdio_init()
679 cmd.data = SDIO_FBR_ENABLE_CSA; in wilc_sdio_init()
680 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_init()
682 dev_err(&func->dev, "Fail cmd 52, enable csa...\n"); in wilc_sdio_init()
691 dev_err(&func->dev, "Fail cmd 52, set func 0 block size...\n"); in wilc_sdio_init()
699 cmd.read_write = 1; in wilc_sdio_init()
700 cmd.function = 0; in wilc_sdio_init()
701 cmd.raw = 1; in wilc_sdio_init()
702 cmd.address = SDIO_CCCR_IOEx; in wilc_sdio_init()
703 cmd.data = WILC_SDIO_CCCR_IO_EN_FUNC1; in wilc_sdio_init()
704 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_init()
707 "Fail cmd 52, set IOE register...\n"); in wilc_sdio_init()
714 cmd.read_write = 0; in wilc_sdio_init()
715 cmd.function = 0; in wilc_sdio_init()
716 cmd.raw = 0; in wilc_sdio_init()
717 cmd.address = SDIO_CCCR_IORx; in wilc_sdio_init()
720 cmd.data = 0; in wilc_sdio_init()
721 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_init()
724 "Fail cmd 52, get IOR register...\n"); in wilc_sdio_init()
727 if (cmd.data == WILC_SDIO_CCCR_IO_EN_FUNC1) in wilc_sdio_init()
748 cmd.read_write = 1; in wilc_sdio_init()
749 cmd.function = 0; in wilc_sdio_init()
750 cmd.raw = 1; in wilc_sdio_init()
751 cmd.address = SDIO_CCCR_IENx; in wilc_sdio_init()
752 cmd.data = WILC_SDIO_CCCR_IEN_MASTER | WILC_SDIO_CCCR_IEN_FUNC1; in wilc_sdio_init()
753 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_init()
755 dev_err(&func->dev, "Fail cmd 52, set IEN register...\n"); in wilc_sdio_init()
765 dev_err(&func->dev, "Fail cmd read chip id...\n"); in wilc_sdio_init()
778 struct sdio_cmd52 cmd; in wilc_sdio_read_size() local
783 cmd.read_write = 0; in wilc_sdio_read_size()
784 cmd.function = 0; in wilc_sdio_read_size()
785 cmd.raw = 0; in wilc_sdio_read_size()
786 cmd.address = WILC_SDIO_INTERRUPT_DATA_SZ_REG; in wilc_sdio_read_size()
787 cmd.data = 0; in wilc_sdio_read_size()
788 wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_read_size()
789 tmp = cmd.data; in wilc_sdio_read_size()
791 cmd.address = WILC_SDIO_INTERRUPT_DATA_SZ_REG + 1; in wilc_sdio_read_size()
792 cmd.data = 0; in wilc_sdio_read_size()
793 wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_read_size()
794 tmp |= (cmd.data << 8); in wilc_sdio_read_size()
806 struct sdio_cmd52 cmd; in wilc_sdio_read_int() local
814 cmd.function = 1; in wilc_sdio_read_int()
815 cmd.address = WILC_SDIO_EXT_IRQ_FLAG_REG; in wilc_sdio_read_int()
817 cmd.function = 0; in wilc_sdio_read_int()
818 cmd.address = WILC_SDIO_IRQ_FLAG_REG; in wilc_sdio_read_int()
820 cmd.raw = 0; in wilc_sdio_read_int()
821 cmd.read_write = 0; in wilc_sdio_read_int()
822 cmd.data = 0; in wilc_sdio_read_int()
823 wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_read_int()
824 irq_flags = cmd.data; in wilc_sdio_read_int()
825 tmp |= FIELD_PREP(IRG_FLAGS_MASK, cmd.data); in wilc_sdio_read_int()
856 struct sdio_cmd52 cmd; in wilc_sdio_clear_int_ext() local
858 cmd.read_write = 1; in wilc_sdio_clear_int_ext()
859 cmd.function = 0; in wilc_sdio_clear_int_ext()
860 cmd.raw = 0; in wilc_sdio_clear_int_ext()
861 cmd.address = WILC_SDIO_IRQ_CLEAR_FLAG_REG; in wilc_sdio_clear_int_ext()
862 cmd.data = reg; in wilc_sdio_clear_int_ext()
864 ret = wilc_sdio_cmd52(wilc, &cmd); in wilc_sdio_clear_int_ext()
868 cmd.address, __LINE__); in wilc_sdio_clear_int_ext()